From nobody Sat Mar 16 15:16:41 2024 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Txl893mmMz5F1Fg; Sat, 16 Mar 2024 15:16:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Txl891FLxz4HWH; Sat, 16 Mar 2024 15:16:41 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1710602201; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=lJ822N2NejGsFWjVXslw18GRgfek3CRGhfFDVlqLc5s=; b=fSiWExeJ+eeDg8tEZwssg7QbFsrvnPCfKpkbjoBU3kheoDZmT/iWAWAZSaQYwQUcY47ZUO LOwLWHtInzjlzVS4h7y3YGxIqQH4lT+YPuYtiur3aj0YmPWPl1jNobTMp1uCOKGNDB0T0c QRpIeZ5kSU5T4y+M+w53m/N2sgAjwpt9lJLQpYvhnFC1nVqAJy9p9oDwUJlUVO62xrKvXp GZnRA635fP+BpD4SnjcKU6sQR4nyQLHCiK9J8qfhSyxMwv9mbiIaZvdQA98akq38WVE6Va Aq0bwEOT/iFwr8nrg/igoL7iFGdabLyR7JD4zS42aP2rqzTYTpf/V6Ljso7S+Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1710602201; a=rsa-sha256; cv=none; b=QLn+t2OYsL6Ifnh6zAcPRlnAvYesRq3RtxnsTFCy9ZuqzgV4wPJ+VLZZSUjzCOtrYfkDCT IivIIiUiYtZnaaE9CeFxCssm1QRIwqO5GxZvIItZ+VOwnNXWsuUjyUkJ3IRlqQmJWWtU3I VWwIp6xS+mG4nuQONjaJRUWkqV66YC0pvnf0RVTv+kKzViYcJ6cDlnD1oGQS1707M3FVlY MkABQKoIKc5IlmNFwpI6dbRM8pN51+IrDiCjZAXjIRuftTv/g044QeW3sbqqRvX57gu4Jo +CihOKneSfragSTn1+kxljuDj18rt1FgmlNNfWgQtRK/cNS8vT8Tp5gkcLnebA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1710602201; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=lJ822N2NejGsFWjVXslw18GRgfek3CRGhfFDVlqLc5s=; b=u1TsWbePlxPjVqGyzwBwiM6LPlI6Sfa+9SJMKnKuYYqklpIRym9ySguol8JRkchaP73av9 BhGAl4Zz8RZGpAyp/9Ycqt/C8zcGg9RAYqrmlmwFHWezS0S0PVbaEH3t743hUkHiMeuEXg PZOn/JE61H8DGJWITGpRCAE7mVXI1m5EHKYOV0mzI0/FIeaHi9HVy3KzpwR23/+LcVYdXC F9MbHfKImwrR7aHeS6VQsNd/aaTIyu/A4kUzzZgF59/Lf+KgFwS8XVU6o2BuhnjcHl6mDG tiwLfMtGQOD4+4KtiGDZdi/TG4+MyyvCm3YGEhxBXJjxQYJyh/xXNGOwwuEjWg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Txl890qnbz106L; Sat, 16 Mar 2024 15:16:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 42GFGfqi063195; Sat, 16 Mar 2024 15:16:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 42GFGfq1063192; Sat, 16 Mar 2024 15:16:41 GMT (envelope-from git) Date: Sat, 16 Mar 2024 15:16:41 GMT Message-Id: <202403161516.42GFGfq1063192@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Andriy Gapon Subject: git: d463f7c7a726 - stable/13 - psci: split off psci_reboot from psci_shutdown List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: avg X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: d463f7c7a726842dca50e87b79d401f5d09dd196 Auto-Submitted: auto-generated The branch stable/13 has been updated by avg: URL: https://cgit.FreeBSD.org/src/commit/?id=d463f7c7a726842dca50e87b79d401f5d09dd196 commit d463f7c7a726842dca50e87b79d401f5d09dd196 Author: Andriy Gapon AuthorDate: 2021-07-09 15:01:57 +0000 Commit: Andriy Gapon CommitDate: 2024-03-16 15:14:47 +0000 psci: split off psci_reboot from psci_shutdown Priority of psci_reboot set so that it is run after shutdown_panic is executed. This is to provide uniform experience with other platforms. (cherry picked from commit 0f354b2b588b60e2ef119ff2f480f7905c5db587) --- sys/dev/psci/psci.c | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/sys/dev/psci/psci.c b/sys/dev/psci/psci.c index 3d9fe230d1a2..a656a1365067 100644 --- a/sys/dev/psci/psci.c +++ b/sys/dev/psci/psci.c @@ -124,7 +124,6 @@ static struct ofw_compat_data compat_data[] = { #endif static int psci_attach(device_t, psci_initfn_t, int); -static void psci_shutdown(void *, int); static int psci_find_callfn(psci_callfn_t *); static int psci_def_callfn(register_t, register_t, register_t, register_t, @@ -472,12 +471,24 @@ psci_shutdown(void *xsc, int howto) if (psci_softc == NULL) return; - /* PSCI system_off and system_reset werent't supported in v0.1. */ if ((howto & RB_POWEROFF) != 0) fn = psci_softc->psci_fnids[PSCI_FN_SYSTEM_OFF]; - else if ((howto & RB_HALT) == 0) - fn = psci_softc->psci_fnids[PSCI_FN_SYSTEM_RESET]; + if (fn) + psci_call(fn, 0, 0, 0); + + /* System reset and off do not return. */ +} +static void +psci_reboot(void *xsc, int howto) +{ + uint32_t fn = 0; + + if (psci_softc == NULL) + return; + + if ((howto & RB_HALT) == 0) + fn = psci_softc->psci_fnids[PSCI_FN_SYSTEM_RESET]; if (fn) psci_call(fn, 0, 0, 0); @@ -488,7 +499,7 @@ void psci_reset(void) { - psci_shutdown(NULL, 0); + psci_reboot(NULL, 0); } #ifdef FDT @@ -586,6 +597,10 @@ psci_v0_2_init(device_t dev, int default_version) EVENTHANDLER_REGISTER(shutdown_final, psci_shutdown, sc, SHUTDOWN_PRI_LAST); + /* Handle reboot after shutdown_panic. */ + EVENTHANDLER_REGISTER(shutdown_final, psci_reboot, sc, + SHUTDOWN_PRI_LAST + 150); + return (0); }