Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/powerpc/booke - Use tlbivax instruction for TLB upd...



details:   https://anonhg.NetBSD.org/src/rev/aae1b300ed28
branches:  trunk
changeset: 335774:aae1b300ed28
user:      nonaka <nonaka%NetBSD.org@localhost>
date:      Fri Jan 23 06:52:55 2015 +0000

description:
- Use tlbivax instruction for TLB update/invalidate when MULTIPROCESSOR is
  defined. Because TLB entry operation is not notified to another CPU.
- When TLB1 is updated, send IPI_TLB1SYNC to another CPU.

diffstat:

 sys/arch/powerpc/booke/e500_tlb.c |  30 ++++++++++++++++++++++++++++--
 1 files changed, 28 insertions(+), 2 deletions(-)

diffs (105 lines):

diff -r 2d3ada6bf1c7 -r aae1b300ed28 sys/arch/powerpc/booke/e500_tlb.c
--- a/sys/arch/powerpc/booke/e500_tlb.c Fri Jan 23 06:39:41 2015 +0000
+++ b/sys/arch/powerpc/booke/e500_tlb.c Fri Jan 23 06:52:55 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: e500_tlb.c,v 1.15 2014/12/28 14:13:56 nonaka Exp $     */
+/*     $NetBSD: e500_tlb.c,v 1.16 2015/01/23 06:52:55 nonaka Exp $     */
 /*-
  * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -40,7 +40,7 @@
 
 #include <sys/cdefs.h>
 
-__KERNEL_RCSID(0, "$NetBSD: e500_tlb.c,v 1.15 2014/12/28 14:13:56 nonaka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: e500_tlb.c,v 1.16 2015/01/23 06:52:55 nonaka Exp $");
 
 #include <sys/param.h>
 
@@ -372,6 +372,9 @@
 static void
 e500_tlb_invalidate_globals(void)
 {
+#if defined(MULTIPROCESSOR)
+       e500_tlb_invalidate_all();
+#else  /* !MULTIPROCESSOR */
        const size_t tlbassoc = TLBCFG_ASSOC(mftlb0cfg());
        const size_t tlbentries = TLBCFG_NENTRY(mftlb0cfg());
        const size_t max_epn = (tlbentries / tlbassoc) << PAGE_SHIFT;
@@ -416,11 +419,15 @@
        }
        __asm volatile("isync\n\tsync");
        wrtee(msr);
+#endif /* MULTIPROCESSOR */
 }
 
 static void
 e500_tlb_invalidate_asids(tlb_asid_t asid_lo, tlb_asid_t asid_hi)
 {
+#if defined(MULTIPROCESSOR)
+       e500_tlb_invalidate_all();
+#else  /* !MULTIPROCESSOR */
        const size_t tlbassoc = TLBCFG_ASSOC(mftlb0cfg());
        const size_t tlbentries = TLBCFG_NENTRY(mftlb0cfg());
        const size_t max_epn = (tlbentries / tlbassoc) << PAGE_SHIFT;
@@ -454,6 +461,7 @@
        }
        __asm volatile("isync\n\tsync");
        wrtee(msr);
+#endif /* MULTIPROCESSOR */
 }
 
 static u_int
@@ -525,6 +533,10 @@
 static bool
 e500_tlb_update_addr(vaddr_t va, tlb_asid_t asid, pt_entry_t pte, bool insert)
 {
+#if defined(MULTIPROCESSOR)
+       e500_tlb_invalidate_addr(va, asid);
+       return true;
+#else  /* !MULTIPROCESSOR */
        struct e500_hwtlb hwtlb = tlb_to_hwtlb(
            (struct e500_tlb){ .tlb_va = va, .tlb_asid = asid,
                .tlb_size = PAGE_SIZE, .tlb_pte = pte,});
@@ -558,6 +570,7 @@
            hwtlb.hwtlb_mas1, hwtlb.hwtlb_mas2, hwtlb.hwtlb_mas3);
 #endif
        return (mas1 & MAS1_V) != 0;
+#endif /* MULTIPROCESSOR */
 }
 
 static void
@@ -788,6 +801,11 @@
        xtlb->e_hwtlb = tlb_to_hwtlb(xtlb->e_tlb);
        xtlb->e_hwtlb.hwtlb_mas0 |= __SHIFTIN(slot, MAS0_ESEL);
        hwtlb_write(xtlb->e_hwtlb, true);
+
+#if defined(MULTIPROCESSOR)
+       cpu_send_ipi(IPI_DST_NOTME, IPI_TLB1SYNC);
+#endif
+
        return 0;
 }
 
@@ -805,6 +823,10 @@
 
        e500_free_tlb1_entry(xtlb, slot, true);
 
+#if defined(MULTIPROCESSOR)
+       cpu_send_ipi(IPI_DST_NOTME, IPI_TLB1SYNC);
+#endif
+
        return 0;
 }
 
@@ -841,6 +863,10 @@
                }
        }
 
+#if defined(MULTIPROCESSOR)
+       cpu_send_ipi(IPI_DST_NOTME, IPI_TLB1SYNC);
+#endif
+
        return nextslot;
 }
 



Home | Main Index | Thread Index | Old Index