From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.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 644BD212FA0 for ; Thu, 24 Jul 2025 14:04:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753365867; cv=none; b=SIJvd7D8ukkkzy6U1TXweLXcsRTMwUgzISCDK6aJLnWKgpI+ggpEeyKkn//6Fpq1fVZUcQYL7VE7A4apPagrtllO/b03M3q5GvbAPs1OlsEOI4PdcwYCPTPcn7AUZZPRRYAAcwj0mzo7OqzjBEHQTSsbQxqyOTDdUf/qA9MTvIg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753365867; c=relaxed/simple; bh=euYDBiI52TaHhbSDj7p1OwmGXPGVNvatQPROiF44G5o=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=JO79RTZsoG0gBdWnm0d1uXJnVw74Q2DBjcQ+rJQ/L63xx5pMz76Eym0qvwCJv5iuqwebSDhbLpcZNlLeiAlzDqgpcJiTqqs+P22UgRFdSEBeG/us5y1r609CRsjWz8IzPTN03tHeaiMOj6hJZvjOPfGUz0rZm8c9AyCfPoFyfzo= 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=W+qSkHEo; arc=none smtp.client-ip=205.220.168.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="W+qSkHEo" Received: from pps.filterd (m0279863.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 56O9on6X001505 for ; Thu, 24 Jul 2025 14:04:24 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= vgq0sS9bJuE54sZn99vBn48DqF4vg0XSEVpZVyXodU0=; b=W+qSkHEoDKvJqeGa j9qzqsOiQGG3tf0XTfyzx7QwDXk5DI/xoPq9qJCLjDm8cOYm6hIxXufP7vtWMTwn +DQBkJtaSF7Ff6gBisK/c82vyKR22b+RCCW5W0rJzbnl+91lQcFvypooKOQEspdu YEa9IJxm97ilBHsHF7aXUfOgh6kHZ0vaJOzhW23pCRfUjyiJnY5SVz/O1vTpIt1s adsG7yPAg1TR5rmuwncyn1OQu8jwFx/d1EfGjJRftiJHMyANiXF3jhdLs7V//apB cR49Su2boGv9A8eiCQplxsEy9mvLOAMUG8n2MG2oJv/Cr0TNA5huNpqQykisxATa aTuhbA== Received: from mail-pf1-f199.google.com (mail-pf1-f199.google.com [209.85.210.199]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 482b1ufj2p-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Thu, 24 Jul 2025 14:04:24 +0000 (GMT) Received: by mail-pf1-f199.google.com with SMTP id d2e1a72fcca58-74d15d8dcd1so1009934b3a.2 for ; Thu, 24 Jul 2025 07:04:24 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1753365863; x=1753970663; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=vgq0sS9bJuE54sZn99vBn48DqF4vg0XSEVpZVyXodU0=; b=Zm8CtklK8glkiwEwDDhdYr0+f08QLcNhqruVSv6McaF0LSWTVwuCr/HI1nVPnuJ2of JpGlR/AAtiJ3eE9uKO5fPnHv8JHqXeQAGE0L6kQt6uuo5BqavPXP8ngua5kBEaed62NN BxKBJxANUqjlWWJ2+WI70ND/8mh4tYBsOPFxsdkbT2kEPraLqdws6688bIjtcLebArao bGr5impBacwDhe0k3zw5BaJ8pjTBtQ/etjl7JTVJTIFE1RBS8VTnD/gq1E0U2fEZ0+R2 +vbWqnZuao3FXirkQglONdje05FXnw/dSXV+TNVzmd31M7F96tZaWMl7tmskJIJWWM9Y gBHQ== X-Forwarded-Encrypted: i=1; AJvYcCWxWd8VeEfnLjoq1LO/Z0nKzxG+kxCWCy913z2yxgcIFRm52uDzHfTBofGL8IWuWdFKqs9t5Sczz5J9@vger.kernel.org X-Gm-Message-State: AOJu0YzJRTCEhiAovnLdq92oR73dclGQFlT9TyjMoi9dne8fxRDQ/PGq liMTPJW0M8T7udKtgjZBzHvMJCuHIbHLCrdhKVALzbWV26rgBcNZ6Z6+i9UsyriBehqqLhwXMyW ClZoa80h64SXBP5KPZuf8NKmMwGp5EUZNa7pwUOYhDLp+Hd8MX4Q7KcbY2fBKtaZj X-Gm-Gg: ASbGncsMovnlTSCqvL7tRwz5Mopp/zWclG52ZRudGrCCKEhEVOJGIrSuPd9LAmxrOKI RScCYQeh+ttGzJoZTbwxHPZ6Kpqq/AburnGT4zZocgGevtTupWM7hBJi1ygvd2xfOgc9Nnrn9I7 c8OCxTJCh9DvQ4EBq7Lai40RFsgqWTGu447aZMGnztvXLO4zI+JHb9IiK5IJMrjtow7yj3AFQfB nLT3Kt7pgDvpst6tqZ23XrBk5NeF3vz5MuEg6j2/5lAGy69DX3hiLAYEiC688lZUZuVu+X+Pu/H 9ureoedfGJQx81/IggqIfRWiweYmpSf+wnhnlBMsZZ7Nrvm0kiPKKUi+8SjwjAahBuEL1RiPNw= = X-Received: by 2002:a05:6a20:d80f:b0:1f5:8a1d:3905 with SMTP id adf61e73a8af0-23d48fe0706mr11806721637.7.1753365863370; Thu, 24 Jul 2025 07:04:23 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGAk87SufmnhCrOrsDy9MKWBmmPKhBPtYqVHhRKiYJ5DGF4kGQc3VXG7/OhXCMjUqW31MLiAw== X-Received: by 2002:a05:6a20:d80f:b0:1f5:8a1d:3905 with SMTP id adf61e73a8af0-23d48fe0706mr11806617637.7.1753365862604; Thu, 24 Jul 2025 07:04:22 -0700 (PDT) Received: from [10.219.57.35] ([202.46.23.19]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-761b06158acsm1757972b3a.109.2025.07.24.07.04.14 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 24 Jul 2025 07:04:22 -0700 (PDT) Message-ID: Date: Thu, 24 Jul 2025 19:34:13 +0530 Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.5.1 Subject: Re: [PATCH v12 0/8] Implement vendor resets for PSCI SYSTEM_RESET2 Content-Language: en-US To: Krzysztof Kozlowski , Florian Fainelli , Bartosz Golaszewski , Bjorn Andersson , Sebastian Reichel , Rob Herring , Sudeep Holla , Souvik Chakravarty , Krzysztof Kozlowski , Conor Dooley , Andy Yan , Mark Rutland , Lorenzo Pieralisi , Arnd Bergmann , Konrad Dybcio , cros-qcom-dts-watchers@chromium.org, Vinod Koul , Catalin Marinas , Will Deacon Cc: Dmitry Baryshkov , Mukesh Ojha , Stephen Boyd , Andre Draszik , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, Elliot Berman , Srinivas Kandagatla , Elliot Berman , Konrad Dybcio References: <20250721-arm-psci-system_reset2-vendor-reboots-v12-0-87bac3ec422e@oss.qualcomm.com> <56599da9-0200-72b5-012e-942a1fc954b2@oss.qualcomm.com> From: Shivendra Pratap In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Authority-Analysis: v=2.4 cv=LdY86ifi c=1 sm=1 tr=0 ts=68823d68 cx=c_pps a=WW5sKcV1LcKqjgzy2JUPuA==:117 a=j4ogTh8yFefVWWEFDRgCtg==:17 a=IkcTkHD0fZMA:10 a=Wb1JkmetP80A:10 a=VwQbUJbxAAAA:8 a=COk6AnOGAAAA:8 a=EUspDBNiAAAA:8 a=Q-fNiiVtAAAA:8 a=QDcQmLXp8I0AkLLIQucA:9 a=3ZKOabzyN94A:10 a=QEXdDO2ut3YA:10 a=OpyuDcXvxspvyRM73sMx:22 a=TjNXssC_j7lpFel5tvFf:22 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwNzI0MDEwNyBTYWx0ZWRfXyreFBQR3ljk2 2vKyC+l4ud8q8qw3j/Ixbm1cpWPty6kNn/sDgneGo5O/HnMIG5UJSKS1YPsNzOmNkd70WDdSquC GczdnbV6h96jp7eZZpz/xv/vR65gwa1UEM82tbFneEOu717cmJaN16xecvGWx0hvvGK9b7qisPC y3xyvHPyMZKQ5+ii+04uWWfin/FM+7NyV7FJwmy9SGiE9KqC0sjmbZKJNqrolmBiCEpEGxumKzp vFiEjSbg5b3wx7t9ppCmPVwfdrfxcgnG5NljSOS+yx/lMBHUSZXnLJafTgdOz7sRD05fao3jS6M 4XrZAZrm5SFmQl6SIt2ZgKWbQIltEMvUQ1pGb+zoUXrCjxMk5zhhENu66QNNP48FaLaa2W2Rjmu nD1pOE0fIAa4JhKMWpjYP5UAqQ8kXY2EMc8L0MitREcDixZeCkd+MR/KWj73O/IusTCHGlbK X-Proofpoint-ORIG-GUID: QAPFKMMZEBT_lf6m604su5N0m6qbmEck X-Proofpoint-GUID: QAPFKMMZEBT_lf6m604su5N0m6qbmEck X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1099,Hydra:6.1.9,FMLib:17.12.80.40 definitions=2025-07-24_02,2025-07-24_01,2025-03-28_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 mlxscore=0 priorityscore=1501 adultscore=0 phishscore=0 malwarescore=0 lowpriorityscore=0 mlxlogscore=999 bulkscore=0 spamscore=0 suspectscore=0 clxscore=1015 classifier=spam authscore=0 authtc=n/a authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2505280000 definitions=main-2507240107 On 7/24/2025 6:18 PM, Krzysztof Kozlowski wrote: > On 24/07/2025 14:24, Shivendra Pratap wrote: >> >> >> On 7/24/2025 5:46 AM, Florian Fainelli wrote: >>> On 7/21/25 11:28, Shivendra Pratap wrote: >>>> The PSCI SYSTEM_RESET2 call allows vendor firmware to define >>>> additional reset types which could be mapped to the reboot >>>> argument. >>>> >>>> User-space should be able to reboot a device into different >>>> operational boot-states supported by underlying bootloader and >>>> firmware. Generally, some HW registers need to be written, based >>>> on which the bootloader and firmware decide the next boot state >>>> of device, after the reset. For example, a requirement on >>>> Qualcomm platforms may state that reboot with "bootloader" >>>> command, should reboot the device into bootloader flashing mode >>>> and reboot with “edl” command, should reboot the device into an >>>> Emergency flashing mode.  Setting up such reboots on Qualcomm >>>> devices can be inconsistent across SoC platforms and may require >>>> setting different HW registers, where some of these registers may >>>> not be accessible to HLOS. These knobs evolve over product >>>> generations and require more drivers.  PSCI defines a >>>> vendor-specific reset in SYSTEM_RESET2 spec, which enables the >>>> firmware to take care of underlying setting for any such >>>> supported vendor-specific reboot. Qualcomm firmwares are >>>> beginning to support and expose PSCI SYSTEM_RESET2 >>>> vendor-specific reset types to simplify driver requirements from >>>> Linux. With such support added in the firmware, we now need a >>>> Linux interface which can make use of the firmware calls for PSCI >>>> vendor-specific resets. This will align such reboot requirement >>>> across platforms and vendors. >>>> >>>> The current psci driver supports two types of resets – >>>> SYSTEM_RESET2 Arch warm-reset and SYSTEM_RESET cold-reset. The >>>> patchset introduces the PSCI SYSTEM_RESET2 vendor-specific reset >>>> into the reset path of the psci driver and aligns it to work with >>>> reboot system call - LINUX_REBOOT_CMD_RESTART2, when used along >>>> with a supported string-based command in “*arg”. >>>> >>>> The patchset uses reboot-mode based commands, to define the >>>> supported vendor reset-types commands in psci device tree node >>>> and registers these commands with the reboot-mode framework. >>>> >>>> The PSCI vendor-specific reset takes two arguments, being, >>>> reset_type and cookie as defined by the spec. To accommodate this >>>> requirement, enhance the reboot-mode framework to support two >>>> 32-bit arguments by switching to 64-bit magic values. >>>> >>>> Along this line, the patchset also extends the reboot-mode >>>> framework to add a non-device-based registration function, which >>>> will allow drivers to register using device tree node, while >>>> keeping backward compatibility for existing users of reboot-mode. >>>> This will enable psci driver to register for reboot-mode and >>>> implement a write function, which will save the magic and then >>>> use it in psci reset path to make a vendor-specific reset call >>>> into the firmware. In addition, the patchset will expose a sysfs >>>> entry interface within reboot-mode which can be used by userspace >>>> to view the supported reboot-mode commands. >>>> >>>> The list of vendor-specific reset commands remains open due to >>>> divergent requirements across vendors, but this can be >>>> streamlined and standardized through dedicated device tree >>>> bindings. >>>> >>>> Currently three drivers register with reboot-mode framework - >>>> syscon-reboot-mode, nvmem-reboot-mode and qcom-pon. Consolidated >>>> list of commands currently added across various vendor DTs: >>>>   mode-loader >>>>   mode-normal >>>>   mode-bootloader >>>>   mode-charge >>>>   mode-fastboot >>>>   mode-reboot-ab-update >>>>   mode-recovery >>>>   mode-rescue >>>>   mode-shutdown-thermal >>>>   mode-shutdown-thermal-battery >>>> >>>> Detailed list of commands being used by syscon-reboot-mode: >>>>      arm64/boot/dts/exynos/exynosautov9.dtsi: >>>>     mode-bootloader = ; >>>>     mode-fastboot = ; >>>>     mode-recovery = ; >>>> >>>>      arm64/boot/dts/exynos/google/gs101.dtsi: >>>>          mode-bootloader = <0xfc>; >>>>          mode-charge = <0x0a>; >>>>          mode-fastboot = <0xfa>; >>>>          mode-reboot-ab-update = <0x52>; >>>>          mode-recovery = <0xff>; >>>>          mode-rescue = <0xf9>; >>>>          mode-shutdown-thermal = <0x51>; >>>>          mode-shutdown-thermal-battery = <0x51>; >>>> >>>>      arm64/boot/dts/hisilicon/hi3660-hikey960.dts: >>>>          mode-normal = <0x77665501>; >>>>          mode-bootloader = <0x77665500>; >>>>          mode-recovery = <0x77665502>; >>>> >>>>      arm64/boot/dts/hisilicon/hi6220-hikey.dts: >>>>          mode-normal = <0x77665501>; >>>>          mode-bootloader = <0x77665500>; >>>>          mode-recovery = <0x77665502>; >>>> >>>>      arm64/boot/dts/rockchip/px30.dtsi: >>>>          mode-bootloader = ; >>>>          mode-fastboot = ; >>>>          mode-loader = ; >>>>          mode-normal = ; >>>>          mode-recovery = ; >>>> >>>>      arm64/boot/dts/rockchip/rk3308.dtsi: >>>>          mode-bootloader = ; >>>>          mode-loader = ; >>>>          mode-normal = ; >>>>          mode-recovery = ; >>>>          mode-fastboot = ; >>>> >>>>      arm64/boot/dts/rockchip/rk3566-lckfb-tspi.dts: >>>>          mode-normal = ; >>>>          mode-loader = ; >>>>             mode-recovery = ; >>>>             mode-bootloader = ; >>>> >>>> Detailed list of commands being used by nvmem-reboot-mode: >>>>      arm64/boot/dts/qcom/pmXXXX.dtsi:(multiple qcom DTs) >>>>             mode-recovery = <0x01>; >>>>             mode-bootloader = <0x02>; >>>> >>>> Previous discussions around SYSTEM_RESET2: >>>> - https://lore.kernel.org/lkml/20230724223057.1208122-2-quic_eberman@quicinc.com/T/ >>>> - https://lore.kernel.org/all/4a679542-b48d-7e11-f33a-63535a5c68cb@quicinc.com/ >>>> >>>> Signed-off-by: Elliot Berman >>>> Signed-off-by: Shivendra Pratap >>> >>> On ARCH_BRCMSTB: >>> >>> Tested-by: Florian Fainelli >>> >>> For the sysfs bits, should not we be seeing "psci" instead of "reboot-mode" twice in this path: >>> >>> # cat /sys/class/reboot-mode/reboot-mode/reboot_modes >>> powercycle >> As per current patch, we create a class named - "reboot-mode". >> /sys/class/reboot-mode >> >> Then comes the DT node name of the registering driver. >> /sys/class/reboot-mode/
/ > > This means that node name becomes part of the ABI? I am not happy about > it. Where is such ABI documented? Because your last patch tells > something completely else! > > I strongly insist using compatible as way to find your device, not node > names. It will look better to switch to compatible. Will define a compatible for psci reboot-mode binding and align the patch to use the compatible for sysfs. Current patch defines reboot-mode as a property to psci, hope its fine to define a compatible for this property like "psci-vendor-reset" or "psci-reboot-modes"? > > In any case you need to document such ABI in Devicetree bindings, > because sysfs ABI is not enough. should reboot-mode Devicetree binding document this ABI? Can you please share some more detail on this? thanks. > > Best regards, > Krzysztof