Source-Changes-HG archive

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

[src/trunk]: src/sys/uvm/pmap Provide a pmap_segtab_deactivate for symmetry w...



details:   https://anonhg.NetBSD.org/src/rev/ce34eb617ea3
branches:  trunk
changeset: 936863:ce34eb617ea3
user:      skrll <skrll%NetBSD.org@localhost>
date:      Fri Aug 07 07:19:45 2020 +0000

description:
Provide a pmap_segtab_deactivate for symmetry with pmap_segtab_activate
and use it in pmap_deactivate

Call pmap_md_xtab_{,de}activate from pmap_segtab_{,de}activate to be used
for PMAP_HWPAGEWALKER and any caches ops that might be required.

Provide empty (for now) pmap_md_xtab_{,de}activate functions on the
platforms that use sys/uvm/pmap

diffstat:

 sys/arch/m68k/include/pmap_coldfire.h |  16 +++++++++++++++-
 sys/arch/mips/include/pmap.h          |  17 ++++++++++++++++-
 sys/arch/powerpc/include/booke/pmap.h |  17 ++++++++++++++++-
 sys/arch/riscv/include/pmap.h         |  17 ++++++++++++++++-
 sys/uvm/pmap/pmap.c                   |   9 +++------
 sys/uvm/pmap/pmap.h                   |   3 ++-
 sys/uvm/pmap/pmap_segtab.c            |  19 +++++++++++++++++--
 7 files changed, 85 insertions(+), 13 deletions(-)

diffs (218 lines):

diff -r 6bc1cc30adcf -r ce34eb617ea3 sys/arch/m68k/include/pmap_coldfire.h
--- a/sys/arch/m68k/include/pmap_coldfire.h     Fri Aug 07 05:13:04 2020 +0000
+++ b/sys/arch/m68k/include/pmap_coldfire.h     Fri Aug 07 07:19:45 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pmap_coldfire.h,v 1.2 2014/03/18 18:20:41 riastradh Exp $      */
+/*     $NetBSD: pmap_coldfire.h,v 1.3 2020/08/07 07:19:45 skrll Exp $  */
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -135,6 +135,20 @@
 {
        return PMAP_TLB_NUM_PIDS - 1;
 }
+
+static inline void
+pmap_md_xtab_activate(struct pmap *pm, struct lwp *l)
+{
+
+       /* nothing */
+}
+
+static inline void
+pmap_md_xtab_deactivate(struct pmap *pm)
+{
+
+       /* nothing */
+}
 #endif
 
 #define        POOL_VTOPHYS(va)        ((paddr_t)(vaddr_t)(va))
diff -r 6bc1cc30adcf -r ce34eb617ea3 sys/arch/mips/include/pmap.h
--- a/sys/arch/mips/include/pmap.h      Fri Aug 07 05:13:04 2020 +0000
+++ b/sys/arch/mips/include/pmap.h      Fri Aug 07 07:19:45 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pmap.h,v 1.72 2020/07/26 08:08:41 simonb Exp $ */
+/*     $NetBSD: pmap.h,v 1.73 2020/08/07 07:19:45 skrll Exp $  */
 
 /*
  * Copyright (c) 1992, 1993
@@ -140,6 +140,21 @@
 {
        return MIPS_HAS_R4K_MMU ? mips_cache_info.mci_cache_prefer_mask : 0;
 }
+
+static inline void
+pmap_md_xtab_activate(struct pmap *pm, struct lwp *l)
+{
+
+       /* nothing */
+}
+
+static inline void
+pmap_md_xtab_deactivate(struct pmap *pm)
+{
+
+       /* nothing */
+}
+
 #endif /* __PMAP_PRIVATE */
 
 struct tlbmask {
diff -r 6bc1cc30adcf -r ce34eb617ea3 sys/arch/powerpc/include/booke/pmap.h
--- a/sys/arch/powerpc/include/booke/pmap.h     Fri Aug 07 05:13:04 2020 +0000
+++ b/sys/arch/powerpc/include/booke/pmap.h     Fri Aug 07 07:19:45 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pmap.h,v 1.22 2020/07/06 09:34:17 rin Exp $    */
+/*     $NetBSD: pmap.h,v 1.23 2020/08/07 07:19:45 skrll Exp $  */
 /*-
  * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -154,6 +154,21 @@
 {
        return true;
 }
+
+static __inline void
+pmap_md_xtab_activate(struct pmap *pm, struct lwp *l)
+{
+
+       /* nothing */
+}
+
+static __inline void
+pmap_md_xtab_deactivate(struct pmap *pm)
+{
+
+       /* nothing */
+}
+
 #endif
 
 #define        POOL_VTOPHYS(va)        ((paddr_t)(vaddr_t)(va))
