From owner-svn-src-all@freebsd.org Tue Oct 25 14:18:29 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A751CC2135B; Tue, 25 Oct 2016 14:18:29 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5105723F; Tue, 25 Oct 2016 14:18:29 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9PEISV2006229; Tue, 25 Oct 2016 14:18:28 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9PEISSQ006225; Tue, 25 Oct 2016 14:18:28 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201610251418.u9PEISSQ006225@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Tue, 25 Oct 2016 14:18:28 +0000 (UTC) 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 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Oct 2016 14:18:29 -0000 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).