From mboxrd@z Thu Jan 1 00:00:00 1970 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 AB5C83D45D0 for ; Tue, 16 Jun 2026 18:09:24 +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=1781633367; cv=none; b=SgVYOCb9xwkmPukClXiB584E6W9OAeU7vmcsXWU7JqsmBOt0uea6Qa+6Qw/noWeicKm65UpTURmgiuqzInENFgVy1ESXqZGTSJDlMyBu9kLdBsui1fkw+J6hF+X8U2KELijCRPu5ky8rE4oV81l4nBCrobWksz0PkAeYNY28KqI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781633367; c=relaxed/simple; bh=zuntpegxMNUfLfKRKVJpD+fHhSqwi5sTESBy5Gc11ms=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=u17sXq7PAG8gXBsBC/TegzuTAnzL4rp/H77unigtrXp5dNOCwbuxs3f1IVOdsEiUc8QjXU9DMAwMVXB+lOBcZVAheG6shbmWRuhAgivrGP9jrBFdmamO23xskQz4n5drSB0L8RN2LZ76Vc0NOFY2GoIdb/1t+IZ2YNfCgkHvuSo= 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=k7TJxMK2; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=OIQe0bmi; 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="k7TJxMK2"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="OIQe0bmi" Received: from pps.filterd (m0279867.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 65GH8wmH3870717 for ; Tue, 16 Jun 2026 18:09:24 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= PDZtaXjETEhxMoI0zV7AcPBY5Wbkc86wyJ65881hyNY=; b=k7TJxMK2tEDVKdCZ fcPYpg+1uVbV2651EKTIOIhdItA5a2Bwr78sfjVqpUSW17xA1Wv2loh9kLX1fr+X 3MDz2sMbMa0rVouu6JiGpbnUmKhGUXcVCwy1+KojoYTRS/L1O9D7JjkbdHs6vxf5 PD6vpwOT2WePZYOAXuaVv0iie0JZFd0Adr1CdP8xANnRcsERYRjQyfod3yFxBh23 eJz73dDbm8afvgtwxq3YHyCTf/cvRpxul4RSheH7JmrjPqnbYIhRftfY0OLeoSI3 Ger5BUeQPHdO7jIVwrMcDuQiktds+4wDwRl0UywtR594IrfPC+s/P4S5t63jQ1j9 Vd6V7w== Received: from mail-dl1-f72.google.com (mail-dl1-f72.google.com [74.125.82.72]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4eu1763609-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Tue, 16 Jun 2026 18:09:24 +0000 (GMT) Received: by mail-dl1-f72.google.com with SMTP id a92af1059eb24-139553dd8acso7407362c88.0 for ; Tue, 16 Jun 2026 11:09:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1781633363; x=1782238163; 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=PDZtaXjETEhxMoI0zV7AcPBY5Wbkc86wyJ65881hyNY=; b=OIQe0bmiPqy7fkQUKklATzOaLjPgh2zaWBMhSSxG/51Vhzp29XBtpKe9LU33ZK0T3P tQ9InoSiR7RAkxiJiL1lqtEGuWVa7FBNnn3aBGJuN3aXaBl4CREJmn/0osQlT6hMFk1+ TYDjLvfa8YMLkTbBXMF+PZkBK/PcahJA6DmVRelRVpq6YyMWrCHFq2iezmzh3ITFLdFT KNdsuxtEwO6ysi3jWxK9LthEHBJFSmavyeyDoATRJgQ28+FZDNpwsSpeog0aJQHAHOIS HBav7thruvYzsOcVBpTDlosrMwmeIsA2e4aiU8v491eJyyPAJ19l4ewiPtRjS963p5m6 +Tqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781633363; x=1782238163; 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=PDZtaXjETEhxMoI0zV7AcPBY5Wbkc86wyJ65881hyNY=; b=DLINZ4KXhIxhQftltleDh8Dfjk90XYQSAU4VsiF+20l6j1i6bhdD/N2tD8McaxE3V0 CwRLXkIM2OHejmNCQSETmQeVwrSaxu9gSCDV7tVgwynpnpTcu5cgtr75Fzbj6/axFfFA 9e6zW5EwxEnr0szS9vKfXsxoWvea7ky0Vnf16WeGnBtLT8OIwkwWa5fQRpf831Tnxav6 Y/i5yEpsYUCSp/LejxDnk+XLIIGZBp2mNrAKWY6O+zsYUsypdv+gwpcXqsrXdreNLUu3 pawLp30vUF4oxdXkalscWDa5p3w11Ia3YOBYjNMsO96pklxvJUC9R+//vw0nXrZxRWFp R6Lg== X-Forwarded-Encrypted: i=1; AFNElJ9yeE67pczJ5tR6vaZqDpYHGl+QNlhP57DXquNoeWoFk0kmv/MYvxL+On5xJpnCckqaRiWYMZhcm4lzSJw=@vger.kernel.org X-Gm-Message-State: AOJu0YxDJuTrynuNAGtfTSUkuYdAvSRXFyIFQ2f3L3O4mpZ5yfzDMAdK 0fMLqdC/BLSBQ4+bCaiBP/O1YrMDAPSm9dXdfG9DUPWNcw2NAN+CCMdwrP9/Gnvpwt+RhrDI755 qkDZ0BtmOFr0O/1/wtrWOzcRpgzHU6MXfV7gqybAcwqP+N5dJQOiDXFTJuojzMpg30zk= X-Gm-Gg: Acq92OFkb0FMuYGhCkJ2HhVpAZqRjx8UJMUCZnljISAvMgX0ekAvaJONuG7X79drsml um8qhSoL94qJlLqcf+DP4PhPGdfosEcGgDVQGB271mbi79cAV90oTXx4wkqxnJghlm+VDvPLdQZ Pmz4ZwFvw9HKDbzVI/0+Q+jMjlVFw0ACkG7mE8X3QRrbltVXpBF7y+Ws264dY2FEOe3jJorWygl vJqrfbLpuCJ/gFpPPKB4SA0zeOg2xdH5to3AS5h5vWoh/2ZElHHf8MDUJB6qu5jiAWbUhrMT6FZ rtlaaN8BM5iyWTXgNfrlBpTHrcKemhgEZsAoxjXgrMqHb7Ikm+TqQONOQkRzGjpn7s5aDXG4dg5 xn1RNokBrBVpxDGpGg2MN1JrJdRKW/KxBFPA0/Yg+F8LvLhBZIw85tByZUhmCJr0= X-Received: by 2002:a05:7022:68d:b0:137:6bdb:5842 with SMTP id a92af1059eb24-1398f5c45ecmr43996c88.0.1781633363289; Tue, 16 Jun 2026 11:09:23 -0700 (PDT) X-Received: by 2002:a05:7022:68d:b0:137:6bdb:5842 with SMTP id a92af1059eb24-1398f5c45ecmr43970c88.0.1781633362667; Tue, 16 Jun 2026 11:09:22 -0700 (PDT) Received: from [169.254.0.13] (Global_NAT1.qualcomm.com. [129.46.96.20]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-1384b916b2bsm13747124c88.6.2026.06.16.11.09.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Jun 2026 11:09:22 -0700 (PDT) From: Bjorn Andersson Date: Tue, 16 Jun 2026 18:09:15 +0000 Subject: [PATCH 1/2] module: add SCMI device table alias support 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: 7bit Message-Id: <20260616-scmi-modalias-v1-1-662b8dd52ab2@oss.qualcomm.com> References: <20260616-scmi-modalias-v1-0-662b8dd52ab2@oss.qualcomm.com> In-Reply-To: <20260616-scmi-modalias-v1-0-662b8dd52ab2@oss.qualcomm.com> To: Sudeep Holla , Cristian Marussi , Nathan Chancellor , Nicolas Schier Cc: arm-scmi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-kbuild@vger.kernel.org, Hans de Goede , Bjorn Andersson X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1781633360; l=6788; i=bjorn.andersson@oss.qualcomm.com; s=20230915; h=from:subject:message-id; bh=zuntpegxMNUfLfKRKVJpD+fHhSqwi5sTESBy5Gc11ms=; b=kEt4IJDgAcszo9qEnabKZ1PfxlY0dKprUvlsugiQm0JnJgv6B2HuknECadqYw9wTY5ru0hGcj llEct1gZ35UAhFv/6bNJUnMr8bmgM7PyCuD4VLWerqLC475PpaR0wqw X-Developer-Key: i=bjorn.andersson@oss.qualcomm.com; a=ed25519; pk=VkhObtljigy9k0ZUIE1Mvr0Y+E1dgBEH9WoLQnUtbIM= X-Proofpoint-GUID: K0Wspsyb_AAZ1S8DMV8gunhR5MPRMHLh X-Proofpoint-ORIG-GUID: K0Wspsyb_AAZ1S8DMV8gunhR5MPRMHLh X-Authority-Analysis: v=2.4 cv=I4RVgtgg c=1 sm=1 tr=0 ts=6a319154 cx=c_pps a=bS7HVuBVfinNPG3f6cIo3Q==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=IkcTkHD0fZMA:10 a=FelO9ux0wxsA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=eoimf2acIAo5FJnRuUoq:22 a=EUspDBNiAAAA:8 a=Fcj57D9thYDiAllwEF0A:9 a=QEXdDO2ut3YA:10 a=vBUdepa8ALXHeOFLBtFW:22 X-Proofpoint-Spam-Info: AW1haW4tMjYwNjE2MDE4NiBTYWx0ZWRfX/6qUOAo4kFZe mFeTDDJWue9/POIbTsIGumhmlk4UAET7JMh9HbDMKPSacyoNRys2WP+iA0SHmpCdT+CD6FtHq2T wJFQf9qf13KsqDGNNUPszLJ7nIfJKgU= X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNjE2MDE4NiBTYWx0ZWRfX7AI8IPG2xtcU Q5YNsWM1Fnbw04ZYCmMYk7kRqfwE7QdqEqLc8gMLfFU+Kv54Ry8w+OelnO9JtxWotpzyLceoBq5 lyiZLFd13rYR7krRwUqo4gC7ZmRAjsFFDp2i+eTBNMAiHDHkkhgQ+34xNxkukmTMNTitJQkmph+ csVC8yrGuQl4MuzyTkRdewAHNUqZfPnVAbXVz9VtYTz4U9nnjolSs7Nnkfud6f2iWvCBVuAX2Hs ix82LpeQhx7TE+kYt75HKDhRSmQJqp7JvBELoj2kXe7gYjMlXatbaJs7StGJOKwWexbhxKauA/j 621io0jouTYQYRL5wJhiYGMQ4vgSASAzI5qyOa8DpVwyqZvrph2outMguc4T4RPNgXiYqIy1cmC DTpTgVvyO9A/9YZzr6tmi7HHwzxIc1Zp5Ho4+212OttUVnEFNGWZJv02+uHCSg08yjPBxRhs9Na iEjMJQFe6GM5DwAjvXQ== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.125,FMLib:17.12.100.49 definitions=2026-06-16_05,2026-06-16_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 phishscore=0 spamscore=0 suspectscore=0 lowpriorityscore=0 priorityscore=1501 clxscore=1015 bulkscore=0 malwarescore=0 adultscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606040000 definitions=main-2606160186 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 Signed-off-by: Bjorn Andersson --- drivers/firmware/arm_scmi/bus.c | 19 +++++++++---------- include/linux/mod_devicetable.h | 11 +++++++++++ include/linux/scmi_protocol.h | 6 +----- scripts/mod/devicetable-offsets.c | 4 ++++ scripts/mod/file2alias.c | 11 +++++++++++ 5 files changed, 36 insertions(+), 15 deletions(-) diff --git a/drivers/firmware/arm_scmi/bus.c b/drivers/firmware/arm_scmi/bus.c index 793be9eabaed..7e344f2ee18d 100644 --- a/drivers/firmware/arm_scmi/bus.c +++ b/drivers/firmware/arm_scmi/bus.c @@ -13,11 +13,12 @@ #include #include #include +#include #include #include "common.h" -#define SCMI_UEVENT_MODALIAS_FMT "%s:%02x:%s" +#define SCMI_UEVENT_MODALIAS_FMT SCMI_MODULE_PREFIX "%02x:%s" BLOCKING_NOTIFIER_HEAD(scmi_requested_devices_nh); EXPORT_SYMBOL_GPL(scmi_requested_devices_nh); @@ -141,7 +142,7 @@ static int scmi_protocol_table_register(const struct scmi_device_id *id_table) int ret = 0; const struct scmi_device_id *entry; - for (entry = id_table; entry->name && ret == 0; entry++) + for (entry = id_table; entry->name[0] && ret == 0; entry++) ret = scmi_protocol_device_request(entry); return ret; @@ -197,18 +198,18 @@ scmi_protocol_table_unregister(const struct scmi_device_id *id_table) { const struct scmi_device_id *entry; - for (entry = id_table; entry->name; entry++) + for (entry = id_table; entry->name[0]; entry++) scmi_protocol_device_unrequest(entry); } static int scmi_dev_match_by_id_table(struct scmi_device *scmi_dev, const struct scmi_device_id *id_table) { - if (!id_table || !id_table->name) + if (!id_table || !id_table->name[0]) return 0; /* Always skip transport devices from matching */ - 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 == scmi_dev->protocol_id && strncmp(scmi_dev->name, "__scmi_transport_device", 23) && !strcmp(id_table->name, scmi_dev->name)) @@ -245,7 +246,7 @@ static struct scmi_device *scmi_child_dev_find(struct device *parent, struct device *dev; id_table[0].protocol_id = prot_id; - id_table[0].name = name; + strscpy(id_table[0].name, name, sizeof(id_table[0].name)); dev = device_find_child(parent, &id_table, scmi_match_by_id_table); if (!dev) @@ -282,8 +283,7 @@ static int scmi_device_uevent(const struct device *dev, struct kobj_uevent_env * const struct scmi_device *scmi_dev = to_scmi_dev(dev); return add_uevent_var(env, "MODALIAS=" SCMI_UEVENT_MODALIAS_FMT, - dev_name(&scmi_dev->dev), scmi_dev->protocol_id, - scmi_dev->name); + scmi_dev->protocol_id, scmi_dev->name); } static ssize_t modalias_show(struct device *dev, @@ -292,8 +292,7 @@ static ssize_t modalias_show(struct device *dev, struct scmi_device *scmi_dev = to_scmi_dev(dev); return sysfs_emit(buf, SCMI_UEVENT_MODALIAS_FMT, - dev_name(&scmi_dev->dev), scmi_dev->protocol_id, - scmi_dev->name); + scmi_dev->protocol_id, scmi_dev->name); } static DEVICE_ATTR_RO(modalias); diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h index 3b0c9a251a2e..769382f2eadd 100644 --- a/include/linux/mod_devicetable.h +++ b/include/linux/mod_devicetable.h @@ -473,6 +473,17 @@ struct rpmsg_device_id { kernel_ulong_t driver_data; }; +/* scmi */ + +#define SCMI_NAME_SIZE 32 +#define SCMI_MODULE_PREFIX "scmi:" + +struct scmi_device_id { + __u8 protocol_id; + char name[SCMI_NAME_SIZE]; + kernel_ulong_t driver_data; +}; + /* i2c */ #define I2C_NAME_SIZE 20 diff --git a/include/linux/scmi_protocol.h b/include/linux/scmi_protocol.h index 5ab73b1ab9aa..48b346a26068 100644 --- a/include/linux/scmi_protocol.h +++ b/include/linux/scmi_protocol.h @@ -10,6 +10,7 @@ #include #include +#include #include #include @@ -951,11 +952,6 @@ struct scmi_device { #define to_scmi_dev(d) container_of_const(d, struct scmi_device, dev) -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-offsets.c index b4178c42d08f..da5bd712c8da 100644 --- a/scripts/mod/devicetable-offsets.c +++ b/scripts/mod/devicetable-offsets.c @@ -144,6 +144,10 @@ int main(void) DEVID(rpmsg_device_id); DEVID_FIELD(rpmsg_device_id, name); + 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); diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c index 8d36c74dec2d..a5283f4c8e6f 100644 --- a/scripts/mod/file2alias.c +++ b/scripts/mod/file2alias.c @@ -852,6 +852,16 @@ static void do_rpmsg_entry(struct module *mod, void *symval) module_alias_printf(mod, false, RPMSG_DEVICE_MODALIAS_FMT, *name); } +/* 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 +1501,7 @@ static const struct devtable devtable[] = { {"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}, -- 2.53.0