Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/arm/fdt Only try to attach to CPUs with the same cl...



details:   https://anonhg.NetBSD.org/src/rev/232d83a23cf8
branches:  trunk
changeset: 824796:232d83a23cf8
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Sun Jun 18 23:20:20 2017 +0000

description:
Only try to attach to CPUs with the same cluster ID as the boot processor.

diffstat:

 sys/arch/arm/fdt/cpu_fdt.c |  24 ++++++++++++++++++++----
 1 files changed, 20 insertions(+), 4 deletions(-)

diffs (51 lines):

diff -r b8cd3a795dec -r 232d83a23cf8 sys/arch/arm/fdt/cpu_fdt.c
--- a/sys/arch/arm/fdt/cpu_fdt.c        Sun Jun 18 22:11:50 2017 +0000
+++ b/sys/arch/arm/fdt/cpu_fdt.c        Sun Jun 18 23:20:20 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu_fdt.c,v 1.1 2017/05/28 00:40:20 jmcneill Exp $ */
+/* $NetBSD: cpu_fdt.c,v 1.2 2017/06/18 23:20:20 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill <jmcneill%invisible.ca@localhost>
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cpu_fdt.c,v 1.1 2017/05/28 00:40:20 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu_fdt.c,v 1.2 2017/06/18 23:20:20 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -68,8 +68,23 @@
                NULL
        };
        struct fdt_attach_args * const faa = aux;
+       int is_compatible;
+       bus_addr_t mpidr;
 
-       return of_compatible(faa->faa_phandle, compatible) >= 0;
+       is_compatible = of_match_compatible(faa->faa_phandle, compatible);
+       if (!is_compatible)
+               return 0;
+
+       /* XXX NetBSD requires all CPUs to be in the same cluster */
+       if (fdtbus_get_reg(faa->faa_phandle, 0, &mpidr, NULL) != 0)
+               return 0;
+       const uint32_t bp_mpidr = armreg_mpidr_read();
+       const u_int bp_clid = __SHIFTOUT(bp_mpidr, CORTEXA9_MPIDR_CLID);
+       const u_int clid = __SHIFTOUT(mpidr, CORTEXA9_MPIDR_CLID);
+       if (bp_clid != clid)
+               return 0;
+
+       return is_compatible;
 }
 
 static void
@@ -87,5 +102,6 @@
                return;
        }
 
-       cpu_attach(self, mpidr);
+       /* Attach the CPU */
+       cpu_attach(self, __SHIFTOUT(mpidr, CORTEXA9_MPIDR_CPUID));
 }



Home | Main Index | Thread Index | Old Index