From nobody Fri Sep 25 00:40:52 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 30FBD3859D7 for ; Fri, 18 Sep 2026 09:29:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789723799; cv=none; b=qfp1RKtosYM6rcvf0Kx+77F4p4LzDXLF2RRlP4lltbbY19umFLp+N8Sas9xG3q9z1GEqPxJGD/dTd+FlCJgez9H/tFCCDmMP4vNvE97y5mZZlITGLrcjNF76Sq6Dwb/V/9ranki9uPN2YU8X+JWkIcmVtKH+iRXY4ZULIpDpgZM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789723799; c=relaxed/simple; bh=bPctaCY2lwvRS0ccVaNiV0/ZxyVwkbmIvtGE9g73VEQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=L2x8PHHuhdt1emam4UOplQBNwTTjC92BW2/XmqFPpU60QLjAdzB+P3kBUPRbSxL7cBhMQroFcGGlOBuM3WNoT37DxYnY0QrFDl64Ct3QFf06gmGMP9JtK4hE7N8JFPuGidqQeuJGqLELMrqmaXFWHYMLohHZK5JBTDSXUU2HY+w= 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=O35s5EVq; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=H6w0yZkI; 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="O35s5EVq"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="H6w0yZkI" Received: from pps.filterd (m0279872.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 68I603oL3304832 for ; Fri, 18 Sep 2026 09:29:56 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=qcppdkim1; bh=mB/Kwt5G75P b96JFouwgftk6m3eSdzzkBsNoPsbIj7o=; b=O35s5EVqUWiIypavIRUAflhtRSn hGGlaZa8U4/IMhrZJ3aIQdD/hq8GzK5PVjsUfrHE+cp63bnDsmCJg5pFrew+tSe9 JwR42dFiE5wRh1/5DJWiMpeWhCWivkJJUgfjhg6wvEKsH5sIIRWTjEsy15GgZ+39 R0j622vUz7aAa2LgDEWKqKXNUZ3CUgEin8Ad00YSJFzCkwqGbgzne+ia8zzyfKdm nFvO3xJT7j8QixjJtWcoa4uuoBxwekuUyUHPvRqyxZjjhLSZ5N9hyS5iavHhqWCv PLYJIWZa0fP3OGZdUmozR4LDqUhP/DgwKRO+2h+/rQgqK7CZO4xhY94Z98g== Received: from mail-qk1-f199.google.com (mail-qk1-f199.google.com [209.85.222.199]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4grq2ktv0m-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Fri, 18 Sep 2026 09:29:56 +0000 (GMT) Received: by mail-qk1-f199.google.com with SMTP id af79cd13be357-93a08ff8451so87132485a.2 for ; Fri, 18 Sep 2026 02:29:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1789723795; x=1790328595; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=mB/Kwt5G75Pb96JFouwgftk6m3eSdzzkBsNoPsbIj7o=; b=H6w0yZkIbQsXtGSdeS7ESJRkq1sFUknd/k7TmigvM4ZL2Zsf8GoNVnhY9lnfpcmXQa BccfUIHeKbmrjZgL+gT9BlCXIDhTZfy/qxFAEOMZyh2Ub17KuYWRHKsY5U9NTj9SLujj xwZKosNIpwV22SbCbnD8mLk/YV235RqMJkQfu6igm0XyO/c2/MtpgGmLJhXKp04igiZT F4AKRnylWuqfkiROTId67aXzrzk5kyoHoocpmG+ZUn3i+mZRhN8GByFJQH4oxTlfRUJO zeQiaECa8qab/RvkqO3HI7vPLOeJOFblGISIi7V9TiPRnQdchqT479rByvfHr6YMj1zo TGkw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1789723795; x=1790328595; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=mB/Kwt5G75Pb96JFouwgftk6m3eSdzzkBsNoPsbIj7o=; b=pYOgeEOYioaU/V2mWyxFypz3IB94AniWhDPDswjI8OSvvDoYsKaxY/bVc4LxRIkwfW 41SWG+/554dC/i3pQuOvK1ryyx7b+29kzHyGCZdZqf7ylyAoOoN/tkMMLOT6Xu82pOkC n4Ml64uWCLhd3aEwxxLHScbJiatpzXkbPEskqBcJVNtsE2AGyyAG+rflcOzwR01dXjZJ 6ju1yqf92rzL6abYiXfoJxF0N2N/iazu3dkWSVLwYFIzHlhAxff49VzlY7dwA1Qox3z7 Rwc35lYCw9/MpdcpSniQtQ28ITC3hY9Mad5hkZxWG2CXzt+NS7k13ciUMi6X4Z1so9pT xSGQ== X-Forwarded-Encrypted: i=1; AKwUvBzfVVsSpgO59vcrlJb3eZ+3kqwioO6KLOiN0oSJFYllfJZ5mVc0oqhjOseL/U+ZEh4kAkV7Ti0yVNp4s6U=@vger.kernel.org X-Gm-Message-State: AFuF++mxY1E9zz1uBQK2EIcBd3oYn+6lKTCIVQvY0GlCdEL3t6sZV6pC cXvTFQJybWwK5W13sovgQqo4XTJ9/THchpztPLacGnmhueDH7dEQJxpXEFb07BCCdduXZTjGc0g bhtoRiAVqkR0V/MHhfPqSUfyl76jGwlJCZ6welpXtSBkJHyO/SPUuq4yic5oFqKiFFTM= X-Gm-Gg: AYBFou2j4FkGIKSDcEzSUlsl3kpMvgKRahpUGhhKCF+k+prIkCnjZ6ZhfMGSPxz0b1M o58OZWTr2rj49Xx0o9e9z2fZuQtHh9qjAt5rLwrRfkc2cf6a4c6uvUMwS6lUbihh47L546XuYnr 2EqIt1XYMSI41ho9fmRWbmdGtRW4hTkQGEGVzBYFpHLPVY3Ojolb2ozhY1KwwJH/zrnC1PAGwaY T55tnKOcQ3GsQByMKVEQjHyigKSXzWGoCpEyUqXNpyGD4Kpjt4+BA/Z861XDQGOirOeu84Ssb58 jz8HezymbAt2WOKQ2JcdcGax4ICb/+PX9keq672BEHtC4EHE8f/7w3DCClk2L7Zbu3edEicCUIa ESLy638ixnDq7Mc33KR3+0Bq5NjWSm8Is1Kl8/QyLBLUFLM1wWTlx2fRTcZn4Em9KHueR1mwHjC QGitECUeokZtA= X-Received: by 2002:a05:620a:2b8c:b0:939:b55a:3c7 with SMTP id af79cd13be357-93bdc7abe05mr214015085a.41.1789723795319; Fri, 18 Sep 2026 02:29:55 -0700 (PDT) X-Received: by 2002:a05:620a:2b8c:b0:939:b55a:3c7 with SMTP id af79cd13be357-93bdc7abe05mr214012585a.41.1789723794867; Fri, 18 Sep 2026 02:29:54 -0700 (PDT) Received: from t14s (2001-1c00-0c32-7800-07d4-cca3-ec08-7ac7.cable.dynamic.v6.ziggo.nl. [2001:1c00:c32:7800:7d4:cca3:ec08:7ac7]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-c2a1bbc6bc0sm36796166b.60.2026.09.18.02.29.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Sep 2026 02:29:53 -0700 (PDT) From: Hans de Goede To: Bjorn Andersson , Cristian Marussi , Sudeep Holla Cc: Hans de Goede , Daniel Lezcano , Bjorn Andersson , Frank.Li@kernel.org, arm-scmi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, imx@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [PATCH v7 1/2] module: add SCMI device table alias support Date: Fri, 18 Sep 2026 11:29:50 +0200 Message-ID: <20260918092951.5656-2-johannes.goede@oss.qualcomm.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260918092951.5656-1-johannes.goede@oss.qualcomm.com> References: <20260918092951.5656-1-johannes.goede@oss.qualcomm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwOTE4MDEzMSBTYWx0ZWRfXyGgxMSbI2TUc /POCAsCOXXJXB0ueo7gyCeoMa9wTU/ocDmltetlppj93LGqIPSRfywgiyJgpXFus9gqaubBdM15 iF4Pynnss997XGphqzvQICmBZIN8dbLf2EV+ePcuDp3Ha3y3Jat3prFPwUrJLJ8O4pzoKfESCNS kAfuyMZKEWLTorQhxs6G7nJ2Kqs/u6mjZlbEjVBIeKSCef++tJ92mvN8zUNV+eyNy2FzOhE2UjL VBmvucFikMYi4IxNdHB3X02tgtw8anqiyem931kN7c/DBfbrQlJjXjNeuiFqSkHs5uUogmTS+H+ SkRXykSb/XEISA+89vRN6ehG9oslc00BqSDLPNFO1EmPxnWQmUYlyLqRRndw6gbtRK9aC0kXyAt 3IdsApKhJvtqN9E3m5LP9/KfgRos77efInW2G6exTtGLTyez3vgSy+I1oldslP7xfayfqKUSs+J 8Oa+d5OnBOL5IMHpkjg== X-Proofpoint-GUID: yG1JbfirjxLSDcGnniP_J3esxxklTCSa X-Authority-Analysis: v=2.4 cv=bcD+w+PB c=1 sm=1 tr=0 ts=6aad0494 cx=c_pps a=HLyN3IcIa5EE8TELMZ618Q==:117 a=xqWC_Br6kY4A:10 a=VdqzKS8jKosA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=yx91gb_oNiZeI1HMLzn7:22 a=bC-a23v3AAAA:8 a=EUspDBNiAAAA:8 a=NbjprmzQH6tOvfj-_-IA:9 a=bTQJ7kPSJx9SKPbeHEYW:22 a=FO4_E8m0qiDe52t0p3_H:22 X-Proofpoint-Spam-Info: AW1haW4tMjYwOTE4MDEzMSBTYWx0ZWRfX0uXd2u3kyj8h ZqF2jQxRGzPZVRH0YYmxWyudXMfaO8LgorLkFb9D15/C8w35QHPXDmOJCSBLAWQ1nJicheVvodl jwYpUpfO6zv8pQzJUiT988fE0x8abhY= X-Proofpoint-ORIG-GUID: yG1JbfirjxLSDcGnniP_J3esxxklTCSa X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-09-18_02,2026-09-16_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 clxscore=1015 adultscore=0 suspectscore=0 priorityscore=1501 bulkscore=0 phishscore=0 impostorscore=0 lowpriorityscore=0 malwarescore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2609040000 definitions=main-2609180131 Content-Type: text/plain; charset="utf-8" From: Bjorn Andersson SCMI client drivers already describe their bus match data with MODULE_DEVICE_TABLE(scmi, ...), but modpost does not know how to consume SCMI device tables. As a result, SCMI modules do not get generated module aliases from their id tables. Move struct scmi_device_id to mod_devicetable.h so it has a fixed layout visible to modpost, add the corresponding generated offsets and teach file2alias to emit scmi:: aliases. Use the same stable alias format for SCMI device uevents and sysfs modaliases. The previous string included the instance-specific device name, which is not useful for matching modules. Assisted-by: Codex:GPT-5.5 Reviewed-by: Hans de Goede Tested-by: Hans de Goede Signed-off-by: Bjorn Andersson Signed-off-by: Hans de Goede Acked-by: Uwe Kleine-K=C3=B6nig Tested-by: Daniel Lezcano # Lenovo=20 Tested-by: Rob Clark --- Changes in v7: - Rebase on top of v7.3-rc3 Changes in v4: - Drop unused driver_data member from struct scmi_device_id (Uwe) - Drop device-id/scmi.h include from mod_devicetable.h (Uwe) - Add device-id/scmi.h to devicetable-offsets.c and file2alias.c (Uwe) Changes in v3: - Adjust for ad428f5811bd ("mod_devicetable.h: Split into per subsystem headers") - Add '\n' to modalias_show() output, matching other subsystems' modalias Changes in v2: - Drop #include from scmi_protocol.h - Link to v1: https://patch.msgid.link/20260616-scmi-modalias-v1-0-662b8dd5= 2ab2@oss.qualcomm.com --- MAINTAINERS | 1 + drivers/firmware/arm_scmi/bus.c | 21 ++++++++++----------- include/linux/device-id/scmi.h | 17 +++++++++++++++++ include/linux/scmi_protocol.h | 6 +----- scripts/mod/devicetable-offsets.c | 5 +++++ scripts/mod/file2alias.c | 12 ++++++++++++ 6 files changed, 46 insertions(+), 16 deletions(-) create mode 100644 include/linux/device-id/scmi.h diff --git a/MAINTAINERS b/MAINTAINERS index c2414447892c..f351ec56a2ec 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -26604,6 +26604,7 @@ F: drivers/pmdomain/arm/ F: drivers/powercap/arm_scmi_powercap.c F: drivers/regulator/scmi-regulator.c F: drivers/reset/reset-scmi.c +F: include/linux/device-id/scmi.h F: include/linux/sc[mp]i_protocol.h F: include/trace/events/scmi.h F: include/uapi/linux/virtio_scmi.h diff --git a/drivers/firmware/arm_scmi/bus.c b/drivers/firmware/arm_scmi/bu= s.c index e060edbe7e83..51de50fbc382 100644 --- a/drivers/firmware/arm_scmi/bus.c +++ b/drivers/firmware/arm_scmi/bus.c @@ -12,11 +12,12 @@ #include #include #include +#include #include =20 #include "common.h" =20 -#define SCMI_UEVENT_MODALIAS_FMT "%s:%02x:%s" +#define SCMI_UEVENT_MODALIAS_FMT SCMI_MODULE_PREFIX "%02x:%s" =20 BLOCKING_NOTIFIER_HEAD(scmi_requested_devices_nh); EXPORT_SYMBOL_GPL(scmi_requested_devices_nh); @@ -185,7 +186,7 @@ static int scmi_protocol_table_register(const struct sc= mi_device_id *id_table) const struct scmi_device_id *entry; int ret; =20 - for (entry =3D id_table; entry->name; entry++) { + for (entry =3D id_table; entry->name[0]; entry++) { ret =3D scmi_protocol_device_request(entry); if (ret) goto err_unrequest; @@ -205,7 +206,7 @@ scmi_protocol_table_unregister(const struct scmi_device= _id *id_table) { const struct scmi_device_id *entry; =20 - for (entry =3D id_table; entry->name; entry++) + for (entry =3D id_table; entry->name[0]; entry++) scmi_protocol_device_unrequest(entry); } =20 @@ -219,10 +220,10 @@ static int __scmi_dev_match_by_id_table(struct scmi_d= evice *scmi_dev, const struct scmi_device_id *id_table, bool skip_transport) { - if (!id_table || !id_table->name) + if (!id_table || !id_table->name[0]) return 0; =20 - for (; id_table->protocol_id && id_table->name; id_table++) + for (; id_table->protocol_id && id_table->name[0]; id_table++) if (id_table->protocol_id =3D=3D scmi_dev->protocol_id && !(skip_transport && scmi_device_is_transport(scmi_dev)) && !strcmp(id_table->name, scmi_dev->name)) @@ -266,7 +267,7 @@ scmi_child_dev_find_get(struct device *parent, int prot= _id, const char *name) struct device *dev; =20 id_table[0].protocol_id =3D prot_id; - id_table[0].name =3D name; + strscpy(id_table[0].name, name, sizeof(id_table[0].name)); =20 dev =3D device_find_child(parent, &id_table, scmi_match_by_id_table); if (!dev) @@ -300,8 +301,7 @@ static int scmi_device_uevent(const struct device *dev,= struct kobj_uevent_env * const struct scmi_device *scmi_dev =3D to_scmi_dev(dev); =20 return add_uevent_var(env, "MODALIAS=3D" SCMI_UEVENT_MODALIAS_FMT, - dev_name(&scmi_dev->dev), scmi_dev->protocol_id, - scmi_dev->name); + scmi_dev->protocol_id, scmi_dev->name); } =20 static ssize_t modalias_show(struct device *dev, @@ -309,9 +309,8 @@ static ssize_t modalias_show(struct device *dev, { struct scmi_device *scmi_dev =3D to_scmi_dev(dev); =20 - return sysfs_emit(buf, SCMI_UEVENT_MODALIAS_FMT, - dev_name(&scmi_dev->dev), scmi_dev->protocol_id, - scmi_dev->name); + return sysfs_emit(buf, SCMI_UEVENT_MODALIAS_FMT "\n", + scmi_dev->protocol_id, scmi_dev->name); } static DEVICE_ATTR_RO(modalias); =20 diff --git a/include/linux/device-id/scmi.h b/include/linux/device-id/scmi.h new file mode 100644 index 000000000000..1b4ccfa9dcc5 --- /dev/null +++ b/include/linux/device-id/scmi.h @@ -0,0 +1,17 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +#ifndef LINUX_DEVICE_ID_SCMI_H +#define LINUX_DEVICE_ID_SCMI_H + +#ifdef __KERNEL__ +#include +#endif + +#define SCMI_NAME_SIZE 32 +#define SCMI_MODULE_PREFIX "scmi:" + +struct scmi_device_id { + __u8 protocol_id; + char name[SCMI_NAME_SIZE]; +}; + +#endif /* ifndef LINUX_DEVICE_ID_SCMI_H */ diff --git a/include/linux/scmi_protocol.h b/include/linux/scmi_protocol.h index 5ab73b1ab9aa..ba53302d95f5 100644 --- a/include/linux/scmi_protocol.h +++ b/include/linux/scmi_protocol.h @@ -9,6 +9,7 @@ #define _LINUX_SCMI_PROTOCOL_H =20 #include +#include #include #include #include @@ -951,11 +952,6 @@ struct scmi_device { =20 #define to_scmi_dev(d) container_of_const(d, struct scmi_device, dev) =20 -struct scmi_device_id { - u8 protocol_id; - const char *name; -}; - struct scmi_driver { const char *name; int (*probe)(struct scmi_device *sdev); diff --git a/scripts/mod/devicetable-offsets.c b/scripts/mod/devicetable-of= fsets.c index b4178c42d08f..91ec3704ee2b 100644 --- a/scripts/mod/devicetable-offsets.c +++ b/scripts/mod/devicetable-offsets.c @@ -1,5 +1,6 @@ // SPDX-License-Identifier: GPL-2.0 #define COMPILE_OFFSETS +#include #include #include =20 @@ -144,6 +145,10 @@ int main(void) DEVID(rpmsg_device_id); DEVID_FIELD(rpmsg_device_id, name); =20 + DEVID(scmi_device_id); + DEVID_FIELD(scmi_device_id, protocol_id); + DEVID_FIELD(scmi_device_id, name); + DEVID(i2c_device_id); DEVID_FIELD(i2c_device_id, name); =20 diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c index 8d36c74dec2d..5379b1def07b 100644 --- a/scripts/mod/file2alias.c +++ b/scripts/mod/file2alias.c @@ -121,6 +121,7 @@ typedef struct { /* Big exception to the "don't include kernel headers into userspace, which * even potentially has different endianness and word sizes, since * we handle those differences explicitly below */ +#include "../../include/linux/device-id/scmi.h" #include "../../include/linux/mod_devicetable.h" =20 struct devtable { @@ -852,6 +853,16 @@ static void do_rpmsg_entry(struct module *mod, void *s= ymval) module_alias_printf(mod, false, RPMSG_DEVICE_MODALIAS_FMT, *name); } =20 +/* Looks like: scmi:NN:S */ +static void do_scmi_entry(struct module *mod, void *symval) +{ + DEF_FIELD(symval, scmi_device_id, protocol_id); + DEF_FIELD_ADDR(symval, scmi_device_id, name); + + module_alias_printf(mod, false, SCMI_MODULE_PREFIX "%02x:%s", + protocol_id, *name); +} + /* Looks like: i2c:S */ static void do_i2c_entry(struct module *mod, void *symval) { @@ -1491,6 +1502,7 @@ static const struct devtable devtable[] =3D { {"virtio", SIZE_virtio_device_id, do_virtio_entry}, {"vmbus", SIZE_hv_vmbus_device_id, do_vmbus_entry}, {"rpmsg", SIZE_rpmsg_device_id, do_rpmsg_entry}, + {"scmi", SIZE_scmi_device_id, do_scmi_entry}, {"i2c", SIZE_i2c_device_id, do_i2c_entry}, {"i3c", SIZE_i3c_device_id, do_i3c_entry}, {"slim", SIZE_slim_device_id, do_slim_entry}, --=20 2.55.0 From nobody Fri Sep 25 00:40:52 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 CBF0C3A8755 for ; Fri, 18 Sep 2026 09:29:58 +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=1789723800; cv=none; b=GDxPZEx8kXJ6jx3SMNLwPTGqHwga8PoysGsm9YpDo1ik7eM+rVchHRBsoUOquR2ED24VvCf1+BYnEGEJ691ttATuNEQK4kcj7gpoyiwMwaSrYIm0+XoouLC/XaoBFzR9PAAMzXVMRQfOszUMT5ave2loarfM6x0Eebj1Li1mGBM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789723800; c=relaxed/simple; bh=uY6a10tUUeLOvhvoLxhXzCg2bACGOAn9guxhSnZlLwo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=bGFy1bcuk4Kj8xXNWfp0hngCO5RwxmwRs0gjJBgAQd9t/vuekPK1bXY+QuUpVT9Nz+plCSiTRvATB1BZP+7Naz7rC9wlwD+aR6L03onrpon1cWbJFBgoMHD50y5axFkAm6p2VDBQYu4C8QcPBk0SiCGikJUNDLDcVp3Zym1BC1Q= 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=mCZE6l73; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=eh6JzLRW; 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="mCZE6l73"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="eh6JzLRW" Received: from pps.filterd (m0279868.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 68I5xsvi3834552 for ; Fri, 18 Sep 2026 09:29:57 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=qcppdkim1; bh=csYgVbrv8Ts eQaIQhbFcx/zPAvB5tHhPbrMBPJ1Wxu4=; b=mCZE6l73Y99dQjjmqPKu2F13UgC Q8V6oDKEg/X6rz6xoc1GT1KKWqTXhm0rQJn3veEbxmZHEuLMuYWe34bOeUeKpWBi xFIh4CZoFwUhPDjQGhqm9gxoRdxq2xKMrGMzksLWjU9SVxVggquzs8cocmjE3bhI 4FAVUsIZEoU6MD5QMlRjMkzF5UgHsWJJBiOgbtURNaNSQKxPlCkRfu5JRoMXzO/i ME0VzaYGzfEwNdQkKO3ropG/elYyQj3vOrUNuqYZjbueobr6eXHOzIYIzqisMb0l KJNLjlLHhN9TIHrd/O5TujJz8/ymATdskrcA4LG8nDAD1Xeju9n+YPZhsgg== Received: from mail-qk1-f200.google.com (mail-qk1-f200.google.com [209.85.222.200]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4gry2bryjq-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Fri, 18 Sep 2026 09:29:57 +0000 (GMT) Received: by mail-qk1-f200.google.com with SMTP id af79cd13be357-93be6ed214eso8068485a.2 for ; Fri, 18 Sep 2026 02:29:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1789723797; x=1790328597; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=csYgVbrv8TseQaIQhbFcx/zPAvB5tHhPbrMBPJ1Wxu4=; b=eh6JzLRWUMv7IBe81EhuCqg5N/wbHU2joI7+9JczGjgzjuramBT+zN56LFrDQ5W6BO BgT8kinI2TnAFI5Ok8363BO+LLSwDDWOq9CDcvVJwjcVrNLgUEaR6P1gTszhAPWfxPC+ 0UiCNz9IGJrpZ/258QZDkL7jj858JMJc1/hzuqNSdz83GXM8XcXe8GSsXZjUA27n+VlP C1xuTAJvHISP18E8I8zXAI5yascsgHNHWMFQNhssXVxmOL9tkFUwYsBTykeAWg/xAtaP bjjg9m6vBZPBFBNlnvaDHG1ZGaIWsTsvirFHbgwmITLjqz425RLNZd78w2jzPpjITOsx UESA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1789723797; x=1790328597; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=csYgVbrv8TseQaIQhbFcx/zPAvB5tHhPbrMBPJ1Wxu4=; b=dqeodknkw2Ej+UJtyjXTlHgtKJZI/GXr4vaf1PIipFqSLTxFDvywpMFkjUuBYH0Cve S+SqtgxfDnIJ+Yz9157YOC92aXcRwddZ8SwIaISsjMXeRPvesBWzBa/6+/e8alk2Xqks G0yNTiJwcYu8UdmwWaJiHQjC564VDB3OWudOmNSk34wLbyaO0qhZXJEQ6BF6TC/mJ9sl 1qC7+FerDagUOLJZpDdV59oNoaP8x1zEqka7jfRbatqFaszwtbzCyNXe50ghcJHOJVGC CZAjgbM15zQtTesQvx6t0W1kxXkzhdwnPjBIoOTLK/XzmE7o55+htn5KEFh7ETRSB7j6 2low== X-Forwarded-Encrypted: i=1; AKwUvBwkD+gUatqKT0MTXXMYi+X6gHVBVOsEzdLMGgIY1+o01991MXzBiJt+4+tI1wTh3UYu0Zs/6vGsXtKc++Q=@vger.kernel.org X-Gm-Message-State: AFuF++n1FW7mop/+ApGgMRFWQvR6c757//zmnJMALhtW+3YK6AEus8Yy 7rcvY6Yi4H5C2gwgY7+EDFsTvBjnCZ0jYbEBEFnNsv9IvDJT0meTHVJi0kycSwXw/P2SNypELja 8qGvfr1WdmjbmGfAzYLN50pbcgGHCx9Yo0z9Flfdmbp/r/Vsf0tKvzPKbMnWUKmDj6Vo= X-Gm-Gg: AYBFou0nA2cbOcm9QP0zBw2/FagB2SPh5Fbrlh/M927qBqjFvccNjudNTjC2w2BI8Xi ChW3QgYhPB15/OpgxmQo6VYVpJ4TBNhofeLlMwf2piQ429lkDevF7RyJNokK3ArBqPE5GOVKEbf d7YYj8P92fo62gHP8MEqmmG5tCvJFyFwsZ0ul2Y9BkXEFjBlc9VffQLnH2tfjHetmyJYSpoFYcS xXpLQGS9wgi734K3dAfn5Vu4Hng1Ivh6R76JPEJGzq9JI7Z2hfAT6F9HWJtcOA2BIsPATXa0ETe zmMG01Mwws8HoFIMIi20vJyNEbbHLcAv4F5X/Gneahgg7UHWcA9QmGelruayhbQzlAJ8kNXx4Am KDhh26QicKOwamhGEDBVnAGCLXMu1olbekq2fjWcWjQL3D3X+21+wKhefotavmn+9nlzeSMqFF0 rfe2+lC4enQpc= X-Received: by 2002:a05:620a:268d:b0:934:ab73:ac53 with SMTP id af79cd13be357-93bdc475a1fmr222769985a.0.1789723796774; Fri, 18 Sep 2026 02:29:56 -0700 (PDT) X-Received: by 2002:a05:620a:268d:b0:934:ab73:ac53 with SMTP id af79cd13be357-93bdc475a1fmr222767585a.0.1789723796258; Fri, 18 Sep 2026 02:29:56 -0700 (PDT) Received: from t14s (2001-1c00-0c32-7800-07d4-cca3-ec08-7ac7.cable.dynamic.v6.ziggo.nl. [2001:1c00:c32:7800:7d4:cca3:ec08:7ac7]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-c2a1bbc6bc0sm36796166b.60.2026.09.18.02.29.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Sep 2026 02:29:55 -0700 (PDT) From: Hans de Goede To: Bjorn Andersson , Cristian Marussi , Sudeep Holla Cc: Hans de Goede , Daniel Lezcano , Bjorn Andersson , Frank.Li@kernel.org, arm-scmi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, imx@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [PATCH v7 2/2] firmware: arm_scmi: Always create devices for standard protocols Date: Fri, 18 Sep 2026 11:29:51 +0200 Message-ID: <20260918092951.5656-3-johannes.goede@oss.qualcomm.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260918092951.5656-1-johannes.goede@oss.qualcomm.com> References: <20260918092951.5656-1-johannes.goede@oss.qualcomm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwOTE4MDEzMSBTYWx0ZWRfX+UKq4MYganmT xM3Pbg6ktDJz2WOjQcI+PvwoR4v2IAfv9VAARpv5M0RJcPxBzdEvkxc3E2UXRS+Xka6n7EzBtk0 RbvGASDv95ufyA30r3V6kxRDKoeiqpNmRJ7uAZYJqo8iXXUy+og4z9SjSl1ZkfdbKsjVsVXJq9Q eyeVUzN2P5jZi26N6ZxU/+A4mAqmZ9xidEXY3FMIIj2p7/mqN81DuAZJZYQ0noI+gI/SmLIXOnY hbbVpCazeveBufEeEXmcEdpdo3cW6NwpPN/19gIC0K3hgJD7IxlPVnHhuK9c/gBa9mL8rjYEHnC 3M2qIc/Y8PV0Y+grDZw/lK2YtlwlMD2nL8FSTYVFDaEZO0QuM7EdxbO5EyWJxvq2bkHj4y3ma1n W3+ty6IC3DlAgzhZwaE0ADNUi9qzj291VItZHfLZZ1F+ErkMuk8h3UFQlAwKt0Ur5y6WSrbRnbs f9pcSPGT0PYeS7wwvvw== X-Proofpoint-GUID: nY7ZJtiBcraHOKnkVHV1FkLgmo-pPLdX X-Authority-Analysis: v=2.4 cv=bYP+w+PB c=1 sm=1 tr=0 ts=6aad0495 cx=c_pps a=hnmNkyzTK/kJ09Xio7VxxA==:117 a=xqWC_Br6kY4A:10 a=VdqzKS8jKosA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=ZpdpYltYx_vBUK5n70dp:22 a=EUspDBNiAAAA:8 a=l971TreVHldC-rsvbM8A:9 a=PEH46H7Ffwr30OY-TuGO:22 X-Proofpoint-Spam-Info: AW1haW4tMjYwOTE4MDEzMSBTYWx0ZWRfX3M8f/SXe90Cz 8Fr4K6eZJaUIHRNWrqQ/KOAZU86iruJs4rNA/7ynRtXKyjEZTGEgCo2nURl8VRn+L3BZX7ULxXp 8EItZIoC5ZelLr2S0dOWluYA5oNe508= X-Proofpoint-ORIG-GUID: nY7ZJtiBcraHOKnkVHV1FkLgmo-pPLdX X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-09-18_02,2026-09-16_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 priorityscore=1501 impostorscore=0 bulkscore=0 clxscore=1015 suspectscore=0 spamscore=0 lowpriorityscore=0 phishscore=0 malwarescore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2609040000 definitions=main-2609180131 Content-Type: text/plain; charset="utf-8" Protocol driver module auto-loading requires the devices to already be created for udev to get the necessary uevents based on which udev loads modules. But SCMI devices are only created after their { protocol, name } device-id has been added to the requested-devices list which is done from scmi_driver_register(). This creates a circular dependency where device creation is waiting for the driver to register and loading the module with the driver is waiting for the device to be created. Add a list of standard protocol device-ids and always create devices for these without relying on these being added to the requested-devices list. This removes the circular dependency, fixing module auto-loading. Signed-off-by: Hans de Goede --- Changes in v7: - Rebase on top of v7.3-rc3 Changes in v6: - Replace the if (!phead) return NULL; early exit with return scmi_dev; Since a standard protocol device may have been created at this point (Shashiko). Changes in v5: - This is a new patch in v5 replacing "Pre-register protocol, name tupples for standard protocol". Pre-registering requires scmi_protocol_device_request() to allow duplicate device-ids, but then if the first driver of two with duplicate devce-ids gets unloaded device creation for the second driver will fail. Allowing duplicates causes all kinds of problems, so this new approach avoids this. --- drivers/firmware/arm_scmi/bus.c | 50 +++++++++++++++++++++++++++++++-- 1 file changed, 47 insertions(+), 3 deletions(-) diff --git a/drivers/firmware/arm_scmi/bus.c b/drivers/firmware/arm_scmi/bu= s.c index 51de50fbc382..31365d59b98a 100644 --- a/drivers/firmware/arm_scmi/bus.c +++ b/drivers/firmware/arm_scmi/bus.c @@ -533,6 +533,34 @@ _scmi_device_create(struct device_node *np, struct dev= ice *parent, return sdev; } =20 +/* Standard protocols table */ +static const struct scmi_device_id scmi_std_id_table[] =3D { + { SCMI_PROTOCOL_POWER, "genpd" }, + { SCMI_PROTOCOL_SYSTEM, "syspower" }, + { SCMI_PROTOCOL_PERF, "perf" }, + { SCMI_PROTOCOL_PERF, "cpufreq" }, + { SCMI_PROTOCOL_CLOCK, "clocks" }, + { SCMI_PROTOCOL_SENSOR, "hwmon" }, + { SCMI_PROTOCOL_SENSOR, "iiodev" }, + { SCMI_PROTOCOL_RESET, "reset" }, + { SCMI_PROTOCOL_VOLTAGE, "regulator" }, + { SCMI_PROTOCOL_POWERCAP, "powercap" }, + { SCMI_PROTOCOL_PINCTRL, "pinctrl" }, + { SCMI_PROTOCOL_PINCTRL, "pinctrl-imx" }, + { }, +}; + +static bool scmi_device_id_in_std_id_table(const struct scmi_device_id *id) +{ + for (int i =3D 0; scmi_std_id_table[i].name[0]; i++) { + if (scmi_std_id_table[i].protocol_id =3D=3D id->protocol_id && + !strcmp(scmi_std_id_table[i].name, id->name)) + return true; + } + + return false; +} + /** * scmi_device_create - A method to create one or more SCMI devices * @@ -562,22 +590,38 @@ struct scmi_device *scmi_device_create(struct device_= node *np, { struct list_head *phead; struct scmi_requested_dev *rdev; - struct scmi_device *scmi_dev =3D NULL; + struct scmi_device *sdev, *scmi_dev =3D NULL; =20 if (name) return _scmi_device_create(np, parent, protocol, name); =20 + /* + * Always create devices for standard protocols, even if the device-ids + * have not been registered into scmi_requested_devices yet. This allows + * auto-loading of SCMI protocol driver modules for standard protocols. + */ + for (int i =3D 0; scmi_std_id_table[i].name[0]; i++) { + if (scmi_std_id_table[i].protocol_id !=3D protocol) + continue; + + sdev =3D _scmi_device_create(np, parent, protocol, scmi_std_id_table[i].= name); + if (sdev) + scmi_dev =3D sdev; + } + mutex_lock(&scmi_requested_devices_mtx); phead =3D idr_find(&scmi_requested_devices, protocol); /* Nothing to do. */ if (!phead) { mutex_unlock(&scmi_requested_devices_mtx); - return NULL; + return scmi_dev; } =20 /* Walk the list of requested devices for protocol and create them */ list_for_each_entry(rdev, phead, node) { - struct scmi_device *sdev; + /* Standard proto matches already have their dev created above */ + if (scmi_device_id_in_std_id_table(rdev->id_table)) + continue; =20 sdev =3D _scmi_device_create(np, parent, rdev->id_table->protocol_id, --=20 2.55.0