Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/riscv/riscv tlb_update_addr gets called with the KE...



details:   https://anonhg.NetBSD.org/src/rev/9989e23431f8
branches:  trunk
changeset: 371902:9989e23431f8
user:      skrll <skrll%NetBSD.org@localhost>
date:      Sun Oct 16 08:43:44 2022 +0000

description:
tlb_update_addr gets called with the KERNEL_PID (ASID) so handle this
case.

diffstat:

 sys/arch/riscv/riscv/pmap_machdep.c |  21 ++++++++++++++-------
 1 files changed, 14 insertions(+), 7 deletions(-)

diffs (49 lines):

diff -r 7bdd1c7b976a -r 9989e23431f8 sys/arch/riscv/riscv/pmap_machdep.c
--- a/sys/arch/riscv/riscv/pmap_machdep.c       Sun Oct 16 06:19:16 2022 +0000
+++ b/sys/arch/riscv/riscv/pmap_machdep.c       Sun Oct 16 08:43:44 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap_machdep.c,v 1.12 2022/10/15 06:41:43 simonb Exp $ */
+/* $NetBSD: pmap_machdep.c,v 1.13 2022/10/16 08:43:44 skrll Exp $ */
 
 /*
  * Copyright (c) 2014, 2019, 2021 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
 #define        __PMAP_PRIVATE
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: pmap_machdep.c,v 1.12 2022/10/15 06:41:43 simonb Exp $");
+__RCSID("$NetBSD: pmap_machdep.c,v 1.13 2022/10/16 08:43:44 skrll Exp $");
 
 #include <sys/param.h>
 #include <sys/buf.h>
@@ -289,6 +289,7 @@
 void    tlb_invalidate_all(void);
 void    tlb_invalidate_globals(void);
 #endif
+
 void
 tlb_invalidate_asids(tlb_asid_t lo, tlb_asid_t hi)
 {
@@ -318,11 +319,17 @@
 bool
 tlb_update_addr(vaddr_t va, tlb_asid_t asid, pt_entry_t pte, bool insert_p)
 {
-       KASSERT(asid != KERNEL_PID);
-       __asm __volatile("sfence.vma %[va], %[asid]"
-           : /* output operands */
-           : [va] "r" (va), [asid] "r" (asid)
-           : "memory");
+       if (asid == KERNEL_PID) {
+               __asm __volatile("sfence.vma %[va]"
+                   : /* output operands */
+                   : [va] "r" (va)
+                   : "memory");
+       } else {
+               __asm __volatile("sfence.vma %[va], %[asid]"
+                   : /* output operands */
+                   : [va] "r" (va), [asid] "r" (asid)
+                   : "memory");
+       }
        return false;
 }
 



Home | Main Index | Thread Index | Old Index