Skip to content

Commit b043a81

Browse files
Ramesh Erraboluhcahca
authored andcommitted
s390/pci: Expose firmware provided UID Checking state in sysfs
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 <[email protected]> Reviewed-by: Niklas Schnelle <[email protected]> Signed-off-by: Heiko Carstens <[email protected]>
1 parent 4335edb commit b043a81

3 files changed

Lines changed: 39 additions & 0 deletions

File tree

arch/s390/include/asm/pci.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,16 @@ int clp_refresh_fh(u32 fid, u32 *fh);
246246
/* UID */
247247
void update_uid_checking(bool new);
248248

249+
/* Firmware Sysfs */
250+
int __init __zpci_fw_sysfs_init(void);
251+
252+
static inline int __init zpci_fw_sysfs_init(void)
253+
{
254+
if (IS_ENABLED(CONFIG_SYSFS))
255+
return __zpci_fw_sysfs_init();
256+
return 0;
257+
}
258+
249259
/* IOMMU Interface */
250260
int zpci_init_iommu(struct zpci_dev *zdev);
251261
void zpci_destroy_iommu(struct zpci_dev *zdev);

arch/s390/pci/pci.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1188,6 +1188,10 @@ static int __init pci_base_init(void)
11881188
if (rc)
11891189
goto out_find;
11901190

1191+
rc = zpci_fw_sysfs_init();
1192+
if (rc)
1193+
goto out_find;
1194+
11911195
s390_pci_initialized = 1;
11921196
return 0;
11931197

arch/s390/pci/pci_sysfs.c

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ zpci_attr(segment1, "0x%02x\n", pfip[1]);
4141
zpci_attr(segment2, "0x%02x\n", pfip[2]);
4242
zpci_attr(segment3, "0x%02x\n", pfip[3]);
4343

44+
#define ZPCI_FW_ATTR_RO(_name) \
45+
static struct kobj_attribute _name##_attr = __ATTR_RO(_name)
46+
4447
static ssize_t mio_enabled_show(struct device *dev,
4548
struct device_attribute *attr, char *buf)
4649
{
@@ -164,6 +167,13 @@ static ssize_t uid_is_unique_show(struct device *dev,
164167
}
165168
static DEVICE_ATTR_RO(uid_is_unique);
166169

170+
static ssize_t uid_checking_show(struct kobject *kobj,
171+
struct kobj_attribute *attr, char *buf)
172+
{
173+
return sysfs_emit(buf, "%d\n", zpci_unique_uid ? 1 : 0);
174+
}
175+
ZPCI_FW_ATTR_RO(uid_checking);
176+
167177
/* analogous to smbios index */
168178
static ssize_t index_show(struct device *dev,
169179
struct device_attribute *attr, char *buf)
@@ -233,3 +243,18 @@ const struct attribute_group pfip_attr_group = {
233243
.name = "pfip",
234244
.attrs = pfip_attrs,
235245
};
246+
247+
static struct attribute *clp_fw_attrs[] = {
248+
&uid_checking_attr.attr,
249+
NULL,
250+
};
251+
252+
static struct attribute_group clp_fw_attr_group = {
253+
.name = "clp",
254+
.attrs = clp_fw_attrs,
255+
};
256+
257+
int __init __zpci_fw_sysfs_init(void)
258+
{
259+
return sysfs_create_group(firmware_kobj, &clp_fw_attr_group);
260+
}

0 commit comments

Comments
 (0)