From owner-svn-src-head@freebsd.org Fri Dec 7 15:55:25 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 015551311C94; Fri, 7 Dec 2018 15:55:25 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 99F8F6A730; Fri, 7 Dec 2018 15:55:24 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6150715366; Fri, 7 Dec 2018 15:55:24 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB7FtO2l056536; Fri, 7 Dec 2018 15:55:24 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB7FtNlw056531; Fri, 7 Dec 2018 15:55:23 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201812071555.wB7FtNlw056531@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Fri, 7 Dec 2018 15:55:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341693 - in head/sys/riscv: include riscv X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: in head/sys/riscv: include riscv X-SVN-Commit-Revision: 341693 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 99F8F6A730 X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.99)[-0.989,0]; NEURAL_HAM_LONG(-0.99)[-0.991,0]; NEURAL_HAM_SHORT(-0.98)[-0.980,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Dec 2018 15:55:25 -0000 Author: markj Date: Fri Dec 7 15:55:23 2018 New Revision: 341693 URL: https://svnweb.freebsd.org/changeset/base/341693 Log: Rename sptbr to satp per v1.10 of the privileged architecture spec. Add a subroutine for updating satp, for use when updating the active pmap. No functional change intended. Reviewed by: jhb MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D18462 Modified: head/sys/riscv/include/cpufunc.h head/sys/riscv/riscv/locore.S head/sys/riscv/riscv/pmap.c head/sys/riscv/riscv/swtch.S Modified: head/sys/riscv/include/cpufunc.h ============================================================================== --- head/sys/riscv/include/cpufunc.h Fri Dec 7 15:52:50 2018 (r341692) +++ head/sys/riscv/include/cpufunc.h Fri Dec 7 15:55:23 2018 (r341693) @@ -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: head/sys/riscv/riscv/locore.S ============================================================================== --- head/sys/riscv/riscv/locore.S Fri Dec 7 15:52:50 2018 (r341692) +++ head/sys/riscv/riscv/locore.S Fri Dec 7 15:55:23 2018 (r341693) @@ -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: head/sys/riscv/riscv/pmap.c ============================================================================== --- head/sys/riscv/riscv/pmap.c Fri Dec 7 15:52:50 2018 (r341692) +++ head/sys/riscv/riscv/pmap.c Fri Dec 7 15:55:23 2018 (r341693) @@ -3302,7 +3302,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: head/sys/riscv/riscv/swtch.S ============================================================================== --- head/sys/riscv/riscv/swtch.S Fri Dec 7 15:52:50 2018 (r341692) +++ head/sys/riscv/riscv/swtch.S Fri Dec 7 15:55:23 2018 (r341693) @@ -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 */