Commit b043a81c authored by Ramesh Errabolu's avatar Ramesh Errabolu Committed by Heiko Carstens
Browse files

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: default avatarRamesh Errabolu <ramesh@linux.ibm.com>
Reviewed-by: default avatarNiklas Schnelle <schnelle@linux.ibm.com>
Signed-off-by: default avatarHeiko Carstens <hca@linux.ibm.com>
parent 4335edb7
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -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);
+4 −0
Original line number Diff line number Diff line
@@ -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;

+25 −0
Original line number Diff line number Diff line
@@ -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);
}