From nobody Mon Oct 6 12:06:21 2025 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 6CBBD2E267F for ; Mon, 21 Jul 2025 18:29:17 +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=1753122559; cv=none; b=IGRWQZkyyTzLjNYI4YolQq3J3JD1il/EkWx/m8OuHNpeUquyvTFfmcWjP2v1ztFT91C77haZlzB0ULkyAqFo+GoEffVw/a89hujgcTEHHBztpGTi2hwiEoVjtSoeFnzU/6dz2pUcjEj8oJHIJk0a8xCDGAmFx6qvLor0tK03s1s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753122559; c=relaxed/simple; bh=ZyOHLYhozG6V8PN3U/0QHQPmjuZ8gOT3WNXbJbdwhzc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=MmH3J5+wTpaTMD8MhH2bUjVqeI4Euenj1z18nglnCRvOsr2cXtdoe2gwi5JeyTRESjhs5ioP/WUTLuiEMV0OOxGrx6xiXZaMaBsx7DYoKwuPsEZQXfIsCy+GvMAFGDyOKq3GEQrv/iRSyIW5RkVyrs2HAonyUP0mSSH3MTIAuI4= 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=N+DFY3Kr; 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="N+DFY3Kr" Received: from pps.filterd (m0279869.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 56LEexw5012594 for ; Mon, 21 Jul 2025 18:29:16 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= rG45QmRI9+iBqNCinCJQTKzCsl1+wtsDTxp0VKROmY0=; b=N+DFY3KrKYEQTf10 IOll9qIyYOdXsk8tbVQ+zsB8byxO9bfpS4MgnaoiNCnHbsmIc1qnh0kA4unf0ain x2q6O6JM/MFzVdQMyc8wQUnUDGrrFFqVww+dbvF/uYy1UtxaXR8zWUGVgYmPU+Po 1V1vNZhL0WpFoCtzby3UGPozbxUfP6J+HykvVKSAc4xmzrlrg4LF77D5pmnYh+VB phvZc56K/jx0fIEzoHKY6NNvwp/zcJeVbCbkwvmBJeViMksBHr3TDaEWHqEgRRiZ cEedjqxO6+odjJ6otUdQQ4EGAi9GNQyXOGaR1sp9AxPB7KRLrJg3GNfbESGXapit L3wh9g== 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 481qh6h4cn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Mon, 21 Jul 2025 18:29:16 +0000 (GMT) Received: by mail-pl1-f197.google.com with SMTP id d9443c01a7336-23689228a7fso70911515ad.1 for ; Mon, 21 Jul 2025 11:29:16 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1753122555; x=1753727355; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=rG45QmRI9+iBqNCinCJQTKzCsl1+wtsDTxp0VKROmY0=; b=iY+K+e031X1kW3L30ShuiG+oU5e3YuNzYVyNS1sawjjzDvj+MGigYBnSd3IPjmoKyZ ze/Zp+ul1P3I7yUk0tQf2S8UEEJ+jwFEEKCJx43b0phqLf3uJuMTMaFtxX853IbwdVXh eE4Sf535JUFImrzucvK+8+PeMV9U6UVmTXzE2ILXAQJrOD/VsUaSh7FawfHC4Av5VKjb fqqAh70LbfVe5BxGRLVOm5azgAG1F3utwsBxw4VaOW88UFwxqywl5zOemgsERJ6d4z1x nvaYzDLXQqmzp5GWpxtD21nOd/UR+SKlrRPkicEtAyhQ0hal3r0GbE9VFRuLLtP5ruHL bP/g== X-Forwarded-Encrypted: i=1; AJvYcCUsiStglYG2W++AOS4/Pdhf0AUqhesPqOcEABWQtwr92nm7n48A/FAL0Ax1LrFT4nSAMftXoxw6qjQMWcY=@vger.kernel.org X-Gm-Message-State: AOJu0Yx1lWIZDkR6zIEAZ904w4VyKbOXygOe6zR6MnV/3tyLFuSkdNoU VDOXA2a5vsYQiYzXh/S/GHL+j2jz83yEdUDkNROuBHNkQOEZCHyTGmzaU9Subw7CQC3BWI2tzvN wkyOf/Mi701/UQo1rxMmwTDXIJbIKvwN05s+d+zzqYUxSLsmGTwxLDguWLy2rPJbQUpY= X-Gm-Gg: ASbGncs+qFy/5nr2nmtusGzBnSOqDBS90RoPO0H5m/gC0dhlslV6DAQpNFi2hVO83Pv 3ZaaWpiC+OXwav2g2Q5UKCarDklrGhv16l2wvKldwMMFcKZ7yHEtF0sP4pR1mkp5Cto6H++8FAX /kjej6VOKOz3tKVWplQCbbKEI6d4slehvT/icq19RwOPUOsn4Wy28T+gfS0jGWULZR7AXpgUfR+ AmB2+oNcgc2IZwo2vLustfvaWZ54ZVZgZeCwrY6ImYDdrRP/ymoSG3okIHu9iHFpTHy+US81j0p zqCnG2gnleImOJ+40cEkTA/cEtzYoWGx36Fg7uCw/MnBZAV41GwKQ8jowhQDpLUaDtcna/6VXtx I X-Received: by 2002:a17:902:e743:b0:236:748f:541f with SMTP id d9443c01a7336-23e303381e2mr198330025ad.33.1753122554971; Mon, 21 Jul 2025 11:29:14 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFpAzVNLaCg2Gv77/iRs3fyWlqjCLVrcaPExqG0knuGIGBMl7og87zCiNVJnrLBQrLtETRsRg== X-Received: by 2002:a17:902:e743:b0:236:748f:541f with SMTP id d9443c01a7336-23e303381e2mr198329695ad.33.1753122554498; Mon, 21 Jul 2025 11:29:14 -0700 (PDT) Received: from hu-spratap-hyd.qualcomm.com ([202.46.22.19]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-23e3b6ef4b8sm61414545ad.194.2025.07.21.11.29.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Jul 2025 11:29:14 -0700 (PDT) From: Shivendra Pratap Date: Mon, 21 Jul 2025 23:58:48 +0530 Subject: [PATCH v12 1/8] power: reset: reboot-mode: Add device tree node-based registration 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: <20250721-arm-psci-system_reset2-vendor-reboots-v12-1-87bac3ec422e@oss.qualcomm.com> References: <20250721-arm-psci-system_reset2-vendor-reboots-v12-0-87bac3ec422e@oss.qualcomm.com> In-Reply-To: <20250721-arm-psci-system_reset2-vendor-reboots-v12-0-87bac3ec422e@oss.qualcomm.com> To: 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 , Florian Fainelli 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 , Shivendra Pratap , Srinivas Kandagatla X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1753122539; l=5726; i=shivendra.pratap@oss.qualcomm.com; s=20250710; h=from:subject:message-id; bh=ZyOHLYhozG6V8PN3U/0QHQPmjuZ8gOT3WNXbJbdwhzc=; b=KOFzSAWzGKbv+M79egz/GChhgHU6xfaA5O1QqIxVw6CFdGzR5PYARtR//aW/C6ryBSPhMCl/x gkyK0fDoyYgA9Q8BCmazAW1z4mUnbbRJq0MZuXwYtmoqTpHggSB0btB X-Developer-Key: i=shivendra.pratap@oss.qualcomm.com; a=ed25519; pk=CpsuL7yZ8NReDPhGgq6Xn/SRoa59mAvzWOW0QZoo4gw= X-Authority-Analysis: v=2.4 cv=CZ4I5Krl c=1 sm=1 tr=0 ts=687e86fc cx=c_pps a=cmESyDAEBpBGqyK7t0alAg==:117 a=fChuTYTh2wq5r3m49p7fHw==:17 a=IkcTkHD0fZMA:10 a=Wb1JkmetP80A:10 a=EUspDBNiAAAA:8 a=239sejjMsMoxT4pUUhgA:9 a=QEXdDO2ut3YA:10 a=1OuFwYUASf3TG4hYMiVC:22 X-Proofpoint-ORIG-GUID: BphSxTeV5vARm0Py5tpPkJtwthufFYu8 X-Proofpoint-GUID: BphSxTeV5vARm0Py5tpPkJtwthufFYu8 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwNzIxMDE2NCBTYWx0ZWRfX+lkOv5VtGKQz 807IV7aXfGhodcHRrh0iHGeY5KOkNb7Z6qnnkOK3Wzx85aaYrvWhIpl/kjXkkjZnVFMMoXW3cmB Mrbh2axfcAMXjd28Z40AGyp4taHejDN6cncT1a8I1Hcoq/ohXFEO9aKQHGSP/5GuXjTjdE42Ths E0yDoahXb4sv7UWQmerV1IoSECC8TOykoR5O0VLY6ndhBT7DwzNMuPP0E9jJ6nYqBU+XCifKZAA NFBCUWcWsYdrE/NTOxLIQVtDNWufc9/2zmHulYxHnHGdkVV3A39IqEBJySz5L+19YXzMXF6/M0O ffHuoZSQJCmV3bjZfLyem/mpLrTGxxk9tSzHODlhZjwMcKBWNMNjEoMdHH5DJvyg7Ij2b4iaUzf /Hfrlfj11wv9sRcMpgqrAbvjYuxe3wqMhSik8mEAUMSNzu5gxUg7cJhkUaJtelkBGKd/6NT3 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-21_05,2025-07-21_02,2025-03-28_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 suspectscore=0 mlxlogscore=999 impostorscore=0 clxscore=1015 mlxscore=0 lowpriorityscore=0 phishscore=0 adultscore=0 bulkscore=0 spamscore=0 malwarescore=0 classifier=spam authscore=0 authtc=n/a authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2505280000 definitions=main-2507210164 The reboot-mode driver does not have a strict requirement for device-based registration. It primarily uses the device's of_node to read mode- properties and the device pointer for logging. Remove the dependency on struct device and introduce support for Device Tree (DT) node-based registration. This enables drivers that are not associated with a struct device to leverage the reboot-mode framework. Signed-off-by: Shivendra Pratap Tested-by: Florian Fainelli --- drivers/power/reset/reboot-mode.c | 45 +++++++++++++++++++++++++++++------= ---- include/linux/reboot-mode.h | 6 +++++- 2 files changed, 39 insertions(+), 12 deletions(-) diff --git a/drivers/power/reset/reboot-mode.c b/drivers/power/reset/reboot= -mode.c index fba53f638da04655e756b5f8b7d2d666d1379535..5dd3f06ca88cb28606d9fd2100c= e03383c14d215 100644 --- a/drivers/power/reset/reboot-mode.c +++ b/drivers/power/reset/reboot-mode.c @@ -3,13 +3,17 @@ * Copyright (c) 2016, Fuzhou Rockchip Electronics Co., Ltd */ =20 +#define pr_fmt(fmt) "reboot-mode: " fmt + #include #include #include +#include #include #include #include #include +#include =20 #define PREFIX "mode-" =20 @@ -55,7 +59,9 @@ static int reboot_mode_notify(struct notifier_block *this, unsigned int magic; =20 reboot =3D container_of(this, struct reboot_mode_driver, reboot_notifier); + mutex_lock(&reboot->rb_lock); magic =3D get_reboot_mode_magic(reboot, cmd); + mutex_unlock(&reboot->rb_lock); if (magic) reboot->write(reboot, magic); =20 @@ -65,45 +71,51 @@ static int reboot_mode_notify(struct notifier_block *th= is, /** * reboot_mode_register - register a reboot mode driver * @reboot: reboot mode driver + * @np: Pointer to device tree node * * Returns: 0 on success or a negative error code on failure. */ -int reboot_mode_register(struct reboot_mode_driver *reboot) +int reboot_mode_register(struct reboot_mode_driver *reboot, struct device_= node *np) { struct mode_info *info; + struct mode_info *next; struct property *prop; - struct device_node *np =3D reboot->dev->of_node; size_t len =3D strlen(PREFIX); int ret; =20 + if (!np) + return -EINVAL; + INIT_LIST_HEAD(&reboot->head); + mutex_init(&reboot->rb_lock); =20 + mutex_lock(&reboot->rb_lock); for_each_property_of_node(np, prop) { if (strncmp(prop->name, PREFIX, len)) continue; =20 - info =3D devm_kzalloc(reboot->dev, sizeof(*info), GFP_KERNEL); + info =3D kzalloc(sizeof(*info), GFP_KERNEL); if (!info) { ret =3D -ENOMEM; goto error; } =20 if (of_property_read_u32(np, prop->name, &info->magic)) { - dev_err(reboot->dev, "reboot mode %s without magic number\n", - info->mode); - devm_kfree(reboot->dev, info); + pr_err("reboot mode %s without magic number\n", info->mode); + kfree(info); continue; } =20 info->mode =3D kstrdup_const(prop->name + len, GFP_KERNEL); if (!info->mode) { ret =3D -ENOMEM; + kfree(info); goto error; } else if (info->mode[0] =3D=3D '\0') { kfree_const(info->mode); + kfree(info); ret =3D -EINVAL; - dev_err(reboot->dev, "invalid mode name(%s): too short!\n", - prop->name); + pr_err("invalid mode name(%s): too short!\n", prop->name); goto error; } =20 @@ -113,12 +125,17 @@ int reboot_mode_register(struct reboot_mode_driver *r= eboot) reboot->reboot_notifier.notifier_call =3D reboot_mode_notify; register_reboot_notifier(&reboot->reboot_notifier); =20 + mutex_unlock(&reboot->rb_lock); return 0; =20 error: - list_for_each_entry(info, &reboot->head, list) + list_for_each_entry_safe(info, next, &reboot->head, list) { + list_del(&info->list); kfree_const(info->mode); + kfree(info); + } =20 + mutex_unlock(&reboot->rb_lock); return ret; } EXPORT_SYMBOL_GPL(reboot_mode_register); @@ -130,11 +147,17 @@ EXPORT_SYMBOL_GPL(reboot_mode_register); int reboot_mode_unregister(struct reboot_mode_driver *reboot) { struct mode_info *info; + struct mode_info *next; =20 unregister_reboot_notifier(&reboot->reboot_notifier); =20 - list_for_each_entry(info, &reboot->head, list) + mutex_lock(&reboot->rb_lock); + list_for_each_entry_safe(info, next, &reboot->head, list) { + list_del(&info->list); kfree_const(info->mode); + kfree(info); + } + mutex_unlock(&reboot->rb_lock); =20 return 0; } @@ -162,7 +185,7 @@ int devm_reboot_mode_register(struct device *dev, if (!dr) return -ENOMEM; =20 - rc =3D reboot_mode_register(reboot); + rc =3D reboot_mode_register(reboot, reboot->dev->of_node); if (rc) { devres_free(dr); return rc; diff --git a/include/linux/reboot-mode.h b/include/linux/reboot-mode.h index 4a2abb38d1d612ec0fdf05eb18c98b210f631b7f..98f68f95c9e8460be23282c51ef= 7fcbed73887bd 100644 --- a/include/linux/reboot-mode.h +++ b/include/linux/reboot-mode.h @@ -2,14 +2,18 @@ #ifndef __REBOOT_MODE_H__ #define __REBOOT_MODE_H__ =20 +#include + struct reboot_mode_driver { struct device *dev; struct list_head head; int (*write)(struct reboot_mode_driver *reboot, unsigned int magic); struct notifier_block reboot_notifier; + /*Protects access to reboot mode list*/ + struct mutex rb_lock; }; =20 -int reboot_mode_register(struct reboot_mode_driver *reboot); +int reboot_mode_register(struct reboot_mode_driver *reboot, struct device_= node *np); int reboot_mode_unregister(struct reboot_mode_driver *reboot); int devm_reboot_mode_register(struct device *dev, struct reboot_mode_driver *reboot); --=20 2.34.1 From nobody Mon Oct 6 12:06:21 2025 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 B0A632E1C78 for ; Mon, 21 Jul 2025 18:29:25 +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=1753122567; cv=none; b=nS4Q4JahIUPEB56Mq8Yh8ZHJnzq4k/V07qSQI7Xbh+aXTInGFRS7XvMam2F31hgkF7R3SJD4eUhVXPmY7DGAgZ0hTx7WAPUKT0VbrOAJEJUmkZXdTSzC7ryRVeoyAw9T0teqi22d1aTkMP2llGr0NOw+/IUiYeWFtxlR1Yh5Mc4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753122567; c=relaxed/simple; bh=DBN6sGXRUVDpd7vqCXSG71Zl1opGNwqmNgNJo0YmBCw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=b6qUZIkrejAN7/2y9oPIwxc4yoRTNiCKiFZjgWUrZg04aYj60i1irOZOrOMqmdeCFQi23lC8azA2D/gmt0zL4OXuyJ0XcyNYfLeju7s3ScxO/ABLrmSDF0G2rol3r2KDSIT+RV31G4PdX8Rzzutl1sBF8nvwuifOuoeSeveSON8= 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=iaLj7WZq; 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="iaLj7WZq" Received: from pps.filterd (m0279872.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 56LGCEb5029281 for ; Mon, 21 Jul 2025 18:29: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= 12+JhUW7UCD4bGTJEyOuS62N8dw9v5aLX1IdtuqMxic=; b=iaLj7WZqcuEZrYAP gP3J2/3cfqhfT9rP/S1IxIZZi4HcSR4xvtBYn4t8J0jgP0EDzFlOeRwS3qWdKW09 eYSNoSM88tHsZtx5Cp0/pm9/eWZtPs87iIo8atfc7AdoPwuU2/koSGUgzoreyor/ /OiqNdyKJ4Sp8CG8s614/yK6qQVNrCmcnrrc2VumaxewG+Iz6V/7MwKXAmS9wjF8 vA5bT3KirgfK8FURcMify03vG+6sN8Kw3k4Yd/eL8X87Lyy7R3Zn5mIPkso7hxdf /8ut3G8RUa2RsTA8nEkOx0eJTwtn+19Gd6OkYUeimOE/o7rz8pxEsvKVUOVL4knA LglsoQ== 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 48048ter46-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Mon, 21 Jul 2025 18:29:24 +0000 (GMT) Received: by mail-pl1-f198.google.com with SMTP id d9443c01a7336-237e6963f70so74913785ad.2 for ; Mon, 21 Jul 2025 11:29:24 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1753122563; x=1753727363; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=12+JhUW7UCD4bGTJEyOuS62N8dw9v5aLX1IdtuqMxic=; b=OzWkcgLM8u1onDXA9yhodUpBF/Zj/QNwitBp1mZ2QeVyQd1F19MJqSi3TFUHHRB3P0 w0/gKuMkJNVQtGZtv+VYpXFSO8brZO7DTQ39E6oc7s+uzIL7fv6u3uWlMrHv9mP4YT+a YeAQpxSp4+q/T28n/ixpGMR9JT1c3BKsxIWPqY1myGa5RvcUQzsq82SId8os5xau2+83 6eBLrs+GS38FhznYW2/AkeX+Gtqcd/v5VEdFZw1fLzqw38wA271QYdnw2Z/17MLppXpB Z6QI0D/lybMXFZ4vYS77aUPi0gbwLE+n/YILfYoAAJsVKa16HNMOIrYI636Z/b31iPlz zaoA== X-Forwarded-Encrypted: i=1; AJvYcCW291hKvNVuUB6Q9LWQcrbXSsnydxIAAipy3A2vBzKs3p6zR/EblrN/Xja061CfE+d5Ry+pq0dY5xB2FiE=@vger.kernel.org X-Gm-Message-State: AOJu0Yy7l1edI+VKiNe2OmAoLZIL5OBoVMHufIE85/1wmaWL6phujvyZ onKmYNMpSRpGK3IGd344x3D8BPlhzyUC+aiJ64COLvbLDAeZ82o/dmGsao58OaqvRw+EpqToUUK 3lSTV3a5SGWyFZahzQG8Kmujc+PaedEozbZCIDrCZdKuZaWC3aVJzDXenegCGS/cKWN4= X-Gm-Gg: ASbGncs310kLP82VDCSEYTYFnLCaSJNHb0FkCxR0GrjhYPpBgshPcJ33wJhN+qdXtOC uat0nVPV3/goiqGswSaPntydfjw8cQXeatQalch8fnGq81NDPXng1hCiV41AEnd0RPDI9yknjUK MGcWWGfMPiuiozEbDRp1fC/8udzYTaVfuErgwWAw+DrjZ4+fxETuLFFXW25ODgbTzpBPjGNVjkx m3r+3kzeOpqg2gxjqw3jCsjbdPvPSGV0/j/5WeaNzKYr+JijOQrw97JE804XD/BWfg5Sgz5ZfDh kL0J1kwMsSJiywtE98pKoO/S8vUiM3L+Owy1Oz/w5mi9Du6g5pxViKjNp47sIeIxJhqUnDyvKvP 5 X-Received: by 2002:a17:902:e848:b0:23d:d348:4567 with SMTP id d9443c01a7336-23e302bed21mr232780925ad.19.1753122562739; Mon, 21 Jul 2025 11:29:22 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFdol/SpmgrRISFDHgOMwYJFgwvsPFVeex1hB/4yuIO2bTcUrO01dBTuiyWXMA2+1WINN2eUA== X-Received: by 2002:a17:902:e848:b0:23d:d348:4567 with SMTP id d9443c01a7336-23e302bed21mr232780645ad.19.1753122562167; Mon, 21 Jul 2025 11:29:22 -0700 (PDT) Received: from hu-spratap-hyd.qualcomm.com ([202.46.22.19]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-23e3b6ef4b8sm61414545ad.194.2025.07.21.11.29.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Jul 2025 11:29:21 -0700 (PDT) From: Shivendra Pratap Date: Mon, 21 Jul 2025 23:58:49 +0530 Subject: [PATCH v12 2/8] power: reset: reboot-mode: Add support for 64 bit magic 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: <20250721-arm-psci-system_reset2-vendor-reboots-v12-2-87bac3ec422e@oss.qualcomm.com> References: <20250721-arm-psci-system_reset2-vendor-reboots-v12-0-87bac3ec422e@oss.qualcomm.com> In-Reply-To: <20250721-arm-psci-system_reset2-vendor-reboots-v12-0-87bac3ec422e@oss.qualcomm.com> To: 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 , Florian Fainelli 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 , Shivendra Pratap , Srinivas Kandagatla X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1753122539; l=6942; i=shivendra.pratap@oss.qualcomm.com; s=20250710; h=from:subject:message-id; bh=DBN6sGXRUVDpd7vqCXSG71Zl1opGNwqmNgNJo0YmBCw=; b=uthIovqgz1rMdV4O6xqp1c1Lo2davyxxmHP0SgklsKRbeQH8BbaMQebhR1bZ4i5Nf/1G5rwvl iPXmBxueTjHATm68va0+MbN1O3gmpMrXn/u2oHEr2IYgJbFrkBz7krn X-Developer-Key: i=shivendra.pratap@oss.qualcomm.com; a=ed25519; pk=CpsuL7yZ8NReDPhGgq6Xn/SRoa59mAvzWOW0QZoo4gw= X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwNzIxMDE2NCBTYWx0ZWRfX37iSnbgX0o3W i++8JrtVqQ8mQnkmxGCfP5JBFkf4c7UmKLr03E21c2Zty/8E/skEAvE8f8RNEFJlumB2uaLfn7v YEbUgZz9DjwJ0ZHjUaCLDUnCD29bky7NIodrvl/8BNOGB+GxdEFlSi4eKtfWmy9pKgJAA803sos sySd6AEmVDFqPQVI1OYv9VXNFwOOBrta4XseOlUAmhBa8XKeJr/GXsAG059QOL8GaB8cH8ouRvu 40NPzr5+yfopWIyfwqr8RHY54CteqQwvIA9bWY9RnAa36X2NqC95JrqrYkuDCfwrm09PPFryAWx QKwjjOlIc7x0kCvdKz3OgUAzjV1kbbOUwpS7Txxrr3viYTh61b2q3yfkDUIVXu5gc+vxcnPMC1f tAAC/r534y5tpqEEmao9T/cr4uxU6nMsm3YgENox+0i9ZA5U2V8BXD9Ca9hjr1asRVtjRK1E X-Authority-Analysis: v=2.4 cv=Jb68rVKV c=1 sm=1 tr=0 ts=687e8704 cx=c_pps a=MTSHoo12Qbhz2p7MsH1ifg==:117 a=fChuTYTh2wq5r3m49p7fHw==:17 a=IkcTkHD0fZMA:10 a=Wb1JkmetP80A:10 a=EUspDBNiAAAA:8 a=bqVjg2-MoX4cBg1ZSeQA:9 a=3ZKOabzyN94A:10 a=QEXdDO2ut3YA:10 a=GvdueXVYPmCkWapjIL-Q:22 X-Proofpoint-GUID: tMO5QTyZ-T6Pcv47cL2VRqbdI5XYVZZ4 X-Proofpoint-ORIG-GUID: tMO5QTyZ-T6Pcv47cL2VRqbdI5XYVZZ4 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-21_05,2025-07-21_02,2025-03-28_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=999 adultscore=0 priorityscore=1501 clxscore=1015 phishscore=0 lowpriorityscore=0 suspectscore=0 bulkscore=0 malwarescore=0 mlxscore=0 spamscore=0 impostorscore=0 classifier=spam authscore=0 authtc=n/a authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2505280000 definitions=main-2507210164 Current reboot-mode supports a single 32-bit argument for any supported mode. Some reboot-mode based drivers may require passing two independent 32-bit arguments during a reboot sequence, for uses-cases, where a mode requires an additional argument. Such drivers may not be able to use the reboot-mode driver. For example, ARM PSCI vendor-specific resets, need two arguments for its operation =E2=80=93 reset_type and cookie, to complete the reset operation. If a driver wants to implement this firmware-based reset, it cannot use reboot-mode framework. Introduce 64-bit magic values in reboot-mode driver to accommodate dual 32-bit arguments when specified via device tree. In cases, where no second argument is passed from device tree, keep the upper 32-bit of magic un-changed(0) to maintain backward compatibility. Update the current drivers using reboot-mode for a 64-bit magic value. Signed-off-by: Shivendra Pratap Tested-by: Florian Fainelli --- drivers/power/reset/nvmem-reboot-mode.c | 13 +++++++++---- drivers/power/reset/qcom-pon.c | 11 ++++++++--- drivers/power/reset/reboot-mode.c | 19 +++++++++++++------ drivers/power/reset/syscon-reboot-mode.c | 11 ++++++++--- include/linux/reboot-mode.h | 3 ++- 5 files changed, 40 insertions(+), 17 deletions(-) diff --git a/drivers/power/reset/nvmem-reboot-mode.c b/drivers/power/reset/= nvmem-reboot-mode.c index 41530b70cfc48c2a83fbbd96f523d5816960a0d1..5d73dde585b1fd438b1847f884f= eb37cd9e4dd5c 100644 --- a/drivers/power/reset/nvmem-reboot-mode.c +++ b/drivers/power/reset/nvmem-reboot-mode.c @@ -16,15 +16,20 @@ struct nvmem_reboot_mode { struct nvmem_cell *cell; }; =20 -static int nvmem_reboot_mode_write(struct reboot_mode_driver *reboot, - unsigned int magic) +static int nvmem_reboot_mode_write(struct reboot_mode_driver *reboot, u64 = magic) { - int ret; struct nvmem_reboot_mode *nvmem_rbm; + u32 magic_32; + int ret; + + if (magic > U32_MAX) + return -EINVAL; + + magic_32 =3D magic; =20 nvmem_rbm =3D container_of(reboot, struct nvmem_reboot_mode, reboot); =20 - ret =3D nvmem_cell_write(nvmem_rbm->cell, &magic, sizeof(magic)); + ret =3D nvmem_cell_write(nvmem_rbm->cell, &magic_32, sizeof(magic_32)); if (ret < 0) dev_err(reboot->dev, "update reboot mode bits failed\n"); =20 diff --git a/drivers/power/reset/qcom-pon.c b/drivers/power/reset/qcom-pon.c index 7e108982a582e8243c5c806bd4a793646b87189f..d0ed9431a02313a7bbaa93743c1= 6fa1ae713ddfe 100644 --- a/drivers/power/reset/qcom-pon.c +++ b/drivers/power/reset/qcom-pon.c @@ -27,17 +27,22 @@ struct qcom_pon { long reason_shift; }; =20 -static int qcom_pon_reboot_mode_write(struct reboot_mode_driver *reboot, - unsigned int magic) +static int qcom_pon_reboot_mode_write(struct reboot_mode_driver *reboot, u= 64 magic) { struct qcom_pon *pon =3D container_of (reboot, struct qcom_pon, reboot_mode); + u32 magic_32; int ret; =20 + if (magic > U32_MAX || (magic << pon->reason_shift) > U32_MAX) + return -EINVAL; + + magic_32 =3D magic << pon->reason_shift; + ret =3D regmap_update_bits(pon->regmap, pon->baseaddr + PON_SOFT_RB_SPARE, GENMASK(7, pon->reason_shift), - magic << pon->reason_shift); + magic_32); if (ret < 0) dev_err(pon->dev, "update reboot mode bits failed\n"); =20 diff --git a/drivers/power/reset/reboot-mode.c b/drivers/power/reset/reboot= -mode.c index 5dd3f06ca88cb28606d9fd2100ce03383c14d215..a17851a303171fd04a47e240f80= 687541cc85a24 100644 --- a/drivers/power/reset/reboot-mode.c +++ b/drivers/power/reset/reboot-mode.c @@ -19,12 +19,11 @@ =20 struct mode_info { const char *mode; - u32 magic; + u64 magic; struct list_head list; }; =20 -static unsigned int get_reboot_mode_magic(struct reboot_mode_driver *reboo= t, - const char *cmd) +static u64 get_reboot_mode_magic(struct reboot_mode_driver *reboot, const = char *cmd) { const char *normal =3D "normal"; struct mode_info *info; @@ -56,7 +55,7 @@ static int reboot_mode_notify(struct notifier_block *this, unsigned long mode, void *cmd) { struct reboot_mode_driver *reboot; - unsigned int magic; + u64 magic; =20 reboot =3D container_of(this, struct reboot_mode_driver, reboot_notifier); mutex_lock(&reboot->rb_lock); @@ -81,6 +80,8 @@ int reboot_mode_register(struct reboot_mode_driver *reboo= t, struct device_node * struct mode_info *next; struct property *prop; size_t len =3D strlen(PREFIX); + u32 magic_arg1; + u32 magic_arg2; int ret; =20 if (!np) @@ -100,12 +101,18 @@ int reboot_mode_register(struct reboot_mode_driver *r= eboot, struct device_node * goto error; } =20 - if (of_property_read_u32(np, prop->name, &info->magic)) { - pr_err("reboot mode %s without magic number\n", info->mode); + if (of_property_read_u32(np, prop->name, &magic_arg1)) { + pr_err("reboot mode without magic number\n"); kfree(info); continue; } =20 + if (of_property_read_u32_index(np, prop->name, 1, &magic_arg2)) + magic_arg2 =3D 0; + + info->magic =3D magic_arg2; + info->magic =3D (info->magic << 32) | magic_arg1; + info->mode =3D kstrdup_const(prop->name + len, GFP_KERNEL); if (!info->mode) { ret =3D -ENOMEM; diff --git a/drivers/power/reset/syscon-reboot-mode.c b/drivers/power/reset= /syscon-reboot-mode.c index e0772c9f70f7a19cd8ec8a0b7fdbbaa7ba44afd0..3cbd000c512239b12ec51987e90= 0d260540a9dea 100644 --- a/drivers/power/reset/syscon-reboot-mode.c +++ b/drivers/power/reset/syscon-reboot-mode.c @@ -20,16 +20,21 @@ struct syscon_reboot_mode { u32 mask; }; =20 -static int syscon_reboot_mode_write(struct reboot_mode_driver *reboot, - unsigned int magic) +static int syscon_reboot_mode_write(struct reboot_mode_driver *reboot, u64= magic) { struct syscon_reboot_mode *syscon_rbm; + u32 magic_32; int ret; =20 + if (magic > U32_MAX) + return -EINVAL; + + magic_32 =3D magic; + syscon_rbm =3D container_of(reboot, struct syscon_reboot_mode, reboot); =20 ret =3D regmap_update_bits(syscon_rbm->map, syscon_rbm->offset, - syscon_rbm->mask, magic); + syscon_rbm->mask, magic_32); if (ret < 0) dev_err(reboot->dev, "update reboot mode bits failed\n"); =20 diff --git a/include/linux/reboot-mode.h b/include/linux/reboot-mode.h index 98f68f95c9e8460be23282c51ef7fcbed73887bd..370228b5161963aac1d75af752a= da0e8282b1078 100644 --- a/include/linux/reboot-mode.h +++ b/include/linux/reboot-mode.h @@ -3,11 +3,12 @@ #define __REBOOT_MODE_H__ =20 #include +#include =20 struct reboot_mode_driver { struct device *dev; struct list_head head; - int (*write)(struct reboot_mode_driver *reboot, unsigned int magic); + int (*write)(struct reboot_mode_driver *reboot, u64 magic); struct notifier_block reboot_notifier; /*Protects access to reboot mode list*/ struct mutex rb_lock; --=20 2.34.1 From nobody Mon Oct 6 12:06:21 2025 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 EC9182E1C57 for ; Mon, 21 Jul 2025 18:29:32 +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=1753122574; cv=none; b=NSISjYRXn8SGK4vgdgLYLCCbIkF1iIlMMR9+lm/Tq1cVroF2a77zQPhOkW0Ti9290TgJf5slv9p5gZTP/h+pqxB/ZKZZly9+tq96V+696046gosZl+IaxtQBecdxGqVNq0ko+mCwsbzOGeY/Vqb/sbLNeVliaelzfFy2nyK9smw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753122574; c=relaxed/simple; bh=TXtx922bW7Cthax35l5eL6qlXJtqJfd163vx/p8QQUw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ltX5NhEg7pDLnStKkrQ8qRafHVe/u33vkjrdykrlEK4eJVHRqSVuvDtlTL9Ub0qSq+jEWmnEAgWn9pDPNt18bJv3kiDXH2UUhDFPfjSg175vEJnQ3XsgUOByp6Rd6NvF2JThPSH21N1se0S620hhSODsDi/LbmaypCJp1n/18+M= 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=Nz9IARnS; 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="Nz9IARnS" Received: from pps.filterd (m0279873.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 56LGd4Ta006465 for ; Mon, 21 Jul 2025 18:29:32 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= dVmI/zpQBLHcmY6/km9+lnVLqKzUs1cGOy2afpNbw1A=; b=Nz9IARnSnjy4o3WP enj39xfEdma5CFqTgjQsX0Ks4/lU1+Q4PTwNMxFoSdJ49AGzdBlDtcF6behBXAmQ FQylQDMi5F9khivZUgHTAr1iXBK1zklqqQ3iZXT/pbPF+iDGXB/9suzemK02r8lM f6X0yX4RgsHnxJWQEFZvoSCdVTIBcmvs/gv68JR5lXeusf/A2m09mdfIx+N6Fup/ UvYm8f8WyqmFvjFB3bNT3a/Rwjz/LJV4Fv4qn/VoAdW+/LM4nlJdmtt9Puvb34/s 743xUP7hPlv1EuhRzG3eUu9iCxO9ziY8IaPwgE//2YQw42ASynzefq91YxNC3c1I AGbdJA== Received: from mail-pl1-f199.google.com (mail-pl1-f199.google.com [209.85.214.199]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 48047q6v1s-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Mon, 21 Jul 2025 18:29:31 +0000 (GMT) Received: by mail-pl1-f199.google.com with SMTP id d9443c01a7336-23dc7d3e708so32500965ad.3 for ; Mon, 21 Jul 2025 11:29:31 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1753122571; x=1753727371; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=dVmI/zpQBLHcmY6/km9+lnVLqKzUs1cGOy2afpNbw1A=; b=KvN/3iw8yAGPW0TYzhiPQSaESqpMGi09plEORPPjTchBV6S1FTzVg3hJZRA90jwxg9 G4MUu1RGtGzdjLDsuZfslIKvwlly5eKvtBlXrhdwwCVpDo60bYECssLbOM2pwO17UqaW qNG5ZrddFgW6sdQOIVBEHkENSAn3gW0wr0x3Cd43Xqhw59oW01wYBcK6F5zQUkk+bF4N WrQNOPS+RdytrrwH5x3J5zeaYUMS8go7yzFxMCy/jvyayhNGKs4t0wDbs5Ko1cw8+1P0 AGLM6IAzpA0AHuCDwKk5QJbySL6iTG/HNNDakG3cgrBoSCdb8nxuKh3wvIuWOF6hsc6C /IRg== X-Forwarded-Encrypted: i=1; AJvYcCV/BqRMxZDAH34dDW+FV40A3jTTD2/dTM6kalDOfm57hC4Kcj3jECUO+x0GOKC7lMJfh57ZIQgK3ADyVwQ=@vger.kernel.org X-Gm-Message-State: AOJu0YycvHnD1GQe3qPnun7N+wRDOHabDDnR1sGXaOtWn4l1kRTiha5F XLApCmfg8ytpxplmC0kX7WtgTM98/dyP6OJhGm5Ira0qb8aqnZYj3MiC0r2c5R//pWNCQZH3fyZ qTX12HouDraIBsrLhmc9lz3qnrVCt5SAaqLlwb5bSQauLselpUph9/WgzFPSDcFGIcrg= X-Gm-Gg: ASbGncvpV6iQWOhbrWBN1ONja+ZJZIZ/+9dEOBZ9sTWtCS+sZ6WbAxtUvZE2/UGDuyG HW7wiDpg1Pr0fSccWYCg3OdtAjnp1qcGulxK9bNgnc9C5/ApwalwFKDtB4jOwjqyt5wGmOSIoWP OvjprDezqdg2OGZkidB3Gxgk7QlTkteReYrRxTf/9f4Fe3nxTdQ1jOpZHgwchBPufwOpPk++egM GwDfuti8dHZEY4qPJHqxQR2/JvN/XKhHNV/5vqGGXNSrpWC+qMjjkJaHA2HmVKWmUgXeGnwt0gl sj4oC1qGF2dZajibBlOv9WC1Ri9KNXI5Nv86jdOCcFbCPuFkc/2Khi5FzHuiGnsLG2rShb7UVRD 5 X-Received: by 2002:a17:902:f60a:b0:234:aa98:7d41 with SMTP id d9443c01a7336-23e257608famr282083575ad.42.1753122570637; Mon, 21 Jul 2025 11:29:30 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH2v+24oc4EGuXA/VCAKEi0tkhjcXI5flOV7/cv88JcfHdhd0j3Bztjw4+c1dSccqUc0h5COA== X-Received: by 2002:a17:902:f60a:b0:234:aa98:7d41 with SMTP id d9443c01a7336-23e257608famr282082955ad.42.1753122570168; Mon, 21 Jul 2025 11:29:30 -0700 (PDT) Received: from hu-spratap-hyd.qualcomm.com ([202.46.22.19]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-23e3b6ef4b8sm61414545ad.194.2025.07.21.11.29.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Jul 2025 11:29:29 -0700 (PDT) From: Shivendra Pratap Date: Mon, 21 Jul 2025 23:58:50 +0530 Subject: [PATCH v12 3/8] dt-bindings: arm: Document reboot mode magic 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: <20250721-arm-psci-system_reset2-vendor-reboots-v12-3-87bac3ec422e@oss.qualcomm.com> References: <20250721-arm-psci-system_reset2-vendor-reboots-v12-0-87bac3ec422e@oss.qualcomm.com> In-Reply-To: <20250721-arm-psci-system_reset2-vendor-reboots-v12-0-87bac3ec422e@oss.qualcomm.com> To: 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 , Florian Fainelli 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 , Shivendra Pratap , Srinivas Kandagatla , Elliot Berman X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1753122539; l=2577; i=shivendra.pratap@oss.qualcomm.com; s=20250710; h=from:subject:message-id; bh=Pb0JW5FgpXpfFWALyentRdrGNmebMgVj4WCNzS0Y1bY=; b=pptw5r8GqVdGNeKRHeianN38LF9fFIuF8QV2U/PQ7Mx8OoSZB0w/WPhNdsfuuQZ8vBD1NQoVo Czo/OiAwv1EBWHrKCYsHwu6lR2k236wFsub+A8iOZv7TumxiO4APofJ X-Developer-Key: i=shivendra.pratap@oss.qualcomm.com; a=ed25519; pk=CpsuL7yZ8NReDPhGgq6Xn/SRoa59mAvzWOW0QZoo4gw= X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwNzIxMDE2NCBTYWx0ZWRfX9/GEzrg1tmvm ZI6FD5YkJ1PIwXckPq+k8kps5usx9MkldHkmWlquBPSeclEWYhI1MH1dTmOSUaWtiNufPDF4MoR 63NQCrbfguXHMOJFUsvKkEU4KjDUfsm/82ZOy/RUvfw7WKWzycwuv0mYoUW+KnaQEM9qfK9cAJk 1wqJqetTpKl+nf32cso4ItX3msugrOAXtWPEGm9Kv29fvqiuTMSe8nj8ZJtpCvDIX9cHLY5H9QS KrJbatErSEcEoeqNIMcSnmyBFppIBX5Uvjb5rWvatIam31IkqNUo3Evk4CbPiXfTW3i54hPcWR2 XPH5IDOEpHPLtEQ3qonDJ6tf1HB8L9+iJ6zl25OW3TSsHIEpZel7o/sRqcWfaje10rZDX2Yco5W 5EOSEUGR6Hu2194u11VRXvq++7+E9UnQ6h+RnHUhWMnK0CVJkKFIJuyNPobTibtb3RecmYzh X-Proofpoint-ORIG-GUID: NK4RpH3KXl9lWKYpFzpUrFyPVM8LMtBt X-Proofpoint-GUID: NK4RpH3KXl9lWKYpFzpUrFyPVM8LMtBt X-Authority-Analysis: v=2.4 cv=IrMecK/g c=1 sm=1 tr=0 ts=687e870b cx=c_pps a=JL+w9abYAAE89/QcEU+0QA==:117 a=fChuTYTh2wq5r3m49p7fHw==:17 a=IkcTkHD0fZMA:10 a=Wb1JkmetP80A:10 a=EUspDBNiAAAA:8 a=VwQbUJbxAAAA:8 a=UInjrUrXc7y1C1sAkbYA:9 a=QEXdDO2ut3YA:10 a=324X-CrmTo6CU4MGRt3R:22 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-21_05,2025-07-21_02,2025-03-28_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 lowpriorityscore=0 malwarescore=0 adultscore=0 clxscore=1015 priorityscore=1501 spamscore=0 mlxscore=0 mlxlogscore=999 phishscore=0 impostorscore=0 bulkscore=0 classifier=spam authscore=0 authtc=n/a authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2505280000 definitions=main-2507210164 From: Elliot Berman Add bindings to describe vendor-specific reboot modes. Values here correspond to valid parameters to vendor-specific reset types in PSCI SYSTEM_RESET2 call. Reviewed-by: Rob Herring (Arm) Signed-off-by: Elliot Berman Signed-off-by: Shivendra Pratap Tested-by: Florian Fainelli --- Documentation/devicetree/bindings/arm/psci.yaml | 43 +++++++++++++++++++++= ++++ 1 file changed, 43 insertions(+) diff --git a/Documentation/devicetree/bindings/arm/psci.yaml b/Documentatio= n/devicetree/bindings/arm/psci.yaml index 7360a2849b5bd1e4cbadac533c1a7228573288d4..da3a584c76b48e313a5d4cb7c8e= 0c3a3628fd1bb 100644 --- a/Documentation/devicetree/bindings/arm/psci.yaml +++ b/Documentation/devicetree/bindings/arm/psci.yaml @@ -98,6 +98,27 @@ properties: [1] Kernel documentation - ARM idle states bindings Documentation/devicetree/bindings/cpu/idle-states.yaml =20 + reboot-mode: + type: object + $ref: /schemas/power/reset/reboot-mode.yaml# + unevaluatedProperties: false + properties: + # "mode-normal" is just SYSTEM_RESET + mode-normal: false + patternProperties: + "^mode-.*$": + minItems: 1 + maxItems: 2 + description: | + Describes a vendor-specific reset type. The string after "mode-" + maps a reboot mode to the parameters in the PSCI SYSTEM_RESET2 c= all. + + Parameters are named mode-xxx =3D , where xxx + is the name of the magic reboot mode, type is the lower 31 bits + of the reset_type, and, optionally, the cookie value. If the coo= kie + is not provided, it is defaulted to zero. + The 31st bit (vendor-resets) will be implicitly set by the drive= r. + patternProperties: "^power-domain-": $ref: /schemas/power/power-domain.yaml# @@ -137,6 +158,15 @@ allOf: required: - cpu_off - cpu_on + - if: + not: + properties: + compatible: + contains: + const: arm,psci-1.0 + then: + properties: + reset-types: false =20 additionalProperties: false =20 @@ -261,4 +291,17 @@ examples: domain-idle-states =3D <&cluster_ret>, <&cluster_pwrdn>; }; }; + + - |+ + + // Case 5: SYSTEM_RESET2 vendor resets + psci { + compatible =3D "arm,psci-1.0"; + method =3D "smc"; + + reboot-mode { + mode-edl =3D <0>; + mode-bootloader =3D <1 2>; + }; + }; ... --=20 2.34.1 From nobody Mon Oct 6 12:06:21 2025 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 8A2B12E1C44 for ; Mon, 21 Jul 2025 18:29:40 +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=1753122583; cv=none; b=qXMb++gVzk7ryhYXJgkkMZDdSpAFtlFbh65aOJfFDC7U1rX2BnyqkEO52cf/tfToSZEc/tRN1VG19RlErXa04qI4pf7w6BJLuKc2nymNmMtKnYsmL/wTqGZGa2Ze/h6LQ0HvXQBK9MmVlx37XMUE0DpGI0RI1/h+YyVdc3ZihkI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753122583; c=relaxed/simple; bh=Y0M2kz4HUE94r4RXMotv0mkp+GddzwJz75VbdAmmA+I=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=cKJMbijHWEFAzu+WiU6RM4ICZSonJfwNEDZGiqDHyTztJNVlu2n66Eipo8jzFDTpEB2DNhAuhDhhAbhB5diptWfvjdjDu092opbadV7LSp9NmcU095254yTsjzBLs0xy9LUM3+89saf9SKVbhHZRn+takQakUZfB40S0pMG2aHE= 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=FKryXw8d; 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="FKryXw8d" Received: from pps.filterd (m0279872.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 56LGTu7Y029264 for ; Mon, 21 Jul 2025 18:29:39 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= Yo29nftHFYZtObTkPZy6VDU45lEt8daBatpcCrb4rZc=; b=FKryXw8dHsDl15ze wx+X6SDNB8zT2RFjaAzNBF5YE4Jg/S7B8U6fGyliJ4Tpv5WbpizOn01d0fSEDCBx DHDTe8sSG7gmPSZZ+L3FxS0qb78t9vH5d4wpi59+Yydgiv5IY2OJJBaQ4PGS37lb vCwdLUEleI/ctq61GotOgBAdLwNrbvglRnz+wlXoQKb0k2xFq4iRDmSN76v15yE8 zfOmjmD+ShX8grw6YuU2gqFRimpcVsqYisCYuaLgIeILZrK68BVt4tj1sTXDU2Rq WVzSiv3lgL8RMUDW/Vr+LMvuPBpz5gcjh8Pq+1yJEpFa2DF6RCCNe4S0HNuLW9X/ ZmMbyw== 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 48048ter5u-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Mon, 21 Jul 2025 18:29:39 +0000 (GMT) Received: by mail-pl1-f198.google.com with SMTP id d9443c01a7336-23536f7c2d7so76593835ad.2 for ; Mon, 21 Jul 2025 11:29:39 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1753122578; x=1753727378; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Yo29nftHFYZtObTkPZy6VDU45lEt8daBatpcCrb4rZc=; b=nJx9SPsWkHh+CpZ9znOpLLBnSMJMmq5wsEvBzCZy28Qr9hMtek/A5zSipchOcIdSCu 2ZQxs0OtpuuvZ73+isZ9OYKUFyImeffbEOFih8CKJwG9ZEHUn7zbffEVV58CTfyrlUAK HEjh+xKzD3K/kcMAxu485eXR6U0pkPzTj4hpvFuB8cIzFTCuQ2rkrFkae6JLgl7QABc9 vWAOT8eKnyS/Vz/uPnUMQ/Cp5NSvTR3KE3ugNz9cawT8wi5ZWDIcKqR7bMqCRDpOHQDX WLO8QkW/C4mc5Gn3fQ5DQrm5x8MOtjaoNG+NJWsbwBV9Dw7o7+F+l4JOoxqed/H3/pyk xyoA== X-Forwarded-Encrypted: i=1; AJvYcCUTKeEdOwEB3zjzj4NhjEZIy4EMgc8By32UhqiSV+d+hDCYeHpFpFRh84WTzvLrBdbeEzf5E5AsF9uPPY0=@vger.kernel.org X-Gm-Message-State: AOJu0YwOkSt9L91BatHLs9NhXGJjxnSToGrT0K9qAxGM0J8c/JN+/L24 IGc2UFp3wz3WBM+EdtWxtZwu9cp0DsEj4fosDdyztkZzrNfOEaHppAvn9d24m6fjw2Zqqohx9xA 9lsZNopCzm2MgTUOoGeBKPJUnDWTDoido2m2a5TsmFYNuCblzAXPSwgGqs7xTNOj0MQM= X-Gm-Gg: ASbGncvuSI8p9NNRFNPC5Y2mvc8Gpoz8pjU3eDTItd4O/qbPthPSfRswudwM/F3Iyeg SpKCgWjdacQwAjy7vGHQMl9eq1yL/ufsCNLYJCSAtpohe6sOb75FNSMp3VCPgPFf93heKSX7KFO jxLs0hnsiCorAXn8nRiQJukclXWZ45frODp4fWsb71xDL1dkcTNsKQMAOgCQCj8KOjUGHmbjT4G 7O6k6h4TLBtKwmf0Yep5itSDCkUNTuJP+jo3u+aSVSqcz4C91ZSfuDZ+MHzjIDjONyEz5ZstPep PFJ+sDL8sc+1nJSOeDNl0dP4RC5hcHMbKAIOPk7orhqZ8jBJSQTov0SuEOqw9IvgTFL7HukY/rn E X-Received: by 2002:a17:902:db10:b0:235:c781:c305 with SMTP id d9443c01a7336-23e25736446mr391994645ad.24.1753122578022; Mon, 21 Jul 2025 11:29:38 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFVFiP0ZX25Wepgp00xsVzQMu1ttAcrm238d8ApOC/0i6QmxfogZvMit+aR3PD49+4LfMgmeg== X-Received: by 2002:a17:902:db10:b0:235:c781:c305 with SMTP id d9443c01a7336-23e25736446mr391994015ad.24.1753122577582; Mon, 21 Jul 2025 11:29:37 -0700 (PDT) Received: from hu-spratap-hyd.qualcomm.com ([202.46.22.19]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-23e3b6ef4b8sm61414545ad.194.2025.07.21.11.29.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Jul 2025 11:29:37 -0700 (PDT) From: Shivendra Pratap Date: Mon, 21 Jul 2025 23:58:51 +0530 Subject: [PATCH v12 4/8] firmware: psci: Implement vendor-specific resets as reboot-mode 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: <20250721-arm-psci-system_reset2-vendor-reboots-v12-4-87bac3ec422e@oss.qualcomm.com> References: <20250721-arm-psci-system_reset2-vendor-reboots-v12-0-87bac3ec422e@oss.qualcomm.com> In-Reply-To: <20250721-arm-psci-system_reset2-vendor-reboots-v12-0-87bac3ec422e@oss.qualcomm.com> To: 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 , Florian Fainelli 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 , Shivendra Pratap , Srinivas Kandagatla X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1753122539; l=4746; i=shivendra.pratap@oss.qualcomm.com; s=20250710; h=from:subject:message-id; bh=Y0M2kz4HUE94r4RXMotv0mkp+GddzwJz75VbdAmmA+I=; b=1zZTSkjZE49wnh2ayD0kNDf089z+CGlweQ3Ax9ee6BChYKeop9Wpk7WDnIs1YYeHNn4XHGcIz SabAsKzD/FQC0owBzriskkYT144jfdAlHzU7O87sNm14fMkH6dnqI6/ X-Developer-Key: i=shivendra.pratap@oss.qualcomm.com; a=ed25519; pk=CpsuL7yZ8NReDPhGgq6Xn/SRoa59mAvzWOW0QZoo4gw= X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwNzIxMDE2NCBTYWx0ZWRfX1JlwwA5V0a+8 YiZjUrriyXUfmtxLe8PZy+Y5UjnEfso4maUtCy5gZoN8qGu80nslF4nYxDa+IS6XZ58KMN/FSk8 gcrXP/vpDVTIZ6BVWChq4nLlrEfcEBkP8IVnG2AEFSF6p5uDgmZaDRr7HwSQruUGwRzjryk9yKx AO18e+aCRigcpqEPTiLYMNIBmFaBI+BXAvxCcjl95483u4ulv3JhCvPcIFrFJf1s5EUOg7x4SHK aH4T47tdubmMY7RyXiyUK0N91rzr0/9pjLjai9AzM+DeCJPQHRHMb9KHPCsqa3cxYjkkL3vV4n4 e0MPiOk+MdTIu6y+ccrI7Zuhje7sR7Q3OxodbSI3D83VRK+6krWzvZ3o2FK1RQSFlHU+cFfPbUz PoDXU9SuuWPyknRXBrderNaZ8a/wrijgK4mfiQurukU2SXxgO1zGzvxhKtJ+0V9/by8nz4HR X-Authority-Analysis: v=2.4 cv=Jb68rVKV c=1 sm=1 tr=0 ts=687e8713 cx=c_pps a=MTSHoo12Qbhz2p7MsH1ifg==:117 a=fChuTYTh2wq5r3m49p7fHw==:17 a=IkcTkHD0fZMA:10 a=Wb1JkmetP80A:10 a=EUspDBNiAAAA:8 a=EdS2NIbk_1D2FrBATFAA:9 a=3ZKOabzyN94A:10 a=QEXdDO2ut3YA:10 a=GvdueXVYPmCkWapjIL-Q:22 X-Proofpoint-GUID: WboF2V3dQL705xH5-oCun60zCF_vZbUG X-Proofpoint-ORIG-GUID: WboF2V3dQL705xH5-oCun60zCF_vZbUG 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-21_05,2025-07-21_02,2025-03-28_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=999 adultscore=0 priorityscore=1501 clxscore=1015 phishscore=0 lowpriorityscore=0 suspectscore=0 bulkscore=0 malwarescore=0 mlxscore=0 spamscore=0 impostorscore=0 classifier=spam authscore=0 authtc=n/a authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2505280000 definitions=main-2507210164 SoC vendors have different types of resets which are controlled through various hardware registers. For instance, Qualcomm SoC may have a requirement that reboot with =E2=80=9Cbootloader=E2=80=9D command should reboot the device to bootloader flashing mode and reboot with =E2=80=9Cedl=E2=80=9D should reboot the device into 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 spec defines, SYSTEM_RESET2, vendor-specific reset which can help align this requirement. Add support for PSCI SYSTEM_RESET2, vendor-specific resets and align the implementation to allow user-space initiated reboots to trigger these resets. Introduce a late_initcall to register PSCI vendor-specific resets as reboot modes. Implement a reboot-mode write function that sets reset_type and cookie values during the reboot notifier callback. Introduce a firmware-based call for SYSTEM_RESET2 vendor-specific reset in the psci_sys_reset path, using reset_type and cookie if supported by secure firmware. By using the above implementation, userspace will be able to issue such resets using the reboot() system call with the "*arg" parameter as a string based command. The commands can be defined in PSCI device tree node as =E2=80=9Creset-types=E2=80=9D and are based on = the reboot-mode based commands. Signed-off-by: Shivendra Pratap Tested-by: Florian Fainelli --- drivers/firmware/psci/Kconfig | 1 + drivers/firmware/psci/psci.c | 57 +++++++++++++++++++++++++++++++++++++++= +++- 2 files changed, 57 insertions(+), 1 deletion(-) diff --git a/drivers/firmware/psci/Kconfig b/drivers/firmware/psci/Kconfig index 97944168b5e66aea1e38a7eb2d4ced8348fce64b..9d65fe7b06a6429de8a26d06f93= 84e5c93f36e5f 100644 --- a/drivers/firmware/psci/Kconfig +++ b/drivers/firmware/psci/Kconfig @@ -1,6 +1,7 @@ # SPDX-License-Identifier: GPL-2.0-only config ARM_PSCI_FW bool + select REBOOT_MODE =20 config ARM_PSCI_CHECKER bool "ARM PSCI checker" diff --git a/drivers/firmware/psci/psci.c b/drivers/firmware/psci/psci.c index 38ca190d4a22d6e7e0f06420e8478a2b0ec2fe6f..8ce23fb931c71357899a942796d= 85ab8e37c2f62 100644 --- a/drivers/firmware/psci/psci.c +++ b/drivers/firmware/psci/psci.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include =20 @@ -51,6 +52,14 @@ 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_vendor_sysreset2 { + u32 reset_type; + u32 cookie; + bool valid; +}; + +static struct psci_vendor_sysreset2 vendor_reset; + bool psci_tos_resident_on(int cpu) { return cpu =3D=3D resident_cpu; @@ -309,7 +318,10 @@ 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) && + if (vendor_reset.valid && psci_system_reset2_supported) { + invoke_psci_fn(PSCI_FN_NATIVE(1_1, SYSTEM_RESET2), vendor_reset.reset_ty= pe, + vendor_reset.cookie, 0); + } else if ((reboot_mode =3D=3D REBOOT_WARM || reboot_mode =3D=3D REBOOT_S= OFT) && psci_system_reset2_supported) { /* * reset_type[31] =3D 0 (architectural) @@ -547,6 +559,49 @@ static const struct platform_suspend_ops psci_suspend_= ops =3D { .enter =3D psci_system_suspend_enter, }; =20 +static int psci_set_vendor_sys_reset2(struct reboot_mode_driver *reboot, u= 64 magic) +{ + u32 magic_32; + + if (psci_system_reset2_supported) { + magic_32 =3D magic & 0xFFFFFFFF; + vendor_reset.reset_type =3D PSCI_1_1_RESET_TYPE_VENDOR_START | magic_32; + vendor_reset.cookie =3D (magic >> 32) & 0xFFFFFFFF; + vendor_reset.valid =3D true; + } + + return NOTIFY_DONE; +} + +static int __init psci_init_vendor_reset(void) +{ + struct reboot_mode_driver *reboot; + struct device_node *np; + int ret; + + np =3D of_find_node_by_path("/psci/reboot-mode"); + if (!np) + return -ENODEV; + + reboot =3D kzalloc(sizeof(*reboot), GFP_KERNEL); + if (!reboot) { + of_node_put(np); + return -ENOMEM; + } + + reboot->write =3D psci_set_vendor_sys_reset2; + + ret =3D reboot_mode_register(reboot, np); + if (ret) { + of_node_put(np); + kfree(reboot); + return ret; + } + + return 0; +} +late_initcall(psci_init_vendor_reset) + static void __init psci_init_system_reset2(void) { int ret; --=20 2.34.1 From nobody Mon Oct 6 12:06:21 2025 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 C1EDB2E1C44 for ; Mon, 21 Jul 2025 18:29:47 +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=1753122589; cv=none; b=GmVPt+ZnJxAHvpHfDU2NeGBeBudoCz9haiNKc/rtEWKtcBISZ7Vg0X25YLPlMf2VHyZ5dEaaTu9IG/6IoVVlhp9pCuaCWHzE7XnxzmyzivdPjoeRv2hpyaK5SKL3+5R8fuG9vbka8+hwcZYg+k6y4zq+Xg8N3L0SSun18jKUIKc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753122589; c=relaxed/simple; bh=n0wa4AEusSMKTJa2REb6Zm/CPFmojeqETl81QHufxBs=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=AjoLzj6VlO28OJDiWvqyoDbq0xutjCbCOiWtaL/k43QFQ2utSx7FxeFdMCuzJ/oZFakdSDJci0pe07kNoJidVaw6pFGoINbn7GRPTWT13s1QNp2bwjzoIEqYhqbvOiiQNUO38XhfU70phF95K0d2o8xPoPsp8aiRRtWGHbuoM/Y= 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=kkNlFt5w; 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="kkNlFt5w" Received: from pps.filterd (m0279868.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 56LH2Lar000890 for ; Mon, 21 Jul 2025 18:29:47 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= IiMmHpQ1bB+met8QLJcdnw+SCuV4S6OJO6VsyYvdUS8=; b=kkNlFt5wACA3Vclf NGmRyORu0cJbEy9crqoWMAVRIBO3IR3LnBHeE3LVmTaviXrUvKdsbLEvohPRQYUn jGVLp9zVxFSftokex/1yBBeyqB4g/CiPWcplToe6KVbhTdwCRQ2lv4o2QciUI9Y9 4eR+Xxr6fCsGk4O6UZtDyvVgulkOl1irMR+rJfjVJB7tHET/zrFUaxw55I5IIFMh DZGrDnwOAbiDtrvhBPMFrKwhu7D1Y0ulIw/DsV9oYFoPzUo1IEYNp9DkQwZpEpnT OwVfYHclC30e1pImYdP4rjIohh/Rse6IgD9EMAs+gj9Md2iZJKUREzwYjFtZjchT 6C9x0g== 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 48044der12-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Mon, 21 Jul 2025 18:29:46 +0000 (GMT) Received: by mail-pl1-f197.google.com with SMTP id d9443c01a7336-234fedd3e51so45030175ad.1 for ; Mon, 21 Jul 2025 11:29:46 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1753122585; x=1753727385; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=IiMmHpQ1bB+met8QLJcdnw+SCuV4S6OJO6VsyYvdUS8=; b=JT1V9CTttea8ouRn72xrBQa+ei6/fivjL5n0qQZUBeI5T68zmt8B70CKS/5Qu4rjsY goqLqPV3PQA2qqZSU2NQW+u0fAkqn8xxpk6LL+LT5ipwDAXuzTx4eQCzXohrfAcDVFu8 S+VLUWsARWP4fer9EhsG/ZMK/K98JN8rtvFEGYMkhCxdZ3yJMOBog4+bDvWK68ugHob3 KfTwisrn6O1SKJg/iLxwVN94u8voaWCIouAuz0Icrpgbg/L+AwNKzRs3EEYoobuWDyW4 vI8gMmuEZIPBnvqcjK1J4ywadrbgJxYNBbitrHYJAY24NyUMCS4w/9u7/fWzrtL5deF1 45CA== X-Forwarded-Encrypted: i=1; AJvYcCVjSBaM+BSiknCH5at/vgxWf4zjlRH1K5Zpqk8z9XwudPa9pbazEdzxXrVgOi5v1Bud/L1C+Bm8Awg0IYo=@vger.kernel.org X-Gm-Message-State: AOJu0YwXirpINhRTHfMDQDT8hNXw5kmr/xyO/b3oN0SdX9dUsmmdgLQH 3QISJo8VLYGCP7jwgfXnIPqmUDtjlyZJ8GlFCca2drNWyIG1zVXW/tqoq/3dWKh3CfEVQLTX2RL qOAaHWhhBCrnN1gRFKnSeQ8NCUUxbfklV8UaRkEy9aDzvvL/BK7d3elAqtznGplKIq/Y= X-Gm-Gg: ASbGncutS8Lw1jKDcN3CJUWn6FGQp07prz3IeUVvA4kmqOfq1Lx/BvpfvA/vgjdpHXE uD+Avph/5UH1PFKYOKvSe3BBs+uA7EXQNavHiKOj2M7k2Jw2LiwHpqRxdYGNT+6kAxJFRDTv7Zk kiiQkIjMfLRlc+vdijXOpU7OLR0LajnlNPMkj82OexZjVRtZIVg+GIMRY6Tf6QUYhS1OpBbrInZ 12QRm5FzvI/dffEExkbQ/Z/KT+l5ttbBW0b0ljV0mkx61NvPL73YniFYt6FlXxYbz9awKDB0B8P WuB2CDMrePmYNe2l2b9/PiHMV9q9sGhFiBe4gphV6bl0t3aYfHUEeAgHLSxa84ZqYmE3LXYGnIf 0 X-Received: by 2002:a17:903:22d2:b0:234:f580:a11 with SMTP id d9443c01a7336-23e256c951amr253931935ad.19.1753122585539; Mon, 21 Jul 2025 11:29:45 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHKesUD9aIM32P7T7wuM3eaFz432EA7KeFqHN0KCnfPzbQxwR6Z60riI80+yCNY/RoO+9fE2Q== X-Received: by 2002:a17:903:22d2:b0:234:f580:a11 with SMTP id d9443c01a7336-23e256c951amr253931365ad.19.1753122585027; Mon, 21 Jul 2025 11:29:45 -0700 (PDT) Received: from hu-spratap-hyd.qualcomm.com ([202.46.22.19]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-23e3b6ef4b8sm61414545ad.194.2025.07.21.11.29.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Jul 2025 11:29:44 -0700 (PDT) From: Shivendra Pratap Date: Mon, 21 Jul 2025 23:58:52 +0530 Subject: [PATCH v12 5/8] arm64: dts: qcom: qcm6490-idp: Add PSCI SYSTEM_RESET2 types 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: <20250721-arm-psci-system_reset2-vendor-reboots-v12-5-87bac3ec422e@oss.qualcomm.com> References: <20250721-arm-psci-system_reset2-vendor-reboots-v12-0-87bac3ec422e@oss.qualcomm.com> In-Reply-To: <20250721-arm-psci-system_reset2-vendor-reboots-v12-0-87bac3ec422e@oss.qualcomm.com> To: 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 , Florian Fainelli 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 , Shivendra Pratap , Srinivas Kandagatla , Elliot Berman , Konrad Dybcio X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1753122539; l=1628; i=shivendra.pratap@oss.qualcomm.com; s=20250710; h=from:subject:message-id; bh=/OISjQAhUBAIE37ASE5b1kssDpdL8gfQSFob68FR4qs=; b=Bd6Eb28aznjRUSwc+8Xgk/BIQuXk1bJ/xKoplQQ+Od6H5h3mOZK4CPnDEWLP4aZz683h/a7pJ mkziSxCbB/OAqiXczvWlddBGNyeSdaJelRlbiVn05DC0+K+10Ob9kho X-Developer-Key: i=shivendra.pratap@oss.qualcomm.com; a=ed25519; pk=CpsuL7yZ8NReDPhGgq6Xn/SRoa59mAvzWOW0QZoo4gw= X-Authority-Analysis: v=2.4 cv=BJ6zrEQG c=1 sm=1 tr=0 ts=687e871a cx=c_pps a=cmESyDAEBpBGqyK7t0alAg==:117 a=fChuTYTh2wq5r3m49p7fHw==:17 a=IkcTkHD0fZMA:10 a=Wb1JkmetP80A:10 a=EUspDBNiAAAA:8 a=KKAkSRfTAAAA:8 a=w06kbW2hXDg5FjFnD0gA:9 a=QEXdDO2ut3YA:10 a=1OuFwYUASf3TG4hYMiVC:22 a=cvBusfyB2V15izCimMoJ:22 X-Proofpoint-GUID: oofC_CIqqiMDLv45lQPLJlby_yLxf0x- X-Proofpoint-ORIG-GUID: oofC_CIqqiMDLv45lQPLJlby_yLxf0x- X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwNzIxMDE2NCBTYWx0ZWRfX3n+9V7Qro30K mXqXZC9ceozHph9qCwygEhBI/GqvwsDyP/PG7y5mr8QAKIee+TFAnNE9A6Xj28S0S1e9cbdBms7 78vGeFPM7K7qdQdcJ28cZKUkozBHG39C8d+73XpvW1tm65kl/fdRlmysT3o/TUA+2D0ArazmO4q pwGcLcZBuCFhNgR5mHV/NAPnS7hQbWfcFfuBVef8U5lC10ryzn9FMeyG9t5/inhCpkKUeS4/Vp/ C0qCpMdUeimbDOi03/dWWE/nKPfrzntpsM2GoJAhd1uWsgYAvklI6gcf5a5GSPcshCHjBZVtNdt siw2jk5rTEwPIUau50F82Jxy1ZlnZ/fPHxV9pKOQ76LYi1fTz61pZjY6xGbHZ6TUuvsgN5CRbQY bHMLPrir8UFuHLAvKBWY59YCKHCcarHkKAldiqxrrQRREgcOPpaYTTeZ0evcH3r4/a2OrHjJ 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-21_05,2025-07-21_02,2025-03-28_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 lowpriorityscore=0 clxscore=1015 spamscore=0 mlxlogscore=958 suspectscore=0 impostorscore=0 phishscore=0 adultscore=0 mlxscore=0 malwarescore=0 bulkscore=0 classifier=spam authscore=0 authtc=n/a authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2505280000 definitions=main-2507210164 From: Elliot Berman Add support for SYSTEM_RESET2 vendor-specific resets in qcm6490-idp as reboot-modes. Describe the resets: "bootloader" will cause device to reboot and stop in the bootloader's fastboot mode. "edl" will cause device to reboot into "emergency download mode", which permits loading images via the Firehose protocol. Reviewed-by: Konrad Dybcio Signed-off-by: Elliot Berman Signed-off-by: Shivendra Pratap Tested-by: Florian Fainelli --- arch/arm64/boot/dts/qcom/qcm6490-idp.dts | 7 +++++++ arch/arm64/boot/dts/qcom/sc7280.dtsi | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/arch/arm64/boot/dts/qcom/qcm6490-idp.dts b/arch/arm64/boot/dts= /qcom/qcm6490-idp.dts index 7a155ef6492e176390faa3f2dbe419f5cfa62f0d..d25dbdde7dcee9fa3f1bd48a38b= aeae0f063023c 100644 --- a/arch/arm64/boot/dts/qcom/qcm6490-idp.dts +++ b/arch/arm64/boot/dts/qcom/qcm6490-idp.dts @@ -654,6 +654,13 @@ &pon_resin { status =3D "okay"; }; =20 +&psci { + reboot-mode { + mode-bootloader =3D <0x10001 0x2>; + mode-edl =3D <0 0x1>; + }; +}; + &qupv3_id_0 { status =3D "okay"; }; diff --git a/arch/arm64/boot/dts/qcom/sc7280.dtsi b/arch/arm64/boot/dts/qco= m/sc7280.dtsi index 64a2abd3010018e94eb50c534a509d6b4cf2473b..e6a99ef50b9b9ade9d2a71a14fc= de429f8076dd5 100644 --- a/arch/arm64/boot/dts/qcom/sc7280.dtsi +++ b/arch/arm64/boot/dts/qcom/sc7280.dtsi @@ -857,7 +857,7 @@ pmu-a78 { interrupts =3D ; }; =20 - psci { + psci: psci { compatible =3D "arm,psci-1.0"; method =3D "smc"; =20 --=20 2.34.1 From nobody Mon Oct 6 12:06:21 2025 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 6993B2E4255 for ; Mon, 21 Jul 2025 18:29:57 +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=1753122598; cv=none; b=aeBHn9gTbeSYjFl8aPwGs99jMpxued5u/vF3D8uT4VuBARDE7h4eGPIRkLXh4bK9xPyh3Io60hfeOoiECMltrANhiJhRQy9BgfjbVQlKQiBFE61VFtcgx3Uefn32h36rIDkgMs+CnCsrB/TFPO8AKdwv0QJsvxbmX5cA2NgkldY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753122598; c=relaxed/simple; bh=wwP0wgs37G7SIgdBXKyajalMO8uencXdkJwBMyqMQK4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=adepdzz+i3fsuM0PDsI8Y+tn2x2u0NlrSMKr0M+XcYez51j6w8LXPN+RdTR7mSkl1ynl5ytbokU20U7vcFzZxYCX48kd++FGcyfiKmC4qiaUkxkWW5kusv8+d3V7YwxdPXudh+b4Gg0YDB1s9M8uG7zKQmr41vSprgZjY7i6/P8= 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=nB0spFK+; 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="nB0spFK+" Received: from pps.filterd (m0279871.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 56LH1wwF015983 for ; Mon, 21 Jul 2025 18:29:56 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= 751t52RdbCcwhdqGfw2MHgsiZQ8ax24R2DVj0BioALo=; b=nB0spFK+PjnDeIyN tEVwVVrmb/XJMeu7DbvyqmqHj5xRUC9wBSTAMGPsS+9TnzaGno9DXR/slXcn4p8u tweAsIdxeNPJ2zXt2QOH54oa4JCh6h0hR7PvrSpT2/mYhL/VQ3/6N9cJ7/9y3LPA YzmgVwTLd1O+QLKvME42UWRA6h5P/9Bt6f7eafed70OWmdq0Yz5yk+15LDErSY8j 0B32i0zfbQOkZJPZO2965Z8GKseCXEprzP9IM8YNbKDiCYk1ZIHJ5Kg/hbk2T1DU fPIGcSIVFSIGH7WwoEnFhYWjqjdJi1glv9/k6maVxASgq7oimgRhemVnBTf0FNlM f9Z2Qg== Received: from mail-pg1-f197.google.com (mail-pg1-f197.google.com [209.85.215.197]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 480451eppj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Mon, 21 Jul 2025 18:29:56 +0000 (GMT) Received: by mail-pg1-f197.google.com with SMTP id 41be03b00d2f7-b2c36d3f884so3071425a12.2 for ; Mon, 21 Jul 2025 11:29:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1753122593; x=1753727393; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=751t52RdbCcwhdqGfw2MHgsiZQ8ax24R2DVj0BioALo=; b=biVq8jL01rjHqj/XIPWlWIRis9uyq/67Ip/AA2MW0wUvM5llbDxPlmxbh3sEK0qpS5 tcmcJvqZwfMLrinmcHET2QS0tYQE7X/ZCmW8skTxnIELPsnluNxzwwBrF4TnwWsOhB38 +/Q7ed5yHTQ9PBMzaYkHL8eVCZByyt5CCHEjsEU3UK/TCHw/tZ/91CMIwNlHpzraBvLv 4XdkJUJVA/y/GFASEI5fzeaFMIwxQXWFkjHiQr8MQaYRmgL1F7HCxDil6sHqgMnA3VoD e89Yi6oxUmgrHi0m9CNB2/nfF0JPKR/BSBDiFT45feWflx2e/xAGCKZD1aKnHmCZYExY f+rA== X-Forwarded-Encrypted: i=1; AJvYcCUzqkRvXFEsykzZ9aUbeWXBJNPR9HvDgPbvY69VsQ2ropC/huSR30QQvUz+087dJRoFXLJElSqf5FMFWgw=@vger.kernel.org X-Gm-Message-State: AOJu0YyH7qXRTCb0KdYSFqGSyIM6258i2oMX2ZwQCicqRSv29fuSgztf Ymzy7xduak9DWdwLxfXIJUFWJC/yawz8rg6kZSbODSvfd9c+x6ASu++i5T0O6vHhLgSb1VVz3N1 1QZByQBFgGFS7Ptwdodn8pvjnKGIsNt6nq2iZDp8/mSq1U0lgK0ukhGmRnHisBYHSjDg= X-Gm-Gg: ASbGncv5/3wk51P92qAcEVNP0jEWJD8xANnXu7WP/DPO1CZP0fpaOoMbSwznkWJwnST dVUuRhzgTWzJDFzvLRiU4MGzpj92r9/LwiL4XkPWtGLWEjRXBREY4WtkW+2DNAuXri6yyX+oqHS TkZ62XrV+Hr7H/jjajDo8iXiFIOaZWF3zqDRcfeSztmR8h4gTjd5cLXz4LOk9N4PB0IPNLRIWYH W4P5cwfKsVYt/l5BHS0g/8+nbahbQlkq1fFACYfJBXMegDVNY2yw/at+Kp5MtixqJeUjSUuKugU 1cMP2D7qkIV/HPnbUwHCc9O/ehNrZ64w4jocJwi7Tz7DKxT/OWL9uHU2qmBQXxvz/RkdBpH2xOe W X-Received: by 2002:a17:902:d508:b0:22f:b6d6:2737 with SMTP id d9443c01a7336-23e2568616dmr307650425ad.10.1753122593198; Mon, 21 Jul 2025 11:29:53 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHEA06S8TFKinv9Wu2LscXJSqCUObI3Wg7g7JStQknBcI4tSz1lSz4wMjNrNt+hJSekJoZkuw== X-Received: by 2002:a17:902:d508:b0:22f:b6d6:2737 with SMTP id d9443c01a7336-23e2568616dmr307649995ad.10.1753122592735; Mon, 21 Jul 2025 11:29:52 -0700 (PDT) Received: from hu-spratap-hyd.qualcomm.com ([202.46.22.19]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-23e3b6ef4b8sm61414545ad.194.2025.07.21.11.29.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Jul 2025 11:29:52 -0700 (PDT) From: Shivendra Pratap Date: Mon, 21 Jul 2025 23:58:53 +0530 Subject: [PATCH v12 6/8] arm64: dts: qcom: qcs6490-rb3gen2: Add PSCI SYSTEM_RESET2 types 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: <20250721-arm-psci-system_reset2-vendor-reboots-v12-6-87bac3ec422e@oss.qualcomm.com> References: <20250721-arm-psci-system_reset2-vendor-reboots-v12-0-87bac3ec422e@oss.qualcomm.com> In-Reply-To: <20250721-arm-psci-system_reset2-vendor-reboots-v12-0-87bac3ec422e@oss.qualcomm.com> To: 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 , Florian Fainelli 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 , Shivendra Pratap , Srinivas Kandagatla , Elliot Berman , Konrad Dybcio X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1753122539; l=1185; i=shivendra.pratap@oss.qualcomm.com; s=20250710; h=from:subject:message-id; bh=rmo18nL+UB7XAtgXRRqne0fPUU/Z0j3760cEPwsemB8=; b=HjHL91oAOUytvzZi0mEKgI8wftmZvhJIdLx+TWOHJsBmGlSiXAn+3kblN7JMKgSlZJrb8QX5I TW7FqjUxLbTB2KM7UkhtL0NpuEmetwIFdB+tykDB/f5LJN5FI+hRnRY X-Developer-Key: i=shivendra.pratap@oss.qualcomm.com; a=ed25519; pk=CpsuL7yZ8NReDPhGgq6Xn/SRoa59mAvzWOW0QZoo4gw= X-Authority-Analysis: v=2.4 cv=EIMG00ZC c=1 sm=1 tr=0 ts=687e8724 cx=c_pps a=rz3CxIlbcmazkYymdCej/Q==:117 a=fChuTYTh2wq5r3m49p7fHw==:17 a=IkcTkHD0fZMA:10 a=Wb1JkmetP80A:10 a=EUspDBNiAAAA:8 a=w06kbW2hXDg5FjFnD0gA:9 a=QEXdDO2ut3YA:10 a=bFCP_H2QrGi7Okbo017w:22 X-Proofpoint-ORIG-GUID: lJj43ilPts020Ba7piwGVoK9zV465D0a X-Proofpoint-GUID: lJj43ilPts020Ba7piwGVoK9zV465D0a X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwNzIxMDE2NCBTYWx0ZWRfXyjlNRNfEmRVT g6Y8Vd9NsmUmoujgm+cu0uuyOxUNhuaJljZUhVbtVWGP9EPcpi7DMGT1ZDfGMHBUOTpIdhehjDb szObX2GESGsSvIRhOx4im5HfYCjMhkGagvRjea47cbxKPjkWnsA2U6FxpX/qptEu7jI2YtPBIso Xvs9Vl3lemNHqiRPS+Psh8yyhNg+i486JZxKFNDOFE8XkaI3W3/ojVGZ9FN0UX6PXMVsG2SwU/S tsPr9FpMJPN2WFtwoW7j515dajD6hIz5SM8Z7AIq6w1ALsMwxq1nMmSQWcR54INF/CnBXyqa2ZG 45PRJr3NqNudgp309+75Qd36FraJ4MSGzOl4o5QgxRXzepJTNxEYX7t1WdBNWxQKzGQC/pgvSBy 6BUKI6nCrCBQYpErTC3qL8xGfJGRoEfB9VBDJmDm7qh+76ZtGjf91H8+d5K4U4pCugA1fgwD 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-21_05,2025-07-21_02,2025-03-28_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 impostorscore=0 lowpriorityscore=0 bulkscore=0 adultscore=0 priorityscore=1501 mlxlogscore=999 phishscore=0 mlxscore=0 clxscore=1015 suspectscore=0 malwarescore=0 classifier=spam authscore=0 authtc=n/a authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2505280000 definitions=main-2507210164 From: Elliot Berman Add support for SYSTEM_RESET2 vendor-specific resets in qcs6490-rb3gen2 as reboot-modes. Describe the resets: "bootloader" will cause device to reboot and stop in the bootloader's fastboot mode. "edl" will cause device to reboot into "emergency download mode", which permits loading images via the Firehose protocol. Reviewed-by: Konrad Dybcio Signed-off-by: Elliot Berman Signed-off-by: Shivendra Pratap Tested-by: Florian Fainelli --- arch/arm64/boot/dts/qcom/qcs6490-rb3gen2.dts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/arch/arm64/boot/dts/qcom/qcs6490-rb3gen2.dts b/arch/arm64/boot= /dts/qcom/qcs6490-rb3gen2.dts index 5fbcd48f2e2d839835fa464a8d5682f00557f82e..8cf289a3cfc4ac7014885494c27= fb003a7258519 100644 --- a/arch/arm64/boot/dts/qcom/qcs6490-rb3gen2.dts +++ b/arch/arm64/boot/dts/qcom/qcs6490-rb3gen2.dts @@ -966,6 +966,13 @@ &pon_resin { status =3D "okay"; }; =20 +&psci { + reboot-mode { + mode-bootloader =3D <0x10001 0x2>; + mode-edl =3D <0 0x1>; + }; +}; + &qup_uart7_cts { /* * Configure a bias-bus-hold on CTS to lower power --=20 2.34.1 From nobody Mon Oct 6 12:06:21 2025 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 D6DAA2E267A for ; Mon, 21 Jul 2025 18:30:03 +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=1753122605; cv=none; b=Vq2lcROJfkXmOYAjbP/drcjqQ5s++AwmPr0y8jneMbGv9tonZFoX0qfONwluBL+2TFCZ3BemGhb8k483W9HVL6ExfTKjlxEI4O/LTh5HXsoWwBQ3IjFzEdYzp3xzug01/a4GOfsklujj3mW4yJ7ewXbJPTmwkbgNPYjBXAY8sVw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753122605; c=relaxed/simple; bh=bDYj8SCrzcBMYL0De2l91EChlN4ZQ8qlnKnsadPkWH0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=rofN6u84+Uk6sr9dKRgqMsqpqZCRYGVzpdArvd8g6hj1FvQ6Z63xNB/WE3pKQbkN0ButNoo/vS4nf+66LiDZpyLiQ8KsL/jrzVSwhzD/I/BUsE6HM1aOF6bQlYoXB5YDTJbJrnhqs/B/6tNL2/xCjyUfa2So3Csk/KyDqE3MWLE= 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=mNot2AE5; 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="mNot2AE5" Received: from pps.filterd (m0279870.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 56LGNSBl016585 for ; Mon, 21 Jul 2025 18:30:02 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= zO1m4Mu1s9USWMxZJk5OY8bYzy46q5JS7Is6cMJU9ok=; b=mNot2AE5X+lLUtlJ fUnS3BfpKFpZ7Bj90v3GMQNCk0NCARF4DgF0lher6/I/WSnZ42DJrD9xo9KOGNzv 2LH5sxsi1FluiEm2/xdjkQ/P+n9rkh7MmW0q6zBu9A4qrzpExhGmZNoIZVE1hZUQ JK15qBRcsUBN+fXDTBbBAdoJw/hYNW8+2txn1UWlYcwqhsNjtXqghCEHcDOs1x/c DtJcqtQiPaTGyfJdVETmQ0qfDi2b3tMYAxNjbM6nQRUD/XQ19j9Jkf+9WZ+2tlvn 8tJGquyfU9KF+LfsVrYU6/UHMXrWkMS12EPSwBg3rt/YBxXFJxHAbKbwaBMCRWnI gyTBhw== 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 48048rxv57-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Mon, 21 Jul 2025 18:30:02 +0000 (GMT) Received: by mail-pl1-f197.google.com with SMTP id d9443c01a7336-235089528a0so46066005ad.1 for ; Mon, 21 Jul 2025 11:30:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1753122601; x=1753727401; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=zO1m4Mu1s9USWMxZJk5OY8bYzy46q5JS7Is6cMJU9ok=; b=qIos3iV+iGhAjFhHowNor8dsj6qsNYSaNCtQ6FFCccYa+I7PMSBVwCeYJZ/9d5PU3W yHqgx51RQj8A6yxpNTYr7FhCacOdueGlp8T2Sy859iAx3mvOkVO/gSPYT/mwBnof6gQu qvIUbtuNtPCylynGUOuF6sVe1ddeo9D5071ofKRTHgBPjEvwunkD/xb45Gh7uUxPI3QB MVkfhBadEJHKCsLZbrVMhBwF02v1Y+sHLf4zlePjoqFZ9LSjuelaBlIw/z5YqH5EU0w2 /QL01mSkGuuMYspQRk9eDUBwQv0V6EB1MWmLtLJ00cp3gP6eFxZmGJLFjOKBp4P1bKZN xPlw== X-Forwarded-Encrypted: i=1; AJvYcCVXLXZtT+4YhuZeHcritvhaECYMkwDaWJXBYLq/muD36MQG4iREpxp5YNPV7pdjUNF59Z2aTqCfKyKZSmI=@vger.kernel.org X-Gm-Message-State: AOJu0YwbfYlbHeFoebAy95i8c/jEyLHIPkZrLtWo0pM8kMKZng/Oz4r/ BgZBK17oDLkxmvrDVBkKmWW+8h5KDhsTA9CAABDX8YluRA39K/UIo0kJd0+0eEjZYciR9SgTcTl qIfKcFaqSUddkDFeNDUzfG+Ckfh/HwQR3Gje/KcTO6D8AvipFnXmWLOc/T+iXVm1QCC8= X-Gm-Gg: ASbGncvIIRwOPY/YEph2gKUYePQ5jV3qE6ecdF34HZvjjzhG3ifPT4aYZ19y4F4n1bs eojEs6fRI4upL2ZN+fNtcDwUoFP8Def+uHC+CW1qXyVbI47O1YS2dnVs+H2l+q9zIy/G5Q1T/b5 Dxej+BQ3G+5Lktcmgmqrwb/56eDPIILAzxHTfyYu7ll54h6zDaRfmuz8wKuagARpfZ1v+0y1444 +189UBpT1RTqigvBw7kZJUHknTNM44SoWnahT4QXamUVJH/adzttbMkaR1A2umg3eHl8O3jAHeu Lkvkz21maGNM+gO74nchQv7JjnIkCQx251Fbh4NUWU0cPJWdx88on/Ne4DjKG2F8vLy0A3x8dun s X-Received: by 2002:a17:903:1247:b0:236:15b7:62e3 with SMTP id d9443c01a7336-23f8ac5c086mr6239575ad.9.1753122600871; Mon, 21 Jul 2025 11:30:00 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFEiVeGtNV9GmrNVrD6U4nu+8UhEiUkMzdQ/98qBAr+cTMXNUdE4x3JFAM19mTP1eT+MB3fNw== X-Received: by 2002:a17:903:1247:b0:236:15b7:62e3 with SMTP id d9443c01a7336-23f8ac5c086mr6239105ad.9.1753122600430; Mon, 21 Jul 2025 11:30:00 -0700 (PDT) Received: from hu-spratap-hyd.qualcomm.com ([202.46.22.19]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-23e3b6ef4b8sm61414545ad.194.2025.07.21.11.29.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Jul 2025 11:30:00 -0700 (PDT) From: Shivendra Pratap Date: Mon, 21 Jul 2025 23:58:54 +0530 Subject: [PATCH v12 7/8] arm64: dts: qcom: sa8775p-ride: Add PSCI SYSTEM_RESET2 types 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: <20250721-arm-psci-system_reset2-vendor-reboots-v12-7-87bac3ec422e@oss.qualcomm.com> References: <20250721-arm-psci-system_reset2-vendor-reboots-v12-0-87bac3ec422e@oss.qualcomm.com> In-Reply-To: <20250721-arm-psci-system_reset2-vendor-reboots-v12-0-87bac3ec422e@oss.qualcomm.com> To: 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 , Florian Fainelli 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 , Shivendra Pratap , Srinivas Kandagatla , Elliot Berman , Konrad Dybcio X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1753122539; l=1668; i=shivendra.pratap@oss.qualcomm.com; s=20250710; h=from:subject:message-id; bh=nykICX8hQVOI73Pb+LH6QfNsfIbx6Lek13GmZ+0SmB4=; b=g3A+MwUIEuwhNYH7AEZ+1Tszhqr06K8jZVVPYm2Soy7Wcl0QigvUOomREQzxuSnNsq9GSDF2n TBAB47HabTaB4SXq+0WPD3nEzI4RciQ7fU3duwR5zUVb3BDxCSqUvDf X-Developer-Key: i=shivendra.pratap@oss.qualcomm.com; a=ed25519; pk=CpsuL7yZ8NReDPhGgq6Xn/SRoa59mAvzWOW0QZoo4gw= X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwNzIxMDE2NCBTYWx0ZWRfX2TXWRjyn/jZA c/bERqlb8T8Cg4HYNidi/Knn1cNxMsag5z/iNvKEkIlEd7M67fevwwFA9gcDRL5zzZTDwVJCLyR C6DGLixRUBrURIMEErwbdZEtEz/SMJuwICF1OhBB0KwDo4brL1CfBLaYM2ik6UelNOS9MMunL9j JbCSnPD2oUnCwIEx9lJ+dDrt61wVP+Yq5SxZzgmywozg9rpkysfoS9l/g2QMvfi9QC3+2/0RIwS HdUteexKucoCoc4TPsrRBaszi+nIJdW+UjhGsZbVLncVcu6H0Oh9YE2571jo3i4wFHH2YN5qcPy uVQyIONKuPA+qg2KUMCTMpdcCIA+7z5ohUnQ6BMrLxSUogbFZ2inQT/LT0ozZSnQfCpggvs1V8k SWd2Rfz8WQXdiJWQsoOznL0hiG4Bg1xa+PbGfcVhnVSbnxT7EQN3mz7qP3eVFwq5Z/0j8MrW X-Proofpoint-ORIG-GUID: CXfQnmTHWoaEY4_qEc_0IbUeoSgfbOlH X-Proofpoint-GUID: CXfQnmTHWoaEY4_qEc_0IbUeoSgfbOlH X-Authority-Analysis: v=2.4 cv=OPUn3TaB c=1 sm=1 tr=0 ts=687e872a cx=c_pps a=cmESyDAEBpBGqyK7t0alAg==:117 a=fChuTYTh2wq5r3m49p7fHw==:17 a=IkcTkHD0fZMA:10 a=Wb1JkmetP80A:10 a=EUspDBNiAAAA:8 a=w06kbW2hXDg5FjFnD0gA:9 a=QEXdDO2ut3YA:10 a=1OuFwYUASf3TG4hYMiVC:22 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-21_05,2025-07-21_02,2025-03-28_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 clxscore=1015 mlxlogscore=999 lowpriorityscore=0 suspectscore=0 spamscore=0 mlxscore=0 bulkscore=0 priorityscore=1501 phishscore=0 malwarescore=0 impostorscore=0 classifier=spam authscore=0 authtc=n/a authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2505280000 definitions=main-2507210164 From: Elliot Berman Add support for SYSTEM_RESET2 vendor-specific resets in sa8775p-ride as reboot-modes. Describe the reset types: "bootloader" will cause device to reboot and stop in the bootloader's fastboot mode. "edl" will cause device to reboot into "emergency download mode", which permits loading images via the Firehose protocol. Reviewed-by: Konrad Dybcio Signed-off-by: Elliot Berman Signed-off-by: Shivendra Pratap Tested-by: Florian Fainelli --- arch/arm64/boot/dts/qcom/sa8775p-ride.dtsi | 7 +++++++ arch/arm64/boot/dts/qcom/sa8775p.dtsi | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/arch/arm64/boot/dts/qcom/sa8775p-ride.dtsi b/arch/arm64/boot/d= ts/qcom/sa8775p-ride.dtsi index 63b3031cfcc15fe2cce58c0fb7502b19f058b80c..b1bbd3270afc65e9e036e8098ae= 7cec3d3363a32 100644 --- a/arch/arm64/boot/dts/qcom/sa8775p-ride.dtsi +++ b/arch/arm64/boot/dts/qcom/sa8775p-ride.dtsi @@ -874,6 +874,13 @@ &pmm8654au_3_gpios { "GNSS_BOOT_MODE"; }; =20 +&psci { + reboot-mode { + mode-bootloader =3D <0x10001 0x2>; + mode-edl =3D <0 0x1>; + }; +}; + &qupv3_id_1 { status =3D "okay"; }; diff --git a/arch/arm64/boot/dts/qcom/sa8775p.dtsi b/arch/arm64/boot/dts/qc= om/sa8775p.dtsi index 9997a29901f57d7894dc1eacb6a809caa427c6c4..52466607035e663f4dc6e5c9722= 3d5c0404650e2 100644 --- a/arch/arm64/boot/dts/qcom/sa8775p.dtsi +++ b/arch/arm64/boot/dts/qcom/sa8775p.dtsi @@ -622,7 +622,7 @@ pmu { interrupts =3D ; }; =20 - psci { + psci: psci { compatible =3D "arm,psci-1.0"; method =3D "smc"; =20 --=20 2.34.1 From nobody Mon Oct 6 12:06:21 2025 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 A607A2E0B55 for ; Mon, 21 Jul 2025 18:30:10 +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=1753122612; cv=none; b=f4D0M7y4yo2CuZjts2Eq1lb7u/H3I9sZusF2ADMW7x30v1ja/hT/uvwb22szTT+jevhwYx8KEEcitX0F8VmSJGVDTQaGYUnvBsBsbk4AKbBA8iYvFPtzuNsCj4964uSAZr0cQfZZhIhyNmuvvWSTCzR87ekVbGphFsDJTChX6xQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753122612; c=relaxed/simple; bh=WRonUOFFWFBCm1rQa5vJx+BF5lvxtARn9QwJcpcG7rc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=jJ02oloExaOgK34/GxPWLN4CoCX24UZ+VNyPrtJCVZH6ll1P7EcfWKX7iYDd8b4mkif8Ta+fWN9C13w8DS2pit9+AZne8Y/+S8ei+X+mY2shM63lt3ESoEJLgCOliXJ1A97PJ324l7rOYEBx9iWSUsS6G+2hCAq38HoYgROmSM4= 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=ZgPjvW91; 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="ZgPjvW91" Received: from pps.filterd (m0279870.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 56LGPG9K016262 for ; Mon, 21 Jul 2025 18:30:09 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= IEmpumKrhaODJMwEzzkAX1UibK4n47hwRLwgIiszPOo=; b=ZgPjvW91SwqWnmVM 7faHGCv2Nd/EQxZ2UQ88t66pvS6Q1Owj9obnZyrWbzM/Ix6tWV95FIIg96TEmwJG AdyfnLGOZZMq5Blxdyn0bsa/j5VKRgbFAWwJHyrCm+zapDwcnhMeRkyENJUYs9Fp +kr4Mi7iao0Lh88B1ysSQEh32j/Ag2WMzMpvf6DnqT1sARgtS6FfhjpGrwQYR5tS HvDMFPo37PmuRF5nfHG0EknFYGxQO+6CR02MpY8LxAhe+IlxvLE+G72YI/P3TpjY eS+N+kFwNhdBaUvBYLgs5NrfzromZWGOShHDG+xehVwgZ/69U4kTDhLbraMzTYjA a9dKhQ== 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 48048rxv68-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Mon, 21 Jul 2025 18:30:09 +0000 (GMT) Received: by mail-pl1-f198.google.com with SMTP id d9443c01a7336-235e1d66fa6so36185545ad.0 for ; Mon, 21 Jul 2025 11:30:09 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1753122608; x=1753727408; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=IEmpumKrhaODJMwEzzkAX1UibK4n47hwRLwgIiszPOo=; b=YjsFCAg5qrEWf6jqifeVEERtpOepZJL6M12//wXk2FmltBbe0sMYNcuMNTQHgsMyi+ che7CNkSkDK4Y6fTsbXtXmfAoi4Ayd8YgygFtoVTyD9lOwlhhIqYoc9OP/OySYOyLlEe ghgCYqxC7btlHas2R10ZQVYWiZOFndrsBQckGDSkNirU4hp3xS94PLNsTOpfr8r98e/M ExsK28UOs4lybEuImJG2Ym8uUAR8xtCRipKnWhrk9iMiqGv7BmQLiVUlL3d60A5LOaUb X8PtBaGuXZVfYuXjB+xicdp+CRR8/Epc3HSdAO4k7MYzDt60Kiz0ZEGzcjmm/doVLaoS YzTA== X-Forwarded-Encrypted: i=1; AJvYcCUt8FSYnrjRP8y8pnN+dKoZAyL5s2uUzZ+roU7Yqv9D9NxrfFJ4xZXUPMU5GRE96fhY3pod0/KPkwy3vbg=@vger.kernel.org X-Gm-Message-State: AOJu0YzSdKmk+Ap4sxqeru3QXmmyCsbd4H3i6e81fSiTIymNB8TacY1y DTHc07ZOD5HBd3x3DEmtm0bYhNsk2gDkQBeK17Lz5H0P0uw3vuzNSiVmQNUgTAArbsAMCncvC6M JFB0nODNC7Pbar+6TyGwXh8+PnATF88+xO90IU88ziwYm0sPV9nFVBa8hqmZlTr/wRrU= X-Gm-Gg: ASbGncti7iqccuU1oIR947OQ8Lv8+AX80g9ROvzB8B2SuiXWwKINSGPaX+Hjzy2VcqD 3dnQ0PRQMUy0ajZTo+yHdyaXeJXt5A8uokH+OQpDiRAzOfILZF8QYgRFQ17PPm1MYTvLZ2V5GcF 0/dAKuLYiNWgQCOWYYGsiN2JEjkIWFYVu62Pusn9vorxciJR1FsIJqIvCrNOQvi7cecS8wen9kD 9xPnjGiPO/vjIjMZTAUqRC0IwJ3NAU8uUte2suVGCEK+ldpv96RLPf2lOnNSh88c0cV6xoKAGFs NCRK83iKnHp8SP7biaXXTpvmYINLS8jMQt5lO57LQOh36cON6mLFjRVoc2IoWNU+PNySDih+Pw3 6 X-Received: by 2002:a17:903:3c6c:b0:235:f51f:c9e4 with SMTP id d9443c01a7336-23e24f49430mr332444855ad.12.1753122608205; Mon, 21 Jul 2025 11:30:08 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGzc5T8auyleKAM78gdw7nHnOP+rs5jlCWnnod/hDPSNKGt7NKcw2Z+61prVl/mK5+bZSi2RA== X-Received: by 2002:a17:903:3c6c:b0:235:f51f:c9e4 with SMTP id d9443c01a7336-23e24f49430mr332444305ad.12.1753122607738; Mon, 21 Jul 2025 11:30:07 -0700 (PDT) Received: from hu-spratap-hyd.qualcomm.com ([202.46.22.19]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-23e3b6ef4b8sm61414545ad.194.2025.07.21.11.30.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Jul 2025 11:30:07 -0700 (PDT) From: Shivendra Pratap Date: Mon, 21 Jul 2025 23:58:55 +0530 Subject: [PATCH v12 8/8] power: reset: reboot-mode: Expose sysfs for registered 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: <20250721-arm-psci-system_reset2-vendor-reboots-v12-8-87bac3ec422e@oss.qualcomm.com> References: <20250721-arm-psci-system_reset2-vendor-reboots-v12-0-87bac3ec422e@oss.qualcomm.com> In-Reply-To: <20250721-arm-psci-system_reset2-vendor-reboots-v12-0-87bac3ec422e@oss.qualcomm.com> To: 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 , Florian Fainelli 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 , Shivendra Pratap , Srinivas Kandagatla X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1753122539; l=8348; i=shivendra.pratap@oss.qualcomm.com; s=20250710; h=from:subject:message-id; bh=WRonUOFFWFBCm1rQa5vJx+BF5lvxtARn9QwJcpcG7rc=; b=9+F1OboddRi/w7XhvUe0uUkbbtNToE1ZUmtWBNgqJFlLCQJTdSKDU8SJT9yHw4UaPJOQlMa+H 49ExLAETNSpBfJ+T/ydBKw6NwtFqX4kK7Hc9yXeVs1ZEly2/24D38Vj X-Developer-Key: i=shivendra.pratap@oss.qualcomm.com; a=ed25519; pk=CpsuL7yZ8NReDPhGgq6Xn/SRoa59mAvzWOW0QZoo4gw= X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwNzIxMDE2NCBTYWx0ZWRfX4VjgGwFzTxZE Y5jKcjf59RCeITfvBqwE/Ta1TsHlvs1EUt7VS3+SRlPSMlKdGlg1UKxUv5OR2apRA0+TZbaerUs rbpcUe9Y2e7xIXYCGVvwcHKtWRay2sl+KHVgsuSi1xsqwNpX7aq9NdRJBKy9irB7xnPjXaVPH8g qzFBybuERK80XuGfLXl4TZXLU1XDdRQgmGSlr4K27R+8X8su403J9Pt7kCdq1MabnWzmCwKr12z VQUxxxaE1dSY3mJK8dVmceEaE0rXJI8dIJJ63nh7tuLBJEMRX5G5JIKlkVrizo2tiwB4F07MYGA 5LNuEpg64yoK4Jesjf4u1YSfFvwCnqVa1q9E4tfv2x2FswitDzWft4JPaghNZRqF06y1QGUgNaL FLQbKznp4bRe2cZyEOui41iU6GxJ0/G9Ere0syWGyVAfiRzFxloU91zMiG0XohqHQVX51EI2 X-Proofpoint-ORIG-GUID: aWePyZ5gBWCxdx2qAh54akAokOZQzJG9 X-Proofpoint-GUID: aWePyZ5gBWCxdx2qAh54akAokOZQzJG9 X-Authority-Analysis: v=2.4 cv=OPUn3TaB c=1 sm=1 tr=0 ts=687e8731 cx=c_pps a=MTSHoo12Qbhz2p7MsH1ifg==:117 a=fChuTYTh2wq5r3m49p7fHw==:17 a=IkcTkHD0fZMA:10 a=Wb1JkmetP80A:10 a=EUspDBNiAAAA:8 a=VwQbUJbxAAAA:8 a=K9ZbaieeY_mUnl2nlUwA:9 a=QEXdDO2ut3YA:10 a=GvdueXVYPmCkWapjIL-Q:22 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-21_05,2025-07-21_02,2025-03-28_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 clxscore=1015 mlxlogscore=999 lowpriorityscore=0 suspectscore=0 spamscore=0 mlxscore=0 bulkscore=0 priorityscore=1501 phishscore=0 malwarescore=0 impostorscore=0 classifier=spam authscore=0 authtc=n/a authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2505280000 definitions=main-2507210164 Currently, there is no standardized mechanism for userspace to discover which reboot-modes are supported on a given platform. This limitation forces tools and scripts to rely on hardcoded assumptions about the supported reboot-modes. Create a class 'reboot-mode' and a device under it to expose a sysfs interface to show the available reboot mode arguments to userspace. Create the device using the node name of the driver that registers with reboot mode driver. This results in the creation of: /sys/class/reboot-mode//reboot_modes This read-only sysfs file will exposes the list of supported reboot modes arguments provided by the driver, enabling userspace to query the list of arguments. Align the clean up path to maintain backward compatibility for existing reboot-mode based drivers. Add ABI documentation for /sys/class/reboot-mode/*/reboot_modes. Signed-off-by: Shivendra Pratap Tested-by: Florian Fainelli --- .../testing/sysfs-class-reboot-mode-reboot_modes | 38 +++++++ drivers/power/reset/reboot-mode.c | 110 +++++++++++++++++= ---- include/linux/reboot-mode.h | 1 + 3 files changed, 128 insertions(+), 21 deletions(-) diff --git a/Documentation/ABI/testing/sysfs-class-reboot-mode-reboot_modes= b/Documentation/ABI/testing/sysfs-class-reboot-mode-reboot_modes new file mode 100644 index 0000000000000000000000000000000000000000..63b3ef1ecc66c73744fc831fa98= 64592c514bd56 --- /dev/null +++ b/Documentation/ABI/testing/sysfs-class-reboot-mode-reboot_modes @@ -0,0 +1,38 @@ +What: /sys/class/reboot-mode//reboot_modes +Date: July 2025 +KernelVersion: 6.16 +Contact: linux-pm@vger.kernel.org + Description: + This interface exposes the reboot-mode arguments + registered with the reboot-mode framework. It is + a read-only interface and provides a comma + separated list of reboot-mode arguments supported + on the current platform. + Example: + normal,recovery,fastboot,bootloader + + The exact sysfs path may vary depending on the + driver that registers the arguments. + Example: + /sys/class/reboot-mode/reboot-mode/reboot_modes + /sys/class/reboot-mode/pon/reboot_modes + + The supported arguments can be used by userspace + to invoke device reset using the reboot() system + call, with the "argument" as string to "*arg" + parameter along with LINUX_REBOOT_CMD_RESTART2. + Example: + reboot(LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2, + LINUX_REBOOT_CMD_RESTART2, "bootloader"); + + A driver can expose the supported arguments by + registering them with the reboot-mode framework + using the property names that follow the + mode- format. + Example: + mode-bootloader, mode-recovery. + + This attribute is useful for scripts or initramfs + logic that need to programmatically determine + which reboot-mode arguments are valid before + triggering a reboot. diff --git a/drivers/power/reset/reboot-mode.c b/drivers/power/reset/reboot= -mode.c index a17851a303171fd04a47e240f80687541cc85a24..c22d296c9549a1be10523cd11bb= 0b77a86e53b09 100644 --- a/drivers/power/reset/reboot-mode.c +++ b/drivers/power/reset/reboot-mode.c @@ -6,6 +6,7 @@ #define pr_fmt(fmt) "reboot-mode: " fmt =20 #include +#include #include #include #include @@ -23,6 +24,8 @@ struct mode_info { struct list_head list; }; =20 +static struct class *rb_class; + static u64 get_reboot_mode_magic(struct reboot_mode_driver *reboot, const = char *cmd) { const char *normal =3D "normal"; @@ -67,6 +70,83 @@ static int reboot_mode_notify(struct notifier_block *thi= s, return NOTIFY_DONE; } =20 +static void release_reboot_mode_device(struct device *dev, void *res); + +static ssize_t reboot_modes_show(struct device *dev, struct device_attribu= te *attr, char *buf) +{ + struct reboot_mode_driver **devres_reboot; + struct reboot_mode_driver *reboot; + struct mode_info *info; + ssize_t size =3D 0; + + devres_reboot =3D devres_find(dev, release_reboot_mode_device, NULL, 0); + reboot =3D *devres_reboot; + mutex_lock(&reboot->rb_lock); + list_for_each_entry(info, &reboot->head, list) { + size +=3D sprintf(buf + size, "%s,", info->mode); + } + mutex_unlock(&reboot->rb_lock); + + if (size) { + size +=3D sprintf(buf + size - 1, "\n"); + return size; + } + + return -ENODATA; +} +static DEVICE_ATTR_RO(reboot_modes); + +static void release_reboot_mode_device(struct device *dev, void *res) +{ + struct reboot_mode_driver *reboot =3D *(struct reboot_mode_driver **)res; + struct mode_info *info; + struct mode_info *next; + + unregister_reboot_notifier(&reboot->reboot_notifier); + + mutex_lock(&reboot->rb_lock); + list_for_each_entry_safe(info, next, &reboot->head, list) { + list_del(&info->list); + kfree_const(info->mode); + kfree(info); + } + mutex_unlock(&reboot->rb_lock); + + device_remove_file(reboot->dev, &dev_attr_reboot_modes); +} + +static int create_reboot_mode_device(struct reboot_mode_driver *reboot, + const char *dev_name) +{ + struct reboot_mode_driver **dr; + int ret =3D 0; + + if (!rb_class) { + rb_class =3D class_create("reboot-mode"); + if (IS_ERR(rb_class)) + return PTR_ERR(rb_class); + } + + reboot->reboot_dev =3D device_create(rb_class, NULL, 0, NULL, dev_name); + if (IS_ERR(reboot->reboot_dev)) + return PTR_ERR(reboot->reboot_dev); + + ret =3D device_create_file(reboot->reboot_dev, &dev_attr_reboot_modes); + if (ret) + return ret; + + dr =3D devres_alloc(release_reboot_mode_device, sizeof(*dr), GFP_KERNEL); + if (!dr) { + device_remove_file(reboot->reboot_dev, &dev_attr_reboot_modes); + return -ENOMEM; + } + + *dr =3D reboot; + devres_add(reboot->reboot_dev, dr); + + return ret; +} + /** * reboot_mode_register - register a reboot mode driver * @reboot: reboot mode driver @@ -77,7 +157,6 @@ static int reboot_mode_notify(struct notifier_block *thi= s, int reboot_mode_register(struct reboot_mode_driver *reboot, struct device_= node *np) { struct mode_info *info; - struct mode_info *next; struct property *prop; size_t len =3D strlen(PREFIX); u32 magic_arg1; @@ -87,6 +166,10 @@ int reboot_mode_register(struct reboot_mode_driver *reb= oot, struct device_node * if (!np) return -EINVAL; =20 + ret =3D create_reboot_mode_device(reboot, np->name ? np->name : "reboot-m= ode-dev"); + if (ret) + return ret; + INIT_LIST_HEAD(&reboot->head); mutex_init(&reboot->rb_lock); =20 @@ -136,13 +219,8 @@ int reboot_mode_register(struct reboot_mode_driver *re= boot, struct device_node * return 0; =20 error: - list_for_each_entry_safe(info, next, &reboot->head, list) { - list_del(&info->list); - kfree_const(info->mode); - kfree(info); - } - mutex_unlock(&reboot->rb_lock); + device_unregister(reboot->reboot_dev); return ret; } EXPORT_SYMBOL_GPL(reboot_mode_register); @@ -153,26 +231,16 @@ EXPORT_SYMBOL_GPL(reboot_mode_register); */ int reboot_mode_unregister(struct reboot_mode_driver *reboot) { - struct mode_info *info; - struct mode_info *next; - - unregister_reboot_notifier(&reboot->reboot_notifier); - - mutex_lock(&reboot->rb_lock); - list_for_each_entry_safe(info, next, &reboot->head, list) { - list_del(&info->list); - kfree_const(info->mode); - kfree(info); - } - mutex_unlock(&reboot->rb_lock); - + device_unregister(reboot->reboot_dev); return 0; } EXPORT_SYMBOL_GPL(reboot_mode_unregister); =20 static void devm_reboot_mode_release(struct device *dev, void *res) { - reboot_mode_unregister(*(struct reboot_mode_driver **)res); + struct reboot_mode_driver *reboot =3D *(struct reboot_mode_driver **)res; + + device_unregister(reboot->reboot_dev); } =20 /** diff --git a/include/linux/reboot-mode.h b/include/linux/reboot-mode.h index 370228b5161963aac1d75af752ada0e8282b1078..d5ffc36272ba776a6bca4e61356= 714e07a5b0501 100644 --- a/include/linux/reboot-mode.h +++ b/include/linux/reboot-mode.h @@ -7,6 +7,7 @@ =20 struct reboot_mode_driver { struct device *dev; + struct device *reboot_dev; struct list_head head; int (*write)(struct reboot_mode_driver *reboot, u64 magic); struct notifier_block reboot_notifier; --=20 2.34.1