Source-Changes-HG archive

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

[src/trunk]: src/sys/arch Change cpus_booted back to a simple variable instea...



details:   https://anonhg.NetBSD.org/src/rev/892096a5664f
branches:  trunk
changeset: 936504:892096a5664f
user:      simonb <simonb%NetBSD.org@localhost>
date:      Tue Jul 28 00:35:38 2020 +0000

description:
Change cpus_booted back to a simple variable instead of a kcpuset.
octeon_cpu_spinup() was trying to set CPU status immediately on kernel
startup _well_ before the kcpuset was initialised.

diffstat:

 sys/arch/evbmips/cavium/machdep.c     |   8 ++------
 sys/arch/mips/cavium/octeon_cpunode.c |  13 +++++++------
 sys/arch/mips/cavium/octeonvar.h      |   5 +----
 sys/arch/mips/mips/locore_octeon.S    |  17 +++++++----------
 4 files changed, 17 insertions(+), 26 deletions(-)

diffs (137 lines):

diff -r 36924a9ef1fa -r 892096a5664f sys/arch/evbmips/cavium/machdep.c
--- a/sys/arch/evbmips/cavium/machdep.c Tue Jul 28 00:13:29 2020 +0000
+++ b/sys/arch/evbmips/cavium/machdep.c Tue Jul 28 00:35:38 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: machdep.c,v 1.21 2020/07/22 13:24:17 simonb Exp $      */
+/*     $NetBSD: machdep.c,v 1.22 2020/07/28 00:35:38 simonb Exp $      */
 
 /*
  * Copyright 2001, 2002 Wasabi Systems, Inc.
@@ -114,7 +114,7 @@
 #include "opt_multiprocessor.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.21 2020/07/22 13:24:17 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.22 2020/07/28 00:35:38 simonb Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -457,10 +457,6 @@
 void
 cpu_startup(void)
 {
-#ifdef MULTIPROCESSOR
-       // Create a kcpuset so we can see on which CPUs the kernel was started.
-       kcpuset_create(&cpus_booted, true);
-#endif
 
        /*
         * Do the common startup items.
diff -r 36924a9ef1fa -r 892096a5664f sys/arch/mips/cavium/octeon_cpunode.c
--- a/sys/arch/mips/cavium/octeon_cpunode.c     Tue Jul 28 00:13:29 2020 +0000
+++ b/sys/arch/mips/cavium/octeon_cpunode.c     Tue Jul 28 00:35:38 2020 +0000
@@ -29,7 +29,7 @@
 #define __INTR_PRIVATE
 #include <sys/cdefs.h>
 
-__KERNEL_RCSID(0, "$NetBSD: octeon_cpunode.c,v 1.17 2020/07/22 15:01:18 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: octeon_cpunode.c,v 1.18 2020/07/28 00:35:38 simonb Exp $");
 
 #include "locators.h"
 #include "cpunode.h"
@@ -81,7 +81,10 @@
 CFATTACH_DECL_NEW(cpu_cpunode, 0,
     cpu_cpunode_match, cpu_cpunode_attach, NULL, NULL);
 
-kcpuset_t *cpus_booted;
+#ifdef MULTIPROCESSOR
+CTASSERT(MAXCPUS <= sizeof(uint64_t) * NBBY);
+volatile uint64_t cpus_booted = __BIT(0);      /* cpu0 is always booted */
+#endif
 
 static void wdog_cpunode_poke(void *arg);
 
@@ -125,9 +128,7 @@
        if (cvmctl & CP0_CVMCTL_REPUN)
                aprint_normal(", unaligned-access ok");
 #ifdef MULTIPROCESSOR
-       uint32_t booted[1];
-       kcpuset_export_u32(cpus_booted, booted, sizeof(booted));
-       aprint_normal(", booted %#" PRIx32, booted[0]);
+       aprint_normal(", booted %#" PRIx64, cpus_booted);
 #endif
        aprint_normal("\n");
 
@@ -308,7 +309,7 @@
                return;
        }
 
-       if (!kcpuset_isset(cpus_booted, cpunum)) {
+       if (!(cpus_booted & __BIT(cpunum))) {
                aprint_naive(" disabled\n");
                aprint_normal(" disabled (unresponsive)\n");
                return;
diff -r 36924a9ef1fa -r 892096a5664f sys/arch/mips/cavium/octeonvar.h
--- a/sys/arch/mips/cavium/octeonvar.h  Tue Jul 28 00:13:29 2020 +0000
+++ b/sys/arch/mips/cavium/octeonvar.h  Tue Jul 28 00:35:38 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: octeonvar.h,v 1.16 2020/07/17 21:59:30 jmcneill Exp $  */
+/*     $NetBSD: octeonvar.h,v 1.17 2020/07/28 00:35:38 simonb Exp $    */
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -201,9 +201,6 @@
 
 #ifdef _KERNEL
 extern struct octeon_config    octeon_configuration;
-#ifdef MULTIPROCESSOR
-extern kcpuset_t               *cpus_booted;
-#endif
 
 const char     *octeon_cpu_model(mips_prid_t);
 
diff -r 36924a9ef1fa -r 892096a5664f sys/arch/mips/mips/locore_octeon.S
--- a/sys/arch/mips/mips/locore_octeon.S        Tue Jul 28 00:13:29 2020 +0000
+++ b/sys/arch/mips/mips/locore_octeon.S        Tue Jul 28 00:35:38 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: locore_octeon.S,v 1.12 2020/07/26 07:47:27 simonb Exp $        */
+/*     $NetBSD: locore_octeon.S,v 1.13 2020/07/28 00:35:38 simonb Exp $        */
 
 /*
  * Copyright (c) 2007 Internet Initiative Japan, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include <mips/asm.h>
-RCSID("$NetBSD: locore_octeon.S,v 1.12 2020/07/26 07:47:27 simonb Exp $")
+RCSID("$NetBSD: locore_octeon.S,v 1.13 2020/07/28 00:35:38 simonb Exp $")
 
 #include "cpunode.h"                   /* for NWDOG */
 #include "opt_cputype.h"
@@ -37,7 +37,7 @@
 #include <mips/cpuregs.h>
 #include <arch/mips/cavium/dev/octeon_corereg.h>
 
-RCSID("$NetBSD: locore_octeon.S,v 1.12 2020/07/26 07:47:27 simonb Exp $")
+RCSID("$NetBSD: locore_octeon.S,v 1.13 2020/07/28 00:35:38 simonb Exp $")
 
 #include "assym.h"
 
@@ -132,13 +132,10 @@
        COP0_SYNC
 
        // Indicate this CPU was started by u-boot
-       PTR_LA  t0, _C_LABEL(cpus_booted) # get addr for kcpuset
-1:     sync
-       PTR_L   a0, (t0)                # get kcpuset
-       beqz    a0, 1b                  # loop until not NULL
-        nop
-       jal     _C_LABEL(kcpuset_atomic_set)
-        move   a1, s0                  # pass it our cpu number
+       PTR_LA  a0, _C_LABEL(cpus_booted)
+       li      a1, 1
+       jal     _C_LABEL(atomic_or_64)
+        sllv   a1, a1, s0              # shift cpu number to bit position
 
        // Wait until cpuid_infos[cpunum] is not NULL.
        PTR_LA  a1, _C_LABEL(cpuid_infos)



Home | Main Index | Thread Index | Old Index