From mboxrd@z Thu Jan 1 00:00:00 1970 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 D70834F30D5 for ; Thu, 17 Sep 2026 12:30:29 +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=1789648243; cv=none; b=RJkoUV3WUYBODC9yltTXINx/DnmoSi9r3ao8GIwsPrlF3rrqLHO3qR0Jmxno1V6TdhhIVlUB7/BTppk1V4Cwg9W1wKW7qYLVRE2QFPdc7efDZsXSO30UyBzyTX0WgaJihHfYC6G2sQ9G1/TZsIg0+uGvfLlA8iam8bg0tPEt7UQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789648243; c=relaxed/simple; bh=IrEZVxtAcGTWTQmjcP4fBFtJejLljjOJ0I0fPBSWZMY=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=jW5/38MhScbkLXud8BJ9LnAS22vdMV+0ZqvQhIq5znEiI5N1DTOufx4zA5m1fEzAHk9ykiIxhsa4gIT5pE5J2kziT31HR0OmQO9wh06cgh71bFWrSjP6d9HRC1kj+xd8qUDavR5iDsvt8nqAA/7pkTHGe+5gAuflZB9EsHhtNHY= 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=jRuDG0nf; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=KvxaQuxD; 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="jRuDG0nf"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="KvxaQuxD" Received: from pps.filterd (m0279868.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 68H9Zb3Y1150048 for ; Thu, 17 Sep 2026 12:30:20 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= 4q8gvMIQDTw2ylw7lWi4SL0F8ENS62IvhhPOrledFr8=; b=jRuDG0nfCRc8tTIE 2ZwZFAIVF6SWkB2EYW2iUY7deRCRkNNw790SGV3yu5Q6vDwbfkL2hUbvxuL+h6p8 YQd89hGJZxcVnQXwMjC6XBZ7WCojS9/S1sjQA4jEx4lfY7aELArzv4cnNqduxJr9 zgvhsYAOnro9uxHBtfmncT6flZg+JUs9AXw7Y6R6M6wD8Lrjvi09JEW8TxXU9jYQ /RFuHB/baJaHPJhil75ntjtmdoMK4Ho4DdJ9H9QFST9ZOJ5zjRq7mrb5WBUXgD5Y Q+FeYVlS9WdoUpptZAezyp5ZC1CF/LN9Sf07UuGv1ymEOjDZ8L0iQz/N3ox/kOJl 2U8d+g== Received: from mail-pj1-f70.google.com (mail-pj1-f70.google.com [209.85.216.70]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4grc9w91q1-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Thu, 17 Sep 2026 12:30:19 +0000 (GMT) Received: by mail-pj1-f70.google.com with SMTP id 98e67ed59e1d1-39de4e72b33so1441077a91.2 for ; Thu, 17 Sep 2026 05:30:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1789648219; x=1790253019; darn=vger.kernel.org; h=content-transfer-encoding:content-type:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:from:to:cc:subject:date:message-id:reply-to :content-type; bh=4q8gvMIQDTw2ylw7lWi4SL0F8ENS62IvhhPOrledFr8=; b=KvxaQuxDpV3tGtzSgmwDX5t9VG774PTCI3enSCETwvqBM5jbEs2UDWqStdb/DXTKAD 13+2V2i2yrd7xFAAcze9SRC3KVI0TNyFxc6hJLD5earfQ8OcMP70GzhscvyqUNB3RjFF UDttM/679RA7AhQeDTlFACb46yOtPodtCV0oTwlgWT+CgT6sG9oE6FIwimbGBit14Mzw 8VRQ/yym/nKb/t12czehm3/cAuyeCXuN2JCWLNDveHaZl09hpS4XMpgVzf9Gs0h46vpa dEVzqMVxfNrA6PydJoH2+r7mUaBSFyn3AeJAWXlF0eyzZ/m5gAfpssWWwyW0vZ9PGLsq wqgw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1789648219; x=1790253019; h=content-transfer-encoding:content-type:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=4q8gvMIQDTw2ylw7lWi4SL0F8ENS62IvhhPOrledFr8=; b=23ADZTTbHwMML6COStbaESuPfI0Gnm48zIQpvDT8SxNyyXs4VDwvCrSytZ5dovEee3 uUTRtUaX83x3QaZmP7IFbm1jZuSvv2cpbD5BqOrt7E44NlZ5LAX6DetuSLkOaXGnNdvO Ti+XtEkWzIqJeUeI3MokDu5uBFcDcKBZuIlIHQoV8QSPM6aUiuftUXbYFN+AT0uoPOIy VhQKaUZJ+6DC5UfkJAxOXnLEQFYHPkR0I9MrDiccStLtHpUTgwxuQOspCNkEvkqNyG5J 4VMV55CXDN2pbNSF2goNKgFHiaThIvObodMefVDvsGofFh3w/7ji0oWBSgW3KuBY0yln 5JCg== X-Forwarded-Encrypted: i=1; AKwUvBxzhX+bkfgir/LAmzY4clt97RjloHRu34OtG3L3OyicMpuntoziUn+Fu/J6fxL1ADngHQf1VFN6kImk@vger.kernel.org X-Gm-Message-State: AFuF++nSB7w9RpuJuF/UoaiH9QLCYAvoCaRgiNycyAsib17euD5VmKqO gn/+1NVUf65ukN7e5ZEAylesCUqpCnNhJD+WvzZOdAPLZRnWxrb8FgjW4l6yb35iD45FPaZrTKV FFO8aNhdTYSX49rpN5h9jmjiDMV1zEtCLIiitS+tV0k7gPVI5bcHLAMicC8NgALVU X-Gm-Gg: AYBFou0aoqN2WVroun6YtoTo0l15ThdGzpP5QzosBKAHcJnw6IV7iSJwB+dr9e2h+Ei X70hjH6Fq7ejIpzbm2qksgG9M4+MXyUXA9ZdrUxVHbInHmcG3M7HhMk0LC14QUIMVx+hy1QkvDY wU8OZS+g8/NnHlQTD1W718fNq4ODhi5Z7NtMDrV4bgj/WhLdmDS0i8LUMnbbSO0gy7NvcbyeXpv AnzusJSgl8GvNPqx6OO58fkPbwNZ3+gBmZ1wu/MLa38lu8fHhJ7sWUXTXs6bNKzCkYyledy0LSF w3EIdgwZNcD/437iqL9hSgysb2/V6Md1Z4rBuVAvsdZBBl5sdkv2XrSZgqR4VontmWqxwJN5azI Y282KmkBCDcyo0uSmiEJTamJEwSn7NjI= X-Received: by 2002:a17:90b:2688:b0:39e:1c2c:1d4b with SMTP id 98e67ed59e1d1-39e1e31d67cmr16479173a91.11.1789648218582; Thu, 17 Sep 2026 05:30:18 -0700 (PDT) X-Received: by 2002:a17:90b:2688:b0:39e:1c2c:1d4b with SMTP id 98e67ed59e1d1-39e1e31d67cmr16479034a91.11.1789648217991; Thu, 17 Sep 2026 05:30:17 -0700 (PDT) Received: from [10.218.9.75] ([202.46.22.19]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-39e361b7266sm5054768a91.13.2026.09.17.05.30.07 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 17 Sep 2026 05:30:17 -0700 (PDT) Message-ID: <14caa8e3-63ba-4a22-b95a-f7bc41ded545@oss.qualcomm.com> Date: Thu, 17 Sep 2026 18:00:05 +0530 Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v25 06/10] power: reset: Add psci-reboot-mode driver To: Bartosz Golaszewski Cc: Florian Fainelli , Krzysztof Kozlowski , Dmitry Baryshkov , Mukesh Ojha , Andre Draszik , Greg Kroah-Hartman , 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, mfd@lists.linux.dev, Srinivas Kandagatla , Ulf Hansson , Bartosz Golaszewski , Lorenzo Pieralisi , Arnd Bergmann , Bjorn Andersson , Sebastian Reichel , Rob Herring , Souvik Chakravarty , Krzysztof Kozlowski , Andy Yan , Matthias Brugger , Mark Rutland , Conor Dooley , Konrad Dybcio , John Stultz , Moritz Fischer , "Rafael J. Wysocki" , Daniel Lezcano , Christian Loehle , Lee Jones , Ulf Hansson , Pavan Kondeti , Abel Vesa , Sudeep Holla References: <20260914-arm-psci-system_reset2-vendor-reboots-v25-0-4aaf5c09b5c2@oss.qualcomm.com> <20260914-arm-psci-system_reset2-vendor-reboots-v25-6-4aaf5c09b5c2@oss.qualcomm.com> Content-Language: en-US From: Shivendra Pratap In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwOTE3MDE3NSBTYWx0ZWRfX9zVrciYOR1Py 2Bd/SJSznyT1p6w2xDRE38Swpp9fWvK4i/SXEpNrsDunGYbnuvT/HAqlUzjltBVrhVe7G2IKwNk p493vewkjbcnQ2OeAsIioOku7BdK4RqzzF9oVbOD4AqcF9t02OBrV4+MDTft/PpkvXOcQdfCJA6 0th8ONCo6i2TAEYtPm+/Sxb6TwhL3NSDKCnhNFtsKgb6s95M6c2kcPfTlKxzCSdWTOOLIPd7syW Vce0OgQPbocjd9Hd5ornaypPONzWbMrIF+oJxSvtNkkgLcISEX1NX9eNvz8GR6ymz9uvDQOWsKv NaM80AKbTlYSJu7p3jlacSQMs7Y83uz3Vg2f1h6cW0JdT4EoWD7q3sT04o/EJNYAyVvk2qOV+y/ rpY971xGUP1zgXG6mGXz1N+/yYzA08p8DZdRjq62I+epXwZneROUwJghBoeknnscxgTfkqjCpUa n0EtdGo5bqDq1qzuPQg== X-Proofpoint-Spam-Info: AW1haW4tMjYwOTE3MDE3NSBTYWx0ZWRfXxkoWiM/eTKEu /OxZK5kDum53/vrHhCCStK4dUL/Z7ouq1SFiOZRRo/CGY3jBiROkMT3zIrToamHCEarHqA+Wquu f4NNOypgSmmYWPldz4IQia216KMDhsA= X-Proofpoint-GUID: QxpQGFzq4JXOtzNoVkAkPSJAbuOMGpvZ X-Proofpoint-ORIG-GUID: QxpQGFzq4JXOtzNoVkAkPSJAbuOMGpvZ X-Authority-Analysis: v=2.4 cv=EsZHPicA c=1 sm=1 tr=0 ts=6aabdd5b cx=c_pps a=0uOsjrqzRL749jD1oC5vDA==:117 a=fChuTYTh2wq5r3m49p7fHw==:17 a=IkcTkHD0fZMA:10 a=VdqzKS8jKosA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=ZpdpYltYx_vBUK5n70dp:22 a=EUspDBNiAAAA:8 a=VwQbUJbxAAAA:8 a=gIm7KJJTxUf_gKF81MkA:9 a=QEXdDO2ut3YA:10 a=mQ_c8vxmzFEMiUWkPHU9:22 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-09-17_02,2026-09-16_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 suspectscore=0 bulkscore=0 lowpriorityscore=0 spamscore=0 malwarescore=0 adultscore=0 priorityscore=1501 impostorscore=0 phishscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2609040000 definitions=main-2609170175 On 9/16/2026 2:53 PM, Bartosz Golaszewski wrote: > On Mon, 14 Sep 2026 16:59:10 +0200, Shivendra Pratap > said: >> PSCI supports different types of resets like SYSTEM_RESET, SYSTEM_RESET2 >> ARCH WARM reset and SYSTEM_RESET2 vendor-specific resets. Currently >> there is no common driver that handles all supported psci resets at one >> place. Additionally, there is no common mechanism to issue the supported >> psci resets from userspace. >> >> Add psci-reboot-mode as an auxiliary device created by the psci-devices >> driver. Define two types of PSCI resets, predefined-resets and >> vendor-specific resets. Predefined-resets are defined by psci driver >> and vendor-specific resets are defined by SoC vendors, under the >> psci:reboot-mode node of SoC device tree. >> >> Register the driver with the reboot-mode framework to interface these >> resets to userspace. When userspace initiates a supported command, pass >> the reset arguments to the PSCI driver to enable command-based reset. >> >> This change allows userspace to issue supported PSCI reset commands >> using the standard reboot system calls while enabling SoC vendors to >> define their specific resets for PSCI. >> >> Suggested-by: Ulf Hansson >> Suggested-by: Lee Jones >> Suggested-by: Bartosz Golaszewski >> Signed-off-by: Shivendra Pratap >> --- >> MAINTAINERS | 1 + >> drivers/firmware/psci/psci-devices.c | 71 +++++++++++++++++++++- >> drivers/power/reset/Kconfig | 10 ++++ >> drivers/power/reset/Makefile | 1 + >> drivers/power/reset/psci-reboot-mode.c | 104 +++++++++++++++++++++++++++++++++ >> 5 files changed, 185 insertions(+), 2 deletions(-) >> >> diff --git a/MAINTAINERS b/MAINTAINERS >> index 9c0334ee2ed2..1c0f111ba197 100644 >> --- a/MAINTAINERS >> +++ b/MAINTAINERS >> @@ -21933,6 +21933,7 @@ S: Maintained >> F: Documentation/devicetree/bindings/arm/psci.yaml >> F: drivers/firmware/psci/ >> F: drivers/firmware/psci/psci-devices.c >> +F: drivers/power/reset/psci-reboot-mode.c >> F: include/linux/psci.h >> F: include/uapi/linux/psci.h >> >> diff --git a/drivers/firmware/psci/psci-devices.c b/drivers/firmware/psci/psci-devices.c >> index f1eca61e3269..43e6743202f9 100644 >> --- a/drivers/firmware/psci/psci-devices.c >> +++ b/drivers/firmware/psci/psci-devices.c >> @@ -4,19 +4,86 @@ >> */ >> >> #include >> +#include >> #include >> #include >> #include >> +#include >> +#include >> + >> +static void arm_psci_auxiliary_device_release(struct device *dev) >> +{ >> + struct auxiliary_device *auxdev = to_auxiliary_dev(dev); >> + >> + of_node_put(dev->of_node); >> + kfree(auxdev); >> +} >> + >> +static struct auxiliary_device * >> +arm_psci_auxiliary_device_create(struct device *dev, const char *devname, >> + struct device_node *np) >> +{ >> + struct auxiliary_device *auxdev; >> + int ret; >> + >> + auxdev = kzalloc_obj(*auxdev); >> + if (!auxdev) >> + return NULL; >> + >> + auxdev->id = 0; >> + auxdev->name = devname; >> + auxdev->dev.parent = dev; >> + auxdev->dev.release = arm_psci_auxiliary_device_release; >> + >> + if (np) >> + device_set_node(&auxdev->dev, of_fwnode_handle(of_node_get(np))); >> + >> + ret = auxiliary_device_init(auxdev); >> + if (ret) { >> + of_node_put(auxdev->dev.of_node); >> + kfree(auxdev); >> + return NULL; >> + } >> + >> + ret = __auxiliary_device_add(auxdev, "arm-psci"); >> + if (ret) { >> + auxiliary_device_uninit(auxdev); >> + return NULL; >> + } >> + >> + ret = devm_add_action_or_reset(dev, auxiliary_device_destroy, auxdev); >> + if (ret) >> + return NULL; >> + >> + return auxdev; >> +} >> >> static int arm_psci_probe(struct platform_device *pdev) >> { >> struct auxiliary_device *auxdev; >> +#ifdef CONFIG_PSCI_REBOOT_MODE >> + struct device_node *reboot_mode_np = NULL; >> +#endif >> >> - auxdev = __devm_auxiliary_device_create(&pdev->dev, "arm-psci", >> - "psci-cpuidle-domain", NULL, 0); >> + auxdev = arm_psci_auxiliary_device_create(&pdev->dev, >> + "psci-cpuidle-domain", >> + pdev->dev.of_node); >> if (!auxdev) >> return -ENOMEM; >> >> +#ifdef CONFIG_PSCI_REBOOT_MODE >> + if (psci_has_system_reset2_support()) >> + reboot_mode_np = of_get_child_by_name(pdev->dev.of_node, >> + "reboot-mode"); >> + >> + auxdev = arm_psci_auxiliary_device_create(&pdev->dev, >> + "psci-reboot-mode", >> + reboot_mode_np); >> + of_node_put(reboot_mode_np); >> + if (!auxdev) >> + dev_warn(&pdev->dev, "failed to create PSCI reboot mode device\n"); >> +#endif >> + >> return 0; >> } >> >> diff --git a/drivers/power/reset/Kconfig b/drivers/power/reset/Kconfig >> index bce996bbef28..5c349f41e097 100644 >> --- a/drivers/power/reset/Kconfig >> +++ b/drivers/power/reset/Kconfig >> @@ -360,6 +360,16 @@ config NVMEM_REBOOT_MODE >> then the bootloader can read it and take different >> action according to the mode. >> >> +config PSCI_REBOOT_MODE >> + bool "PSCI reboot mode driver" >> + depends on ARM_PSCI_DEVICES >> + select REBOOT_MODE > > Needs: select AUXILIARY_BUS Ack. > >> + help >> + Say y here to enable the PSCI reboot mode driver. The driver >> + registers with the reboot-mode framework to configure PSCI >> + reset commands, which are executed by the PSCI driver during >> + psci_sys_reset(). >> + >> config POWER_MLXBF >> tristate "Mellanox BlueField power handling driver" >> depends on (GPIO_MLXBF2 || GPIO_MLXBF3) && ACPI >> diff --git a/drivers/power/reset/Makefile b/drivers/power/reset/Makefile >> index e31cab4ba78e..45d8aaaffaa1 100644 >> --- a/drivers/power/reset/Makefile >> +++ b/drivers/power/reset/Makefile >> @@ -41,5 +41,6 @@ obj-$(CONFIG_REBOOT_MODE) += reboot-mode.o >> obj-$(CONFIG_SYSCON_REBOOT_MODE) += syscon-reboot-mode.o >> obj-$(CONFIG_POWER_RESET_SC27XX) += sc27xx-poweroff.o >> obj-$(CONFIG_NVMEM_REBOOT_MODE) += nvmem-reboot-mode.o >> +obj-$(CONFIG_PSCI_REBOOT_MODE) += psci-reboot-mode.o >> obj-$(CONFIG_POWER_MLXBF) += pwr-mlxbf.o >> obj-$(CONFIG_POWER_RESET_QEMU_VIRT_CTRL) += qemu-virt-ctrl.o >> diff --git a/drivers/power/reset/psci-reboot-mode.c b/drivers/power/reset/psci-reboot-mode.c >> new file mode 100644 >> index 000000000000..bf2dd6626feb >> --- /dev/null >> +++ b/drivers/power/reset/psci-reboot-mode.c >> @@ -0,0 +1,104 @@ >> +// SPDX-License-Identifier: GPL-2.0-only >> +/* >> + * Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. >> + */ >> + >> +#include >> +#include >> +#include > > [ > >> +#include >> +#include >> +#include > > ] > > Why are you including these? errno.h and init.h were added for EINVAL and subsys_initcall() - will remove these. available in psci.h kconfig.h for IS_ENABLED(CONFIG_64BIT) - will retain this. thanks, Shivendra