Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 7 Sep 2016 12:59:08 +0000 (UTC)
From:      Andrew Turner <andrew@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r305532 - stable/11/sys/arm64/arm64
Message-ID:  <201609071259.u87Cx8r7086618@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: andrew
Date: Wed Sep  7 12:59:08 2016
New Revision: 305532
URL: https://svnweb.freebsd.org/changeset/base/305532

Log:
  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

Modified:
  stable/11/sys/arm64/arm64/mp_machdep.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/arm64/arm64/mp_machdep.c
==============================================================================
--- stable/11/sys/arm64/arm64/mp_machdep.c	Wed Sep  7 12:33:04 2016	(r305531)
+++ stable/11/sys/arm64/arm64/mp_machdep.c	Wed Sep  7 12:59:08 2016	(r305532)
@@ -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
 	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));



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201609071259.u87Cx8r7086618>