svn commit: r307910 - in head/sys: arm64/arm64 dev/psci

Andrew Turner andrew at FreeBSD.org
Tue Oct 25 14:18:29 UTC 2016


Author: andrew
Date: Tue Oct 25 14:18:27 2016
New Revision: 307910
URL: https://svnweb.freebsd.org/changeset/base/307910

Log:
  Create a new PSCI error code and use it to signal that starting the CPU is
  impossible as the PSCI firmware is missing.
  
  Sponsored by:	ABT Systmes Ltd

Modified:
  head/sys/arm64/arm64/mp_machdep.c
  head/sys/dev/psci/psci.c
  head/sys/dev/psci/psci.h

Modified: head/sys/arm64/arm64/mp_machdep.c
==============================================================================
--- head/sys/arm64/arm64/mp_machdep.c	Tue Oct 25 14:04:35 2016	(r307909)
+++ head/sys/arm64/arm64/mp_machdep.c	Tue Oct 25 14:18:27 2016	(r307910)
@@ -461,9 +461,13 @@ cpu_init_fdt(u_int id, phandle_t node, u
 
 	err = psci_cpu_on(target_cpu, pa, cpuid);
 	if (err != PSCI_RETVAL_SUCCESS) {
-		/* Panic here if INVARIANTS are enabled */
-		KASSERT(0, ("Failed to start CPU %u (%lx)\n", id,
-		    target_cpu));
+		/*
+		 * Panic here if INVARIANTS are enabled and PSCI failed to
+		 * start the requested CPU. If psci_cpu_on returns PSCI_MISSING
+		 * to indicate we are unable to use it to start the given CPU.
+		 */
+		KASSERT(err == PSCI_MISSING,
+		    ("Failed to start CPU %u (%lx)\n", id, target_cpu));
 
 		pcpu_destroy(pcpup);
 		kmem_free(kernel_arena, (vm_offset_t)dpcpu[cpuid - 1],

Modified: head/sys/dev/psci/psci.c
==============================================================================
--- head/sys/dev/psci/psci.c	Tue Oct 25 14:04:35 2016	(r307909)
+++ head/sys/dev/psci/psci.c	Tue Oct 25 14:18:27 2016	(r307910)
@@ -189,12 +189,12 @@ psci_cpu_on(unsigned long cpu, unsigned 
 		node = ofw_bus_find_compatible(OF_peer(0), "arm,psci-0.2");
 		if (node == 0)
 			/* TODO: Handle psci 0.1 */
-			return (PSCI_RETVAL_INTERNAL_FAILURE);
+			return (PSCI_MISSING);
 
 		fnid = PSCI_FNID_CPU_ON;
 		callfn = psci_get_callfn(node);
 		if (callfn == NULL)
-			return (PSCI_RETVAL_INTERNAL_FAILURE);
+			return (PSCI_MISSING);
 	} else {
 		callfn = psci_softc->psci_call;
 		fnid = psci_softc->psci_fnids[PSCI_FN_CPU_ON];

Modified: head/sys/dev/psci/psci.h
==============================================================================
--- head/sys/dev/psci/psci.h	Tue Oct 25 14:04:35 2016	(r307909)
+++ head/sys/dev/psci/psci.h	Tue Oct 25 14:18:27 2016	(r307910)
@@ -54,6 +54,10 @@ int	psci_smc_despatch(register_t, regist
 #define	PSCI_RETVAL_INTERNAL_FAILURE	-6
 #define	PSCI_RETVAL_NOT_PRESENT		-7
 #define	PSCI_RETVAL_DISABLED		-8
+/*
+ * Used to signal PSCI is not available, e.g. to start a CPU.
+ */
+#define	PSCI_MISSING			1
 
 /*
  * PSCI function codes (as per PSCI v0.2).


More information about the svn-src-all mailing list