Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 25 Oct 2016 14:18:28 +0000 (UTC)
From:      Andrew Turner <andrew@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r307910 - in head/sys: arm64/arm64 dev/psci
Message-ID:  <201610251418.u9PEISSQ006225@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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).



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