git: c4f8506809c2 - stable/13 - riscv: Use generic CSR macros for writing SATP

From: Mark Johnston <markj_at_FreeBSD.org>
Date: Mon, 14 Mar 2022 14:46:07 UTC
The branch stable/13 has been updated by markj:

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

commit c4f8506809c2f870721feffa2d67fd7f567c4527
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2022-03-01 14:03:44 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2022-03-14 14:45:29 +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
    Sponsored by:   The FreeBSD Foundation
    
    (cherry picked from commit 2e956c30cab6a36fee9a3d5159c3903406e3e5e7)
---
 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 59fdbae53eb4..55f0c7f4a86e 100644
--- a/sys/riscv/riscv/pmap.c
+++ b/sys/riscv/riscv/pmap.c
@@ -4398,7 +4398,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