From nobody Mon Feb 9 10:38:50 2026 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 B06F7309EFD for ; Sun, 16 Nov 2025 15:20:14 +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=1763306416; cv=none; b=HkeVr1MKZMrPLbtqeJJMnZUK5hjjP1YD3m+vYV6ns68pzo6mxzgGmOdumEROqeG+FKxI+TAblHn6eRzZeQoNeO8PqAO1Y+lzq4TaW6wcjZEowSQRJr+Z1y58/JsAsGVcIFTgWFI6Vk0gY1qVjyMKISHm126o4CFh9o1KSMiKnIU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763306416; c=relaxed/simple; bh=x68jRFp5+Ep135r/sEE2bKgY0z0IuEd+y7yLWTo/bzo=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=M9pZwiJHoazqB1t7RP2x80iBWCZWD5/q9+bfYr18WZ/63HxQiiC3fFffEu/pSBCMifu0zZNa08rxreBPOKkI3iX58PaMUDALdsWPRAPUUqKNkLKQcX13b62fY7gQyH5GDvAWzLekQ5uikFglEdfwcx1goEN5ggySqHw7+tFEhUc= 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=cKhxYAxV; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=cAmr6PUO; 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="cKhxYAxV"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="cAmr6PUO" Received: from pps.filterd (m0279870.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 5AGDNpg81222765 for ; Sun, 16 Nov 2025 15:20:13 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= sGA9hYTr1IMErczwCUGeUfRUFMoZs5m5Jm/OUZnJOlI=; b=cKhxYAxVt3dcjW76 WH5CADuUdsLYYtsNfsDDaxyu8E4QlSxVs+rmwQoMXDuNcJibz8yZtC7Huo4g7GCL ytEAVKqbefPt0HuVTBXVGWIVr6sfUjoKwiFcC6FQcOgOznrUW7cSTajbhhcpoac8 albYH3nd1BpOcODyxxzjjKTBWQ0CFPkBk66WgHdJ0LdAwrn0Tmqq8ZErSdNDRMo/ 6nuzOSw2LYNS2DAGMGsFiDMKp3VLRY1Tb3N8DMGuVVzaTuwAL9FYthYcBG49Cvit WmmD7uqGB+/w6f88p/GCCB4w8qrFeb86dcNVRzPpfXof1/BtsOejsd8XiDy18dX0 eiXLcw== Received: from mail-pl1-f198.google.com (mail-pl1-f198.google.com [209.85.214.198]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4aejhr28ch-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Sun, 16 Nov 2025 15:20:13 +0000 (GMT) Received: by mail-pl1-f198.google.com with SMTP id d9443c01a7336-2982dec5ccbso39757825ad.3 for ; Sun, 16 Nov 2025 07:20:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1763306412; x=1763911212; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=sGA9hYTr1IMErczwCUGeUfRUFMoZs5m5Jm/OUZnJOlI=; b=cAmr6PUOvDp9kTcCo0UDg1i869HBriVOmoCBS3LXrJdnZRj8V2yNLSnYcnTivNOn51 LjM8L109A3QIURwMlEElkaYcg64WSC02r4UsMgIuMmolT0pCpt2SzDtcaDVTXm3DiiDv CCHcWqMBlLDorASkSWjBBz1fGAvZQqzvYg56MF1rjdJCaEoQUVlhFkKlgm9p9ox+KGJA 5ieh6GuFqjKds122gUa1aMMmhtUkpMxxnFkqs3OfXrwQpgRDf0/JJWYaYT2cYf5hnzIZ g0Vg28t1quOm5l0IUbA3n6Q8MgGD5TzeIx6XeQX0ioRhkY7E3yp0vamoLxo11Y4U4nX5 nKkg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763306412; x=1763911212; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=sGA9hYTr1IMErczwCUGeUfRUFMoZs5m5Jm/OUZnJOlI=; b=h6JlXOkWNuvzlcvoMFvwEB4FKio4zO5Ge+8WW9tLzGa5Lnk/tm6IgwicwqXIlvKdiP AivziugxwgFuJXAkoFwa1RPs4TULyAkO1L07M7EYkkSFLg4T+0wafpdrGt+QlCl56mhk 9hAipOJQ8TzBuR1qUvCbwwXvH0/xo1Kp3fJql06MT0M0Uxwc6CytRNgedW5tNj1R9CMB pNpkfwieIxaM9G7LT+ex+L/rVbrkpU9bFE/jGR3T3mzfjLnH/tkyPatEYLQAlleqWxo8 BRYn6zmNBsf6xs+jryhux0mrmEuTnJvTpJtIIih6toOcCF08ydEWkHciTCy2TWBffgbo C8AA== X-Gm-Message-State: AOJu0Yw3ZLIpkvuD30Vj263KQcYX51faKaHNsTZT62faFKO27dCsAOlr tEuR1tlfnkW+Ib8TxoDMeEwFO8t+q1uottTVWkhzINBxjcK9Zs2YXxOqrcWXpVg+lVJfhlxMSVU PtEdouqXjXoZG6PI5FT8tqA0rNuHXPz9efqr0LemlhCGIcampDx3iM05CB0qplHoK+6U= X-Gm-Gg: ASbGncucDVuX8LbsBn3QTbwXosaEKyomoRM5ijI3uE4ZJMg45svKvEvIokWvRyHHLmL +cgE5FRU6LkT+pXfB03wum+hOT6VpsTqgpEgC45IRnpQLE0wFDfIj4N9mlKgdgHR72Fl0xQQs8w m/yStO0pE38QtJdEgngU+kNkSMotjucHiZuLqhOFxSHttzLhIMmdBMegEwS1eLwqcQaXGwwM51/ JCons6nNL+ValU/SntnfbSPOFFIoYMkPTLsmM3EEoSwMPVkYvVfiFof6cXBxe+ve2vluxV0YVEq YtwpLpFhPPQH2ikGcZHGIxn/HBYBVbEtsRvMr1UghFifGPZhWXFC0QQP+0pMMtUYbXpaCdZaU5H 0B1grAIwAxBVTbVdxGXjgNQh6giZYnV3uQ8g= X-Received: by 2002:a17:903:3c2e:b0:26c:2e56:ec27 with SMTP id d9443c01a7336-2986a6d567emr103436545ad.19.1763306412403; Sun, 16 Nov 2025 07:20:12 -0800 (PST) X-Google-Smtp-Source: AGHT+IEz1vNpP2QFMVLYhK96pUpFR8ZiwKFWbTkTNB2NBCvXCU45AQFzxqStf/RfRDg8o44D6+uVXw== X-Received: by 2002:a17:903:3c2e:b0:26c:2e56:ec27 with SMTP id d9443c01a7336-2986a6d567emr103436295ad.19.1763306411919; Sun, 16 Nov 2025 07:20:11 -0800 (PST) Received: from hu-spratap-hyd.qualcomm.com ([202.46.22.19]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2985c241f89sm111166205ad.28.2025.11.16.07.20.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 16 Nov 2025 07:20:11 -0800 (PST) From: Shivendra Pratap Date: Sun, 16 Nov 2025 20:49:47 +0530 Subject: [PATCH 1/2] Documentation: ABI: Add sysfs-class-reboot-mode-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: <20251116-next-15nov_expose_sysfs-v1-1-3b7880e5b40e@oss.qualcomm.com> References: <20251116-next-15nov_expose_sysfs-v1-0-3b7880e5b40e@oss.qualcomm.com> In-Reply-To: <20251116-next-15nov_expose_sysfs-v1-0-3b7880e5b40e@oss.qualcomm.com> To: Sebastian Reichel , Bartosz Golaszewski , Bjorn Andersson Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-pm@vger.kernel.org, Shivendra Pratap , Sebastian Reichel X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1763306406; l=2382; i=shivendra.pratap@oss.qualcomm.com; s=20250710; h=from:subject:message-id; bh=x68jRFp5+Ep135r/sEE2bKgY0z0IuEd+y7yLWTo/bzo=; b=KW2TSEm/VotGkWV9be+AEVfXRXm+LoVnESDgwfHl2FRRusPT3QN6GlzniAKbTv6wNrOsX8E1F XrZFWDPqBYKAQOMWl5zW/OQ5BDob7VMtzUHfNf6/JEti+B2qTY/V84o X-Developer-Key: i=shivendra.pratap@oss.qualcomm.com; a=ed25519; pk=CpsuL7yZ8NReDPhGgq6Xn/SRoa59mAvzWOW0QZoo4gw= X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUxMTE2MDEyNyBTYWx0ZWRfX4YPswgfQzxOl bdw2PBlQewcC7ZkJO5y7mguD4qx9rKFLCnW3qypM+Z6caH4kmpP2dkPmlWIdw+gWclcJB2oZldF sTdJ/SJvgmt00ot7Mf8hHv6dlrw26yGcXa2VLTR0/c9ImF61fkm2D5GobeLyCon2Wjqpy4jxOpR SwG2pzgkowcUJxrqBOnkXNtvuC54paj5Kr8LPx8mAk1jMYCANta55XcHNvl0WWlezAl16/ud5RS sAbFQQBvK/pmcvFi/WcdqV9uGYOrrktfFvKcWzUdsNziifqM7Ta/qiAheEiqGLGt8g9XL/KLMmX 7+jGIS8nn6VYMoSwD+sUfM48cEnzCEhJRcBjXDIWbCyF0mf4YbFjMM45h0biT8brQ3FX7RpPz4y OSrl3Irvo9qWethIHyvG0TufE0WNKg== X-Proofpoint-GUID: ZSOoqrCBjg8_DMT2gIeLtSC_6c0BbPMi X-Authority-Analysis: v=2.4 cv=dLCrWeZb c=1 sm=1 tr=0 ts=6919ebad cx=c_pps a=MTSHoo12Qbhz2p7MsH1ifg==:117 a=fChuTYTh2wq5r3m49p7fHw==:17 a=IkcTkHD0fZMA:10 a=6UeiqGixMTsA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=QX4gbG5DAAAA:8 a=EUspDBNiAAAA:8 a=VwQbUJbxAAAA:8 a=LKyF0dicRlewKW4vAhwA:9 a=QEXdDO2ut3YA:10 a=GvdueXVYPmCkWapjIL-Q:22 a=AbAUZ8qAyYyZVLSsDulk:22 X-Proofpoint-ORIG-GUID: ZSOoqrCBjg8_DMT2gIeLtSC_6c0BbPMi X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.9,FMLib:17.12.100.49 definitions=2025-11-16_06,2025-11-13_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 priorityscore=1501 phishscore=0 adultscore=0 lowpriorityscore=0 suspectscore=0 clxscore=1015 spamscore=0 impostorscore=0 malwarescore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2510240001 definitions=main-2511160127 Add ABI documentation for /sys/class/reboot-mode/*/reboot_modes, a read-only sysfs attribute exposing the list of supported reboot-mode arguments. This file is created by reboot-mode framework and provides a user-readable interface to query available reboot-mode arguments. Reviewed-by: Sebastian Reichel Signed-off-by: Shivendra Pratap --- .../testing/sysfs-class-reboot-mode-reboot_modes | 39 ++++++++++++++++++= ++++ 1 file changed, 39 insertions(+) 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..28280ffe9bf962ef9d2136ea5d7= c6aef77c4bd34 --- /dev/null +++ b/Documentation/ABI/testing/sysfs-class-reboot-mode-reboot_modes @@ -0,0 +1,39 @@ +What: /sys/class/reboot-mode//reboot_modes +Date: November 2025 +KernelVersion: 6.18.0-rc5 +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 space + separated list of reboot-mode arguments supported + on the current platform. + Example: + recovery fastboot bootloader + + The exact sysfs path may vary depending on the + name of the driver that registers the arguments. + Example: + /sys/class/reboot-mode/nvmem-reboot-mode/reboot_modes + /sys/class/reboot-mode/syscon-reboot-mode/reboot_modes + /sys/class/reboot-mode/qcom-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. --=20 2.34.1 From nobody Mon Feb 9 10:38:50 2026 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 164A430BB8C for ; Sun, 16 Nov 2025 15:20:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763306418; cv=none; b=MjyTtoTtJ96C3/w4Q8JYNtKdgGzZhSwTGiPC4RdlBud5DXMVzcmC6fEPJgZYzqbIFOqwdk9xQgG8jcwjP/RYuBG2oxdmnz5wITpXbrSBjVGU3X4rVBzjXjqqBPVKazDwNtzKyXkhtzcxSDYyT0OGn4iuDgTABKNKXzfBccaA6mo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763306418; c=relaxed/simple; bh=ZtBepfXNfP9Vd9Fvqol0mLMn32NO2zO+JnUdEY5QW14=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ptc/KVf6AG5yXO2UoDrsxq+JpanH4+XdTaRAUvjYQS76KZPAr11LpH0bMWoCNh6xCd8HBUyJ27hj7BnVLg9ffNeCN/ip12RAiKWCZnW/yueLFj+s9xYjYNnZsnFrE0oXshpRkMtNd1/08gB4CYZGuYrdqZ7tmP6F7o3VICze0MA= 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=YpNVlsUS; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=IjQc+ku1; 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="YpNVlsUS"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="IjQc+ku1" Received: from pps.filterd (m0279870.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 5AGDVVcU1239594 for ; Sun, 16 Nov 2025 15:20:16 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= ewpABGkpKfdAof+4lPAMR//vcQEzIZ3zsrx2TmN8ivU=; b=YpNVlsUSMn1If3wz 8bD5cHkJqPqVnT8BPQSQw76luKcEpvxaO8nAXHznBLeHG6f2O7EJmKsEQoWGd6yg fXjEd2h2g1I4pq3EUJAQYDPKCO/buqKAk4cVCT3KC3Qv2IchhZdrSe5pV6HyHwHa 06I7bxSl8DfAmK8kS+NE9WP9IcXf13b4enXJkjk5V2rHbo+QbY19s6pq/52+6W1y H+nA1KKVaVcBBPkagVIBL9t5PJBWUM2YF7CPlMVdibpEHWBMkWCfzhE73EZkEh3f t5wovxi4HpUsjhIGTPDn8JYOopVjoMsxBBvEdP81G7OM00g0tGyekTYYo74EDlNY UWJSEA== Received: from mail-pl1-f200.google.com (mail-pl1-f200.google.com [209.85.214.200]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4aejhr28cp-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Sun, 16 Nov 2025 15:20:16 +0000 (GMT) Received: by mail-pl1-f200.google.com with SMTP id d9443c01a7336-297f48e81b8so57458525ad.0 for ; Sun, 16 Nov 2025 07:20:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1763306415; x=1763911215; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=ewpABGkpKfdAof+4lPAMR//vcQEzIZ3zsrx2TmN8ivU=; b=IjQc+ku1USblPJtM8ZTFnPoMWFOLIRnMtHvF8LqrpPO1u632JV+alIXxuLf38NrS1+ yCbrmTFblUSXSPuBEWIx45re2lMHFZupoegiesa+taVGe6TQYfCicwQrgAYbQGEzFCLa aNxv6RwhkhohSqw6qQlwU0hHkuGHcIps9kSS11YSkhK7Z/KonRUCKCmLQtb71Bxp0Ntv YGt/JGplTi60mavoXCs12sneEqp9wpjLxLaFrI1xE0YLx7A9Mg/vAAbguuqNBscgeaVy VZo/8qJw/h56lsMU1ly5AG6BGds8c5aTWqqyLf0Tl3chZLDDDWAJy3xcS4ws1bjvZWSp 7Epw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763306415; x=1763911215; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=ewpABGkpKfdAof+4lPAMR//vcQEzIZ3zsrx2TmN8ivU=; b=nMeIyOv9xulnHOG2pq1t1dxRsKZOXqCtjVFH1BBcAfpbycoNNW5EufbNfESgz76Rmc eodeGBBDmwYme6OyQMoLDCgVeVwqsEiYMK360OIuoTaPgvgILTu8YoZEm0sBeXGAvJj8 2gCvJLgdk6ZmDqXs2xLDZUPPQrE1lvJeFxH4PS5crhjR1BmH4kaghXdwy9hdM6Z3UKkq A/no2MVLhrv89yHEOj7yVAmLC0xFDcuvjq8tQ21pJQXq3Y0Fq0/jFFdCs2svPp7NbCMl 1M+8fn3uSZMhKVQWIpKKrSZs0IW79pg01S/QHXCvuNpqo2j/Nse2bxypH+5sc6+j9wQA k18g== X-Gm-Message-State: AOJu0YxGm4FGezSekHMVo0xMKWl+b9l6L4DUkvsCFos5bSPLopjC7HaS 5cAX6j6dbPmyy4sGhuNWrlUlH6cK6swUAZlSLzVYj/qkhXq7n3KFY8Qe2u0NCRyW7gCbq+VkqMC LoB/o+ZmeH1SjH2z0h7r5O9JMjbKrc7mzFo4yA73+68gWtNZD6AkZro6eT69AQprlWfRPESRBpp g= X-Gm-Gg: ASbGncs2qtUXa/cULBFjHcH68nRsd8SNkT0iG8wUihqIHX/l16hCIdLgJfrUBRGkV4H IccPo27oEc7tWYvTw1s1hjTTzwpxBFJ05hqdo7YF+Hl6Ox6lME96yxuUQxvrRqfIDBzxZdAKOgC j8KndNHaDsZb5k+e7ymzLksT1oyRvzIpUD8R6SCMGjvs6YsqH6cU64Q2sJsnwd9lqupet0Z5xw5 daUBVHFZWKQihKDRPdVVS7/gpVqLm6mYF/npD8DGJXZrSzomtOJbHvEQM4Rrzu0M0Kz9b7e1scU 9fD48izLT+w6NIFM28VZGTcV4s7O7tjaz6iD5tVT82/m3+p5yZWX2+qPLgVGwX1q18dKeM9KFT8 n/Ru/cMuZUgQxUzBKy+jQAdV1gP9lczi0mtc= X-Received: by 2002:a17:902:da81:b0:295:96bc:8698 with SMTP id d9443c01a7336-29867f92114mr109667735ad.19.1763306414892; Sun, 16 Nov 2025 07:20:14 -0800 (PST) X-Google-Smtp-Source: AGHT+IGUR8jLj88wIIf0FT51OOczIH022Q0TKoHXMgGFMRInkMbIf18ICcoUzzrUCfhXd/Vb1SfmUg== X-Received: by 2002:a17:902:da81:b0:295:96bc:8698 with SMTP id d9443c01a7336-29867f92114mr109667545ad.19.1763306414430; Sun, 16 Nov 2025 07:20:14 -0800 (PST) Received: from hu-spratap-hyd.qualcomm.com ([202.46.22.19]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2985c241f89sm111166205ad.28.2025.11.16.07.20.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 16 Nov 2025 07:20:14 -0800 (PST) From: Shivendra Pratap Date: Sun, 16 Nov 2025 20:49:48 +0530 Subject: [PATCH 2/2] 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: <20251116-next-15nov_expose_sysfs-v1-2-3b7880e5b40e@oss.qualcomm.com> References: <20251116-next-15nov_expose_sysfs-v1-0-3b7880e5b40e@oss.qualcomm.com> In-Reply-To: <20251116-next-15nov_expose_sysfs-v1-0-3b7880e5b40e@oss.qualcomm.com> To: Sebastian Reichel , Bartosz Golaszewski , Bjorn Andersson Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-pm@vger.kernel.org, Shivendra Pratap X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1763306406; l=5218; i=shivendra.pratap@oss.qualcomm.com; s=20250710; h=from:subject:message-id; bh=ZtBepfXNfP9Vd9Fvqol0mLMn32NO2zO+JnUdEY5QW14=; b=SmkzVXNdbmQwayygGGczzgYkY8viIOj8rWoujItwOjAczz/dhPZ4nONtj5ROCcSIfOFr3PFJC rkIyuNjHWysAf9ydKpcP/VWbqusFWtCH/qUdP1DBKpFZaw8mK7E/NFy X-Developer-Key: i=shivendra.pratap@oss.qualcomm.com; a=ed25519; pk=CpsuL7yZ8NReDPhGgq6Xn/SRoa59mAvzWOW0QZoo4gw= X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUxMTE2MDEyNyBTYWx0ZWRfX0tTry+gZJElp Q/aqagixt6xL6q4pTJcG6h5EW2Ektlmxrdf2mp2LE2flaOY7gQazXkMKls3ivtXhZ0pRcvgILja EKnp4UuydvpgjO6wxjD2/Tb77aWWWMsuWTSD7s8urK6fv6RXMd1FRpqFrHfKfbVfYFglynz97Sy Em6v04ZhaMfytb78s5joUeN3rHCWSFywYZJDavAw3yKDH/hmL6EbY8Kgm+bxw+tvN/gV2gqmCDN R66IAVWO6piAfGd/Jl2LLdyO7sEmIPXy0zbMbxBLGQn6RDcFQ4zlmAvH46l++KoLH6OXj1A1tqJ yO+nLtx52MR0eUBd1Osrp5qKNu5cJ8RPPxZRrBVM0wn3bOzHnw2GASXLqYx6RHrZeM/0m13d/xh 0Sj61X3MeDL1CcvlqpiASnYkcBFtwg== X-Proofpoint-GUID: pLSXPSgXmszetuLywi7ufGKghJGyuARE X-Authority-Analysis: v=2.4 cv=dLCrWeZb c=1 sm=1 tr=0 ts=6919ebb0 cx=c_pps a=IZJwPbhc+fLeJZngyXXI0A==:117 a=fChuTYTh2wq5r3m49p7fHw==:17 a=IkcTkHD0fZMA:10 a=6UeiqGixMTsA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=EUspDBNiAAAA:8 a=_IXiiBmLcBuSsypf6xIA:9 a=QEXdDO2ut3YA:10 a=uG9DUKGECoFWVXl0Dc02:22 X-Proofpoint-ORIG-GUID: pLSXPSgXmszetuLywi7ufGKghJGyuARE X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.9,FMLib:17.12.100.49 definitions=2025-11-16_06,2025-11-13_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 priorityscore=1501 phishscore=0 adultscore=0 lowpriorityscore=0 suspectscore=0 clxscore=1015 spamscore=0 impostorscore=0 malwarescore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2510240001 definitions=main-2511160127 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. Use the driver_name field of the struct reboot_mode_driver to create the device. For device-based drivers, configure the device driver name as driver_name. 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. Signed-off-by: Shivendra Pratap --- drivers/power/reset/reboot-mode.c | 72 +++++++++++++++++++++++++++++++++++= ++++ include/linux/reboot-mode.h | 3 ++ 2 files changed, 75 insertions(+) diff --git a/drivers/power/reset/reboot-mode.c b/drivers/power/reset/reboot= -mode.c index fba53f638da04655e756b5f8b7d2d666d1379535..062df67735c4818cfeb894941e5= 37f19ea9d4ccb 100644 --- a/drivers/power/reset/reboot-mode.c +++ b/drivers/power/reset/reboot-mode.c @@ -7,18 +7,77 @@ #include #include #include +#include #include #include #include =20 #define PREFIX "mode-" =20 +static DEFINE_MUTEX(reboot_mode_mutex); + struct mode_info { const char *mode; u32 magic; struct list_head list; }; =20 +static ssize_t reboot_modes_show(struct device *dev, struct device_attribu= te *attr, char *buf) +{ + struct reboot_mode_driver *reboot; + struct mode_info *info; + ssize_t size =3D 0; + + reboot =3D container_of(dev, struct reboot_mode_driver, reboot_mode_devic= e); + if (!reboot) + return -ENODATA; + + list_for_each_entry(info, &reboot->head, list) + size +=3D sysfs_emit_at(buf, size, "%s ", info->mode); + + if (!size) + return -ENODATA; + + return size + sysfs_emit_at(buf, size - 1, "\n"); +} +static DEVICE_ATTR_RO(reboot_modes); + +static struct attribute *reboot_mode_attrs[] =3D { + &dev_attr_reboot_modes.attr, + NULL, +}; +ATTRIBUTE_GROUPS(reboot_mode); + +static const struct class reboot_mode_class =3D { + .name =3D "reboot-mode", + .dev_groups =3D reboot_mode_groups, +}; + +static void reboot_mode_device_release(struct device *dev) +{ + /* place holder to avoid warning on device_unregister. nothing to free= */ +} + +static void reboot_mode_create_device(struct reboot_mode_driver *reboot) +{ + static bool is_class_registered; + + reboot->reboot_mode_device_registered =3D false; + + scoped_guard(mutex, &reboot_mode_mutex) { + if (!is_class_registered) { + if (!class_register(&reboot_mode_class)) + is_class_registered =3D true; + } + } + + reboot->reboot_mode_device.class =3D &reboot_mode_class; + reboot->reboot_mode_device.release =3D reboot_mode_device_release; + dev_set_name(&reboot->reboot_mode_device, reboot->driver_name); + if (!device_register(&reboot->reboot_mode_device)) + reboot->reboot_mode_device_registered =3D true; +} + static unsigned int get_reboot_mode_magic(struct reboot_mode_driver *reboo= t, const char *cmd) { @@ -78,6 +137,8 @@ int reboot_mode_register(struct reboot_mode_driver *rebo= ot) =20 INIT_LIST_HEAD(&reboot->head); =20 + reboot_mode_create_device(reboot); + for_each_property_of_node(np, prop) { if (strncmp(prop->name, PREFIX, len)) continue; @@ -119,6 +180,11 @@ int reboot_mode_register(struct reboot_mode_driver *re= boot) list_for_each_entry(info, &reboot->head, list) kfree_const(info->mode); =20 + if (reboot->reboot_mode_device_registered) { + device_unregister(&reboot->reboot_mode_device); + reboot->reboot_mode_device_registered =3D false; + } + return ret; } EXPORT_SYMBOL_GPL(reboot_mode_register); @@ -136,6 +202,11 @@ int reboot_mode_unregister(struct reboot_mode_driver *= reboot) list_for_each_entry(info, &reboot->head, list) kfree_const(info->mode); =20 + if (reboot->reboot_mode_device_registered) { + device_unregister(&reboot->reboot_mode_device); + reboot->reboot_mode_device_registered =3D false; + } + return 0; } EXPORT_SYMBOL_GPL(reboot_mode_unregister); @@ -162,6 +233,7 @@ int devm_reboot_mode_register(struct device *dev, if (!dr) return -ENOMEM; =20 + reboot->driver_name =3D reboot->dev->driver->name; rc =3D reboot_mode_register(reboot); if (rc) { devres_free(dr); diff --git a/include/linux/reboot-mode.h b/include/linux/reboot-mode.h index 4a2abb38d1d612ec0fdf05eb18c98b210f631b7f..400cfde0e029aef14ff90a11b9d= 12d0c3ce8dee6 100644 --- a/include/linux/reboot-mode.h +++ b/include/linux/reboot-mode.h @@ -5,6 +5,9 @@ struct reboot_mode_driver { struct device *dev; struct list_head head; + const char *driver_name; + struct device reboot_mode_device; + bool reboot_mode_device_registered; int (*write)(struct reboot_mode_driver *reboot, unsigned int magic); struct notifier_block reboot_notifier; }; --=20 2.34.1