From a9fd4815fcf34f47d730136efd6afb73d593f80f Mon Sep 17 00:00:00 2001 From: andrew Date: Wed, 7 Sep 2016 12:59:08 +0000 Subject: MFC 303307, 303308, 303309 clean up the arm64 MP code: - Rework how we number CPUs on arm64 to try and keep clusters together. - Fix a typo in a string in a KASSERT to sanity check the CPU IDs. - Remove an unused variable. Obtained from: ABT Systems Ltd Sponsored by: The FreeBSD Foundation --- sys/arm64/arm64/mp_machdep.c | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) (limited to 'sys/arm64') diff --git a/sys/arm64/arm64/mp_machdep.c b/sys/arm64/arm64/mp_machdep.c index 5256dcf..b8e0394 100644 --- a/sys/arm64/arm64/mp_machdep.c +++ b/sys/arm64/arm64/mp_machdep.c @@ -112,9 +112,6 @@ static int ipi_handler(void *arg); struct mtx ap_boot_mtx; struct pcb stoppcbs[MAXCPU]; -#ifdef INVARIANTS -static uint32_t cpu_reg[MAXCPU][2]; -#endif static device_t cpu_list[MAXCPU]; /* @@ -441,22 +438,22 @@ cpu_init_fdt(u_int id, phandle_t node, u_int addr_size, pcell_t *reg) if (id > mp_maxid) return (0); - KASSERT(id < MAXCPU, ("Too mant CPUs")); - - KASSERT(addr_size == 1 || addr_size == 2, ("Invalid register size")); -#ifdef INVARIANTS - cpu_reg[id][0] = reg[0]; - if (addr_size == 2) - cpu_reg[id][1] = reg[1]; -#endif + KASSERT(id < MAXCPU, ("Too many CPUs")); /* We are already running on cpu 0 */ if (id == cpu0) return (1); + /* + * Rotate the CPU IDs to put the boot CPU as CPU 0. We keep the other + * CPUs ordered as the are likely grouped into clusters so it can be + * useful to keep that property, e.g. for the GICv3 driver to send + * an IPI to all CPUs in the cluster. + */ cpuid = id; if (cpuid < cpu0) - cpuid++; + cpuid += mp_maxid + 1; + cpuid -= cpu0; pcpup = &__pcpu[cpuid]; pcpu_init(pcpup, cpuid, sizeof(struct pcpu)); -- cgit v1.1