]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
s390/pci: Expose firmware provided UID Checking state in sysfs
authorRamesh Errabolu <ramesh@linux.ibm.com>
Mon, 29 Sep 2025 04:38:27 +0000 (23:38 -0500)
committerHeiko Carstens <hca@linux.ibm.com>
Sat, 4 Oct 2025 16:40:42 +0000 (18:40 +0200)
The sysfs file /sys/bus/pci/devices/<device_id>/uid_is_unique provides
the UID Checking state as a per device attribute, highlighting its
effect of providing the guarantee that a device's UID is unique.
As a device attribute, this parameter is however unavailable if no
device is configured.

Expose the UID Checking state as:
  - A platform-level parameter
  - Available regardless of device presence or state

Signed-off-by: Ramesh Errabolu <ramesh@linux.ibm.com>
Reviewed-by: Niklas Schnelle <schnelle@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
arch/s390/include/asm/pci.h
arch/s390/pci/pci.c
arch/s390/pci/pci_sysfs.c

index 41f900f693d92522ff729829e446b581977ef3ff..6890925d5587b1825cc51ac7e2be2003132244da 100644 (file)
@@ -246,6 +246,16 @@ int clp_refresh_fh(u32 fid, u32 *fh);
 /* UID */
 void update_uid_checking(bool new);
 
+/* Firmware Sysfs */
+int __init __zpci_fw_sysfs_init(void);
+
+static inline int __init zpci_fw_sysfs_init(void)
+{
+       if (IS_ENABLED(CONFIG_SYSFS))
+               return __zpci_fw_sysfs_init();
+       return 0;
+}
+
 /* IOMMU Interface */
 int zpci_init_iommu(struct zpci_dev *zdev);
 void zpci_destroy_iommu(struct zpci_dev *zdev);
index cd6676c2d6022d60e3358484d5674a9b65880829..c82c577db2bcd2143476cb8189fd89b9a4dc9836 100644 (file)
@@ -1188,6 +1188,10 @@ static int __init pci_base_init(void)
        if (rc)
                goto out_find;
 
+       rc = zpci_fw_sysfs_init();
+       if (rc)
+               goto out_find;
+
        s390_pci_initialized = 1;
        return 0;
 
index 0ee0924cfab7e5d22468fb197ee78cac679d8c13..12060870e2aa167c58a690d584f0268b1347fbfe 100644 (file)
@@ -41,6 +41,9 @@ zpci_attr(segment1, "0x%02x\n", pfip[1]);
 zpci_attr(segment2, "0x%02x\n", pfip[2]);
 zpci_attr(segment3, "0x%02x\n", pfip[3]);
 
+#define ZPCI_FW_ATTR_RO(_name)                                         \
+       static struct kobj_attribute _name##_attr = __ATTR_RO(_name)
+
 static ssize_t mio_enabled_show(struct device *dev,
                                struct device_attribute *attr, char *buf)
 {
@@ -164,6 +167,13 @@ static ssize_t uid_is_unique_show(struct device *dev,
 }
 static DEVICE_ATTR_RO(uid_is_unique);
 
+static ssize_t uid_checking_show(struct kobject *kobj,
+                                struct kobj_attribute *attr, char *buf)
+{
+       return sysfs_emit(buf, "%d\n", zpci_unique_uid ? 1 : 0);
+}
+ZPCI_FW_ATTR_RO(uid_checking);
+
 /* analogous to smbios index */
 static ssize_t index_show(struct device *dev,
                          struct device_attribute *attr, char *buf)
@@ -233,3 +243,18 @@ const struct attribute_group pfip_attr_group = {
        .name = "pfip",
        .attrs = pfip_attrs,
 };
+
+static struct attribute *clp_fw_attrs[] = {
+       &uid_checking_attr.attr,
+       NULL,
+};
+
+static struct attribute_group clp_fw_attr_group = {
+       .name = "clp",
+       .attrs = clp_fw_attrs,
+};
+
+int __init __zpci_fw_sysfs_init(void)
+{
+       return sysfs_create_group(firmware_kobj, &clp_fw_attr_group);
+}