Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 14 Dec 2018 18:39:06 +0000 (UTC)
From:      Mark Johnston <markj@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org
Subject:   svn commit: r342090 - in stable/12/sys/riscv: include riscv
Message-ID:  <201812141839.wBEId6Is023348@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: markj
Date: Fri Dec 14 18:39:06 2018
New Revision: 342090
URL: https://svnweb.freebsd.org/changeset/base/342090

Log:
  MFC r341693:
  Rename sptbr to satp per v1.10 of the privileged architecture spec.

Modified:
  stable/12/sys/riscv/include/cpufunc.h
  stable/12/sys/riscv/riscv/locore.S
  stable/12/sys/riscv/riscv/pmap.c
  stable/12/sys/riscv/riscv/swtch.S
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/riscv/include/cpufunc.h
==============================================================================
--- stable/12/sys/riscv/include/cpufunc.h	Fri Dec 14 18:38:10 2018	(r342089)
+++ stable/12/sys/riscv/include/cpufunc.h	Fri Dec 14 18:39:06 2018	(r342090)
@@ -109,6 +109,13 @@ sfence_vma_page(uintptr_t addr)
 #define	rdinstret()			csr_read64(instret)
 #define	rdhpmcounter(n)			csr_read64(hpmcounter##n)
 
+static __inline void
+load_satp(uint64_t val)
+{
+
+	__asm __volatile("csrw satp, %0" :: "r"(val));
+}
+
 #define	cpufunc_nullop()		riscv_nullop()
 
 void riscv_nullop(void);

Modified: stable/12/sys/riscv/riscv/locore.S
==============================================================================
--- stable/12/sys/riscv/riscv/locore.S	Fri Dec 14 18:38:10 2018	(r342089)
+++ stable/12/sys/riscv/riscv/locore.S	Fri Dec 14 18:39:06 2018	(r342090)
@@ -152,7 +152,7 @@ _start:
 	li	t0, SATP_MODE_SV39
 	or	s2, s2, t0
 	sfence.vma
-	csrw	sptbr, s2
+	csrw	satp, s2
 
 	.align 2
 va:
@@ -297,7 +297,7 @@ ENTRY(mpentry)
 	li	t0, SATP_MODE_SV39
 	or	s2, s2, t0
 	sfence.vma
-	csrw	sptbr, s2
+	csrw	satp, s2
 
 	.align 2
 mpva:

Modified: stable/12/sys/riscv/riscv/pmap.c
==============================================================================
--- stable/12/sys/riscv/riscv/pmap.c	Fri Dec 14 18:38:10 2018	(r342089)
+++ stable/12/sys/riscv/riscv/pmap.c	Fri Dec 14 18:39:06 2018	(r342090)
@@ -3277,7 +3277,7 @@ pmap_activate(struct thread *td)
 
 	reg = SATP_MODE_SV39;
 	reg |= (td->td_pcb->pcb_l1addr >> PAGE_SHIFT);
-	__asm __volatile("csrw sptbr, %0" :: "r"(reg));
+	load_satp(reg);
 
 	pmap_invalidate_all(pmap);
 	critical_exit();

Modified: stable/12/sys/riscv/riscv/swtch.S
==============================================================================
--- stable/12/sys/riscv/riscv/swtch.S	Fri Dec 14 18:38:10 2018	(r342089)
+++ stable/12/sys/riscv/riscv/swtch.S	Fri Dec 14 18:39:06 2018	(r342090)
@@ -223,7 +223,7 @@ ENTRY(cpu_throw)
 	srli	t0, t0, PAGE_SHIFT
 	li	t1, SATP_MODE_SV39
 	or	t0, t0, t1
-	csrw	sptbr, t0
+	csrw	satp, t0
 
 	/* TODO: Invalidate the TLB */
 
@@ -341,7 +341,7 @@ ENTRY(cpu_switch)
 	srli	t0, t0, PAGE_SHIFT
 	li	t1, SATP_MODE_SV39
 	or	t0, t0, t1
-	csrw	sptbr, t0
+	csrw	satp, t0
 
 	/* TODO: Invalidate the TLB */
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201812141839.wBEId6Is023348>