mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-17 01:34:00 +08:00
s390/pci: expose UID uniqueness guarantee
On s390 each PCI device has a user-defined ID (UID) exposed under
/sys/bus/pci/devices/<dev>/uid. This ID was designed to serve as the PCI
device's primary index and to match the device within Linux to the
device configured in the hypervisor. To serve as a primary identifier
the UID must be unique within the Linux instance, this is guaranteed by
the platform if and only if the UID Uniqueness Checking flag is set
within the CLP List PCI Functions response.
While the UID has been exposed to userspace since commit ac4995b9d5
("s390/pci: add some new arch specific pci attributes") whether or not
the platform guarantees its uniqueness for the lifetime of the Linux
instance while defined is not visible from userspace. Remedy this by
exposing this as a per device attribute at
/sys/bus/pci/devices/<dev>/uid_is_unique
Keeping this a per device attribute allows for maximum flexibility if we
ever end up with some devices not having a UID or not enjoying the
guaranteed uniqueness.
Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com>
Reviewed-by: Viktor Mihajlovski <mihajlov@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
This commit is contained in:
parent
652d40b2f8
commit
408f2c9c15
@ -50,7 +50,8 @@ Entries specific to zPCI functions and entries that hold zPCI information.
|
|||||||
* /sys/bus/pci/slots/XXXXXXXX
|
* /sys/bus/pci/slots/XXXXXXXX
|
||||||
|
|
||||||
The slot entries are set up using the function identifier (FID) of the
|
The slot entries are set up using the function identifier (FID) of the
|
||||||
PCI function.
|
PCI function. The format depicted as XXXXXXXX above is 8 hexadecimal digits
|
||||||
|
with 0 padding and lower case hexadecimal digitis.
|
||||||
|
|
||||||
- /sys/bus/pci/slots/XXXXXXXX/power
|
- /sys/bus/pci/slots/XXXXXXXX/power
|
||||||
|
|
||||||
@ -88,8 +89,15 @@ Entries specific to zPCI functions and entries that hold zPCI information.
|
|||||||
is attached to.
|
is attached to.
|
||||||
|
|
||||||
- uid
|
- uid
|
||||||
The unique identifier (UID) is defined when configuring an LPAR and is
|
The user identifier (UID) may be defined as part of the machine
|
||||||
unique in the LPAR.
|
configuration or the z/VM or KVM guest configuration. If the accompanying
|
||||||
|
uid_is_unique attribute is 1 the platform guarantees that the UID is unique
|
||||||
|
within that instance and no devices with the same UID can be attached
|
||||||
|
during the lifetime of the system.
|
||||||
|
|
||||||
|
- uid_is_unique
|
||||||
|
Indicates whether the user identifier (UID) is guaranteed to be and remain
|
||||||
|
unique within this Linux instance.
|
||||||
|
|
||||||
- pfip/segmentX
|
- pfip/segmentX
|
||||||
The segments determine the isolation of a function.
|
The segments determine the isolation of a function.
|
||||||
|
@ -131,6 +131,13 @@ static ssize_t report_error_write(struct file *filp, struct kobject *kobj,
|
|||||||
}
|
}
|
||||||
static BIN_ATTR(report_error, S_IWUSR, NULL, report_error_write, PAGE_SIZE);
|
static BIN_ATTR(report_error, S_IWUSR, NULL, report_error_write, PAGE_SIZE);
|
||||||
|
|
||||||
|
static ssize_t uid_is_unique_show(struct device *dev,
|
||||||
|
struct device_attribute *attr, char *buf)
|
||||||
|
{
|
||||||
|
return sysfs_emit(buf, "%d\n", zpci_unique_uid ? 1 : 0);
|
||||||
|
}
|
||||||
|
static DEVICE_ATTR_RO(uid_is_unique);
|
||||||
|
|
||||||
static struct bin_attribute *zpci_bin_attrs[] = {
|
static struct bin_attribute *zpci_bin_attrs[] = {
|
||||||
&bin_attr_util_string,
|
&bin_attr_util_string,
|
||||||
&bin_attr_report_error,
|
&bin_attr_report_error,
|
||||||
@ -148,8 +155,10 @@ static struct attribute *zpci_dev_attrs[] = {
|
|||||||
&dev_attr_uid.attr,
|
&dev_attr_uid.attr,
|
||||||
&dev_attr_recover.attr,
|
&dev_attr_recover.attr,
|
||||||
&dev_attr_mio_enabled.attr,
|
&dev_attr_mio_enabled.attr,
|
||||||
|
&dev_attr_uid_is_unique.attr,
|
||||||
NULL,
|
NULL,
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct attribute_group zpci_attr_group = {
|
static struct attribute_group zpci_attr_group = {
|
||||||
.attrs = zpci_dev_attrs,
|
.attrs = zpci_dev_attrs,
|
||||||
.bin_attrs = zpci_bin_attrs,
|
.bin_attrs = zpci_bin_attrs,
|
||||||
|
Loading…
Reference in New Issue
Block a user