diff -r 6bc1cc30adcf -r ce34eb617ea3 sys/arch/riscv/include/pmap.h
--- a/sys/arch/riscv/include/pmap.h     Fri Aug 07 05:13:04 2020 +0000
+++ b/sys/arch/riscv/include/pmap.h     Fri Aug 07 07:19:45 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.h,v 1.4 2020/03/11 13:30:31 thorpej Exp $ */
+/* $NetBSD: pmap.h,v 1.5 2020/08/07 07:19:45 skrll Exp $ */
 
 /*
  * Copyright (c) 2014, 2019 The NetBSD Foundation, Inc.
@@ -163,6 +163,21 @@
 {
        return PMAP_TLB_NUM_PIDS - 1;
 }
+
+static inline void
+pmap_md_xtab_activate(struct pmap *pm, struct lwp *l)
+{
+
+       /* nothing */
+}
+
+static inline void
+pmap_md_xtab_deactivate(struct pmap *pm)
+{
+
+       /* nothing */
+}
+
 #endif /* __PMAP_PRIVATE */
 #endif /* _KERNEL */
 
diff -r 6bc1cc30adcf -r ce34eb617ea3 sys/uvm/pmap/pmap.c
--- a/sys/uvm/pmap/pmap.c       Fri Aug 07 05:13:04 2020 +0000
+++ b/sys/uvm/pmap/pmap.c       Fri Aug 07 07:19:45 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pmap.c,v 1.50 2020/07/18 16:12:09 skrll Exp $  */
+/*     $NetBSD: pmap.c,v 1.51 2020/08/07 07:19:45 skrll Exp $  */
 
 /*-
  * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
 
 #include <sys/cdefs.h>
 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.50 2020/07/18 16:12:09 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.51 2020/08/07 07:19:45 skrll Exp $");
 
 /*
  *     Manages physical address maps.
@@ -869,11 +869,8 @@
        kpreempt_disable();
        KASSERT(l == curlwp || l->l_cpu == curlwp->l_cpu);
        pmap_tlb_miss_lock_enter();
-       curcpu()->ci_pmap_user_segtab = PMAP_INVALID_SEGTAB_ADDRESS;
-#ifdef _LP64
-       curcpu()->ci_pmap_user_seg0tab = NULL;
-#endif
        pmap_tlb_asid_deactivate(pmap);
+       pmap_segtab_deactivate(pmap);
        pmap_tlb_miss_lock_exit();
        kpreempt_enable();
 
diff -r 6bc1cc30adcf -r ce34eb617ea3 sys/uvm/pmap/pmap.h
--- a/sys/uvm/pmap/pmap.h       Fri Aug 07 05:13:04 2020 +0000
+++ b/sys/uvm/pmap/pmap.h       Fri Aug 07 07:19:45 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pmap.h,v 1.15 2020/07/08 12:12:16 skrll Exp $  */
+/*     $NetBSD: pmap.h,v 1.16 2020/08/07 07:19:45 skrll Exp $  */
 
 /*
  * Copyright (c) 1992, 1993
@@ -114,6 +114,7 @@
 void pmap_pte_process(struct pmap *, vaddr_t, vaddr_t, pte_callback_t,
        uintptr_t);
 void pmap_segtab_activate(struct pmap *, struct lwp *);
+void pmap_segtab_deactivate(struct pmap *);
 void pmap_segtab_init(struct pmap *);
 void pmap_segtab_destroy(struct pmap *, pte_callback_t, uintptr_t);
 extern kmutex_t pmap_segtab_lock;
diff -r 6bc1cc30adcf -r ce34eb617ea3 sys/uvm/pmap/pmap_segtab.c
--- a/sys/uvm/pmap/pmap_segtab.c        Fri Aug 07 05:13:04 2020 +0000
+++ b/sys/uvm/pmap/pmap_segtab.c        Fri Aug 07 07:19:45 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pmap_segtab.c,v 1.14 2020/02/24 12:20:30 rin Exp $     */
+/*     $NetBSD: pmap_segtab.c,v 1.15 2020/08/07 07:19:45 skrll Exp $   */
 
 /*-
  * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
 
 #include <sys/cdefs.h>
 
-__KERNEL_RCSID(0, "$NetBSD: pmap_segtab.c,v 1.14 2020/02/24 12:20:30 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap_segtab.c,v 1.15 2020/08/07 07:19:45 skrll Exp $");
 
 /*
  *     Manages physical address maps.
@@ -370,6 +370,7 @@
 {
        if (l == curlwp) {
                struct cpu_info * const ci = l->l_cpu;
+               pmap_md_xtab_activate(pm, l);
                KASSERT(pm == l->l_proc->p_vmspace->vm_map.pmap);
                if (pm == pmap_kernel()) {
                        ci->ci_pmap_user_segtab = PMAP_INVALID_SEGTAB_ADDRESS;
@@ -385,6 +386,20 @@
        }
 }
 
+
+void
+pmap_segtab_deactivate(pmap_t pm)
+{
+
+       pmap_md_xtab_deactivate(pm);
+
+       curcpu()->ci_pmap_user_segtab = PMAP_INVALID_SEGTAB_ADDRESS;
+#ifdef _LP64
+       curcpu()->ci_pmap_user_seg0tab = NULL;
+#endif
+
+}
+
 /*
  *     Act on the given range of addresses from the specified map.
  *



Home | Main Index | Thread Index | Old Index