From nobody Mon Oct 6 19:10:04 2025 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 783012D5C62 for ; Thu, 17 Jul 2025 12:47:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1752756476; cv=none; b=D0mKbt6XxQVqUF+7tSV/V+a5oq9011vNHkNjqaRjge4S+Q9kitlCo9amBaxJ21tHKAUrCq2ayKv65QEGnXYsnTYNxmYy+/uo//tX3g1WhzIokGX4tzqcyemiZFratRwpN+kTCFXCNhXkbfGbU/15mA7LDlAEif3KaDjqdiAe2go= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1752756476; c=relaxed/simple; bh=Ac0WjvV+M2yFP9Da/mh/o8GHODNrcW5YrR+v85Mz4Aw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=O7DlJQnyAXh65lY4EsFwYdwqlsbL9uu+OYq3z7uaUg9umg8Jn2UDlJLzBIYeDbJjwij2y+nkrBVOWJHLk2123/r7heTUTBqtg73KeAMZwNhKu3e5ImUKuOUmUB1WF8roOJSL+gxsQfiacsdVP3l0Pf31SNmrQSvvJj3SJ9YFA+I= 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=Li7ofBKi; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="Li7ofBKi" Received: from pps.filterd (m0279865.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 56HCTkqZ000567 for ; Thu, 17 Jul 2025 12:47:53 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= SiZpTfe8Zu+K6BMsKWciZIsGv+skYHmcAh4GOfMFdWc=; b=Li7ofBKinmY2cAVn 79Bvy9YiXw96IOTZPfIrhChJkdb0NLe3/fgj73gL9n1PiAE8rgDez6onjPRem/Ir fG1CzI65mA7fXo+D53pLUsOvYxSvtm9OkB11r/zbyMyjZ3a/iO8bvCR1AiyjodqV 0yvnY5m649TXi+94CiD9qs9aDlSoiVvxOVFMc6bDmaDdakcymcR8DEwX+2C0caqZ Y6ivNYOqD1aNrNDVBtHHYQE1ToqRe9SG7uV0dCHTD6ym4ZC4+DmoqQZ4gmFeuE4r pdId6oTHOopS2eF8yNFCUhA1JHUpu0CJWUbiNotTE0V8Vvnm5CEAUQffJbfLjSrS XV6I/g== 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 47w5drtq3x-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Thu, 17 Jul 2025 12:47:53 +0000 (GMT) Received: by mail-pg1-f197.google.com with SMTP id 41be03b00d2f7-b2c36d3f884so603724a12.2 for ; Thu, 17 Jul 2025 05:47:53 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1752756472; x=1753361272; 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=SiZpTfe8Zu+K6BMsKWciZIsGv+skYHmcAh4GOfMFdWc=; b=byeJNvPqBGYSL8fDl2pJUB9opdkAsNo1GUD1pYEpF4E7bg80+17H/r/GtjBNx+9RoP wdTkjj7+tUWhG25INJjJAQJlSJuMpTupz/5osxf5P/CaKENb3zI89XYrmsXy/SgDPhA2 JIl7wkFyrNiFJC7RcsCXJl2dv7sTK3t1uKd86q5IJ9XSCXvQ7Km9ULuWcwqyBVjKHXT9 DiyOi88oVT8fVeJfSme9sac0YgGI7H5BL1UgfssoOWvhrHyY5hjkXrwQR7SEVztayxJK gYPXmOPup0ue0ICv66mosDnS66UKR/CSzx52pJB6mfXy7MoPX3XwgemWVactbAuCUWbn eeNw== X-Forwarded-Encrypted: i=1; AJvYcCUOzcTyx4tArnub+Fr4goSrUojjrEIzNVfz8GbyX84WWdq3MsdaXm5FQKr3HNnPQtjuxeR2C2CzNa7PHJk=@vger.kernel.org X-Gm-Message-State: AOJu0YxdEu7xr4ER6WIM1mLVwOauz3cgdJi5WuCu7KdEvGH/jQhAjd+C QZJR5wXGQmmJzm0q86cLxCDsdeZXMS5wZxJt5d60M2xM2DIQ/1+/HpFChjTg0qHKEpqw0xMWinB XBwywLkachrMe3gA5AYcoJpgRnKYRlqITk3SiC8krRx4ZJ87eoJ55bwQBddj0bo6Fm+A= X-Gm-Gg: ASbGncs5tr4G8KeQ9HaEBoVjtpI5VfigYHTtUPjdBq68JFHrtsqTmoUziv4RVDASWrw 9PVgvFcNaQ0Jrmu3JrREtUKrWqOzNszh/eGe8piwVDQu8PcsCU3BmFw6UbZ4u30P4xuAD+LX5Pl tAsxsUOXtrko7qRHvkd7Hre9OWPp8Kuy/ZCt6YEFDnlDjcZQkyu9ZOVyq3zMmryX/5XH3uSnZHK l993wdGScMqei6o4fTevixAbY+i6oGqlN4GlWagXlThZ8LRfRLfAGYVRHZUFEF0stGopa7R0u51 nBn5mA2TfvoKCkB9WLEVYxVGAdM5SdAS4flgR5btBKPjTiViMUvLjMdsHzojW1B/BH7Go9qH7sc c X-Received: by 2002:a17:90b:50ce:b0:312:f2ee:a895 with SMTP id 98e67ed59e1d1-31c9f45b0abmr8446914a91.31.1752756472135; Thu, 17 Jul 2025 05:47:52 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGeDXvff2phI+gdj5k/aZjVFSg5HoF5SSERKmlmox6bjKji8pYexr3zYbXI3CwHG6Qv0EEU5w== X-Received: by 2002:a17:90b:50ce:b0:312:f2ee:a895 with SMTP id 98e67ed59e1d1-31c9f45b0abmr8446852a91.31.1752756471656; Thu, 17 Jul 2025 05:47:51 -0700 (PDT) Received: from hu-spratap-hyd.qualcomm.com ([202.46.22.19]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-31caf828a0esm1505283a91.42.2025.07.17.05.47.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Jul 2025 05:47:51 -0700 (PDT) From: Shivendra Pratap Date: Thu, 17 Jul 2025 18:16:47 +0530 Subject: [PATCH v11 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: <20250717-arm-psci-system_reset2-vendor-reboots-v11-1-df3e2b2183c3@oss.qualcomm.com> References: <20250717-arm-psci-system_reset2-vendor-reboots-v11-0-df3e2b2183c3@oss.qualcomm.com> In-Reply-To: <20250717-arm-psci-system_reset2-vendor-reboots-v11-0-df3e2b2183c3@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=1752756455; l=4290; i=shivendra.pratap@oss.qualcomm.com; s=20250710; h=from:subject:message-id; bh=Ac0WjvV+M2yFP9Da/mh/o8GHODNrcW5YrR+v85Mz4Aw=; b=jQZGEPbbqcRPTYTNCkzogKxfIiutINDN+O/ZIaySmkSbWhNHqd/Y/564EWs4jG5AxSxgCntTq A4sgUiptrehBNUzt39OkoGp3QkKGGtncvx1v5my+muPAQH1Lc2Z+7j4 X-Developer-Key: i=shivendra.pratap@oss.qualcomm.com; a=ed25519; pk=CpsuL7yZ8NReDPhGgq6Xn/SRoa59mAvzWOW0QZoo4gw= X-Proofpoint-ORIG-GUID: eQQCHAyDtUbtIdS0XerUjgeHinXBGkfw X-Authority-Analysis: v=2.4 cv=D4xHKuRj c=1 sm=1 tr=0 ts=6878f0f9 cx=c_pps a=rz3CxIlbcmazkYymdCej/Q==:117 a=fChuTYTh2wq5r3m49p7fHw==:17 a=IkcTkHD0fZMA:10 a=Wb1JkmetP80A:10 a=EUspDBNiAAAA:8 a=IcmTHOqSNbDvJ54L4SUA:9 a=QEXdDO2ut3YA:10 a=bFCP_H2QrGi7Okbo017w:22 X-Proofpoint-GUID: eQQCHAyDtUbtIdS0XerUjgeHinXBGkfw X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwNzE3MDExMiBTYWx0ZWRfXz0nhRL6WYiyY 9Vhfn60sk6ENgD6a/7RZtFlP8oI2MR8BkyyU8mtDn/hMDtxI+HmYQLUoNlSE7UGHE/NVmQ/2bvJ +sEoCI7h3zWpV9PSWn9e4/WDqNJaOdpIGPZP/eLRB1jtUTJroYTCvGAJMMF1csnhiPe1LX1cIV4 DAtXnNZPGiF2lImHAwyuZu5X763Nkt8kilvQmdoZ0bfTCLbIN47G++0M1jsXueSM+4UGnYpt2Gk +Z+k9GO24vOY7wliq7m3O972EFDILXxT++gLSVqocEYPdlzbCN4/uv7B8YwReFrjfq88iDAwF/W AIg8Y1lZqOyaibP9Q4YF3N6k9UmR4xGptYS24QTohutFLea2HXVl5UKOxRU4Ruf6SbxKM8JLSmr coaeBfTctMjisdpYDlVucvE/8BsUkeTFPg4DHqLAKaSV9LZoW77zqdoPNsvbLIyFyVoVsOwY 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-17_01,2025-07-17_01,2025-03-28_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 mlxlogscore=999 impostorscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 malwarescore=0 suspectscore=0 bulkscore=0 mlxscore=0 priorityscore=1501 phishscore=0 classifier=spam authscore=0 authtc=n/a authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2505280000 definitions=main-2507170112 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 | 29 +++++++++++++++++++---------- include/linux/reboot-mode.h | 2 +- 2 files changed, 20 insertions(+), 11 deletions(-) diff --git a/drivers/power/reset/reboot-mode.c b/drivers/power/reset/reboot= -mode.c index fba53f638da04655e756b5f8b7d2d666d1379535..0269ec55106472cf2f2b12bd657= 04dd0114bf4a3 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 @@ -65,33 +69,35 @@ 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 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); =20 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 @@ -102,8 +108,7 @@ int reboot_mode_register(struct reboot_mode_driver *reb= oot) } else if (info->mode[0] =3D=3D '\0') { kfree_const(info->mode); 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 @@ -130,11 +135,15 @@ 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) + list_for_each_entry_safe(info, next, &reboot->head, list) { kfree_const(info->mode); + list_del(&info->list); + kfree(info); + } =20 return 0; } @@ -162,7 +171,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..36f071f4b82e1fc255d8dd679a1= 8e537655c3179 100644 --- a/include/linux/reboot-mode.h +++ b/include/linux/reboot-mode.h @@ -9,7 +9,7 @@ struct reboot_mode_driver { struct notifier_block reboot_notifier; }; =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 19:10:04 2025 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 32B012D5A08 for ; Thu, 17 Jul 2025 12:48:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1752756483; cv=none; b=iO4P3MkaggEwzGr9P91vvNGmHttaivMf8RqLCXFtxvrFwimtN/7OqjDPJ/rhIAAh52vD76Sx8rOR0/aKws/C6/2YtC9+wXk31GgfAOiL41cpN1YjaEgebNUso71hpR/Zz+2sXAtWi6T7PxRBfFQk02ppdOrje5M18Da/QCD56qE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1752756483; c=relaxed/simple; bh=UKHC8eZAoHyXEZlPPTpz/4QLM3qhn581r0uuXJUoOgc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=tMbrl7d3WgjcU3Rs5vIbfq7C3SilMNGWAlqTZGzcB7wywOJy6mBmu6ROOYQ6hy6OemBBaDvu5AkTd1Ft+VzUgsQxh6yHS8cFdXj0Jm50D1Al6SulCpri+6HKww0a90aogClCqzkRRH6+u6XMyX9btxtb+2IMWPdIFqJUpSCbnxU= 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=UdTlnJxz; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="UdTlnJxz" Received: from pps.filterd (m0279865.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 56HCGTVa000541 for ; Thu, 17 Jul 2025 12:48:01 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= ndnZbAUz6f28J4I6Xb/FkBP9eQc/v/Yc+2hDDgd7eLk=; b=UdTlnJxzXyItwjsM HeZi32sOlahKgZBb9tJZVIRjfiOFIz1VNZ8ttWBW9VcGKE/XmzVVana5CTMWGWaG p7P0rVczeTUEUU8exs+I6bDUfHRrOcYek8Zey188XSZAFN6zmvbQm+iRyB4/2A5r qaACCc0FR84ZeG4oBLp6wWeYX6kfeqEXFrNEdAGP7T5Xav8JENrJqXakRA+xBB9n ZCkosJUtJhQ+ps8fKvu12Kbnc1eh1rGWAkkDpIwBXtGpx4ZEdW+R24FUJJPRKfE8 fvVdeA2Iwu+XWzLBscgW2j5SM+YkV6HkvH/RFvtPk5Uq7jMWIXzL4EhTun+saBgl zG4LXw== Received: from mail-pj1-f71.google.com (mail-pj1-f71.google.com [209.85.216.71]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 47w5drtq54-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Thu, 17 Jul 2025 12:48:01 +0000 (GMT) Received: by mail-pj1-f71.google.com with SMTP id 98e67ed59e1d1-3122368d82bso1374217a91.0 for ; Thu, 17 Jul 2025 05:48:01 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1752756480; x=1753361280; 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=ndnZbAUz6f28J4I6Xb/FkBP9eQc/v/Yc+2hDDgd7eLk=; b=j3u4NDDcg2MVqZOiliUuPNNQZE9vstqiRUHLQs5uHdFv+j7n15rQcLV0Cp7zRBGhTn ZxkVPvnSkfzmhSzbZJW0vRLrmKerU0Ny9kzfMJ62Ij7Eek1+ttJTku/bVTM5Hq3n/6gj IR1Iga93y363akVG1OdapUhlSw+AF/anlE6EXiCVqrHGKjlodBjTiEyxX0mkl9c9k8qv QceoWPWuYAFcxZrEtPupLAOcKhXPLOouvmvc5KNZA3RXdjAoHPqlVtjWN4VFIHb5uvPB Jzl5iPUpaY4g0zOgwupbqPlLrsYlLV5YZCjwRgtHCj6/9d784rLkuJArxIeh/odN5veo K/oQ== X-Forwarded-Encrypted: i=1; AJvYcCX+ZL3GvDqobYQRk31KADCE7cO9V6W3pvowHywf6jMqTtbVWXZMfNbVZFwzemP9OmjyxXnpYXikbUeNv4U=@vger.kernel.org X-Gm-Message-State: AOJu0Yzr1Gat19ySMjWj7dUbvjwFoLPqbt6LDmZgQaK7C7nt9/M9lvdH bCk3Z1kZFSWVu3npbaa7sdlaDIvRRVaeWljRXp3h/L6w8tzJ+Py6oM7JGJDKHm8bGzPSuVLIswd 23dvgx61NfCQlayzIrJeL16NB9FtzGGsbzgoU4qYyV/Vi80yWZ0rnX6kEgPBXo7T6Wqs= X-Gm-Gg: ASbGncujMQOo567UBnUdGKNZ4D+aBhBe0dlI6KgVLyobTG1Gb4F+YLAZ2CYpXgmDitI KpHBwKECca0/aA4iWV0hsJe6JyvHIbY+UpIMb3IkEch/Djl9v1dJcrdfk1+2aIhrvlG9jf7kEbY vilm1mQqqQeTuhiBV69NrkX+fV+2a8GPLlnyo5RsOStUzyobs9xjpPli+W3AEl0yhx2bqRR3VwJ KoxyYOjeq4uJ3XJnNp348NuXTQRrDp1Z6DhEDVE+ySkWORtdQnqrrys/Qq2EY5GQBWCZeuC4ea0 LhLqg5lFUdOfNyVAmrIYW4tN8leqzLlAjgaGgoCPDbIxXnGGtYLZsZiaQRMtieHkO3YqElYxEo7 D X-Received: by 2002:a17:90b:270b:b0:311:ab20:159a with SMTP id 98e67ed59e1d1-31c9f47ce74mr8791568a91.29.1752756480054; Thu, 17 Jul 2025 05:48:00 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHSOTf6eWDU0ft+hKrp8ihh0WiXr7hyJaFtJBeCdXFKJ8P8KRZZCoFlpcTtg4Y4L60jS9UJvA== X-Received: by 2002:a17:90b:270b:b0:311:ab20:159a with SMTP id 98e67ed59e1d1-31c9f47ce74mr8791502a91.29.1752756479474; Thu, 17 Jul 2025 05:47:59 -0700 (PDT) Received: from hu-spratap-hyd.qualcomm.com ([202.46.22.19]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-31caf828a0esm1505283a91.42.2025.07.17.05.47.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Jul 2025 05:47:59 -0700 (PDT) From: Shivendra Pratap Date: Thu, 17 Jul 2025 18:16:48 +0530 Subject: [PATCH v11 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: <20250717-arm-psci-system_reset2-vendor-reboots-v11-2-df3e2b2183c3@oss.qualcomm.com> References: <20250717-arm-psci-system_reset2-vendor-reboots-v11-0-df3e2b2183c3@oss.qualcomm.com> In-Reply-To: <20250717-arm-psci-system_reset2-vendor-reboots-v11-0-df3e2b2183c3@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=1752756455; l=7499; i=shivendra.pratap@oss.qualcomm.com; s=20250710; h=from:subject:message-id; bh=UKHC8eZAoHyXEZlPPTpz/4QLM3qhn581r0uuXJUoOgc=; b=AKgwqjmRPiLizBw9dD4+7Y/kPL4CJSLKmsWjhy1mzs9Xe4lxaMckMUb3MamNinpFqxyhA/y3+ /gypLngaYBoBQOUdTlCFiAc+4hmG6d4L6/OuR9heG2gYM2El9tjAKKU X-Developer-Key: i=shivendra.pratap@oss.qualcomm.com; a=ed25519; pk=CpsuL7yZ8NReDPhGgq6Xn/SRoa59mAvzWOW0QZoo4gw= X-Proofpoint-ORIG-GUID: 0jayyo8vsa1B_T8MAIM-fOu7DWB8iv2M X-Authority-Analysis: v=2.4 cv=D4xHKuRj c=1 sm=1 tr=0 ts=6878f101 cx=c_pps a=UNFcQwm+pnOIJct1K4W+Mw==:117 a=fChuTYTh2wq5r3m49p7fHw==:17 a=IkcTkHD0fZMA:10 a=Wb1JkmetP80A:10 a=EUspDBNiAAAA:8 a=MO_J9Aa4ypbE8kPWTcIA:9 a=3ZKOabzyN94A:10 a=QEXdDO2ut3YA:10 a=uKXjsCUrEbL0IQVhDsJ9:22 X-Proofpoint-GUID: 0jayyo8vsa1B_T8MAIM-fOu7DWB8iv2M X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwNzE3MDExMiBTYWx0ZWRfX7lZAA09Ev2po 4Nzc+IyaQvk3yThv+4ZWHtWG/AJAnUsmZoyrpjjTTaWBxDqhgoLh1PQb8qtNuc6ydllfA14qJXJ yvxmsyCyV2Ojxp3fSkIWmOYxyWwEGQ8QeEVTAQYwKYMOVpvADFN9zXSQy4CMmoVocrptlKUNdqr SllTmK4xQ63DVTfUR3uDz7cPkVz9OSnhGazRiINNvizYMKBx6/KakDXpkgwqljX/R14cBTdAUto OTE4vP4KqOWBmaIh2TpXWmHCN4rRz5opRNERHsTYhJEj9V0FpZZOOXUB8yKEBFrk/82kHJFqvJs z1kKmDvCcdgJABDHs8qQAl8yArODa1VHjYpo45XL1tcPzpKy4eVruNk114HlzSlRoYqJKSZjKA6 2P2Ni3wSHxiYQ3Q8phsgf5hdi5QpzrGbi7OBoJ53tGiTY+OBXejxK+jUjDQPcvH5LFMDRX6K 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-17_01,2025-07-17_01,2025-03-28_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 mlxlogscore=999 impostorscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 malwarescore=0 suspectscore=0 bulkscore=0 mlxscore=0 priorityscore=1501 phishscore=0 classifier=spam authscore=0 authtc=n/a authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2505280000 definitions=main-2507170112 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 | 5 ++--- drivers/power/reset/qcom-pon.c | 5 ++--- drivers/power/reset/reboot-mode.c | 27 +++++++++++++++------------ drivers/power/reset/syscon-reboot-mode.c | 5 ++--- include/linux/reboot-mode.h | 4 +++- 5 files changed, 24 insertions(+), 22 deletions(-) diff --git a/drivers/power/reset/nvmem-reboot-mode.c b/drivers/power/reset/= nvmem-reboot-mode.c index 41530b70cfc48c2a83fbbd96f523d5816960a0d1..e3eed943fdefa271b22e1f1891a= bef5c9095b9a5 100644 --- a/drivers/power/reset/nvmem-reboot-mode.c +++ b/drivers/power/reset/nvmem-reboot-mode.c @@ -16,15 +16,14 @@ 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; =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, (u32 *)&magic, sizeof(u32)); 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..93daf93c097f970afbaf43d36b1= e4f725ca7a81f 100644 --- a/drivers/power/reset/qcom-pon.c +++ b/drivers/power/reset/qcom-pon.c @@ -27,8 +27,7 @@ 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); @@ -37,7 +36,7 @@ static int qcom_pon_reboot_mode_write(struct reboot_mode_= driver *reboot, ret =3D regmap_update_bits(pon->regmap, pon->baseaddr + PON_SOFT_RB_SPARE, GENMASK(7, pon->reason_shift), - magic << pon->reason_shift); + ((u32)magic) << pon->reason_shift); 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 0269ec55106472cf2f2b12bd65704dd0114bf4a3..1196627fbf98d87eec57a3d4ee5= 44e403e6eb946 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 struct mode_info *get_reboot_mode_info(struct reboot_mode_driver *r= eboot, const char *cmd) { const char *normal =3D "normal"; struct mode_info *info; @@ -35,11 +34,11 @@ static unsigned int get_reboot_mode_magic(struct reboot= _mode_driver *reboot, =20 list_for_each_entry(info, &reboot->head, list) if (!strcmp(info->mode, cmd)) - return info->magic; + return info; =20 /* try to match again, replacing characters impossible in DT */ if (strscpy(cmd_, cmd, sizeof(cmd_)) =3D=3D -E2BIG) - return 0; + return NULL; =20 strreplace(cmd_, ' ', '-'); strreplace(cmd_, ',', '-'); @@ -47,21 +46,21 @@ static unsigned int get_reboot_mode_magic(struct reboot= _mode_driver *reboot, =20 list_for_each_entry(info, &reboot->head, list) if (!strcmp(info->mode, cmd_)) - return info->magic; + return info; =20 - return 0; + return NULL; } =20 static int reboot_mode_notify(struct notifier_block *this, unsigned long mode, void *cmd) { struct reboot_mode_driver *reboot; - unsigned int magic; + struct mode_info *info; =20 reboot =3D container_of(this, struct reboot_mode_driver, reboot_notifier); - magic =3D get_reboot_mode_magic(reboot, cmd); - if (magic) - reboot->write(reboot, magic); + info =3D get_reboot_mode_info(reboot, cmd); + if (info) + reboot->write(reboot, info->magic); =20 return NOTIFY_DONE; } @@ -78,6 +77,7 @@ int reboot_mode_register(struct reboot_mode_driver *reboo= t, struct device_node * struct mode_info *info; struct property *prop; size_t len =3D strlen(PREFIX); + u32 magic_64; int ret; =20 if (!np) @@ -95,12 +95,15 @@ int reboot_mode_register(struct reboot_mode_driver *reb= oot, struct device_node * goto error; } =20 - if (of_property_read_u32(np, prop->name, &info->magic)) { + if (of_property_read_u32(np, prop->name, (u32 *)&info->magic)) { pr_err("reboot mode %s without magic number\n", info->mode); kfree(info); continue; } =20 + if (!of_property_read_u32_index(np, prop->name, 1, &magic_64)) + info->magic |=3D (u64)magic_64 << 32; + 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..6783d05e80fbc2c812b45ffe697= 55478af90d30a 100644 --- a/drivers/power/reset/syscon-reboot-mode.c +++ b/drivers/power/reset/syscon-reboot-mode.c @@ -20,8 +20,7 @@ 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; int ret; @@ -29,7 +28,7 @@ static int syscon_reboot_mode_write(struct reboot_mode_dr= iver *reboot, 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, (u32)magic); 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 36f071f4b82e1fc255d8dd679a18e537655c3179..d9d9165a8635e5d55d92197a69c= 7fae179ac2045 100644 --- a/include/linux/reboot-mode.h +++ b/include/linux/reboot-mode.h @@ -2,10 +2,12 @@ #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); + int (*write)(struct reboot_mode_driver *reboot, u64 magic); struct notifier_block reboot_notifier; }; =20 --=20 2.34.1 From nobody Mon Oct 6 19:10:04 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 9357F2D8376 for ; Thu, 17 Jul 2025 12:48: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=1752756493; cv=none; b=fCCeXecmJP1DXk5OFpQH7cWuie2uYECGrQi9m3Cs8z6/s1b5jZGqQ61mBCh0GH6SrSZFp0JcYNt4/YPbqVg2puL9ol9rtSM3sxRkElwWAjMYEMCNZitHg9ggnV6ifCaRPltmL8H4FVTy/u6wuriEo2tUERYFjd91SmD3DuoD4wE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1752756493; c=relaxed/simple; bh=TXtx922bW7Cthax35l5eL6qlXJtqJfd163vx/p8QQUw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=E3aSpFP+3m7NZif3tDXKbaGXEh2yeH0Vd7iHYg+3s4Th/zDeFkPZSE31cstytsBPbH7XzXIdtFgXQUpJszPbX0SvtvDxvHelNOw0VHLPriVCT159xTICaFKKMEfsw+kuvyzvLbtPuTDs3Ig/8oTxRmXnZatMTGLBaottGJVruqU= 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=CdWLIJxF; 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="CdWLIJxF" 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 56HCEgN6007306 for ; Thu, 17 Jul 2025 12:48: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= dVmI/zpQBLHcmY6/km9+lnVLqKzUs1cGOy2afpNbw1A=; b=CdWLIJxFATwrJk1Z sXz+cK0ikSSAhq9RFKcE2ix+DNfu5lE9tiDOHj6FP0o2zWVzgOsrjm7QY7STDf9a k7v5p7ePBWaIJsTsn+JUXm2Boa+2ANZ6V/jw24Iw3SbPnQyMjieI+ean0HVyUnTq LaU69T9tmxB160H7fslKCnqCIYK6ET93yKHk+fbhmyVy6mSzjPeBkNx1JwsS1jZ4 mO2skWUz0nyjlimMD8qMn71iXqNefDDDPoVEPklV4jJZfYFFTg7gHvt3wH9bWZbr wHVeTd0LXd/RXckF9YiFtyun4hmqMDDhPbZe8aqXDJPJT7dpB9N4AjThaVwiXJyT yhmTdA== Received: from mail-pj1-f72.google.com (mail-pj1-f72.google.com [209.85.216.72]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 47wfca8uq8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Thu, 17 Jul 2025 12:48:09 +0000 (GMT) Received: by mail-pj1-f72.google.com with SMTP id 98e67ed59e1d1-3121cffd7e8so750157a91.0 for ; Thu, 17 Jul 2025 05:48:09 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1752756488; x=1753361288; 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=bx5O/e6p1kAtCQY4QRVR1EfwgLgygdtR4PICgUymxm+HDVNwMIOXBIlxTrze8O7xyh gnjMcq9fUsMfqKcwuO5EjdBFK40UUKnWrVGUZKYbHy0cL409PHL3bt2/UsbanIAHP9LQ c452UVk3muMmEtxA2+ktRc/mkRyUDTV7DpnxwRtbbp8pqJIzbBx8t11DXY4HWFJckwdu VdgZGIH8NNDfLDfRPjgnMYSHaiomKfpd+V9U/JDYF9FbLMCBJF9/xzIfpgcfAwg0+oCc hFZw5V5HryfG2zDzd3UIYmxjlPKI6ooCav6fBluAPZQFokO1kfsIvYhq86eevMOUUM6r 2a1Q== X-Forwarded-Encrypted: i=1; AJvYcCXlM+pn+xPpIS9PiEFBT9B+pJMdSaLYOxOcAs/RDWNFFeDZA4/5rS/JxIKlAb2qXmO5m0BU3sC2iBIqzS0=@vger.kernel.org X-Gm-Message-State: AOJu0Yx3vRqUbeDH17mb1RULc8ctYnWNpN7pum2n8jfqnDu7lG1PcgyJ Yuhanw2xotizW+xpoJbUFDi9RQnPpCnVYSRiIN6Ds+atnR1UiJs7k1ZROz2MCmWreTUy0tihsu7 WSWs26jrburMGL9zjFzF9VqWlzUjHoUPGqp8usIt9WNLK1bi9yp85KWEpga4/WJPCKiE= X-Gm-Gg: ASbGncupQADuLQyl8lz4AE2mNob3njW4IqcgIr5710DuwPvPzcovQ597ucRDP2XDBzA w0vCrB0x45JCggQE8vzU6QyUEnYVgSBRKlr1dVB38x45GUdXte7qGtvzJ30rYs5OzJQO/23PAUz jq0BXJPblsA6XftNaC5LDIL/f934zFOQNZA18/KV4SvyyP1xFzltQkh8CMCIyT758nwfAoS+okT U87t8N3WXt/TNkxhqD7rRHDq5jz+JpU54f2QPofty7qXgHorOVTXxiHEz0r6LQIjbX89z/32YSZ gjRxBOPEo4PotjH0eUZwC5uEGgwW37Nukmz7ETVYAxgvPVPKD3v2N1z9DOWrmrO/1my8woe3fuZ 3 X-Received: by 2002:a17:90b:5388:b0:31c:15b4:8e22 with SMTP id 98e67ed59e1d1-31c9f435808mr9114241a91.7.1752756488052; Thu, 17 Jul 2025 05:48:08 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHkOlSWzDs1uSxp1jQJYtEnS6kEvwG5U6hkqUjcCEAR0EVPDQRcrI9D1cToYjNe3mFQ7HLYKQ== X-Received: by 2002:a17:90b:5388:b0:31c:15b4:8e22 with SMTP id 98e67ed59e1d1-31c9f435808mr9114191a91.7.1752756487531; Thu, 17 Jul 2025 05:48:07 -0700 (PDT) Received: from hu-spratap-hyd.qualcomm.com ([202.46.22.19]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-31caf828a0esm1505283a91.42.2025.07.17.05.47.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Jul 2025 05:48:07 -0700 (PDT) From: Shivendra Pratap Date: Thu, 17 Jul 2025 18:16:49 +0530 Subject: [PATCH v11 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: <20250717-arm-psci-system_reset2-vendor-reboots-v11-3-df3e2b2183c3@oss.qualcomm.com> References: <20250717-arm-psci-system_reset2-vendor-reboots-v11-0-df3e2b2183c3@oss.qualcomm.com> In-Reply-To: <20250717-arm-psci-system_reset2-vendor-reboots-v11-0-df3e2b2183c3@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=1752756455; l=2577; i=shivendra.pratap@oss.qualcomm.com; s=20250710; h=from:subject:message-id; bh=Pb0JW5FgpXpfFWALyentRdrGNmebMgVj4WCNzS0Y1bY=; b=BgwZ30iCRhtExbmDA6TGpA/ZoDLVSuir4HWMJR6quDkTJVIhg8rPL/W6Ku9lD9vGEir88pY36 8DCIosdvqopAvydgEHilt2iR7zGvvBaGtQw4OuratuzgNcdD01zNQmc X-Developer-Key: i=shivendra.pratap@oss.qualcomm.com; a=ed25519; pk=CpsuL7yZ8NReDPhGgq6Xn/SRoa59mAvzWOW0QZoo4gw= X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwNzE3MDExMiBTYWx0ZWRfXwIiSQeUy2UAT H6mlJVqG8TuBHekDfWsl5uhmA4nsQG6uFCvy8xDBDFRj4/Y05Ja/INBS9myAvRfIBgYjGdTw386 cBAead1bii7LvIg/3b8FhbBmb97Mv1tcYva5lvPlhTrYXBo4+zxnWAk4RZoDmbvsDlu5sMcx2Qm 5w00duoRuu/4FP+EE4QgyzRjD1/uMdrCznNEypVJXMM5V1sD5VTTQzhU0hLzt/u0HZk1oPqenFf UtRYOdr0Yl14i7PUDTBOUdYGeTadF4VeUQo0vRGM6ASHBfeUUudZDdEr6JMo2JkfLu8CYguKYHW TlSbT20+FANBsnIZSOy6U5SECQ+9jSRIDVjnxd/GIZAENPaiqu4pk2D2EmVSiyM3ljpdAfOM605 UsfCgK67ge6lBzVO85JZW14HfQkilwfFAYDD2ylxWGdl6cNBslBV2cVZnbAlOcWHaXJceYPQ X-Proofpoint-GUID: W0wO8_zXqNw0q3ka2vWDtZYuWJpv0gLg X-Authority-Analysis: v=2.4 cv=SeX3duRu c=1 sm=1 tr=0 ts=6878f109 cx=c_pps a=RP+M6JBNLl+fLTcSJhASfg==:117 a=fChuTYTh2wq5r3m49p7fHw==:17 a=IkcTkHD0fZMA:10 a=Wb1JkmetP80A:10 a=EUspDBNiAAAA:8 a=VwQbUJbxAAAA:8 a=UInjrUrXc7y1C1sAkbYA:9 a=QEXdDO2ut3YA:10 a=iS9zxrgQBfv6-_F4QbHw:22 X-Proofpoint-ORIG-GUID: W0wO8_zXqNw0q3ka2vWDtZYuWJpv0gLg 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-17_01,2025-07-17_01,2025-03-28_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 mlxscore=0 priorityscore=1501 bulkscore=0 phishscore=0 lowpriorityscore=0 mlxlogscore=999 impostorscore=0 clxscore=1015 adultscore=0 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-2507170112 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 19:10:04 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 F1FC529C33A for ; Thu, 17 Jul 2025 12:48:18 +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=1752756500; cv=none; b=QdP4yWMDvBUXb2UObx994YMM63/+rnOBMLojDbe3NU8OHWsIIUY7I1AOrv8iH5ipm2t+AjZmnkEdxmKrhidvVYbEWPEPh/iOGAvtlZsL2Lfm71hqCGpPxhw5C4kvzQJ/2SkTJGwu7e31qBCh1LuPIlWqmLIheeSFOA4LCIbEng8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1752756500; c=relaxed/simple; bh=vRGudR+4lCF/CFjdEfDPgNRqqgAfbw6WDOCEN0Ok4b4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=MlctP2jvYhlELAPPtNxQBXS+Egn1vqLYgxjCvt/z7Qt0YslMh9FNj+dw9hmepwDzSaiaBLiYzMe1BLj6n9AeeGDjPxZtrlDmpFwvmcnZ6isBNz9SdPX4BRVhautsvtiHd5JNHvFFuRrh2ID6EQn3a8/oEx5Yvvqf/5rDVY9VW+o= 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=IV7TUvDR; 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="IV7TUvDR" 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 56HBxD6B030459 for ; Thu, 17 Jul 2025 12:48:18 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= R1G5wt+CsWrcVcnaihKm5UaXqpfLNEFUHyU0bAvOqxE=; b=IV7TUvDR0s+V1EGx kraaD4KbPyxTSj0RoNvIiReG4qMA8GXBCM3mMZrqAICtuFzpEqKHZReV/VXHxCVK coM+YWcLgMwOrIJ4DtXsp+2AQGb+8+mMztTpyE3ouHHNaDOa2cYDJro/uRE3R84V I6QkQgeNJ2CwPl9ePb12P8ugKangaZJ18HN/d7wfBg7KvED8ih5QBnrE9/YgYNEA a4FW+PLV0yACunjuAkahEHN+lmkmQ01V8oC+LFk2CEiwX1h1KhUdmN90dm7UZ0xb r45RVK6NXjMZb/N8Wcuu7bxvNZTDYPwlhUNZF9B2ura1YcJDBedTwLB8r+vb9FyQ PrWjkw== Received: from mail-pj1-f69.google.com (mail-pj1-f69.google.com [209.85.216.69]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 47x8x7mgf8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Thu, 17 Jul 2025 12:48:17 +0000 (GMT) Received: by mail-pj1-f69.google.com with SMTP id 98e67ed59e1d1-311ef4fb5eeso1062375a91.1 for ; Thu, 17 Jul 2025 05:48:17 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1752756496; x=1753361296; 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=R1G5wt+CsWrcVcnaihKm5UaXqpfLNEFUHyU0bAvOqxE=; b=mAzkVH8ka8Oqxs+I+X6cEJumUKgZ6yRTcsKJEjMuOE3SK8o1G6bKy0WWS+DfsYokKz t9iSsA69w/xQjjHB6epJnFCJcc3rKfCx5ryifEm9S/Lbi6aWqx31HoT8lMQQQ4Q0SNuB ZbpbPoehSGZ6dvpkCTX9ZwikjAtjAIktwwdZ9TvFg5XFKqMrpOCNp/joY1MS5Be1hvxF XqwxlvuO2R1kDZTFyIRz0bpMQK92MEQyNVV55i1c04cu/n11cU+8sQvMZxQvmgigRSmN Mk+ioZaPrbu6u07O1GHfwb8QrnXWJDKda5yac8bQEM2jDr6gETRM8uH2XuTJINqBfxUz 9gqw== X-Forwarded-Encrypted: i=1; AJvYcCUOSwwy7JtXRV02cMpscignt4qBwGE7SdM5CedcYndTMTwBfKlUeSkn/ogZKv6K458U/3GNWYiIGxIJEhc=@vger.kernel.org X-Gm-Message-State: AOJu0YwBO4xoA+lCWur0ZgyBSVr9z1whkwtF/FV+V7nDqoY6Ddrxm8RC BKufpj6oO0LSi8tL7OS52ch1BloiigpRrb/V2BzkcaZALT93+zfgSviVLensmMVI/4g+io5lSmK Vj7SFhukERlwEPJ8Kwkp9Ik4J/p21Y9r5M7RtoPl0zQ7FqN9PgNfY0IuY0gGyd4A+IMY= X-Gm-Gg: ASbGncv5WVO+BgM3bS9QWOxJOHq+LvsduEM0JZ28Q6EH4NCCkbyBUC/DuiUat5rtcgH bM1Mp83dsqLGm9Npzde/bzo9dzxiK6yJFcQfVqgCmnWKpX+j9O3a9U/lT4o7Qbt6oPTtXiil3dZ wBRbT21kuU8EaWFWDYEdtyQLR2pktj87FjeCntBkwZA1KKev9PhqYQUehyztvDEZDxRr++NKOyP jvX9l/w7aJUNzvI5Yg9AdoxGdNRSbwpdyNePZGsll3XcOsz6lnw/8J8AYp1a23yZYpryuv1/2o5 9ixCQI7RuVL8oH29UMaTrcfyBQPK5ZJzoqNkNJLlO+mRrizDxL+YU+2rV2RAbwS9j80kPt4jtKL e X-Received: by 2002:a17:90b:1d91:b0:313:d7ec:b7b7 with SMTP id 98e67ed59e1d1-31caea21192mr4833805a91.13.1752756495960; Thu, 17 Jul 2025 05:48:15 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH3rytw7zOtg7Xmx743LeMDSPzC+ugRsDIVSFqGgIoj+8yoPglIf7EpfOaxpi0dHqanWFp4pg== X-Received: by 2002:a17:90b:1d91:b0:313:d7ec:b7b7 with SMTP id 98e67ed59e1d1-31caea21192mr4833737a91.13.1752756495409; Thu, 17 Jul 2025 05:48:15 -0700 (PDT) Received: from hu-spratap-hyd.qualcomm.com ([202.46.22.19]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-31caf828a0esm1505283a91.42.2025.07.17.05.48.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Jul 2025 05:48:15 -0700 (PDT) From: Shivendra Pratap Date: Thu, 17 Jul 2025 18:16:50 +0530 Subject: [PATCH v11 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: <20250717-arm-psci-system_reset2-vendor-reboots-v11-4-df3e2b2183c3@oss.qualcomm.com> References: <20250717-arm-psci-system_reset2-vendor-reboots-v11-0-df3e2b2183c3@oss.qualcomm.com> In-Reply-To: <20250717-arm-psci-system_reset2-vendor-reboots-v11-0-df3e2b2183c3@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=1752756455; l=4666; i=shivendra.pratap@oss.qualcomm.com; s=20250710; h=from:subject:message-id; bh=vRGudR+4lCF/CFjdEfDPgNRqqgAfbw6WDOCEN0Ok4b4=; b=OKh/pjXrYEArit7zr7m33XcTU+HzHx1vsKq5fDIex79NvYaBydSHXdfZ/6HqRxS8LAxhfcoeB qdpS62xMdWeDv1FlHwDj6hA1ZEKsrTAid1BW/6NnYjepSdI2QniynAr X-Developer-Key: i=shivendra.pratap@oss.qualcomm.com; a=ed25519; pk=CpsuL7yZ8NReDPhGgq6Xn/SRoa59mAvzWOW0QZoo4gw= X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwNzE3MDExMSBTYWx0ZWRfX8/sCwfqVjwSA 4mfsXMF5QTxkDsR67BvTmad09h6x+Y/Y5Tar8rEYm0P30OwsEaljCoSfzMRiBW7PPpPfHQ6QhLP LUbGvA+winYh8ruuG7CLrtTwyXS73t2aMZCfBoUwNw7NuwPp9h5QPC8jyARhlfe3KXU0+39szIg Ca/L2ErBbJGqFwiISoc0h44BH7XJgs6cwXA8uF00B7m3xEYo3Vsf5RWixhqJ3soqzq1kA/b9Hfb S+1S52eE3T2+NMPs+xobJDTqyMeM6j4n64POolUlOPrMenNOc5GLsciQdscFmiWq7WlxquAITfv Fqr+FeWh9FWBAIOSNu4Oal3P7UdIPRGj2j9s1IY8aznZlkQ4MOlxXUM9A27JF3MABrYa6xE+xnt FwDjj2jy/P9jS/Uhi+YLZGbkHZ6E6TMOp/Hy1pv3WmpJYbuYkssp18/BK6eOoZP94KvShRdz X-Proofpoint-GUID: BBglbTUqgUGQESDiHUMd5tFEvgIIeM_q X-Proofpoint-ORIG-GUID: BBglbTUqgUGQESDiHUMd5tFEvgIIeM_q X-Authority-Analysis: v=2.4 cv=N9YpF39B c=1 sm=1 tr=0 ts=6878f111 cx=c_pps a=vVfyC5vLCtgYJKYeQD43oA==:117 a=fChuTYTh2wq5r3m49p7fHw==:17 a=IkcTkHD0fZMA:10 a=Wb1JkmetP80A:10 a=EUspDBNiAAAA:8 a=ppK30-iitoQuh3faNGMA:9 a=3ZKOabzyN94A:10 a=QEXdDO2ut3YA:10 a=rl5im9kqc5Lf4LNbBjHf: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-17_01,2025-07-17_01,2025-03-28_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 lowpriorityscore=0 mlxlogscore=999 bulkscore=0 adultscore=0 priorityscore=1501 clxscore=1015 mlxscore=0 suspectscore=0 impostorscore=0 phishscore=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-2507170111 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 | 53 +++++++++++++++++++++++++++++++++++++++= +++- 2 files changed, 53 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..28018c283eb627bcb4ce6223c56= 899a43ed56399 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,45 @@ 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) +{ + if (psci_system_reset2_supported) { + vendor_reset.reset_type =3D PSCI_1_1_RESET_TYPE_VENDOR_START | (u32)magi= c; + vendor_reset.cookie =3D (u32)(magic >> 32); + 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); + 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 19:10:04 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 AD3EA299AB3 for ; Thu, 17 Jul 2025 12:48:27 +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=1752756509; cv=none; b=UfBLqr8LaeL33RM/rbHCRnj0jzXHcj7yHCOL8c7pnBfE5ilePMTqj4E7+eG41uglLEZnDSMQN5mrCWpSIvmHGTxy24tSTy5DBRneBi4I2AF0R42qT3eagCkk5Hv3LmUBPRxWPSEP09/b3F2MvKlTBwuL0GPUp0GTxJEutxbKNb8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1752756509; c=relaxed/simple; bh=n0wa4AEusSMKTJa2REb6Zm/CPFmojeqETl81QHufxBs=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=TRxJBrYZ5C6D8uAXDUP6OOOFee9vNtMH746dVjAyKMpRUl1Ew5d2sfVXxC2Nb3JpymYcQhYvmhIzCZYyD/HwXd1ukdhN3XK+i4QvkqDLKAyFqpg9GWMP4ZD75p6qAZRDfLRMXEFW2LmUhxKAa/tDZraNxW+fvlu1iBLnfZG6aA8= 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=OleD3QDM; 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="OleD3QDM" 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 56HBvMqa030488 for ; Thu, 17 Jul 2025 12:48:26 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=OleD3QDMSnB0kFR5 QbrMf4A0Nu6i+xPLTRqU5b5RmVXSxaZ9+rrFo7PY++s6xYefUKFJNwYxZU1AMc/q Wd5vTJnnNcoNSdYZLkFZOIEcSv4aeQ753yuY5XjXYfeX0va5UGRrafeSM6GD8wq1 I/SM2QArHsHlDdIfEoBN/Cg9oKqf7L0FMqVWNhmwhmOfZXkitG4dH4zww7+I31Pw 1yNtfQ1YzGutK2wNmkolBBbUat4okFLBOmmyHOAzuMQFFcixxjKQBaUmMMwLzx9w SZdngh9Ed5PULMd/8BHHum3RlagD27Z2ZXEc3vHxB6aKHSU5LVQ/nj3x4Xk/ix9M HgfE3A== Received: from mail-pj1-f69.google.com (mail-pj1-f69.google.com [209.85.216.69]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 47x8x7mgmc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Thu, 17 Jul 2025 12:48:26 +0000 (GMT) Received: by mail-pj1-f69.google.com with SMTP id 98e67ed59e1d1-31332dc2b59so885389a91.0 for ; Thu, 17 Jul 2025 05:48:26 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1752756505; x=1753361305; 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=QDZ2jC/Bce5Xu7L5670NWAXHaoy0fZdqbKuuK1FLkftAN2/ENX+sleQh3B5A3xuUPK Bh1ovRgwkmoySbB8yHN9aBwIEQwg08IY6Nfzwv/vIEqvzeSIfj2KLay0tuAT3ss3SsD4 LbnVgpkvqJw7rV3tXOXY8h/5JoVHkYhljhYtp3AA6MdSwemEaWjM3OYZdRMb5aZeDwYW 7M4B9240dUmYKfCRIjMhPaZhtGybEIdAZAjHBIGSOxU8TJSl2p+v6U+bLQlSLhg7d8r5 e+AjuEnRORow3rUGEgnT5qDbjlL/3ugnSiXuPAN9N0AwtcLLSgvNwZBp3Y3gG7+2w+mU Pz9g== X-Forwarded-Encrypted: i=1; AJvYcCUjyTM8Sy0Hl5v01Cq70qaER/10qPXdgvWUKdnrues+uQ+Mi/Kd3Jk0bg92hFX7rJjewi+BmMl45th51Po=@vger.kernel.org X-Gm-Message-State: AOJu0Yxtc/cAiba0oE23nHSFnGxIdo+fw6yyMfb0K0T90dHWGwbfU7ns bjw67JKb6Fk2KhTnDNril9D4MQJKOFUt5J50V8bIz+QLDv8/Zu89VGAV642tg1npctDEhF/kd2s YfNf3kr746yZgN7B+FFEMVS3aGtdfN1blTJY1pkKFsvwxJflys2IDuFKGGuful6Ftn3Q= X-Gm-Gg: ASbGnctBams3nfM09f7e3Pp4Ww7FZM1/V/f7bvzw8TUX7fy9cmYjOkTwzHJ6vvrnXmE efCMCabvox/IC7XHI4mrEs6FIek5fdtLG/JIvZaGQsBZQpqUkcRPj/ji/mot05ecojAzxEpoUpz HGpcbaUWyj3D5u8V1ihUtkW4DPd6mEALYG1eB3ht6IZal8e3gIbTM4RtJWRbfop9HTXaQHxAolD MUVrcN5JPzc5BeiG+m/yZT5VjTTKlhQULYKV2X3O9A7nKqyYcsxjniIhek5zI1+LN87aOa7je+F LyTIF2SzUiG0tb91ToLyq9I7/0B8AkNQQDgYAxPL31x8cvaZItR0yUeg3163uEHEVxtvMkhjApv l X-Received: by 2002:a17:90b:3d8c:b0:316:3972:b9d0 with SMTP id 98e67ed59e1d1-31c9e5fcacfmr10321289a91.0.1752756504217; Thu, 17 Jul 2025 05:48:24 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFVfbBlxohsXCc2xaE5I67a16rXLDbWY2pLu/jks1PnLsDto+TVjiDWxjRUtHLmCkYlmqeVog== X-Received: by 2002:a17:90b:3d8c:b0:316:3972:b9d0 with SMTP id 98e67ed59e1d1-31c9e5fcacfmr10321217a91.0.1752756503454; Thu, 17 Jul 2025 05:48:23 -0700 (PDT) Received: from hu-spratap-hyd.qualcomm.com ([202.46.22.19]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-31caf828a0esm1505283a91.42.2025.07.17.05.48.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Jul 2025 05:48:23 -0700 (PDT) From: Shivendra Pratap Date: Thu, 17 Jul 2025 18:16:51 +0530 Subject: [PATCH v11 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: <20250717-arm-psci-system_reset2-vendor-reboots-v11-5-df3e2b2183c3@oss.qualcomm.com> References: <20250717-arm-psci-system_reset2-vendor-reboots-v11-0-df3e2b2183c3@oss.qualcomm.com> In-Reply-To: <20250717-arm-psci-system_reset2-vendor-reboots-v11-0-df3e2b2183c3@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=1752756455; l=1628; i=shivendra.pratap@oss.qualcomm.com; s=20250710; h=from:subject:message-id; bh=/OISjQAhUBAIE37ASE5b1kssDpdL8gfQSFob68FR4qs=; b=XSN/9ti8C5qipL44dj5FAZ2QRrNwANKVYhyqlCyp9SwpFFRbw/wawFmv17T5pBXhvUzvKxmxu NFzHvaaVO1rBYtjuTYcep97ASAoayTlgr9TSXw6xEqBBou95yYoBpy3 X-Developer-Key: i=shivendra.pratap@oss.qualcomm.com; a=ed25519; pk=CpsuL7yZ8NReDPhGgq6Xn/SRoa59mAvzWOW0QZoo4gw= X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwNzE3MDExMSBTYWx0ZWRfXw8uXuYrRYaKK mX9ST6x5bmRMnSAaeWeHK+EDGZs3l4muHCHkXtOI5lTsXefSi53iobfFbUXAT4AFqaYealP9NbU vNRXKIlaz5VSX+Psobb5EyJr7hpPHwXXmFXrUGjPVoEci8U7HVzWRcqkpqLL5YV1ra32jJS5Tbh KGoVkeejLacHsSkRNoozFq99wiKHmH5mhUiaE+Lt6+A9/fZBeyXpw0/dJLOIU6tAwSJCKOEGvrT /uTudvgyc1N5E+688sup4OmTRM4Mf5IrDvhpF7bT0h1LWSHLWtwxJwMb2fdZBS1CySXxh8G0WMG DM8NRJOeiYAh31Ag88yPhZ5ROKUJo0qr2BBkW/DlIzj5YrPExGcznccCGDxJEBbZN1s+ucBIyt0 lScrJrMitncWn1OSDB50YJ9jtOrewdAUJEyjPdQuFd4lMQdqe1hbZ4AvC11DwTjx052IPju1 X-Proofpoint-GUID: G7wC6EExYBGoPaMutgpL5zPdow99eGxn X-Proofpoint-ORIG-GUID: G7wC6EExYBGoPaMutgpL5zPdow99eGxn X-Authority-Analysis: v=2.4 cv=N9YpF39B c=1 sm=1 tr=0 ts=6878f11a cx=c_pps a=vVfyC5vLCtgYJKYeQD43oA==:117 a=fChuTYTh2wq5r3m49p7fHw==:17 a=IkcTkHD0fZMA:10 a=Wb1JkmetP80A:10 a=EUspDBNiAAAA:8 a=KKAkSRfTAAAA:8 a=w06kbW2hXDg5FjFnD0gA:9 a=QEXdDO2ut3YA:10 a=rl5im9kqc5Lf4LNbBjHf:22 a=cvBusfyB2V15izCimMoJ: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-17_01,2025-07-17_01,2025-03-28_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 lowpriorityscore=0 mlxlogscore=957 bulkscore=0 adultscore=0 priorityscore=1501 clxscore=1015 mlxscore=0 suspectscore=0 impostorscore=0 phishscore=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-2507170111 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 19:10:04 2025 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6C2BB2D63E3 for ; Thu, 17 Jul 2025 12:48:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1752756516; cv=none; b=HvWRqugfryLyp2XFgscbDDJTyEdf6KL8zVBdWfwf0tIlEjcDGNY3zxyqEpjYkP4zYP5X3Iu+asIOoeCeLMg8TV8yixNYMF8abpf4NUBFdbwVtWbx1tAH3PfEm1clDbShBLjn4yi36FqWUxXd7lrPe51jfJEs4e0FxyxWq4zs/rE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1752756516; c=relaxed/simple; bh=wwP0wgs37G7SIgdBXKyajalMO8uencXdkJwBMyqMQK4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Y53w4zmdab9pzxYnmTvETzdTJm35ULvLnYIjJLIErbTJBVka0fLUpTWqY3FzLuHPenTqDKMt8T3inrktgBoB8Q3ODFfjcZimGk+mXSsJa0W2Y/Zp1dAwUs97Y//wou52/clRynLAVoMMocbhrWq2igLL0P8S7ykValtvXo/0uno= 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=LGbiqt2X; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="LGbiqt2X" Received: from pps.filterd (m0279866.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 56HBPmfv003058 for ; Thu, 17 Jul 2025 12:48:35 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=LGbiqt2X17LP031m pxacikIzoEWgrYhQvwMNhiCNOL59xdHJz5aL1u+U+aKHOGrsfuM2B/805zmzKG9w J7szGKPuWi/Np7FiRfqbkiO8jm7bB8R9TCO2vKpGPZaZ9DlSYGSJ0yN8QMcT5K/m WWOmbPDp4S09DONkrVAxOCktNlcBwZs+Hm7Bwd7VLT8q7o98tcHb4PwNAvmywWJQ QE2sts5wQyk8tcxpRnv4kwsP9m5E/2tNk0gKZb4zpdvRmteqHSdQicpjfyLYmPpO 3Ei06IQj2d7V1sgDzYx6ZjNMlQDuvBfC+CudPkBveTUC0xUZTtwOBAKvHtzm2+3Y OTm1iw== 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 47xsuksfrn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Thu, 17 Jul 2025 12:48:34 +0000 (GMT) Received: by mail-pl1-f199.google.com with SMTP id d9443c01a7336-235e3f93687so14741285ad.2 for ; Thu, 17 Jul 2025 05:48:34 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1752756512; x=1753361312; 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=DQ3rCWwJofS7ZfoRnoVms5t04Ey/ssJ72Hd5lVaOOWs18CPSAPu7+WxpSSewjNPKQF sFAEAf87unlgNk6ZZF0v8KBmtlRrvhSAMVuk+fX1yaa1qdgSeHH4fzHISYDCj4xtyZCb 7jLQxy5TVFKXiiTwSfbWvTUcmEfM6/8DID+yflXrT/Rm2XuiPslYUmBhOkDVfwRgZ26P piRNLg2wMHn9YsFjin+KclbxZ+DDUM7WkODCnGsY+auojbnzg92lFxTjVjyaRe0Q7AsK 7eJLL8H1kNla+oVEc/R3MQGBisD1svnsYubM6PbiSYJ0yZfh/MMoxBsu4rJbtw/V6d5W YWTQ== X-Forwarded-Encrypted: i=1; AJvYcCVtfja3QdykADkHwuxp0RGyz4/zLHM/rvkKRLNlqteaczqLIwdohfKSNArU+mzmden7aL3FQxHAqG1HX58=@vger.kernel.org X-Gm-Message-State: AOJu0YyMeXAJ7R7erkBCMwGe8ZhaCFgmT07lO0PJVHzuAatY31Jq2u8z eXO7nwlXJ1A49yJpGnBx7ERnuXZ/IXkTfCdtOgJvri9Ze1aJM0/RLxmtD3Ma4kmpyMu+QR6byEC mfUEEaZqnvDSM98sxG/C/JnfUK3Hm1eke3LNs2u4W9l2GyqMOnsz8heY1DtLnNrJ0lMc= X-Gm-Gg: ASbGncuuQfz/Vw6Wp1w+q/DHNtqXWDPYzHE3veeDX2/dHsT9BbdpLWID1BQjQllqoeQ 6rnKw20zhD5bsFgSpNDD405jlSld03GJrwEVpqhTpk0DpHzOn/z2byIP5rsxvb8/L2k023XfrOV 7LlnyVLlCH3WTVI0pZJqCIDMzFzfI3s8ir9tk7PImAr8zjHPPXsdTSVP1l+FwIhVLDRsaYROoYl sRGIp00QTrwA5cax/uNOwI5SPgQ12/cgr8hdVyBdmEVGgKRu3er1qb+9tSIE8tPQsyAPsO5FRAm t2kwrY4KPqShLg8XswRoKzLa1THUz56MyA5SFE2EqgFTnHEeAevSd3/Eue2yHiqXk6qcDouvJLO G X-Received: by 2002:a17:903:230b:b0:23d:ddf0:c93b with SMTP id d9443c01a7336-23e257435e3mr88941275ad.37.1752756512227; Thu, 17 Jul 2025 05:48:32 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE8DUsFwY4tYypfpmfxBilLBUvP2Z+g2tucXJh7Sk3ZEP6OFjznFBKFx5xkkD6zUVMZmlHT7w== X-Received: by 2002:a17:903:230b:b0:23d:ddf0:c93b with SMTP id d9443c01a7336-23e257435e3mr88940755ad.37.1752756511748; Thu, 17 Jul 2025 05:48:31 -0700 (PDT) Received: from hu-spratap-hyd.qualcomm.com ([202.46.22.19]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-31caf828a0esm1505283a91.42.2025.07.17.05.48.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Jul 2025 05:48:31 -0700 (PDT) From: Shivendra Pratap Date: Thu, 17 Jul 2025 18:16:52 +0530 Subject: [PATCH v11 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: <20250717-arm-psci-system_reset2-vendor-reboots-v11-6-df3e2b2183c3@oss.qualcomm.com> References: <20250717-arm-psci-system_reset2-vendor-reboots-v11-0-df3e2b2183c3@oss.qualcomm.com> In-Reply-To: <20250717-arm-psci-system_reset2-vendor-reboots-v11-0-df3e2b2183c3@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=1752756455; l=1185; i=shivendra.pratap@oss.qualcomm.com; s=20250710; h=from:subject:message-id; bh=rmo18nL+UB7XAtgXRRqne0fPUU/Z0j3760cEPwsemB8=; b=ppLcpvC8rVl1IEadr9ZLl9ZareIhC7diBss7JmDD0pOFm/RzNVRac0cIFzMaJsT3pSWLwEtkk xwfXL7h/RO3DNbgHkoFJAo3qHKOrXDxQ7WVxfN1TuspSeNiFGreIQFp X-Developer-Key: i=shivendra.pratap@oss.qualcomm.com; a=ed25519; pk=CpsuL7yZ8NReDPhGgq6Xn/SRoa59mAvzWOW0QZoo4gw= X-Proofpoint-ORIG-GUID: ya0-M1rtbENMSbrgt55GtdASfXWetqJe X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwNzE3MDExMSBTYWx0ZWRfX+hDmqwZS/h66 4b7fs9/3a4UQVNkkBzKFXbaLxs4a/fBg1O4Bko4gIpzlayEeKu5SRE3ZNRjxkxEt5g0xSUZcHJN KX2ng4rtYb49/JJWLamOLXPsQZ9zxkDLjGqSdjaVw6dY1RMJPFO76XUjY5ohwYI1YJR5Hkctik1 1XAgkkwFfQVsMhMuC07Xc3mp4I+pIK1VpohEfC7utt79QZ6izdn7vOVdgCCHDdaDd8EC+xkiujC CVg/amJhE6ief1VIGrcj/MR5opwON8lkUssWEx9Srte9l1Aoy0e3rU4MT+1GFElGPYYgxELIW+f W5NbGBcyS7IbVOzOek8YQgAUObTsaTDH3Lh9dz7FeSyXAx8KRqD3VK67iUgbG0a1hsenyrbWFFF AgYRJc8h5AUmEEhd5URpkkSi2WxwoxYDSijghGqn4X1P9yuSkLR+vBQBK/lgeYrkksZmL+/w X-Proofpoint-GUID: ya0-M1rtbENMSbrgt55GtdASfXWetqJe X-Authority-Analysis: v=2.4 cv=JJk7s9Kb c=1 sm=1 tr=0 ts=6878f122 cx=c_pps a=JL+w9abYAAE89/QcEU+0QA==:117 a=fChuTYTh2wq5r3m49p7fHw==:17 a=IkcTkHD0fZMA:10 a=Wb1JkmetP80A:10 a=EUspDBNiAAAA:8 a=w06kbW2hXDg5FjFnD0gA: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-17_01,2025-07-17_01,2025-03-28_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 phishscore=0 mlxlogscore=999 adultscore=0 clxscore=1015 malwarescore=0 bulkscore=0 spamscore=0 lowpriorityscore=0 priorityscore=1501 impostorscore=0 mlxscore=0 classifier=spam authscore=0 authtc=n/a authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2505280000 definitions=main-2507170111 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 19:10:04 2025 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 027292900AA for ; Thu, 17 Jul 2025 12:48:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1752756523; cv=none; b=fG8EZsXKT2HoXnVHhfQnRgWKbsRlJPhFJO4oEhSVX7YCKlaDX1tm1UvpNxHBgpqL93E9UPTrU6YnjZ69mtYFxWaLVh8AWVMX7IrCrmrcydKucjUh9DSbXw5z/Rq5lHoV8cOLPDbuZsKtgsUGLNGL8qu+B6D/4aRFot/TBokVp4U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1752756523; c=relaxed/simple; bh=bDYj8SCrzcBMYL0De2l91EChlN4ZQ8qlnKnsadPkWH0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=L7W702eMw73m1k6QIs0PQpN2tYQjHzagXapi2fOah3On9oIZIuDvCdwfTUAnBAXfQ4sjXM5ueetBWmlyvtj8MbxVZQ8FhSxUYsek6rHZB3KQTgrEaLFFt2fLqe/YhYMHlImwJoImiL/72sq1OR+iXxBYb3JK1ROd5dwYlRn83qQ= 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=m2M0ijgj; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="m2M0ijgj" Received: from pps.filterd (m0279866.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 56HBuXDn003003 for ; Thu, 17 Jul 2025 12:48:41 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=m2M0ijgjpDIH5XHA kGFkVZjyT6ODkzEFE2I1liMEz3vA3GDuXvCBxEgLJtZdApP1Qg+z2SZMZj6wKL6j XllhprhyvzeaG0nhtCMjqWRvzuLB5j3y+9Oa/BcD6h/y0//Gu5gTwqZ4pszCaII1 MBoSuWqsnfewV7WPdP8SSvZ12YipgaAjBZEAgr4JAOpHFR33VQ+Sj+oUu7TedBsE 1vi+rwPcxKZrDeVE4M5zy2//hAucayaoY18XKg6Z8F4s+m3Ghd8CVBv20fwvCqfj PutqdmNycq53BGQ3T7EvXT/vF1I4NuMaECqvpJpSqNIpK5A4P25iRmpa3qLC0j+0 CksERg== 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 47xsuksfs4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Thu, 17 Jul 2025 12:48:41 +0000 (GMT) Received: by mail-pg1-f197.google.com with SMTP id 41be03b00d2f7-b391a561225so746872a12.1 for ; Thu, 17 Jul 2025 05:48:41 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1752756520; x=1753361320; 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=fXKMPz5RERkljLgv5piUq7ubbEH77i6KKvt+JHy6o9wcfgldbpfXNFQuqMR5I6kurd JpTOwALxbrcX7bjmtnivAuzoxJWws3ynNnBByNbLwLI6rXRJSoejJcgoXf0eAjHE8rzp l7B/GSGMfnU5LIFT7CF5fHgPttuJwFXfvv2tsZ0mZX+R0nxRZwSNsoGnWsUkEQLEIIkB Yiq1+hIbHEcoBTar23EdHCxyawPRggKGP0ELv2m2/xTmVSd8FBXeB6SX2iaiU+m4RIOh Ugub8jdPK/7A3K76+05aDNZSb+6xtMAOksreKnm/HBRLLPkcAapaOlQr+nmKNw4uPKGg VvVg== X-Forwarded-Encrypted: i=1; AJvYcCV/v2V4vK9hlK2dtbGAjDC6pH5ot04qY7gH31JJWDVSyzADYdiwXGyEt8AUVvkZmzcmpymCfVNu5j4EGUU=@vger.kernel.org X-Gm-Message-State: AOJu0YyfjIYN7OG+OLSp40Vg/+PQZI4B31awLgnTPuAV1NOAxh66Cpwv m78/cx29Y/o4mT0aRUwUL8bE7mPZ6IMepNIlqOmWzlC47hoKwsQFbBe0ldMxYoFBHxKl8s+XtrW vvFuwTRp2R8mBUXOh5uL5XV5sjc0eCKs5re12TwAQNMtbrZgwr1H1Uv7gvd+ztO7gnbw= X-Gm-Gg: ASbGncsCIjxr2HxXuapsHdy3tnLRHI6zWHEEOaa4yELnxJpW8FElyIzuwEWSKKBhIK3 pxoTulvIutzuwzKAtjhknHXC/hItf8YQ6jiU2Don69QheIP87yYV8RG3f2XMLiCGZ+j42m6MIRx mWk0GFpEzE/oNZRV361FQvJsfPY8TXQ/ZPwyYOYPXKLaFhGdOGnUckYUaID6xnvKWyza/kGJr9J n6LWAf+VBtPR7uYxYyEU+JTyPMIwvKxoqLp7LGaSQPKFfa8z3kZ7jHGIrn/IC5HWHjzpvehvicW 1RWx0UWL1dgcxv+kXn7kLXSAuDD4IZf0HZ7vLESecAZVtLyTsWjjLKpUhNg1KHAfUbQIur6qf30 O X-Received: by 2002:a17:90b:1806:b0:311:f30b:c21 with SMTP id 98e67ed59e1d1-31c9f4b40a8mr8772549a91.26.1752756520543; Thu, 17 Jul 2025 05:48:40 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGXMBxI6IZLFJW1s6JPc9VrE1ngxmouoIjEDFAd9i20pNgJNbkO88UCtpZcIP58Sg3KuJiB5g== X-Received: by 2002:a17:90b:1806:b0:311:f30b:c21 with SMTP id 98e67ed59e1d1-31c9f4b40a8mr8772503a91.26.1752756520031; Thu, 17 Jul 2025 05:48:40 -0700 (PDT) Received: from hu-spratap-hyd.qualcomm.com ([202.46.22.19]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-31caf828a0esm1505283a91.42.2025.07.17.05.48.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Jul 2025 05:48:39 -0700 (PDT) From: Shivendra Pratap Date: Thu, 17 Jul 2025 18:16:53 +0530 Subject: [PATCH v11 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: <20250717-arm-psci-system_reset2-vendor-reboots-v11-7-df3e2b2183c3@oss.qualcomm.com> References: <20250717-arm-psci-system_reset2-vendor-reboots-v11-0-df3e2b2183c3@oss.qualcomm.com> In-Reply-To: <20250717-arm-psci-system_reset2-vendor-reboots-v11-0-df3e2b2183c3@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=1752756455; l=1668; i=shivendra.pratap@oss.qualcomm.com; s=20250710; h=from:subject:message-id; bh=nykICX8hQVOI73Pb+LH6QfNsfIbx6Lek13GmZ+0SmB4=; b=EiF8IZxooW3vYhvtPrDfdjqeu8GiMcEGqyXXqmthd53rwasr7uw84mgWXdkL1gvuf8BBZ0DON MDQxMZOV0SIDfo+q4a1SmrjVCc+0M5DF4A+sIyRvJ9Q6hTTHal1B6cE X-Developer-Key: i=shivendra.pratap@oss.qualcomm.com; a=ed25519; pk=CpsuL7yZ8NReDPhGgq6Xn/SRoa59mAvzWOW0QZoo4gw= X-Proofpoint-ORIG-GUID: A93c_99gQ9QS0HZCcF9OU_0il4JDPj_K X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwNzE3MDExMSBTYWx0ZWRfX9HjmfR8AuLbf ROSoVdUtBJoCIZtKxCwTFuRs9ytI57EQvJlObCCPVTv3LZSWjnFScuk1iC/q5tFb8Kq1NaxC/dF D1UjEqCgFdid6L8008vk4CT3Dj89x/0wVkV5lS0W90MRfb5tCE1QgfXZcPBAeFZOp40Xn+9v/1m kU3Jm108X+2S2Mv3L2DARIUcIMIbQP5YetKeqojtmrPsbAmNYh/1KtL0FtC71kPUb86QWaTp+eD SOrZoHbQWpZP7o8n3qb7Sq+2Er/tGzcS361rHnmKPKI2KHvt/eFhmiM1+DF7dwlSSyl14TjHqS7 AqQ6JOsiFUK17Tqd5oSwh+cdR8EaJqw7IyAvIpL7DYy4FQeKhL0QPXdeJKbH+D/LeAGYJPCo7aS TQL0QhKRIG4HlOl+zUXeJxuKP5y6aD6XaT2l+Ton0DJuG3lgwmVH8ru4nKws9UKTBrHF66GD X-Proofpoint-GUID: A93c_99gQ9QS0HZCcF9OU_0il4JDPj_K X-Authority-Analysis: v=2.4 cv=JJk7s9Kb c=1 sm=1 tr=0 ts=6878f129 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-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-17_01,2025-07-17_01,2025-03-28_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 phishscore=0 mlxlogscore=999 adultscore=0 clxscore=1015 malwarescore=0 bulkscore=0 spamscore=0 lowpriorityscore=0 priorityscore=1501 impostorscore=0 mlxscore=0 classifier=spam authscore=0 authtc=n/a authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2505280000 definitions=main-2507170111 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 19:10:04 2025 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3BBC42D77F3 for ; Thu, 17 Jul 2025 12:48:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1752756531; cv=none; b=ozZj4jg3g8Bihjp2toqxcSISR1IcNcGJKrb+1Pgnu+rnBxqX1P/I7Y7bJ59cdPvi7/TgR59+sEOVE9dRWvgD7S0V3QLTG6nsdV9j9XIiFuhC36+6fPe9Nccaux4d92o+mGdf5PFFiyBeK9R5z1XPeXsSzKx2TvNeGePnZ8w4mXE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1752756531; c=relaxed/simple; bh=dzfywuUuVDRiw0cxEMBMzlxkHVeafnNl2y+/gY2scNQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=RxCnwrnn/HcJ+fWHYRQuV8lKNWQCsiGtKV7uu9cpWiWqUGGlAqgt5YOKTgPzSRFsYAsUNxpv385GxLhgG8dpTO85L2nj2p0d07gi7Td/PjlX3zqCF4FsAyICoFpW+5vmfNT7mfzuWKudTJ61qdFn5g0UrYI3ConMIszrZqNNbiw= 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=hdoC58Fp; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="hdoC58Fp" Received: from pps.filterd (m0279864.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 56HCfGQs028159 for ; Thu, 17 Jul 2025 12:48:49 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= tkUicWB76ieKISxjnwkwmUAWcFBcwTj81cvO9nIz9Bk=; b=hdoC58FpNpctw++K Sn76G/AMFCO7bv26b8rfuUDuFzPS3sIvTN7q7prrNRsltvbpKlpB22Y2rJ3Qss7T oiJrAVXBKFTGXNyOahK+h1OfF4BiOdmyQFcmTelI9TKvwiyorRz/7LUEMf8x5fSS I48DeEMHVqDw/exasxqGNnUFzWbJX5D3eAquUHbCYv69UMXQvia6a9GsBQTsneyq ohEOQEa0ksHtb+Y4TKkzS6Kfu6AFDy9LjjXR9tu4u+C8V5PinJ7ozUhPVM8PajIO iLtHf1gB8fiUWBiYqhigDtQByywBztKFN/KiQKYbku1WDuqyLEbpNWulhXBkwaO8 5wrx8Q== Received: from mail-pj1-f69.google.com (mail-pj1-f69.google.com [209.85.216.69]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 47wnh5ywj3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Thu, 17 Jul 2025 12:48:49 +0000 (GMT) Received: by mail-pj1-f69.google.com with SMTP id 98e67ed59e1d1-311ae2b6647so1061348a91.0 for ; Thu, 17 Jul 2025 05:48:49 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1752756528; x=1753361328; 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=tkUicWB76ieKISxjnwkwmUAWcFBcwTj81cvO9nIz9Bk=; b=nrAtDy+fQoOpzTL+cSu3IXMDTPL6i9/JH2S+lUhzBdD7y1Cb/OaH+fvhZXhocxN1z0 8BVJI+WYq4MS5eXub/QtIXQUFbxCiRVLG0F4Yz0GVE8AUNp7EFvbWpjJ+IpPa3Hh91Tr +LBzG4uxp/390EuO1ml0lomAfPwHwXGCzhuzEYXGHYpZ7uSj+f4JKEDPucQnDgdWjC+W XZ3IZOt1QZJzF/izOMS3FhmUGGoz/V1BgJtidmkzkVtOqb01KZuM6iPCEyMHZdhAq2v6 LiDgkOVxuoKX/TdfMCCpB7c2mQodwZMjm/bcAVkExWnrtsXa8NNslHXvm72vdnv1JhNa jdtw== X-Forwarded-Encrypted: i=1; AJvYcCXOBfJVwR9uoYnJbtWUWaK3I8jVkssuTi+VSTno53dWOS3R3F5BcGg+r1E+4/+DDiBmF87doNN335wejK0=@vger.kernel.org X-Gm-Message-State: AOJu0YwrnIZYnmVs/e65/l4Bp2/GKc8T+GJtWvhHhuTmsvyiZ35r4U8E Ha+L+9OuA+4WAjmYy9Po4ze4AnnpNa9n7DXAJfOZpmaT7OR2Gj6PjVh5v8aMgpgXHaB7omJRhha zmId+JuTicOuIsNhVMMEAevuyD8aED86KywutKDn2WgKQYZinNKlpxEbVAOm3PW8U0KE= X-Gm-Gg: ASbGncuDWPi97DijPklJqyqeG9yy2Z02y2m0JYprcAjM2ndFmnOp0hvDs1cu/b4QSpH vebd01jupznwJIT93A2GD0LE8ZUZSHia/60sRDwNQVkSEvyOCTvBbKf1+iBm+XjciEMd5AZTNrl kXdIdq8paVysRgI1p5klmHBQfSetxRpcWlT0nprR2b29WUYnex3lVwjMe1mQZmv4oAAaxgGUYAT W1irK1TJfOWpibEOAChvSw3flrHLTPWPaFVlf6zU/ziY06qnjnpGf2sEjuR5ssIrRzfMUHAnowO 6KOZH22aO4KuH/uq8hxhoQV9S/eTznQHd+zipO00Jx4Gb+DPmb5i2BibE2nun2C0D9l6u+3/usv X X-Received: by 2002:a17:90b:1ccc:b0:313:271a:af56 with SMTP id 98e67ed59e1d1-31c9e78d9fcmr9191652a91.30.1752756528367; Thu, 17 Jul 2025 05:48:48 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHRdKlC16lxkWUCUZhw0+fz+yA0Fr68ZbmeflAPY4PRaTdeyJr/foHYSUxJAaxMSb2tkmP1bQ== X-Received: by 2002:a17:90b:1ccc:b0:313:271a:af56 with SMTP id 98e67ed59e1d1-31c9e78d9fcmr9191603a91.30.1752756527883; Thu, 17 Jul 2025 05:48:47 -0700 (PDT) Received: from hu-spratap-hyd.qualcomm.com ([202.46.22.19]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-31caf828a0esm1505283a91.42.2025.07.17.05.48.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Jul 2025 05:48:47 -0700 (PDT) From: Shivendra Pratap Date: Thu, 17 Jul 2025 18:16:54 +0530 Subject: [PATCH v11 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: <20250717-arm-psci-system_reset2-vendor-reboots-v11-8-df3e2b2183c3@oss.qualcomm.com> References: <20250717-arm-psci-system_reset2-vendor-reboots-v11-0-df3e2b2183c3@oss.qualcomm.com> In-Reply-To: <20250717-arm-psci-system_reset2-vendor-reboots-v11-0-df3e2b2183c3@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=1752756455; l=7454; i=shivendra.pratap@oss.qualcomm.com; s=20250710; h=from:subject:message-id; bh=dzfywuUuVDRiw0cxEMBMzlxkHVeafnNl2y+/gY2scNQ=; b=5xhLKNPQS9288lBeKvndsb2ahvA45N7vW93WeXRvHYkiJ3x0JHi1/4pHQT6SKD9hbWK6UZK/C QFftekoiK3iCxfTUpVKLTbdmPu/sUWAZDSDiJeONjmSnzidTJWdlBoA X-Developer-Key: i=shivendra.pratap@oss.qualcomm.com; a=ed25519; pk=CpsuL7yZ8NReDPhGgq6Xn/SRoa59mAvzWOW0QZoo4gw= X-Authority-Analysis: v=2.4 cv=dKimmPZb c=1 sm=1 tr=0 ts=6878f131 cx=c_pps a=vVfyC5vLCtgYJKYeQD43oA==:117 a=fChuTYTh2wq5r3m49p7fHw==:17 a=IkcTkHD0fZMA:10 a=Wb1JkmetP80A:10 a=EUspDBNiAAAA:8 a=VwQbUJbxAAAA:8 a=I4qJSSq-i-5ETPqSmjYA:9 a=QEXdDO2ut3YA:10 a=rl5im9kqc5Lf4LNbBjHf:22 X-Proofpoint-GUID: 5l1uWT_wmtQiP7mndDds3_jiMnvE3qIO X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwNzE3MDExMiBTYWx0ZWRfXyO0gpm02R5wv cw12nSeYQn85SXJ9R1IHaD3JTdXsUf5+E2IgMUyhQHRd45C/QTAeA7WwhJYL9svVWjS89EjJwXk nChXTERzI0hQahpYlZR5resjGkkCyTiRqFxHVymVvz0aszo2lXEaJnTi04+RMgZ4KaRU1iMgUtX 2Io7ehYo7qtM4pOBtLDyff34B1vyVYXR4DnZfnDmBjUfpQJj5acDgryv7L3Juu3rJa1EKfKiegL S0ZDIwgKdQUZHACcFkZHFa4eMg5CSGdlUjhkuPJvu8WTY73C2z9FE/hxczD0PCtg234HWVgxnZ6 GSEWtk2rfJonQsDSvpEytb+9pxxaRQ2NHu+6O+vkP3T4AM82Rc/AXBPOhvTcwdrlnr5Vz1MJNXq 9fs9OQUGrwGnpgbxtMa/1/giZa+bt6syck4NqxnFAQiLfXy8JNh6bm7K5mKMvPeUEr/tnK2q X-Proofpoint-ORIG-GUID: 5l1uWT_wmtQiP7mndDds3_jiMnvE3qIO 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-17_01,2025-07-17_01,2025-03-28_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 clxscore=1015 mlxlogscore=999 mlxscore=0 spamscore=0 adultscore=0 impostorscore=0 priorityscore=1501 suspectscore=0 bulkscore=0 phishscore=0 lowpriorityscore=0 classifier=spam authscore=0 authtc=n/a authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2505280000 definitions=main-2507170112 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 | 96 ++++++++++++++++++= +--- include/linux/reboot-mode.h | 1 + 3 files changed, 123 insertions(+), 12 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 1196627fbf98d87eec57a3d4ee544e403e6eb946..af3551fe2f625aacd31699604b7= cbdd66c318c00 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 struct mode_info *get_reboot_mode_info(struct reboot_mode_driver *r= eboot, const char *cmd) { const char *normal =3D "normal"; @@ -65,6 +68,79 @@ 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; + list_for_each_entry(info, &reboot->head, list) { + size +=3D sprintf(buf + size, "%s,", info->mode); + } + + 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); + + list_for_each_entry_safe(info, next, &reboot->head, list) { + kfree_const(info->mode); + list_del(&info->list); + kfree(info); + } + + 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 @@ -83,6 +159,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); =20 for_each_property_of_node(np, prop) { @@ -137,24 +217,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); - - list_for_each_entry_safe(info, next, &reboot->head, list) { - kfree_const(info->mode); - list_del(&info->list); - kfree(info); - } - + 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 d9d9165a8635e5d55d92197a69c7fae179ac2045..8fb35ef1c00749500a99d088b5f= 7010d57547844 100644 --- a/include/linux/reboot-mode.h +++ b/include/linux/reboot-mode.h @@ -6,6 +6,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