Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/mips/rmi - in cpucore_rmixl_attach(), keep track of...



details:   https://anonhg.NetBSD.org/src/rev/2678bf8a57b0
branches:  trunk
changeset: 764211:2678bf8a57b0
user:      cliff <cliff%NetBSD.org@localhost>
date:      Thu Apr 14 05:14:23 2011 +0000

description:
- in cpucore_rmixl_attach(), keep track of which threads are
enabled by firmware and configured and attach, or not.
- add cpucore_rmixl_run() to do the post-running initialization:
disable unused threads in RMIXL_PCR_THREADEN, and
set Round Robin thread scheduling mode.

diffstat:

 sys/arch/mips/rmi/rmixl_cpucore.c |  60 +++++++++++++++++++++++++++++++-------
 1 files changed, 49 insertions(+), 11 deletions(-)

diffs (98 lines):

diff -r e6c877e8d155 -r 2678bf8a57b0 sys/arch/mips/rmi/rmixl_cpucore.c
--- a/sys/arch/mips/rmi/rmixl_cpucore.c Thu Apr 14 05:12:58 2011 +0000
+++ b/sys/arch/mips/rmi/rmixl_cpucore.c Thu Apr 14 05:14:23 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rmixl_cpucore.c,v 1.2 2011/02/20 07:48:37 matt Exp $   */
+/*     $NetBSD: rmixl_cpucore.c,v 1.3 2011/04/14 05:14:23 cliff Exp $  */
 
 /*
  * Copyright 2002 Wasabi Systems, Inc.
@@ -38,7 +38,7 @@
 #include "locators.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rmixl_cpucore.c,v 1.2 2011/02/20 07:48:37 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rmixl_cpucore.c,v 1.3 2011/04/14 05:14:23 cliff Exp $");
 
 #include "opt_multiprocessor.h"
 
@@ -145,25 +145,44 @@
                (u_int)(rcp->rc_psb_info.userapp_cpu_map >> core_shft) & thread_mask;
        u_int threads_dis = (~threads_enb) & thread_mask;
 
+       sc->sc_threads_dis = threads_dis;
        if (threads_dis != 0) {
                aprint_normal_dev(self, "threads");
-               while (threads_dis != 0) {
-                       u_int t = ffs(threads_dis) - 1;
-                       threads_dis ^= (1 << t);
-                       aprint_normal(" %d%s",
-                               t, (threads_dis==0) ? "" : ",");
+               u_int d = threads_dis;
+               while (d != 0) {
+                       u_int t = ffs(d) - 1;
+                       d ^= (1 << t);
+                       aprint_normal(" %d%s", t, (d==0) ? "" : ",");
                }
                aprint_normal(" offline (disabled by firmware)\n");
        }
 
-       while (threads_enb != 0) {
-               u_int t = ffs(threads_enb) - 1;
-               threads_enb ^= (1 << t);
+       u_int threads_try_attach = threads_enb;
+       while (threads_try_attach != 0) {
+               u_int t = ffs(threads_try_attach) - 1;
+               threads_try_attach ^= (1 << t);
                ca.ca_name = "cpu";
                ca.ca_thread = t;
                ca.ca_core = sc->sc_core;
-               config_found(self, &ca, cpucore_rmixl_print);
+               if (config_found(self, &ca, cpucore_rmixl_print) == NULL) {
+                       /*
+                        * thread did not attach, e.g. not configured
+                        * arrange to have it disabled in THREADEN PCR
+                        */
+                       u_int bit = 1 << t;
+                       threads_enb ^= bit;
+                       threads_dis |= bit;
+               }
        }
+       sc->sc_threads_enb = threads_enb;
+       sc->sc_threads_dis = threads_dis;
+
+       /*
+        * when attaching the core of the primary cpu,
+        * do the post-running initialization here
+        */
+       if (sc->sc_core == RMIXL_CPU_CORE((curcpu()->ci_cpuid)))
+               cpucore_rmixl_run(self);
 }
 
 static int
@@ -178,6 +197,25 @@
        return (UNCONF);
 }
 
+/*
+ * cpucore_rmixl_run
+ *     called from cpu_rmixl_hatch for each cpu
+ *     the first call for each cpucore causes init of per-core features:
+ *     - disable unused threads
+ *     - set Fine-grained (Round Robin) thread scheduling mode
+ */
+void
+cpucore_rmixl_run(device_t self)
+{
+       struct cpucore_softc * const sc = device_private(self);
+
+       if (sc->sc_running == false) {
+               sc->sc_running = true;
+               rmixl_mtcr(RMIXL_PCR_THREADEN, sc->sc_threads_enb);
+               rmixl_mtcr(RMIXL_PCR_SCHEDULING, 0);
+       }
+}
+
 #ifdef MULTIPROCESSOR
 /*
  * cpucore_rmixl_hatch



Home | Main Index | Thread Index | Old Index