git: 2e956c30cab6 - main - riscv: Use generic CSR macros for writing SATP

From: Mark Johnston <markj_at_FreeBSD.org>
Date: Tue, 01 Mar 2022 14:39:59 UTC
The branch main has been updated by markj:

URL: https://cgit.FreeBSD.org/src/commit/?id=2e956c30cab6a36fee9a3d5159c3903406e3e5e7

commit 2e956c30cab6a36fee9a3d5159c3903406e3e5e7
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2022-03-01 14:03:44 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2022-03-01 14:39:43 +0000

    riscv: Use generic CSR macros for writing SATP
    
    Instead of having the one-off load_satp(), just use csr_write().  No
    functional change intended.
    
    Reviewed by:    alc, jhb
    MFC after:      1 week
    Sponsored by:   The FreeBSD Foundation
    Differential Revision:  https://reviews.freebsd.org/D34271
---
 sys/riscv/include/cpufunc.h | 7 -------
 sys/riscv/riscv/pmap.c      | 2 +-
 2 files changed, 1 insertion(+), 8 deletions(-)

diff --git a/sys/riscv/include/cpufunc.h b/sys/riscv/include/cpufunc.h
index 0f27fc45d57d..7b7afb50fee8 100644
--- a/sys/riscv/include/cpufunc.h
+++ b/sys/riscv/include/cpufunc.h
@@ -120,13 +120,6 @@ extern int64_t icache_line_size;
 #define	cpu_icache_sync_range(a, s)
 #define	cpu_icache_sync_range_checked(a, s)
 
-static __inline void
-load_satp(uint64_t val)
-{
-
-	__asm __volatile("csrw satp, %0" :: "r"(val));
-}
-
 #define	cpufunc_nullop()		riscv_nullop()
 
 void riscv_nullop(void);
diff --git a/sys/riscv/riscv/pmap.c b/sys/riscv/riscv/pmap.c
index 545d77f808c7..d26d6113ee36 100644
--- a/sys/riscv/riscv/pmap.c
+++ b/sys/riscv/riscv/pmap.c
@@ -4402,7 +4402,7 @@ pmap_activate_sw(struct thread *td)
 	pmap = vmspace_pmap(td->td_proc->p_vmspace);
 	if (pmap == oldpmap)
 		return;
-	load_satp(pmap->pm_satp);
+	csr_write(satp, pmap->pm_satp);
 
 	hart = PCPU_GET(hart);
 #ifdef SMP