Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/arm/arm32 cpu_hatch is too late to report AP topolo...



details:   https://anonhg.NetBSD.org/src/rev/f08ab91a10ea
branches:  trunk
changeset: 466994:f08ab91a10ea
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Wed Jan 08 18:47:43 2020 +0000

description:
cpu_hatch is too late to report AP topology, do it at attach time instead

diffstat:

 sys/arch/arm/arm32/arm32_boot.c |  18 ++----------------
 sys/arch/arm/arm32/cpu.c        |  32 ++++++++++++++++----------------
 2 files changed, 18 insertions(+), 32 deletions(-)

diffs (99 lines):

diff -r c2ceb92705db -r f08ab91a10ea sys/arch/arm/arm32/arm32_boot.c
--- a/sys/arch/arm/arm32/arm32_boot.c   Wed Jan 08 17:38:41 2020 +0000
+++ b/sys/arch/arm/arm32/arm32_boot.c   Wed Jan 08 18:47:43 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: arm32_boot.c,v 1.35 2019/12/20 21:05:33 ad Exp $       */
+/*     $NetBSD: arm32_boot.c,v 1.36 2020/01/08 18:47:43 jmcneill Exp $ */
 
 /*
  * Copyright (c) 2002, 2003, 2005  Genetec Corporation.  All rights reserved.
@@ -122,7 +122,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(1, "$NetBSD: arm32_boot.c,v 1.35 2019/12/20 21:05:33 ad Exp $");
+__KERNEL_RCSID(1, "$NetBSD: arm32_boot.c,v 1.36 2020/01/08 18:47:43 jmcneill Exp $");
 
 #include "opt_arm_debug.h"
 #include "opt_cputypes.h"
@@ -357,20 +357,6 @@
        ci->ci_ctrl = armreg_sctlr_read();
        uint32_t mpidr = armreg_mpidr_read();
        ci->ci_mpidr = mpidr;
-       if (mpidr & MPIDR_MT) {
-               cpu_topology_set(ci,
-                   __SHIFTOUT(mpidr, MPIDR_AFF2),
-                   __SHIFTOUT(mpidr, MPIDR_AFF1),
-                   __SHIFTOUT(mpidr, MPIDR_AFF0),
-                   0);
-       } else {
-               cpu_topology_set(ci,
-                   __SHIFTOUT(mpidr, MPIDR_AFF1),
-                   __SHIFTOUT(mpidr, MPIDR_AFF0),
-                   0,
-                   0);
-       }
-
        ci->ci_arm_cpuid = cpu_idnum();
        ci->ci_arm_cputype = ci->ci_arm_cpuid & CPU_ID_CPU_MASK;
        ci->ci_arm_cpurev = ci->ci_arm_cpuid & CPU_ID_REVISION_MASK;
diff -r c2ceb92705db -r f08ab91a10ea sys/arch/arm/arm32/cpu.c
--- a/sys/arch/arm/arm32/cpu.c  Wed Jan 08 17:38:41 2020 +0000
+++ b/sys/arch/arm/arm32/cpu.c  Wed Jan 08 18:47:43 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cpu.c,v 1.136 2019/12/20 21:05:33 ad Exp $     */
+/*     $NetBSD: cpu.c,v 1.137 2020/01/08 18:47:43 jmcneill Exp $       */
 
 /*
  * Copyright (c) 1995 Mark Brinicombe.
@@ -46,7 +46,7 @@
 #include "opt_multiprocessor.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.136 2019/12/20 21:05:33 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.137 2020/01/08 18:47:43 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/conf.h>
@@ -109,20 +109,6 @@
 #ifdef MULTIPROCESSOR
                uint32_t mpidr = armreg_mpidr_read();
                ci->ci_mpidr = mpidr;
-
-               if (mpidr & MPIDR_MT) {
-                       cpu_topology_set(ci,
-                           __SHIFTOUT(mpidr, MPIDR_AFF2),
-                           __SHIFTOUT(mpidr, MPIDR_AFF1),
-                           __SHIFTOUT(mpidr, MPIDR_AFF0),
-                           0);
-               } else {
-                       cpu_topology_set(ci,
-                           __SHIFTOUT(mpidr, MPIDR_AFF1),
-                           __SHIFTOUT(mpidr, MPIDR_AFF0),
-                           0,
-                           0);
-               }
 #endif
        } else {
 #ifdef MULTIPROCESSOR
@@ -152,6 +138,20 @@
        ci->ci_dev = dv;
        dv->dv_private = ci;
 
+       if (id & MPIDR_MT) {
+               cpu_topology_set(ci,
+                   __SHIFTOUT(id, MPIDR_AFF2),
+                   __SHIFTOUT(id, MPIDR_AFF1),
+                   __SHIFTOUT(id, MPIDR_AFF0),
+                   0);
+       } else {
+               cpu_topology_set(ci,
+                   __SHIFTOUT(id, MPIDR_AFF1),
+                   __SHIFTOUT(id, MPIDR_AFF0),
+                   0,
+                   0);
+       }
+
        evcnt_attach_dynamic(&ci->ci_arm700bugcount, EVCNT_TYPE_MISC,
            NULL, xname, "arm700swibug");
 



Home | Main Index | Thread Index | Old Index