From nobody Sun Jun 14 06:54:33 2026 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (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 0263E3B8BBB; Tue, 7 Apr 2026 13:25:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.158.5 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775568309; cv=none; b=FG1KOFw6ypkj/h01V0URWyZlCJYjqBBL70W/cxX/5uYrk5Cl+FTOodRRIUJtjo2ZElNlKKMdWnunhSA2dTf6xnBiIKXyv6T0dof/8OeTpQfehF8CBnQEwDhmJF+OXeWqTx5c1RwpCgzhYosSTnSH6rrn4yPemXCtDT17BdWfpt8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775568309; c=relaxed/simple; bh=O/1yfVXRBs+oyvm0+6VCCBj24N7Sl/Wrs7hNpLylzHc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=L4AIMD2Xij1aiCFVhE/Z30M6VQfEf+wAcYcHHWeXOqkWyawU39x7HDSN4fXKhUkgD1GjTtqWc60TONPyXjpIM26vz8PI5o5W95CBWL3X0Tyg0aPfnitYz7b3McpYP+x9iEXm6Mt5Krdh15TR1uj1wXBFNXLOPhXr3fxO9Uf2Nl8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=hpX/fm4K; arc=none smtp.client-ip=148.163.158.5 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="hpX/fm4K" Received: from pps.filterd (m0360072.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 636LlnCJ2297436; Tue, 7 Apr 2026 13:25:00 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=pp1; bh=OQX9xy 0dseiFPGRnHRX8PrciEVvGdHCLqgmN6UtDDpw=; b=hpX/fm4KcklqWxvya/zZmw DUYUB/PIHxGRutkq1yTccmUo0kcA5m781GMn3II9MrVtJASAvCGc0NS4Zu3jzwUc QA4u4Rq9gafQsBRdkaRTEaxWjVOIn5Dt9dSRF1zl0V+04M+kT6/i5yQ8bHNcZNif dmHMdG7lA4X/0/tmUHltxz8GwSAWQn5TLb1unADFnEsck1FEtF+WPkCtynoX88GP LFXhR0EpJzOUDxFXfw3/sXzaqCgmOIGB29JkzRxdE19pee/HYfXSnAHzMTErVJ+0 nSgQX30VZWg9GGOqZxbFLB9KpYruRU0P1z6CX8jhMOBTrAEkS1bzMdGuky9vnf0Q == Received: from ppma22.wdc07v.mail.ibm.com (5c.69.3da9.ip4.static.sl-reverse.com [169.61.105.92]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4dcn2ftw0f-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 07 Apr 2026 13:24:59 +0000 (GMT) Received: from pps.filterd (ppma22.wdc07v.mail.ibm.com [127.0.0.1]) by ppma22.wdc07v.mail.ibm.com (8.18.1.2/8.18.1.2) with ESMTP id 637BOm4Z007881; Tue, 7 Apr 2026 13:24:59 GMT Received: from smtprelay06.wdc07v.mail.ibm.com ([172.16.1.73]) by ppma22.wdc07v.mail.ibm.com (PPS) with ESMTPS id 4dcmg2baaq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 07 Apr 2026 13:24:59 +0000 Received: from smtpav03.dal12v.mail.ibm.com (smtpav03.dal12v.mail.ibm.com [10.241.53.102]) by smtprelay06.wdc07v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 637DOvZ931130126 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 7 Apr 2026 13:24:57 GMT Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 60C745805A; Tue, 7 Apr 2026 13:24:57 +0000 (GMT) Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6E40C58056; Tue, 7 Apr 2026 13:24:54 +0000 (GMT) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.87.85.9]) by smtpav03.dal12v.mail.ibm.com (Postfix) with ESMTP; Tue, 7 Apr 2026 13:24:54 +0000 (GMT) From: Niklas Schnelle Date: Tue, 07 Apr 2026 15:24:45 +0200 Subject: [PATCH v8 1/2] docs: s390/pci: Improve and update PCI documentation 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: <20260407-uid_slot-v8-1-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 , Jonathan Corbet , Lukas Wunner , Shuah Khan Cc: Farhan Ali , Alexander Gordeev , Christian Borntraeger , Gerald Schaefer , Gerd Bayer , Heiko Carstens , Julian Ruess , Matthew Rosato , Peter Oberparleiter , Ramesh Errabolu , Sven Schnelle , Vasily Gorbik , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, linux-s390@vger.kernel.org, Niklas Schnelle , Randy Dunlap X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=10292; i=schnelle@linux.ibm.com; h=from:subject:message-id; bh=O/1yfVXRBs+oyvm0+6VCCBj24N7Sl/Wrs7hNpLylzHc=; b=kA0DAAoW+x9tocCJ5FYByyZiAGnVBaHIDbf6iCsK3RvejsbTA9DtTmBGYfV5sLpG5SLsO9FrG 4h1BAAWCgAdFiEEoopDTq5wlDW8Uo+I+x9tocCJ5FYFAmnVBaEACgkQ+x9tocCJ5Fa/3gD/cGZH Xa7LyEAtaf++RFX3ia/dTY/Hrpo5PMZuFK6qwPkA/09j1zdR3VmBGVpZ3aZUuCtI+HCqC6+ZceZ E/Mum7cgD X-Developer-Key: i=schnelle@linux.ibm.com; a=openpgp; fpr=9DB000B2D2752030A5F72DDCAFE43F15E8C26090 X-TM-AS-GCONF: 00 X-Proofpoint-Reinject: loops=2 maxloops=12 X-Authority-Analysis: v=2.4 cv=KeridwYD c=1 sm=1 tr=0 ts=69d505ac cx=c_pps a=5BHTudwdYE3Te8bg5FgnPg==:117 a=5BHTudwdYE3Te8bg5FgnPg==:17 a=IkcTkHD0fZMA:10 a=A5OVakUREuEA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=RzCfie-kr_QcCd8fBx8p:22 a=VnNF1IyMAAAA:8 a=JfrnYn6hAAAA:8 a=TOD45aG0oo66aBzYHRIA:9 a=QEXdDO2ut3YA:10 a=O8hF6Hzn-FEA:10 a=1CNFftbPRP8L7MoqJWF3:22 X-Proofpoint-ORIG-GUID: w08_cbNC0HdW87aEDtVQaYDI_IAuQIVd X-Proofpoint-GUID: BUYgZWeynwlWjU39dh8anUBtd_HXpNPn X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNDA3MDEyNSBTYWx0ZWRfX/uKpAN4GXsdN MAjj/n0fPcTg/+fYm2OGZC87ZsktSwFg1vs6SmsLV3lW7UTcLBOIM4pPVcc1jlJ+iGT5suxnTvR DpRpiEofQ36558851UbLZM9/KWs0R/4oYHOGgpIuN3BMkh5hzigRqe/ze/agFCWOtq5XwO2ZoBy GXSFlZb4ojvWTj5rc3OtPsdc1EIaR3RLsEAVEjusPD2MoB+7CnRC+t05uG13vRD5v/pYf5qbSWq vbvsbHRXA/o718lCWYqk54MPrlY7Mli3kQTxOsV/QTNNmdcjrnJN6Pmb92fFORx6ZKyUtEjCEh2 P2cI2/RcWLlNQfhCmJ2ND/Rp2cHv6Qydmzi/YzQDZ5TGFxFMDJ2A+MJQ7yS9dnrjXShQSs5Zq2K K6AcywmmigYXNcsD8PQCJ0mjLvIefB6nIfv1IYio0gyJ/ynWcQSdzOZRLGXhXW/xG75q3z4/Nwe EwBvXPYw/eAwepPUeTQ== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-04-07_02,2026-04-07_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 malwarescore=0 lowpriorityscore=0 adultscore=0 impostorscore=0 clxscore=1015 phishscore=0 priorityscore=1501 spamscore=0 bulkscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2604010000 definitions=main-2604070125 Update the s390 specific PCI documentation to better reflect current behavior and terms such as the handling of Isolated VFs via commit 25f39d3dcb48 ("s390/pci: Ignore RID for isolated VFs"). Add a descriptions for /sys/firmware/clp/uid_checking which was added in commit b043a81ce3ee ("s390/pci: Expose firmware provided UID Checking state in sysfs") but missed documentation. Similarly add documentation for the fidparm attribute added by commit 99ad39306a62 ("s390/pci: Expose FIDPARM attribute in sysfs") and add a list of pft values and their names. Finally improve formatting of the different attribute descriptions by adding a separating colon. Reviewed-by: Farhan Ali Acked-by: Randy Dunlap Tested-by: Randy Dunlap Reviewed-by: Matthew Rosato Signed-off-by: Niklas Schnelle Reviewed-by: Gerd Bayer --- Documentation/arch/s390/pci.rst | 144 +++++++++++++++++++++++++++---------= ---- 1 file changed, 97 insertions(+), 47 deletions(-) diff --git a/Documentation/arch/s390/pci.rst b/Documentation/arch/s390/pci.= rst index d5755484d8e75c7bf67a350e61bbe04f0452a2fa..c3476de4f03278d07099aa32cbe= a0f868b6e9c9c 100644 --- a/Documentation/arch/s390/pci.rst +++ b/Documentation/arch/s390/pci.rst @@ -6,6 +6,7 @@ S/390 PCI =20 Authors: - Pierre Morel + - Niklas Schnelle =20 Copyright, IBM Corp. 2020 =20 @@ -27,14 +28,16 @@ Command line parameters debugfs entries --------------- =20 -The S/390 debug feature (s390dbf) generates views to hold various debug re= sults in sysfs directories of the form: +The S/390 debug feature (s390dbf) generates views to hold various debug re= sults +in sysfs directories of the form: =20 * /sys/kernel/debug/s390dbf/pci_*/ =20 For example: =20 - /sys/kernel/debug/s390dbf/pci_msg/sprintf - Holds messages from the processing of PCI events, like machine check h= andling + + holds messages from the processing of PCI events, like machine check h= andling and setting of global functionality, like UID checking. =20 Change the level of logging to be more or less verbose by piping @@ -47,87 +50,134 @@ Sysfs entries =20 Entries specific to zPCI functions and entries that hold zPCI information. =20 -* /sys/bus/pci/slots/XXXXXXXX +* /sys/bus/pci/slots/XXXXXXXX: =20 - The slot entries are set up using the function identifier (FID) of the - PCI function. The format depicted as XXXXXXXX above is 8 hexadecimal dig= its - with 0 padding and lower case hexadecimal digits. + The slot entries are set up using the function identifier (FID) of the P= CI + function as slot name. The format depicted as XXXXXXXX above is 8 hexade= cimal + digits with 0 padding and lower case hexadecimal digits. =20 - /sys/bus/pci/slots/XXXXXXXX/power =20 A physical function that currently supports a virtual function cannot be powered off until all virtual functions are removed with: - echo 0 > /sys/bus/pci/devices/XXXX:XX:XX.X/sriov_numvf + echo 0 > /sys/bus/pci/devices/DDDD:BB:dd.f/sriov_numvf =20 -* /sys/bus/pci/devices/XXXX:XX:XX.X/ +* /sys/bus/pci/devices/DDDD:BB:dd.f/: =20 - - function_id - A zPCI function identifier that uniquely identifies the function in th= e Z server. + - function_id: + The zPCI function identifier (FID) is a 32-bit hexadecimal value that + uniquely identifies the PCI function. Unless the hypervisor provides + a virtual FID e.g. on KVM this identifier is unique across the machine= even + between different partitions. =20 - - function_handle - Low-level identifier used for a configured PCI function. - It might be useful for debugging. + - function_handle: + This 32-bit hexadecimal value is a low-level identifier used for a PCI + function. Note that the function handle may be changed and become inva= lid + on PCI events and when enabling/disabling the PCI function. =20 - - pchid - Model-dependent location of the I/O adapter. + - pchid: + This 16-bit hexadecimal value encodes a model-dependent location for + the PCI function. =20 - - pfgid - PCI function group ID, functions that share identical functionality + - pfgid: + PCI function group ID; functions that share identical functionality use a common identifier. A PCI group defines interrupts, IOMMU, IOTLB, and DMA specifics. =20 - - vfn + - vfn: The virtual function number, from 1 to N for virtual functions, 0 for physical functions. =20 - - pft - The PCI function type + - pft: + The PCI function type is an s390-specific type attribute. It indicates + a more general, usage oriented, type than PCI Specification + class/vendor/device identifiers. That is PCI functions with the same p= ft + value may be backed by different hardware implementations. At the same= time + apart from unclassified functions (pft is 0x00) the same pft value + generally implies a similar usage model. At the same time the same + PCI hardware device may appear with different pft values when in a + different usage model. For example NETD and NETH VFs may be implemented + by the same PCI hardware device but in NETD the parent Physical Functi= on + is user managed while with NETH it is platform managed. =20 - - port - The port corresponds to the physical port the function is attached to. - It also gives an indication of the physical function a virtual function - is attached to. + Currently the following PFT values are defined: =20 - - uid - The user identifier (UID) may be defined as part of the machine - configuration or the z/VM or KVM guest configuration. If the accompany= ing - uid_is_unique attribute is 1 the platform guarantees that the UID is u= nique - within that instance and no devices with the same UID can be attached - during the lifetime of the system. + - 0x00 (UNC): Unclassified + - 0x02 (ROCE): RoCE Express + - 0x05 (ISM): Internal Shared Memory + - 0x0a (ROC2): RoCE Express 2 + - 0x0b (NVMe): NVMe + - 0x0c (NETH): Network Express hybrid + - 0x0d (CNW): Cloud Network Adapter + - 0x0f (NETD): Network Express direct =20 - - uid_is_unique - Indicates whether the user identifier (UID) is guaranteed to be and re= main - unique within this Linux instance. + - port: + The port is a decimal value corresponding to the physical port the fun= ction + is attached to. Virtual Functions (VFs) share the port with their pare= nt + Physical Function (PF). A value of 0 indicates that the port attribute= is + not applicable for that PCI function type. =20 - - pfip/segmentX + - uid: + The user-defined identifier (UID) for a PCI function is a 32-bit + hexadecimal value. It is defined on a per instance basis as part of the + partition, KVM guest, or z/VM guest configuration. If UID Checking is + enabled the platform ensures that the UID is unique within that instan= ce + and no two PCI functions with the same UID will be visible to the inst= ance. + + Independent of this guarantee and unlike the function ID (FID) the UID= may + be the same in different partitions within the same machine. This allo= ws to + create PCI configurations in multiple partitions to be identical in the + UID-namespace. + + - uid_is_unique: + A 0 or 1 flag indicating whether the user-defined identifier (UID) is + guaranteed to be and remain unique within this Linux instance. This + platform feature is called UID Checking. + + - pfip/segmentX: The segments determine the isolation of a function. They correspond to the physical path to the function. The more the segments are different, the more the functions are isolat= ed. =20 + - fidparm: + Contains an 8-bit-per-PCI function parameter field in hexadecimal prov= ided + by the platform. The meaning of this field is PCI function type specif= ic. + For NETH VFs a value of 0x01 indicates that the function supports + promiscuous mode. + +* /sys/firmware/clp/uid_checking: + + In addition to the per-device uid_is_unique attribute this presents a + global indication of whether UID Checking is enabled. This allows users + to check for UID Checking even when no PCI functions are configured. + Enumeration and hotplug =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =20 The PCI address consists of four parts: domain, bus, device and function, -and is of this form: DDDD:BB:dd.f +and is of this form: DDDD:BB:dd.f. =20 -* When not using multi-functions (norid is set, or the firmware does not - support multi-functions): +* For a PCI function for which the platform does not expose the RID, the + pci=3Dnorid kernel parameter is used, or a so-called isolated Virtual Fu= nction + which does have RID information but is used without its parent Physical + Function being part of the same PCI configuration: =20 - There is only one function per domain. =20 - - The domain is set from the zPCI function's UID as defined during the - LPAR creation. + - The domain is set from the zPCI function's UID if UID Checking is on; + otherwise the domain ID is generated dynamically and is not stable + across reboots or hot plug. =20 -* When using multi-functions (norid parameter is not set), - zPCI functions are addressed differently: +* For a PCI function for which the platform exposes the RID and which + is not an Isolated Virtual Function: =20 - There is still only one bus per domain. =20 - - There can be up to 256 functions per bus. + - There can be up to 256 PCI functions per bus. =20 - - The domain part of the address of all functions for - a multi-Function device is set from the zPCI function's UID as defined - in the LPAR creation for the function zero. + - The domain part of the address of all functions within the same topolo= gy is + that of the configured PCI function with the lowest devfn within that + topology. =20 - - New functions will only be ready for use after the function zero - (the function with devfn 0) has been enumerated. + - Virtual Functions generated by an SR-IOV capable Physical Function only + become visible once SR-IOV is enabled. --=20 2.51.0 From nobody Sun Jun 14 06:54:33 2026 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (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 6A15A3B7752; Tue, 7 Apr 2026 13:25:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.158.5 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775568306; cv=none; b=QvMIiXvz25O9keiMBXgXG5TtI5VV1lR53ReDSa9DUzp4POjCRaOsxUziu4kSFfxol9jwmrL70CExV3JFLos80sdj1aERyAFkrAQEbqI3lmWHS/uHNhjiFwkoT063KsJf/ZMhI04D5CCvKcnv/Y0NHzE3T6Bll8EYf0whI5nExTo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775568306; c=relaxed/simple; bh=eJ+f5VtW06hjPWQhL+mxU1tuQeMXPch8iPmbd9Za310=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=rvIIsHwY8xQgeCyK+nOl+j/TYe7M1SNQkNwgc56Iq7LKvtq6NRSLAfwI+MDIhkStro3YV8ThtVPCDFFZ0KnkXaxmN2Mu+UtFobmVxfymxrA+QdX6Mp5PuSKeE3PA/79AET2aV2VgS5F4/3QXHd4qfuWt2sNaJMnjoMKp5FDRpGg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=tSYiyPaj; arc=none smtp.client-ip=148.163.158.5 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="tSYiyPaj" Received: from pps.filterd (m0353725.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 636NQ5tk2401288; Tue, 7 Apr 2026 13:25:03 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=pp1; bh=/lcr96 SrwFC1B6RU1s1QLzKzJb5TcyudQnEV0SzV2eQ=; b=tSYiyPaj5CqVOvfG4X1Rt1 gVc+TaWQo4DSNcuourGu/NmbSqPbDx05TCV6lIiy3B7gRJyVoKar6kqKKyP9V/6J mBcIpU1UHPlOskv+W0qDJvVm/m7++NUvbRD8IT7QQv+wqYwb0POz9OdyM978FBWb 3g23GHyWI1jpn+vgCYpn4OmPncuwi+N+uyyWJ/NvVMuBTlSQ6XtVdOntYQXSGC+O vrEvfwsXgIKVV3vjk85ItjWDvPi7GlW02bPjDFoVMEeZzpQ3FdToecwFs4eL6dUh XwlI4Am7AKx/fE2D3Mo0yfLZLt1pjOp53TmNA1vtMyaUxe6lpRmM5ftSkUKCfGkA == Received: from ppma21.wdc07v.mail.ibm.com (5b.69.3da9.ip4.static.sl-reverse.com [169.61.105.91]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4dcn2hav1w-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 07 Apr 2026 13:25:02 +0000 (GMT) Received: from pps.filterd (ppma21.wdc07v.mail.ibm.com [127.0.0.1]) by ppma21.wdc07v.mail.ibm.com (8.18.1.2/8.18.1.2) with ESMTP id 637BNAKM029863; Tue, 7 Apr 2026 13:25:01 GMT Received: from smtprelay05.dal12v.mail.ibm.com ([172.16.1.7]) by ppma21.wdc07v.mail.ibm.com (PPS) with ESMTPS id 4dcme7bab2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 07 Apr 2026 13:25:01 +0000 Received: from smtpav03.dal12v.mail.ibm.com (smtpav03.dal12v.mail.ibm.com [10.241.53.102]) by smtprelay05.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 637DP0OY21824210 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 7 Apr 2026 13:25:00 GMT Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5CC6C58060; Tue, 7 Apr 2026 13:25:00 +0000 (GMT) Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9D8E05803F; Tue, 7 Apr 2026 13:24:57 +0000 (GMT) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.87.85.9]) by smtpav03.dal12v.mail.ibm.com (Postfix) with ESMTP; Tue, 7 Apr 2026 13:24:57 +0000 (GMT) From: Niklas Schnelle Date: Tue, 07 Apr 2026 15:24:46 +0200 Subject: [PATCH v8 2/2] PCI: s390: Expose the UID as an arch specific PCI slot attribute 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: <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 , Jonathan Corbet , Lukas Wunner , Shuah Khan Cc: Farhan Ali , Alexander Gordeev , Christian Borntraeger , Gerald Schaefer , Gerd Bayer , Heiko Carstens , Julian Ruess , Matthew Rosato , Peter Oberparleiter , Ramesh Errabolu , Sven Schnelle , Vasily Gorbik , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, linux-s390@vger.kernel.org, Niklas Schnelle X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=5423; i=schnelle@linux.ibm.com; h=from:subject:message-id; bh=eJ+f5VtW06hjPWQhL+mxU1tuQeMXPch8iPmbd9Za310=; b=owGbwMvMwCX2Wz534YHOJ2GMp9WSGDKvsi5qmLBp3QreRKb5D4/+2vpOZKK9UtusTJYnqdP+X jy8069fs6OUhUGMi0FWTJFlUZez37qCKaZ7gvo7YOawMoEMYeDiFICJbGhkZDimZaXasfWD8lvp 6pKtv5l7RWw0Pc9+t/sqFud1SPL/xL8Mf3ifnfzhk7fTaUVovJD62WWW5vybDM/8bfB+FDdjlt4 RNzYA X-Developer-Key: i=schnelle@linux.ibm.com; a=openpgp; fpr=9DB000B2D2752030A5F72DDCAFE43F15E8C26090 X-TM-AS-GCONF: 00 X-Proofpoint-Reinject: loops=2 maxloops=12 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNDA3MDEyNSBTYWx0ZWRfX5tYDnBUKYrg2 ZmfaJjr1ZmknHjEnKi4z6LP6CuwUIiXdDyuX3I6z+n3s8vexTnY3c6Q87wlLbR5aAsG2CFaA6hw jlujSWb5ydTuX5opBAW9F9UZa2d4FMVAAx0F+1FFmPvyvKRU6a484NrSrLFMerRuGsKHg+VF88P nQHELiMK5OQZe4JwQNUrDXSoIGJ07p5VP4ePgwc16syfqgCzobVMxpmnQ6hY/oBo+mSYQXnOu8V BEg7fi+7Rm3K7nZQz13jLYi5P7jLmgt17LBcZvDOahO+oslijInfB9Uu2Xo7oUnGDMmMHs0nNjf mopk91/rIdXsak0xWH/XpCg4ZNfeBOad7QV3Dqj1J2nclxyjMQwKyYnf2a3CfY7+JD8JVzYT0HW 9CNcDgteC1jxr392nJEUcH7Xmpy3QZ7xaf8pIdmnPEIyw0PwgAXeEAdj3Qtr1dXotcknhBlBMD1 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 a=GFwsV6G8L6GxiO2Y/PsHdQ==:117 a=GFwsV6G8L6GxiO2Y/PsHdQ==:17 a=IkcTkHD0fZMA:10 a=A5OVakUREuEA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=V8glGbnc2Ofi9Qvn3v5h:22 a=VnNF1IyMAAAA:8 a=WU3I-MCEZjdC1qMpAq0A:9 a=QEXdDO2ut3YA:10 X-Proofpoint-ORIG-GUID: vIs2OYqdjfg5CNNaBCf1RdBJ7NoiH80F X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-04-07_02,2026-04-07_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 clxscore=1015 spamscore=0 impostorscore=0 priorityscore=1501 phishscore=0 lowpriorityscore=0 adultscore=0 malwarescore=0 suspectscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2604010000 definitions=main-2604070125 On s390, an individual PCI function can generally be identified by two identifiers, the FID and the UID. Which identifier is used depends on the scope and the platform configuration. The first identifier, the FID, is always available and identifies a PCI device uniquely within a machine. The FID may be virtualized by hypervisors, but on the LPAR level, the machine scope makes it impossible to create the same configuration based on FIDs on two different LPARs of the same machine, and difficult to reuse across machines. Such matching LPAR configurations are useful, though, allowing standardized setups and booting a Linux installation on different LPARs. To this end the UID, or user-defined identifier, was introduced. While it is only guaranteed to be unique within an LPAR and only if indicated by firmware, it allows users to replicate PCI device setups. On s390, which uses a machine hypervisor, a per PCI function hotplug model is used. The shortcoming with the UID then is, that it is not visible to the user without first attaching the PCI function and accessing the "uid" device attribute. The FID, on the other hand, is used as the slot name and is thus known even with the PCI function in standby. Remedy this shortcoming by providing the UID as an attribute on the slot allowing the user to identify a PCI function based on the UID without having to first attach it. Do this via a macro mechanism analogous to what was introduced by commit 265baca69a07 ("s390/pci: Stop usurping pdev->dev.groups") for the PCI device attributes. Reviewed-by: Gerd Bayer Reviewed-by: Julian Ruess Signed-off-by: Niklas Schnelle Acked-by: Bjorn Helgaas # drivers/pci/slot.c --- Documentation/arch/s390/pci.rst | 7 +++++++ arch/s390/include/asm/pci.h | 4 ++++ arch/s390/pci/pci_sysfs.c | 20 ++++++++++++++++++++ drivers/pci/slot.c | 13 ++++++++++++- 4 files changed, 43 insertions(+), 1 deletion(-) diff --git a/Documentation/arch/s390/pci.rst b/Documentation/arch/s390/pci.= rst index c3476de4f03278d07099aa32cbea0f868b6e9c9c..80f4ba19315994da056a10b4d21= 6d61ff22ea5aa 100644 --- a/Documentation/arch/s390/pci.rst +++ b/Documentation/arch/s390/pci.rst @@ -58,6 +58,13 @@ Entries specific to zPCI functions and entries that hold= zPCI information. =20 - /sys/bus/pci/slots/XXXXXXXX/power =20 + In addition to using the FID as the name of the slot, the slot directory + also contains the following s390-specific slot attributes. + + - uid: + The User-defined identifier (UID) of the function which may be configu= red + by this slot. See also the corresponding attribute of the device. + A physical function that currently supports a virtual function cannot be powered off until all virtual functions are removed with: echo 0 > /sys/bus/pci/devices/DDDD:BB:dd.f/sriov_numvf diff --git a/arch/s390/include/asm/pci.h b/arch/s390/include/asm/pci.h index c0ff19dab5807c7e1aabb48a0e9436aac45ec97d..5dcf35f0f325f5f44b28109a1c8= d9aef18401035 100644 --- a/arch/s390/include/asm/pci.h +++ b/arch/s390/include/asm/pci.h @@ -208,6 +208,10 @@ extern const struct attribute_group zpci_ident_attr_gr= oup; &pfip_attr_group, \ &zpci_ident_attr_group, =20 +extern const struct attribute_group zpci_slot_attr_group; + +#define ARCH_PCI_SLOT_GROUPS (&zpci_slot_attr_group) + extern unsigned int s390_pci_force_floating __initdata; extern unsigned int s390_pci_no_rid; =20 diff --git a/arch/s390/pci/pci_sysfs.c b/arch/s390/pci/pci_sysfs.c index c2444a23e26c4218832bb91930b5f0ffd498d28f..d98d97df792adb3c7e415a8d374= cc2f3a65fbb52 100644 --- a/arch/s390/pci/pci_sysfs.c +++ b/arch/s390/pci/pci_sysfs.c @@ -187,6 +187,17 @@ static ssize_t index_show(struct device *dev, } static DEVICE_ATTR_RO(index); =20 +static ssize_t zpci_uid_slot_show(struct pci_slot *slot, char *buf) +{ + struct zpci_dev *zdev =3D container_of(slot->hotplug, struct zpci_dev, + hotplug_slot); + + return sysfs_emit(buf, "0x%x\n", zdev->uid); +} + +static struct pci_slot_attribute zpci_slot_attr_uid =3D + __ATTR(uid, 0444, zpci_uid_slot_show, NULL); + static umode_t zpci_index_is_visible(struct kobject *kobj, struct attribute *attr, int n) { @@ -243,6 +254,15 @@ const struct attribute_group pfip_attr_group =3D { .attrs =3D pfip_attrs, }; =20 +static struct attribute *zpci_slot_attrs[] =3D { + &zpci_slot_attr_uid.attr, + NULL, +}; + +const struct attribute_group zpci_slot_attr_group =3D { + .attrs =3D zpci_slot_attrs, +}; + static struct attribute *clp_fw_attrs[] =3D { &uid_checking_attr.attr, NULL, diff --git a/drivers/pci/slot.c b/drivers/pci/slot.c index 787311614e5b6ebb39e7284f9b9f205a0a684d6d..2f8fcfbbec24e73d0bb6e40fd04= c05a94f518045 100644 --- a/drivers/pci/slot.c +++ b/drivers/pci/slot.c @@ -96,7 +96,18 @@ static struct attribute *pci_slot_default_attrs[] =3D { &pci_slot_attr_cur_speed.attr, NULL, }; -ATTRIBUTE_GROUPS(pci_slot_default); + +static const struct attribute_group pci_slot_default_group =3D { + .attrs =3D pci_slot_default_attrs, +}; + +static const struct attribute_group *pci_slot_default_groups[] =3D { + &pci_slot_default_group, +#ifdef ARCH_PCI_SLOT_GROUPS + ARCH_PCI_SLOT_GROUPS, +#endif + NULL, +}; =20 static const struct kobj_type pci_slot_ktype =3D { .sysfs_ops =3D &pci_slot_sysfs_ops, --=20 2.51.0