From nobody Tue Feb 10 12:58:51 2026 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DF40A19C556 for ; Sun, 28 Dec 2025 17:21:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766942474; cv=none; b=kejtKi4ExEpulxcuKJFztQaw12xA8vKZsJmHMnTQI1Cg4QphHzhHtziNJYcJhIt5TO00Vw9aDwzhLYQXsdeR+oaKn4g3WvoONbNt9zvzkXK8cwL0gF3hoAeNhwrlsaF8DAzPYK1VHp/Cw/tE9fcUt7vKgI6WQi7TkremptPA5is= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766942474; c=relaxed/simple; bh=LHOC90yAoiwemIEAKL3+u1kkTKM+A1ZqtQ5uNG8qwD8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=iByUXO6PlEqc3OAYN91BdJnNx4Z2nYcnKXEnT0BJlnVLFAr/l5lhW2lrdhE04z7fxInXVYcI0yDeRR/KgrtCXNR5H/wObyA2Ba/DylejCK7Av9HugOc442O4XUWhReEZDtxh6T+yWUiBDoMa6CW3m0b19VFZyUE+Qaq6FU2L/rA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=pZ2pXMZT; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=ZTyrCQTI; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="pZ2pXMZT"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="ZTyrCQTI" Received: from pps.filterd (m0279869.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 5BSFIXfg3548156 for ; Sun, 28 Dec 2025 17:21:06 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= IVcTn3KqGR/L4VgGa1zjn9+vt8y24OHnRTPtAi2BpJg=; b=pZ2pXMZTL/YK8WqE Dj74KJaZ8Mj/3oyXl3NgqX2nV80RXCC9TKWYKLDd4N+sl5qUYDuqUpoQYoHygVfj 0ZdFSDEUpYZ9FZWCmtmxrIfGgM4pflE9q8Pf8zLZkxTsW94Xlne4iN1VcpHIYM+g uuWROg/eOhJuF0IuE8C/vj4XVsReNn+K7lKLe/p7ommRYmnz16VAdC7D6zwdx+C/ SCh1CtMpcwqMpknAPlqOeyPxKBJ5yGGyoXdJ5YBvj3Pe0oqeBtQBayxPnpIjDGJN FmP1YH4IGYUImZHLxI8SZs0f9f7+g3HYBPhF6daX+qQsuELscAd6eAQjszbYCAJy lhpfZA== Received: from mail-pl1-f197.google.com (mail-pl1-f197.google.com [209.85.214.197]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4ba6f62j8d-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Sun, 28 Dec 2025 17:21:06 +0000 (GMT) Received: by mail-pl1-f197.google.com with SMTP id d9443c01a7336-2a0d59f0198so115321795ad.1 for ; Sun, 28 Dec 2025 09:21:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1766942465; x=1767547265; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=IVcTn3KqGR/L4VgGa1zjn9+vt8y24OHnRTPtAi2BpJg=; b=ZTyrCQTIV6mEv7sa93/Qv1YeJzKJ3a7/9DhMPMbqYKjFf4i6K80/fPsQZiePjNHv+L NtfOkrwmXDnwmUNlmaUX4MUinBGzIY4phMYWcfASXlXll3F+Lnfk8Eg7XQ/O8xEJqFB9 ffsNcEG2r/18Z9WNm5MdO4CSHGpoMXI2NcRHirfjl7Vsco/sU3ZZtMuvPav6Njku3JlG yEQa9M29r4whRSyaEesIJy/381Z58zo5qwCzDGSQ7J5VjuOrvOBKAL4AaSqQfFgL1n9b M+QfBDdeMuUsmHKBPN1ReG7LmY/6I+tUsTewdXuBsK3Q6NKAPCL/rzIGuhnXeNJnCSUW CKwA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1766942465; x=1767547265; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=IVcTn3KqGR/L4VgGa1zjn9+vt8y24OHnRTPtAi2BpJg=; b=ZQ2BVDS1WgdjCAVZ9nAbGxMYgtw/4gtAfDOxPRnZTmgpZAg4q0i3yENKx2lwvw1exV +kSKFhP40l9j0/9LbGX9E3RhXg99y7f/EWUumTaHB1ENtmO+LEuyG1ryI+oc8QoD30e5 iGB2JhKHnA5x09i+KZ2Iu6VrDvjlK1Q4EIKkfEfSRDnDjYJOQxOo6pGjvm3F2W5hB04D oordudWyPXX/t/gFKVGh6ennkksGC/1DkBRO3EiIf+7l1itg4bAs3bM0hvNpzjFd3kGu bjo1JqlQnHU9clO5ZMU5/0bn7ghB6qVXm2jfUuRTs6zKOYi4gho8/kjbVAPASuMQDASE a8XQ== X-Forwarded-Encrypted: i=1; AJvYcCWTbDuXu9kIlxYCs4tbDqIScuEKWWdz8ryZgbbGn3P+pVAIoPISTlVfH5oUQLWivwLo8w4HuRPuw7OQQV8=@vger.kernel.org X-Gm-Message-State: AOJu0YyhmLPeOGx48fQwuEhAoIYBS3reeoFEzfNWJE/utZqdzDabgv9z soXGX8I2nzNGlx+EacJ/AEUCM3E9oiCeKkv9tFgEMw/GMrABItQFKYAIit7UZH2jvVhOzGOavl9 pOsrpiaPuhzztHxp3Ki0UR49GM61sk/81fuBTgDlYkBjC7M2DILyLRTnAxkbffehTBC3L92T8pu 0= X-Gm-Gg: AY/fxX7X32rR07We0/CCoqvlQtbVfyltc+7TgY4YceDeU5dxfqqLbXw8S2oE28Gd7m6 k5FEGuzQV3Sm/YTFnjOdVwg7pFVwA4+JyWsBRpjbd2q63wwIVoc/KBxZt3HMyp8nTm7lgFzBw3R 8GIM0PXWvfM764PYhz1jy0HtJE4rtu7QLWG/bmZ+GTOBRIp9P1HVnG8Tveje1D9T+MYXuimyoW2 8X1muyDRPbj9M2XFNF1YLV9xhIFzQu2+FUfKZ6SGYvpy2JJVpZoFlMsjVZIrnhg8OkCTlkMXo6W yI9ySXM37Skl7+arZlTE3ONFTl0EvdCgyf0VKUIbdXxPfoJeeIZI6v+slkYBalM1d6TYX9xoPwf 5vaSzjh4lHu7ku1qzpDoF5q9fVajFWA2Gdndc1MUnn2VNpg== X-Received: by 2002:a17:902:f68b:b0:2a0:afeb:fbb6 with SMTP id d9443c01a7336-2a2f2202efbmr247419105ad.8.1766942464904; Sun, 28 Dec 2025 09:21:04 -0800 (PST) X-Google-Smtp-Source: AGHT+IHvLWJGvwwSQTUevMZQ5PBmpbNhxoSUnp1idgws9zQOSNVHlKUJTahTxvetNh17hCPL7TDtLg== X-Received: by 2002:a17:902:f68b:b0:2a0:afeb:fbb6 with SMTP id d9443c01a7336-2a2f2202efbmr247418855ad.8.1766942464387; Sun, 28 Dec 2025 09:21:04 -0800 (PST) Received: from hu-spratap-hyd.qualcomm.com ([202.46.22.19]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2a2f3d776ebsm255743965ad.99.2025.12.28.09.20.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 28 Dec 2025 09:21:04 -0800 (PST) From: Shivendra Pratap Date: Sun, 28 Dec 2025 22:50:22 +0530 Subject: [PATCH v19 04/10] firmware: psci: Introduce command-based reset in psci_sys_reset Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251228-arm-psci-system_reset2-vendor-reboots-v19-4-ebb956053098@oss.qualcomm.com> References: <20251228-arm-psci-system_reset2-vendor-reboots-v19-0-ebb956053098@oss.qualcomm.com> In-Reply-To: <20251228-arm-psci-system_reset2-vendor-reboots-v19-0-ebb956053098@oss.qualcomm.com> To: Lorenzo Pieralisi , Arnd Bergmann , Bjorn Andersson , Sebastian Reichel , Rob Herring , Sudeep Holla , Souvik Chakravarty , Krzysztof Kozlowski , Andy Yan , John Stultz , Matthias Brugger , Moritz Fischer , Mark Rutland , Conor Dooley , Konrad Dybcio , Bartosz Golaszewski Cc: Florian Fainelli , Krzysztof Kozlowski , Dmitry Baryshkov , Mukesh Ojha , Andre Draszik , Kathiravan Thirumoorthy , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, Shivendra Pratap , Srinivas Kandagatla X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1766942426; l=4358; i=shivendra.pratap@oss.qualcomm.com; s=20250710; h=from:subject:message-id; bh=LHOC90yAoiwemIEAKL3+u1kkTKM+A1ZqtQ5uNG8qwD8=; b=sWN6sTNCRcdeGqX6q7zskFmdTLAQicaxMgOh0lxtfbIU8M9y9rQgQsYsISuK6JP1Qm/eaa0cp JuLYxzWfqgIDtw8t8c7Ba8IvDrELeHysFF5pou+bwpIA+SelYR8d0P5 X-Developer-Key: i=shivendra.pratap@oss.qualcomm.com; a=ed25519; pk=CpsuL7yZ8NReDPhGgq6Xn/SRoa59mAvzWOW0QZoo4gw= X-Proofpoint-GUID: hnhiGFMzPlekSWuriHwlY-aAV6Gtk4xH X-Proofpoint-ORIG-GUID: hnhiGFMzPlekSWuriHwlY-aAV6Gtk4xH X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUxMjI4MDE1OCBTYWx0ZWRfXzN6nB1kB9sFG yPUHlzwgJRWuPzppLUGqxLR2mLFKcxFlDT3HRRJNs9AKyu09vPQ6wcU7oes9iyS0E30RbTSeOjg EYWy8f8YzUNYHYv6b3+wd9bQdXz2LLwkJG49DSjV0PxoU66c/gcf8FHxz3j5HAdK8xbnwykJbPN y5CtDPOCnvunGPVZdM/x/qK31jRwOdO641r5rhCo+EZX2yhjXC0dMw0R/2XU2ReD7LE4r8NSfGm FN5noG6G0fM1GadkP7dOVqKDnhpF6DEJsbHOnuAzOp2tP6O8L92RJDIorJV6lk60tQtQbb11D4d l8BueQMjOOft4k9MGFJjcJOWATZyuAsJxZAscBRJYD+4m1V7vlutiTVBkVf8K59dkUJzsW/ejwM +k2hyNkk4aVnHSFc/Z+PUx+s2bjBiQLQFgmVf/K0mAUc+UaSavx/VupxO621MK0psIYwj0aPsQb QlxxX2hYj7ADVn0kmEw== X-Authority-Analysis: v=2.4 cv=YuEChoYX c=1 sm=1 tr=0 ts=69516702 cx=c_pps a=cmESyDAEBpBGqyK7t0alAg==:117 a=fChuTYTh2wq5r3m49p7fHw==:17 a=IkcTkHD0fZMA:10 a=wP3pNCr1ah4A:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=EUspDBNiAAAA:8 a=eczEI0HPkUfQIoTEgvMA:9 a=QEXdDO2ut3YA:10 a=1OuFwYUASf3TG4hYMiVC:22 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.9,FMLib:17.12.100.49 definitions=2025-12-28_06,2025-12-26_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 lowpriorityscore=0 priorityscore=1501 malwarescore=0 adultscore=0 phishscore=0 spamscore=0 clxscore=1015 impostorscore=0 bulkscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2512120000 definitions=main-2512280158 PSCI currently supports only COLD reset and ARCH WARM reset based on the Linux reboot_mode variable. The PSCI specification now includes SYSTEM_RESET2 for vendor-specific resets, but there's no mechanism to issue these through psci_sys_reset. Add a command-based reset mechanism that allows external drivers to set the psci reset command via a new psci_set_reset_cmd() function. The psci command-based reset is disabled by default and the psci_sys_reset follows its original flow until a psci_reset command is set or a kernel panic is in progress. Signed-off-by: Shivendra Pratap --- drivers/firmware/psci/psci.c | 46 ++++++++++++++++++++++++++++++++++++++++= ++-- include/linux/psci.h | 2 ++ 2 files changed, 46 insertions(+), 2 deletions(-) diff --git a/drivers/firmware/psci/psci.c b/drivers/firmware/psci/psci.c index 38ca190d4a22d6e7e0f06420e8478a2b0ec2fe6f..ad7a3267276f9e26740aea99c11= f171ac715f9ba 100644 --- a/drivers/firmware/psci/psci.c +++ b/drivers/firmware/psci/psci.c @@ -51,6 +51,15 @@ static int resident_cpu =3D -1; struct psci_operations psci_ops; static enum arm_smccc_conduit psci_conduit =3D SMCCC_CONDUIT_NONE; =20 +struct psci_sys_reset_params { + u32 system_reset; + u32 reset_type; + u32 cookie; + bool cmd; +}; + +static struct psci_sys_reset_params psci_reset; + bool psci_tos_resident_on(int cpu) { return cpu =3D=3D resident_cpu; @@ -80,6 +89,29 @@ static u32 psci_cpu_suspend_feature; static bool psci_system_reset2_supported; static bool psci_system_off2_hibernate_supported; =20 +/** + * psci_set_reset_cmd - Sets the psci_reset_cmd for command-based + * reset which will be used in psci_sys_reset call. + * + * @cmd_sys_rst2: Set to true for SYSTEM_RESET2 based resets. + * @cmd_reset_type: Set the reset_type argument for psci_sys_reset. + * @cmd_cookie: Set the cookie argument for psci_sys_reset. + */ +void psci_set_reset_cmd(bool cmd_sys_rst2, u32 cmd_reset_type, u32 cmd_coo= kie) +{ + if (cmd_sys_rst2 && psci_system_reset2_supported) { + psci_reset.system_reset =3D PSCI_FN_NATIVE(1_1, SYSTEM_RESET2); + psci_reset.reset_type =3D cmd_reset_type; + psci_reset.cookie =3D cmd_cookie; + } else { + psci_reset.system_reset =3D PSCI_0_2_FN_SYSTEM_RESET; + psci_reset.reset_type =3D 0; + psci_reset.cookie =3D 0; + } + psci_reset.cmd =3D true; +} +EXPORT_SYMBOL_GPL(psci_set_reset_cmd); + static inline bool psci_has_ext_power_state(void) { return psci_cpu_suspend_feature & @@ -309,14 +341,24 @@ static int get_set_conduit_method(const struct device= _node *np) static int psci_sys_reset(struct notifier_block *nb, unsigned long action, void *data) { - if ((reboot_mode =3D=3D REBOOT_WARM || reboot_mode =3D=3D REBOOT_SOFT) && - psci_system_reset2_supported) { + if (((reboot_mode =3D=3D REBOOT_WARM || reboot_mode =3D=3D REBOOT_SOFT) && + psci_system_reset2_supported) && (panic_in_progress() || !psci_reset= .cmd)) { /* * reset_type[31] =3D 0 (architectural) * reset_type[30:0] =3D 0 (SYSTEM_WARM_RESET) * cookie =3D 0 (ignored by the implementation) */ invoke_psci_fn(PSCI_FN_NATIVE(1_1, SYSTEM_RESET2), 0, 0, 0); + } else if (!panic_in_progress() && psci_reset.cmd) { + /* + * Commands are being set in psci_set_reset_cmd + * This issues, SYSTEM_RESET2 arch warm reset or + * SYSTEM_RESET2 vendor-specific reset or + * a SYSTEM_RESET cold reset in accordance with + * the reboot-mode command. + */ + invoke_psci_fn(psci_reset.system_reset, psci_reset.reset_type, + psci_reset.cookie, 0); } else { invoke_psci_fn(PSCI_0_2_FN_SYSTEM_RESET, 0, 0, 0); } diff --git a/include/linux/psci.h b/include/linux/psci.h index 4ca0060a3fc42ba1ca751c7862fb4ad8dda35a4c..d13ceca88eab8932894051e7c86= e806c2ad8a73a 100644 --- a/include/linux/psci.h +++ b/include/linux/psci.h @@ -45,8 +45,10 @@ struct psci_0_1_function_ids get_psci_0_1_function_ids(v= oid); =20 #if defined(CONFIG_ARM_PSCI_FW) int __init psci_dt_init(void); +void psci_set_reset_cmd(bool cmd_sys_rst2, u32 cmd_reset_type, u32 cmd_coo= kie); #else static inline int psci_dt_init(void) { return 0; } +static inline void psci_set_reset_cmd(bool cmd_sys_rst2, u32 cmd_reset_typ= e, u32 cmd_cookie) { } #endif =20 #if defined(CONFIG_ARM_PSCI_FW) && defined(CONFIG_ACPI) --=20 2.34.1