Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/sparc64 smp_tlb_flush_pte(): Avoid run-time check f...



details:   https://anonhg.NetBSD.org/src/rev/c6036e0fc584
branches:  trunk
changeset: 335325:c6036e0fc584
user:      palle <palle%NetBSD.org@localhost>
date:      Sat Jan 03 11:22:14 2015 +0000

description:
smp_tlb_flush_pte(): Avoid run-time check for cpu type/implementation by installing correct function pointer in sparc64_ip_init(). sparc64_send_ipi() is changed to a function pointer as well to avoid 
run-time checks.

diffstat:

 sys/arch/sparc64/include/cpu.h      |   4 +-
 sys/arch/sparc64/sparc64/ipifuncs.c |  48 ++++++++++++++++++------------------
 2 files changed, 26 insertions(+), 26 deletions(-)

diffs (122 lines):

diff -r c0f3760bd693 -r c6036e0fc584 sys/arch/sparc64/include/cpu.h
--- a/sys/arch/sparc64/include/cpu.h    Fri Jan 02 23:38:45 2015 +0000
+++ b/sys/arch/sparc64/include/cpu.h    Sat Jan 03 11:22:14 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cpu.h,v 1.113 2014/09/24 18:32:10 palle Exp $ */
+/*     $NetBSD: cpu.h,v 1.114 2015/01/03 11:22:14 palle Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -287,7 +287,7 @@
 
 void   sparc64_multicast_ipi(sparc64_cpuset_t, ipifunc_t, uint64_t, uint64_t);
 void   sparc64_broadcast_ipi(ipifunc_t, uint64_t, uint64_t);
-void   sparc64_send_ipi(int, ipifunc_t, uint64_t, uint64_t);
+extern void (*sparc64_send_ipi)(int, ipifunc_t, uint64_t, uint64_t);
 
 /*
  * Call an arbitrary C function on another cpu (or all others but ourself)
diff -r c0f3760bd693 -r c6036e0fc584 sys/arch/sparc64/sparc64/ipifuncs.c
--- a/sys/arch/sparc64/sparc64/ipifuncs.c       Fri Jan 02 23:38:45 2015 +0000
+++ b/sys/arch/sparc64/sparc64/ipifuncs.c       Sat Jan 03 11:22:14 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ipifuncs.c,v 1.53 2014/11/05 13:30:11 nakayama Exp $ */
+/*     $NetBSD: ipifuncs.c,v 1.54 2015/01/03 11:22:14 palle Exp $ */
 
 /*-
  * Copyright (c) 2004 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ipifuncs.c,v 1.53 2014/11/05 13:30:11 nakayama Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ipifuncs.c,v 1.54 2015/01/03 11:22:14 palle Exp $");
 
 #include "opt_ddb.h"
 
@@ -68,6 +68,7 @@
 /* Send IPI functions for supported platforms */
 static void    sparc64_send_ipi_sun4u(int, ipifunc_t, uint64_t, uint64_t);
 static void    sparc64_send_ipi_sun4v(int, ipifunc_t, uint64_t, uint64_t);
+void           (*sparc64_send_ipi)(int, ipifunc_t, uint64_t, uint64_t) = NULL;
  
 /*
  * These are the "function" entry points in locore.s/mp_subr.s to handle IPI's.
@@ -83,6 +84,9 @@
 void   sparc64_ipi_blast_dcache(void *, void *);
 void   sparc64_ipi_ccall(void *, void *);
 
+/* Function pointer for use in smp_tlb_flush() - setup in sparc64_ipi_init() */
+static ipifunc_t smp_tlb_flush_pte_func = NULL;
+
 /*
  * Process cpu stop-self event.
  */
@@ -171,6 +175,23 @@
        CPUSET_CLEAR(cpus_spinning);
        CPUSET_CLEAR(cpus_paused);
        CPUSET_CLEAR(cpus_resumed);
+
+       /*
+        * Prepare cpu type dependent function pointers
+        */
+
+       if (CPU_ISSUN4V)
+               smp_tlb_flush_pte_func = sparc64_ipi_flush_pte_sun4v;
+       else if (CPU_IS_USIII_UP())
+               smp_tlb_flush_pte_func = sparc64_ipi_flush_pte_usiii;
+       else
+               smp_tlb_flush_pte_func = sparc64_ipi_flush_pte_us;
+
+       if (CPU_ISSUN4V)
+               sparc64_send_ipi = sparc64_send_ipi_sun4v;
+       else
+               sparc64_send_ipi = sparc64_send_ipi_sun4u;
+
 }
 
 /*
@@ -206,19 +227,6 @@
 }
 
 /*
- * Send an interprocessor interrupt.
- */
-void
-sparc64_send_ipi(int upaid, ipifunc_t func, uint64_t arg1, uint64_t arg2)
-{
-       if (CPU_ISSUN4V)
-               sparc64_send_ipi_sun4v(upaid, func, arg1, arg2);
-       else
-               sparc64_send_ipi_sun4u(upaid, func, arg1, arg2);
-                   
-}
-
-/*
  * Send an interprocessor interrupt - sun4v.
  */
 void
@@ -438,14 +446,6 @@
        struct cpu_info *ci;
        int ctx;
        bool kpm = (pm == pmap_kernel());
-       ipifunc_t func;
-       if (CPU_ISSUN4V)
-               func = sparc64_ipi_flush_pte_sun4v;
-       else if (CPU_IS_USIII_UP())
-               func = sparc64_ipi_flush_pte_usiii;
-       else
-               func = sparc64_ipi_flush_pte_us;
-
        /* Flush our own TLB */
        ctx = pm->pm_ctx[cpu_number()];
        KASSERT(ctx >= 0);
@@ -465,7 +465,7 @@
                        KASSERT(ctx >= 0);
                        if (!kpm && ctx == 0)
                                continue;
-                       sparc64_send_ipi(ci->ci_cpuid, func, va, ctx);
+                       sparc64_send_ipi(ci->ci_cpuid, smp_tlb_flush_pte_func, va, ctx);
                }
        }
 }



Home | Main Index | Thread Index | Old Index