{"id":2220544,"url":"http://patchwork.ozlabs.org/api/1.1/patches/2220544/?format=json","web_url":"http://patchwork.ozlabs.org/project/linux-pci/patch/20260407-uid_slot-v8-2-15ae4409d2ce@linux.ibm.com/","project":{"id":28,"url":"http://patchwork.ozlabs.org/api/1.1/projects/28/?format=json","name":"Linux PCI development","link_name":"linux-pci","list_id":"linux-pci.vger.kernel.org","list_email":"linux-pci@vger.kernel.org","web_url":null,"scm_url":null,"webscm_url":null},"msgid":"<20260407-uid_slot-v8-2-15ae4409d2ce@linux.ibm.com>","date":"2026-04-07T13:24:46","name":"[v8,2/2] PCI: s390: Expose the UID as an arch specific PCI slot attribute","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"2837db47a0530de2c88db910e1d9bd172422d503","submitter":{"id":78856,"url":"http://patchwork.ozlabs.org/api/1.1/people/78856/?format=json","name":"Niklas Schnelle","email":"schnelle@linux.ibm.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/linux-pci/patch/20260407-uid_slot-v8-2-15ae4409d2ce@linux.ibm.com/mbox/","series":[{"id":498984,"url":"http://patchwork.ozlabs.org/api/1.1/series/498984/?format=json","web_url":"http://patchwork.ozlabs.org/project/linux-pci/list/?series=498984","date":"2026-04-07T13:24:45","name":"PCI: s390: Expose the UID as an arch specific PCI slot attribute","version":8,"mbox":"http://patchwork.ozlabs.org/series/498984/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2220544/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2220544/checks/","tags":{},"headers":{"Return-Path":"\n <linux-pci+bounces-52069-incoming=patchwork.ozlabs.org@vger.kernel.org>","X-Original-To":["incoming@patchwork.ozlabs.org","linux-pci@vger.kernel.org"],"Delivered-To":"patchwork-incoming@legolas.ozlabs.org","Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=ibm.com header.i=@ibm.com header.a=rsa-sha256\n header.s=pp1 header.b=tSYiyPaj;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=2600:3c0a:e001:db::12fc:5321; helo=sea.lore.kernel.org;\n envelope-from=linux-pci+bounces-52069-incoming=patchwork.ozlabs.org@vger.kernel.org;\n receiver=patchwork.ozlabs.org)","smtp.subspace.kernel.org;\n\tdkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com\n header.b=\"tSYiyPaj\"","smtp.subspace.kernel.org;\n arc=none smtp.client-ip=148.163.158.5","smtp.subspace.kernel.org;\n dmarc=pass (p=none dis=none) header.from=linux.ibm.com","smtp.subspace.kernel.org;\n spf=pass smtp.mailfrom=linux.ibm.com"],"Received":["from sea.lore.kernel.org (sea.lore.kernel.org\n [IPv6:2600:3c0a:e001:db::12fc:5321])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fqnFh4PD9z1yD3\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 07 Apr 2026 23:33:12 +1000 (AEST)","from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby sea.lore.kernel.org (Postfix) with ESMTP id D4DB23137D70\n\tfor <incoming@patchwork.ozlabs.org>; Tue,  7 Apr 2026 13:25:36 +0000 (UTC)","from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id 058E33B7B7B;\n\tTue,  7 Apr 2026 13:25:07 +0000 (UTC)","from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com\n [148.163.158.5])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby smtp.subspace.kernel.org (Postfix) with ESMTPS id 6A15A3B7752;\n\tTue,  7 Apr 2026 13:25:05 +0000 (UTC)","from pps.filterd (m0353725.ppops.net [127.0.0.1])\n\tby mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id\n 636NQ5tk2401288;\n\tTue, 7 Apr 2026 13:25:03 GMT","from ppma21.wdc07v.mail.ibm.com\n (5b.69.3da9.ip4.static.sl-reverse.com [169.61.105.91])\n\tby mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4dcn2hav1w-1\n\t(version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT);\n\tTue, 07 Apr 2026 13:25:02 +0000 (GMT)","from pps.filterd (ppma21.wdc07v.mail.ibm.com [127.0.0.1])\n\tby ppma21.wdc07v.mail.ibm.com (8.18.1.2/8.18.1.2) with ESMTP id\n 637BNAKM029863;\n\tTue, 7 Apr 2026 13:25:01 GMT","from smtprelay05.dal12v.mail.ibm.com ([172.16.1.7])\n\tby ppma21.wdc07v.mail.ibm.com (PPS) with ESMTPS id 4dcme7bab2-1\n\t(version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT);\n\tTue, 07 Apr 2026 13:25:01 +0000","from smtpav03.dal12v.mail.ibm.com (smtpav03.dal12v.mail.ibm.com\n [10.241.53.102])\n\tby smtprelay05.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id\n 637DP0OY21824210\n\t(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK);\n\tTue, 7 Apr 2026 13:25:00 GMT","from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1])\n\tby IMSVA (Postfix) with ESMTP id 5CC6C58060;\n\tTue,  7 Apr 2026 13:25:00 +0000 (GMT)","from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1])\n\tby IMSVA (Postfix) with ESMTP id 9D8E05803F;\n\tTue,  7 Apr 2026 13:24:57 +0000 (GMT)","from tuxmaker.boeblingen.de.ibm.com (unknown [9.87.85.9])\n\tby smtpav03.dal12v.mail.ibm.com (Postfix) with ESMTP;\n\tTue,  7 Apr 2026 13:24:57 +0000 (GMT)"],"ARC-Seal":"i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1775568306; cv=none;\n b=QvMIiXvz25O9keiMBXgXG5TtI5VV1lR53ReDSa9DUzp4POjCRaOsxUziu4kSFfxol9jwmrL70CExV3JFLos80sdj1aERyAFkrAQEbqI3lmWHS/uHNhjiFwkoT063KsJf/ZMhI04D5CCvKcnv/Y0NHzE3T6Bll8EYf0whI5nExTo=","ARC-Message-Signature":"i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1775568306; c=relaxed/simple;\n\tbh=eJ+f5VtW06hjPWQhL+mxU1tuQeMXPch8iPmbd9Za310=;\n\th=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References:\n\t In-Reply-To:To:Cc;\n b=rvIIsHwY8xQgeCyK+nOl+j/TYe7M1SNQkNwgc56Iq7LKvtq6NRSLAfwI+MDIhkStro3YV8ThtVPCDFFZ0KnkXaxmN2Mu+UtFobmVxfymxrA+QdX6Mp5PuSKeE3PA/79AET2aV2VgS5F4/3QXHd4qfuWt2sNaJMnjoMKp5FDRpGg=","ARC-Authentication-Results":"i=1; smtp.subspace.kernel.org;\n dmarc=pass (p=none dis=none) header.from=linux.ibm.com;\n spf=pass smtp.mailfrom=linux.ibm.com;\n dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com\n header.b=tSYiyPaj; arc=none smtp.client-ip=148.163.158.5","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc\n\t:content-transfer-encoding:content-type:date:from:in-reply-to\n\t:message-id:mime-version:references:subject:to; s=pp1; bh=/lcr96\n\tSrwFC1B6RU1s1QLzKzJb5TcyudQnEV0SzV2eQ=; b=tSYiyPaj5CqVOvfG4X1Rt1\n\tgVc+TaWQo4DSNcuourGu/NmbSqPbDx05TCV6lIiy3B7gRJyVoKar6kqKKyP9V/6J\n\tmBcIpU1UHPlOskv+W0qDJvVm/m7++NUvbRD8IT7QQv+wqYwb0POz9OdyM978FBWb\n\t3g23GHyWI1jpn+vgCYpn4OmPncuwi+N+uyyWJ/NvVMuBTlSQ6XtVdOntYQXSGC+O\n\tvrEvfwsXgIKVV3vjk85ItjWDvPi7GlW02bPjDFoVMEeZzpQ3FdToecwFs4eL6dUh\n\tXwlI4Am7AKx/fE2D3Mo0yfLZLt1pjOp53TmNA1vtMyaUxe6lpRmM5ftSkUKCfGkA\n\t==","From":"Niklas Schnelle <schnelle@linux.ibm.com>","Date":"Tue, 07 Apr 2026 15:24:46 +0200","Subject":"[PATCH v8 2/2] PCI: s390: Expose the UID as an arch specific PCI\n slot attribute","Precedence":"bulk","X-Mailing-List":"linux-pci@vger.kernel.org","List-Id":"<linux-pci.vger.kernel.org>","List-Subscribe":"<mailto:linux-pci+subscribe@vger.kernel.org>","List-Unsubscribe":"<mailto:linux-pci+unsubscribe@vger.kernel.org>","MIME-Version":"1.0","Content-Type":"text/plain; charset=\"utf-8\"","Content-Transfer-Encoding":"7bit","Message-Id":"<20260407-uid_slot-v8-2-15ae4409d2ce@linux.ibm.com>","References":"<20260407-uid_slot-v8-0-15ae4409d2ce@linux.ibm.com>","In-Reply-To":"<20260407-uid_slot-v8-0-15ae4409d2ce@linux.ibm.com>","To":"Bjorn Helgaas <bhelgaas@google.com>, Jonathan Corbet <corbet@lwn.net>,\n        Lukas Wunner <lukas@wunner.de>, Shuah Khan <skhan@linuxfoundation.org>","Cc":"Farhan Ali <alifm@linux.ibm.com>,\n        Alexander Gordeev <agordeev@linux.ibm.com>,\n        Christian Borntraeger <borntraeger@linux.ibm.com>,\n        Gerald Schaefer <gerald.schaefer@linux.ibm.com>,\n        Gerd Bayer <gbayer@linux.ibm.com>, Heiko Carstens <hca@linux.ibm.com>,\n        Julian Ruess <julianr@linux.ibm.com>,\n        Matthew Rosato <mjrosato@linux.ibm.com>,\n        Peter Oberparleiter <oberpar@linux.ibm.com>,\n        Ramesh Errabolu <ramesh@linux.ibm.com>,\n        Sven Schnelle <svens@linux.ibm.com>,\n Vasily Gorbik <gor@linux.ibm.com>,\n        linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,\n        linux-pci@vger.kernel.org, linux-s390@vger.kernel.org,\n        Niklas Schnelle <schnelle@linux.ibm.com>","X-Mailer":"b4 0.14.2","X-Developer-Signature":"v=1; a=openpgp-sha256; l=5423;\n i=schnelle@linux.ibm.com; h=from:subject:message-id;\n bh=eJ+f5VtW06hjPWQhL+mxU1tuQeMXPch8iPmbd9Za310=;\n b=owGbwMvMwCX2Wz534YHOJ2GMp9WSGDKvsi5qmLBp3QreRKb5D4/+2vpOZKK9UtusTJYnqdP+X\n jy8069fs6OUhUGMi0FWTJFlUZez37qCKaZ7gvo7YOawMoEMYeDiFICJbGhkZDimZaXasfWD8lvp\n 6pKtv5l7RWw0Pc9+t/sqFud1SPL/xL8Mf3ifnfzhk7fTaUVovJD62WWW5vybDM/8bfB+FDdjlt4\n RNzYA","X-Developer-Key":"i=schnelle@linux.ibm.com; a=openpgp;\n fpr=9DB000B2D2752030A5F72DDCAFE43F15E8C26090","X-TM-AS-GCONF":"00","X-Proofpoint-Reinject":"loops=2 maxloops=12","X-Proofpoint-Spam-Details-Enc":"AW1haW4tMjYwNDA3MDEyNSBTYWx0ZWRfX5tYDnBUKYrg2\n ZmfaJjr1ZmknHjEnKi4z6LP6CuwUIiXdDyuX3I6z+n3s8vexTnY3c6Q87wlLbR5aAsG2CFaA6hw\n jlujSWb5ydTuX5opBAW9F9UZa2d4FMVAAx0F+1FFmPvyvKRU6a484NrSrLFMerRuGsKHg+VF88P\n nQHELiMK5OQZe4JwQNUrDXSoIGJ07p5VP4ePgwc16syfqgCzobVMxpmnQ6hY/oBo+mSYQXnOu8V\n BEg7fi+7Rm3K7nZQz13jLYi5P7jLmgt17LBcZvDOahO+oslijInfB9Uu2Xo7oUnGDMmMHs0nNjf\n mopk91/rIdXsak0xWH/XpCg4ZNfeBOad7QV3Dqj1J2nclxyjMQwKyYnf2a3CfY7+JD8JVzYT0HW\n 9CNcDgteC1jxr392nJEUcH7Xmpy3QZ7xaf8pIdmnPEIyw0PwgAXeEAdj3Qtr1dXotcknhBlBMD1\n 86nr2ZAZ1DSQ5Y9ZmYw==","X-Proofpoint-GUID":"VyT9t5m2ehuyfEPkLtPSnDHfdh4nrn6x","X-Authority-Analysis":"v=2.4 cv=a/wAM0SF c=1 sm=1 tr=0 ts=69d505ae cx=c_pps\n a=GFwsV6G8L6GxiO2Y/PsHdQ==:117 a=GFwsV6G8L6GxiO2Y/PsHdQ==:17\n a=IkcTkHD0fZMA:10 a=A5OVakUREuEA:10 a=VkNPw1HP01LnGYTKEx00:22\n a=RnoormkPH1_aCDwRdu11:22 a=V8glGbnc2Ofi9Qvn3v5h:22 a=VnNF1IyMAAAA:8\n a=WU3I-MCEZjdC1qMpAq0A:9 a=QEXdDO2ut3YA:10","X-Proofpoint-ORIG-GUID":"vIs2OYqdjfg5CNNaBCf1RdBJ7NoiH80F","X-Proofpoint-Virus-Version":"vendor=baseguard\n engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49\n definitions=2026-04-07_02,2026-04-07_02,2025-10-01_01","X-Proofpoint-Spam-Details":"rule=outbound_notspam policy=outbound score=0\n bulkscore=0 clxscore=1015 spamscore=0 impostorscore=0 priorityscore=1501\n phishscore=0 lowpriorityscore=0 adultscore=0 malwarescore=0 suspectscore=0\n classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0\n reason=mlx scancount=1 engine=8.22.0-2604010000 definitions=main-2604070125"},"content":"On s390, an individual PCI function can generally be identified by two\nidentifiers, the FID and the UID. Which identifier is used depends on\nthe scope and the platform configuration.\n\nThe first identifier, the FID, is always available and identifies a PCI\ndevice uniquely within a machine. The FID may be virtualized by\nhypervisors, but on the LPAR level, the machine scope makes it\nimpossible to create the same configuration based on FIDs on two\ndifferent LPARs of the same machine, and difficult to reuse across\nmachines.\n\nSuch matching LPAR configurations are useful, though, allowing\nstandardized setups and booting a Linux installation on different LPARs.\nTo this end the UID, or user-defined identifier, was introduced. While\nit is only guaranteed to be unique within an LPAR and only if indicated\nby firmware, it allows users to replicate PCI device setups.\n\nOn s390, which uses a machine hypervisor, a per PCI function hotplug\nmodel is used. The shortcoming with the UID then is, that it is not\nvisible to the user without first attaching the PCI function and\naccessing the \"uid\" device attribute. The FID, on the other hand, is\nused as the slot name and is thus known even with the PCI function in\nstandby.\n\nRemedy this shortcoming by providing the UID as an attribute on the slot\nallowing the user to identify a PCI function based on the UID without\nhaving to first attach it. Do this via a macro mechanism analogous to\nwhat was introduced by commit 265baca69a07 (\"s390/pci: Stop usurping\npdev->dev.groups\") for the PCI device attributes.\n\nReviewed-by: Gerd Bayer <gbayer@linux.ibm.com>\nReviewed-by: Julian Ruess <julianr@linux.ibm.com>\nSigned-off-by: Niklas Schnelle <schnelle@linux.ibm.com>\n---\n Documentation/arch/s390/pci.rst |  7 +++++++\n arch/s390/include/asm/pci.h     |  4 ++++\n arch/s390/pci/pci_sysfs.c       | 20 ++++++++++++++++++++\n drivers/pci/slot.c              | 13 ++++++++++++-\n 4 files changed, 43 insertions(+), 1 deletion(-)","diff":"diff --git a/Documentation/arch/s390/pci.rst b/Documentation/arch/s390/pci.rst\nindex c3476de4f03278d07099aa32cbea0f868b6e9c9c..80f4ba19315994da056a10b4d216d61ff22ea5aa 100644\n--- a/Documentation/arch/s390/pci.rst\n+++ b/Documentation/arch/s390/pci.rst\n@@ -58,6 +58,13 @@ Entries specific to zPCI functions and entries that hold zPCI information.\n \n   - /sys/bus/pci/slots/XXXXXXXX/power\n \n+  In addition to using the FID as the name of the slot, the slot directory\n+  also contains the following s390-specific slot attributes.\n+\n+  - uid:\n+    The User-defined identifier (UID) of the function which may be configured\n+    by this slot. See also the corresponding attribute of the device.\n+\n   A physical function that currently supports a virtual function cannot be\n   powered off until all virtual functions are removed with:\n   echo 0 > /sys/bus/pci/devices/DDDD:BB:dd.f/sriov_numvf\ndiff --git a/arch/s390/include/asm/pci.h b/arch/s390/include/asm/pci.h\nindex c0ff19dab5807c7e1aabb48a0e9436aac45ec97d..5dcf35f0f325f5f44b28109a1c8d9aef18401035 100644\n--- a/arch/s390/include/asm/pci.h\n+++ b/arch/s390/include/asm/pci.h\n@@ -208,6 +208,10 @@ extern const struct attribute_group zpci_ident_attr_group;\n \t\t\t    &pfip_attr_group,\t\t \\\n \t\t\t    &zpci_ident_attr_group,\n \n+extern const struct attribute_group zpci_slot_attr_group;\n+\n+#define ARCH_PCI_SLOT_GROUPS (&zpci_slot_attr_group)\n+\n extern unsigned int s390_pci_force_floating __initdata;\n extern unsigned int s390_pci_no_rid;\n \ndiff --git a/arch/s390/pci/pci_sysfs.c b/arch/s390/pci/pci_sysfs.c\nindex c2444a23e26c4218832bb91930b5f0ffd498d28f..d98d97df792adb3c7e415a8d374cc2f3a65fbb52 100644\n--- a/arch/s390/pci/pci_sysfs.c\n+++ b/arch/s390/pci/pci_sysfs.c\n@@ -187,6 +187,17 @@ static ssize_t index_show(struct device *dev,\n }\n static DEVICE_ATTR_RO(index);\n \n+static ssize_t zpci_uid_slot_show(struct pci_slot *slot, char *buf)\n+{\n+\tstruct zpci_dev *zdev = container_of(slot->hotplug, struct zpci_dev,\n+\t\t\t\t\t     hotplug_slot);\n+\n+\treturn sysfs_emit(buf, \"0x%x\\n\", zdev->uid);\n+}\n+\n+static struct pci_slot_attribute zpci_slot_attr_uid =\n+\t__ATTR(uid, 0444, zpci_uid_slot_show, NULL);\n+\n static umode_t zpci_index_is_visible(struct kobject *kobj,\n \t\t\t\t     struct attribute *attr, int n)\n {\n@@ -243,6 +254,15 @@ const struct attribute_group pfip_attr_group = {\n \t.attrs = pfip_attrs,\n };\n \n+static struct attribute *zpci_slot_attrs[] = {\n+\t&zpci_slot_attr_uid.attr,\n+\tNULL,\n+};\n+\n+const struct attribute_group zpci_slot_attr_group = {\n+\t.attrs = zpci_slot_attrs,\n+};\n+\n static struct attribute *clp_fw_attrs[] = {\n \t&uid_checking_attr.attr,\n \tNULL,\ndiff --git a/drivers/pci/slot.c b/drivers/pci/slot.c\nindex 787311614e5b6ebb39e7284f9b9f205a0a684d6d..2f8fcfbbec24e73d0bb6e40fd04c05a94f518045 100644\n--- a/drivers/pci/slot.c\n+++ b/drivers/pci/slot.c\n@@ -96,7 +96,18 @@ static struct attribute *pci_slot_default_attrs[] = {\n \t&pci_slot_attr_cur_speed.attr,\n \tNULL,\n };\n-ATTRIBUTE_GROUPS(pci_slot_default);\n+\n+static const struct attribute_group pci_slot_default_group = {\n+\t.attrs = pci_slot_default_attrs,\n+};\n+\n+static const struct attribute_group *pci_slot_default_groups[] = {\n+\t&pci_slot_default_group,\n+#ifdef ARCH_PCI_SLOT_GROUPS\n+\tARCH_PCI_SLOT_GROUPS,\n+#endif\n+\tNULL,\n+};\n \n static const struct kobj_type pci_slot_ktype = {\n \t.sysfs_ops = &pci_slot_sysfs_ops,\n","prefixes":["v8","2/2"]}