From nobody Tue Feb 10 09:58:42 2026 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 B5D561EFF93 for ; Sun, 28 Dec 2025 17:20:59 +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=1766942461; cv=none; b=DPu//QGebz5/FCS6FQv41tuvYcTn0rnQ32yoHhYu1RdX3pEEZ1Hax/9K02LdBXPsv8rmsXPwew4naCA55Xh7TtbhpRKLHMPmFxnyKRUAU4KY9jK/9AedfGkviyECJKnIZ4v4TR+uePdGdZWg7t2cqN64zAG/zusXBpgp4wSzSzE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766942461; c=relaxed/simple; bh=RR0xOQLLtrXPV5kRPIO4cHWLbRM+XB8C1weupKJA+c4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Bv5Y1S12oDz2BHAaMkcG4cwEHB0chdGYMBcU6g7BKsMt1IOUtQaXOjtNVTihTrtofXeqqzgORh+tbjxYLTW+jDLPayXSmFJmuj/JzZkW3IZvG0YyZEU0M+oTFRxgrDYETV5eDELBPgnw95A9c1hQV7ZUjcXBdfDtuyT8R2rm+ao= 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=cp+aJFLE; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=WiK83+Q8; 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="cp+aJFLE"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="WiK83+Q8" Received: from pps.filterd (m0279864.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 5BS6I4Bn3631972 for ; Sun, 28 Dec 2025 17:20:58 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= S0o1zCXTjNkh/pbRdZs0xzKk67AJPh5NU+NUSgiOw/4=; b=cp+aJFLEvVC1VWrh B4+E+Tql+Q7M3DevsdpOgnBdBBE6ZdphLHdLJKe/+WgjUOU8r2c18uIhXGtN0UF3 U3P7i2A/fVNRi0WSVPceVbcf7poZ3+OllGDmj504PT2KeVNAEZVNh2QDC6hrMwvY PZm+2XHl3I6lModn6uJt6FBF4lUiWQ9pe7H8lVzWGjOAT+YESAkZFWW9Fcj0ZUMG RRgnGW1BzbCyw395keZeq32BEIsbjY+sFKu8bABo7jSRtD8hGw1VL1DEyL57zQgs 2iL2v6Rd5wVN7hGfFHANSDOUndSEeNe0mywMWBUizKdXbOpHZwAtbWBBH386WZWT KQ6n/w== Received: from mail-pl1-f198.google.com (mail-pl1-f198.google.com [209.85.214.198]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4bavrj0w7e-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Sun, 28 Dec 2025 17:20:58 +0000 (GMT) Received: by mail-pl1-f198.google.com with SMTP id d9443c01a7336-2a0e9e0fd49so100461605ad.0 for ; Sun, 28 Dec 2025 09:20:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1766942458; x=1767547258; 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=S0o1zCXTjNkh/pbRdZs0xzKk67AJPh5NU+NUSgiOw/4=; b=WiK83+Q8W/4Ig13t5zTktug3Zitziwgqkicf5dq3wAcgaps38k4j1dK8D0cERMcpQB gdacipLwEnepGtIUEjBfEmOdijeQb9KsvRVD4YEECIsp6GUHAvl6duBUNDpJp5pE0zF6 yDays6c74VTY8kFUmLjdzJ/F1hE9Z5QcLfCJGX17Lysr8o30ffj7Ch/R9e6qufqHGs4L maJYXn1C1sHqS3fHOdJZT/E9C+WxcNG5V/F2cD7xSI6xhA5iC5ig9PaqMI/DXFG+u/yc 6BXjx4i6L5cyNq9c1QQgPonweH6TZApIBT+Yp6AJ444G3aWuqRNGtz+zKtG4IT1wMPPv EDzQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1766942458; x=1767547258; 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=S0o1zCXTjNkh/pbRdZs0xzKk67AJPh5NU+NUSgiOw/4=; b=kN7nK5vUuITHdBwNSE6AdJa90OZBhGyGqxBeYokA2OJjO2Pp8+t60oQWoXeVJSpzlU /HvVUUWXEOI3zbIFTs9T3huShGd92M++C7Lrc0+lGnSk0pD7zqrUEUwDTMFIfLd2jt+k Z1iPL+j+AwLhIYSPjpxMrf7RwjnixiN6p5vXBbjJi5giWRFj3Aw2AAT79rQC0DvRxpwF ufaJ1OolyCFWxhXq34LYGQ3+YOHyo2R9lyiAQ6ClH8dCLrD0AZyB5f9wIt57UjvONlCb mQVDQL9xoaf60/hVSNptx+onuUDXJqpQs2VF/Yj1fWJpGonsqf/vok2m8yyrimIPCfYY Xhfg== X-Forwarded-Encrypted: i=1; AJvYcCVDh0S6nKArScRc0SPAfufkHvLlPGGbpilhOrVqGbH3OHmNMKZSzVE0S165u9KiLaShfsIGeh3LrCJV3PA=@vger.kernel.org X-Gm-Message-State: AOJu0YzNf53QgSugAtf6IOB4TdS4awFtmznadOKz3yj1WFutSpysWfJ3 /+O7suMDp9HNBkmt3yeGSAaQGfMkBgKk2ghxQSJ1Nq0aCdcIjv6WdTz4ZVyc9vTDRy0yoeXPXBD dIHuN2umZibCw6rLmQdDmU7Fq5+ca7FQXXTDThxEwaCkDoS0ikPF0gmEaYnaJ9Ip8VAb2OIaY0y g= X-Gm-Gg: AY/fxX7ewfi9QxBWa6GCeuZjvfK2fiRqRmvf+kZzoq3PvRZTqPussHKj03LX4t7+eRS qigDBha9i47qPR94J5qDGj1X0THJQX9FgMkzpgclrpPFw8Qrc1nBY5coLCDr8mwHxOazJG2R0uj FCVy7SL6afVTdI1n0sa1OMgg1JV4BQRVHTEm5QzMu8frYbU5Q8yxiTu1Mjp+qG8l3kZJAhNj6jB Yazr3M4cgtyN7GBFrQp4/jolh7rWiBec1RCOJobGG4ZG4/PHOBSiwidDRJMLyfsdvnXlbxKH+jU aPFCOggSvV/u1CWgJEkk+7mafYSpOcEmA44f9HZwiOPVUw+i9OjsWKwy9/re4EIOTIes4UNqgRl RSMRiC40S65FvAe7QxYOYXyFYtw9RTNoLIXSK0hwGS1E4+g== X-Received: by 2002:a17:902:d2d0:b0:24b:1585:6350 with SMTP id d9443c01a7336-2a2f0cd2058mr314763765ad.11.1766942457546; Sun, 28 Dec 2025 09:20:57 -0800 (PST) X-Google-Smtp-Source: AGHT+IFBe5Txf/b1blWPhrmKhnlyFpaO+p9BsHeyiOjkOmGftLhpF+t6BCy4iYoTHXTykwYPFM84OA== X-Received: by 2002:a17:902:d2d0:b0:24b:1585:6350 with SMTP id d9443c01a7336-2a2f0cd2058mr314763345ad.11.1766942456990; Sun, 28 Dec 2025 09:20:56 -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.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 28 Dec 2025 09:20:56 -0800 (PST) From: Shivendra Pratap Date: Sun, 28 Dec 2025 22:50:21 +0530 Subject: [PATCH v19 03/10] power: reset: reboot-mode: Add support for predefined reboot modes 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-3-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=5544; i=shivendra.pratap@oss.qualcomm.com; s=20250710; h=from:subject:message-id; bh=RR0xOQLLtrXPV5kRPIO4cHWLbRM+XB8C1weupKJA+c4=; b=M/YNhCaGnRsu/MkjLVjdG2SPg9H51HzeE4kgbtRPGlIFzxuidQi8h+tPHbojQ3ty47bBbQihz Tst7V7lloqGAL95py59+K6ejFt5sVD6F8mFcTbr9f2XAzKPHOtnN3aI X-Developer-Key: i=shivendra.pratap@oss.qualcomm.com; a=ed25519; pk=CpsuL7yZ8NReDPhGgq6Xn/SRoa59mAvzWOW0QZoo4gw= X-Proofpoint-ORIG-GUID: q4E8tCeUo2MaH_qvzWXFYtnXQHUdpXCe X-Proofpoint-GUID: q4E8tCeUo2MaH_qvzWXFYtnXQHUdpXCe X-Authority-Analysis: v=2.4 cv=coiWUl4i c=1 sm=1 tr=0 ts=695166fa cx=c_pps a=MTSHoo12Qbhz2p7MsH1ifg==:117 a=fChuTYTh2wq5r3m49p7fHw==:17 a=IkcTkHD0fZMA:10 a=wP3pNCr1ah4A:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=EUspDBNiAAAA:8 a=9azGcnLTnVfPEkPguh4A:9 a=QEXdDO2ut3YA:10 a=GvdueXVYPmCkWapjIL-Q:22 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUxMjI4MDE1OSBTYWx0ZWRfX95XRc1rs5eIV 8jB3TEYTo+xazuwroQMVmij8aGAHcXWQCRKXMy3eSUR0wbXdDnoFHEKuD8ZuP4RyTa/OzNQpyFi c6eQN5NnsPDasmC5mvfwYm8mItvkWTJkJVq1ASnePgj5Y5zDdN6YvJXOlAlRatGZtInOI4aLdTo OyOHF7Iy7sIGIkou+Bhrk6XVNdxd8PKEkTDuoSkCynWmxHe4+8ZiVslC+gHE7SXubsLqTqJvEoF RsRhXkSt3VsM5MEGci59MGFYklOEe7DAm9C914xvTrxLTji36Ba9CoW2bGs/XktwTJAHcjDVnN4 UBrY+C9xmzKHKxcHToBcexVybcnz5k1pQkjpv8tDZj6nsNqJYS8UUhPJwbjMolt/LMjd2A3vEZ2 ocedirfaiKmzhG1Fse7AT8sKlXeSxaI1VQRdnVzXKK16BpCSlpTFd0BNQ6Lxc8Yc9/V9HqiyjVW HeY7tcy0KqKb+PBTh/w== 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 spamscore=0 lowpriorityscore=0 bulkscore=0 clxscore=1015 malwarescore=0 phishscore=0 adultscore=0 priorityscore=1501 impostorscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2512120000 definitions=main-2512280159 reboot-mode based drivers can define a reboot-mode by adding it under the reboot-mode node in device tree. This limits such drivers, to define any predefined reboot-modes statically within the driver and creates a dependency on device-tree. Introduce a list for predefined modes in the reboot-mode framework and process the predefined reboot-modes along with the device-tree defined reboot-modes. Modify existing reboot-mode based drivers to initialize the predefined list-head as empty. This patch enables a reboot mode driver to define reboot-modes through a predefined static list, in addition to the device-tree based reboot-modes. Signed-off-by: Shivendra Pratap --- drivers/power/reset/nvmem-reboot-mode.c | 1 + drivers/power/reset/qcom-pon.c | 1 + drivers/power/reset/reboot-mode.c | 28 ++++++++++++++++++++++------ drivers/power/reset/syscon-reboot-mode.c | 1 + include/linux/reboot-mode.h | 9 +++++++++ 5 files changed, 34 insertions(+), 6 deletions(-) diff --git a/drivers/power/reset/nvmem-reboot-mode.c b/drivers/power/reset/= nvmem-reboot-mode.c index b3d21d39b0f732254c40103db1b51fb7045ce344..b02a2af31aac52cb0ab19cf5d4d= 315d17c208f6e 100644 --- a/drivers/power/reset/nvmem-reboot-mode.c +++ b/drivers/power/reset/nvmem-reboot-mode.c @@ -44,6 +44,7 @@ static int nvmem_reboot_mode_probe(struct platform_device= *pdev) =20 nvmem_rbm->reboot.dev =3D &pdev->dev; nvmem_rbm->reboot.write =3D nvmem_reboot_mode_write; + INIT_LIST_HEAD(&nvmem_rbm->reboot.predefined_modes); =20 nvmem_rbm->cell =3D devm_nvmem_cell_get(&pdev->dev, "reboot-mode"); if (IS_ERR(nvmem_rbm->cell)) { diff --git a/drivers/power/reset/qcom-pon.c b/drivers/power/reset/qcom-pon.c index ccce1673b2ec47d02524edd44811d4f528c243e8..bf7b9f0bcdcc4c168aa7ff8d649= 4122d898814b5 100644 --- a/drivers/power/reset/qcom-pon.c +++ b/drivers/power/reset/qcom-pon.c @@ -75,6 +75,7 @@ static int qcom_pon_probe(struct platform_device *pdev) pon->reboot_mode.dev =3D &pdev->dev; pon->reason_shift =3D reason_shift; pon->reboot_mode.write =3D qcom_pon_reboot_mode_write; + INIT_LIST_HEAD(&pon->reboot_mode.predefined_modes); error =3D devm_reboot_mode_register(&pdev->dev, &pon->reboot_mode); if (error) { dev_err(&pdev->dev, "can't register reboot mode\n"); diff --git a/drivers/power/reset/reboot-mode.c b/drivers/power/reset/reboot= -mode.c index 1e85f2c052c916e153c7c9ac0b184c91d7153402..877c2459a3b2e47679ee2e9fbb9= b0329dc3b1e0f 100644 --- a/drivers/power/reset/reboot-mode.c +++ b/drivers/power/reset/reboot-mode.c @@ -16,12 +16,6 @@ =20 #define PREFIX "mode-" =20 -struct mode_info { - const char *mode; - u64 magic; - struct list_head list; -}; - static u64 get_reboot_mode_magic(struct reboot_mode_driver *reboot, const = char *cmd) { const char *normal =3D "normal"; @@ -72,6 +66,7 @@ static int reboot_mode_notify(struct notifier_block *this, */ int reboot_mode_register(struct reboot_mode_driver *reboot) { + struct mode_info *info_predef; struct mode_info *info; struct mode_info *next; struct property *prop; @@ -83,6 +78,9 @@ int reboot_mode_register(struct reboot_mode_driver *reboo= t) =20 INIT_LIST_HEAD(&reboot->head); =20 + if (!np) + goto predefined_modes; + for_each_property_of_node(np, prop) { if (strncmp(prop->name, PREFIX, len)) continue; @@ -124,6 +122,24 @@ int reboot_mode_register(struct reboot_mode_driver *re= boot) list_add_tail(&info->list, &reboot->head); } =20 +predefined_modes: + list_for_each_entry(info_predef, &reboot->predefined_modes, list) { + info =3D kzalloc(sizeof(*info), GFP_KERNEL); + if (!info) { + ret =3D -ENOMEM; + goto error; + } + + info->mode =3D kstrdup_const(info_predef->mode, GFP_KERNEL); + if (!info->mode) { + ret =3D -ENOMEM; + goto error; + } + + info->magic =3D info_predef->magic; + list_add_tail(&info->list, &reboot->head); + } + reboot->reboot_notifier.notifier_call =3D reboot_mode_notify; register_reboot_notifier(&reboot->reboot_notifier); =20 diff --git a/drivers/power/reset/syscon-reboot-mode.c b/drivers/power/reset= /syscon-reboot-mode.c index eb7fc5b7d6a7ed8a833d4920991c4c40b5b13ca7..74e2e14c5d87c54ac24ef63c790= 5b3266d736439 100644 --- a/drivers/power/reset/syscon-reboot-mode.c +++ b/drivers/power/reset/syscon-reboot-mode.c @@ -50,6 +50,7 @@ static int syscon_reboot_mode_probe(struct platform_devic= e *pdev) syscon_rbm->reboot.dev =3D &pdev->dev; syscon_rbm->reboot.write =3D syscon_reboot_mode_write; syscon_rbm->mask =3D 0xffffffff; + INIT_LIST_HEAD(&syscon_rbm->reboot.predefined_modes); =20 syscon_rbm->map =3D syscon_node_to_regmap(pdev->dev.parent->of_node); if (IS_ERR(syscon_rbm->map)) diff --git a/include/linux/reboot-mode.h b/include/linux/reboot-mode.h index a359dc0c6dede0ac5ce67190a00d46a7e7856707..bddec9b7f94187dcb056540df79= eea34c25b1d0d 100644 --- a/include/linux/reboot-mode.h +++ b/include/linux/reboot-mode.h @@ -4,11 +4,20 @@ =20 #include #include +#include #include =20 +struct mode_info { + const char *mode; + u64 magic; + struct list_head list; +}; + struct reboot_mode_driver { struct device *dev; struct list_head head; + /* List of predefined reboot-modes, a reboot-mode-driver may populate. */ + struct list_head predefined_modes; int (*write)(struct reboot_mode_driver *reboot, u64 magic); struct notifier_block reboot_notifier; }; --=20 2.34.1