From: Niklas Schnelle <schnelle@linux.ibm.com>
To: Bjorn Helgaas <bhelgaas@google.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-s390@vger.kernel.org,
Peter Oberparleiter <oberpar@linux.ibm.com>,
Viktor Mihajlovski <mihajlov@linux.ibm.com>
Subject: [RFC v2 1/1] PCI: Add s390 specific UID uniqueness attribute
Date: Thu, 4 Feb 2021 10:43:53 +0100 [thread overview]
Message-ID: <20210204094353.63819-2-schnelle@linux.ibm.com> (raw)
In-Reply-To: <20210204094353.63819-1-schnelle@linux.ibm.com>
The global UID uniqueness attribute exposes whether the platform
guarantees that the user-defined per-device UID attribute values
(/sys/bus/pci/device/<dev>/uid) are unique and can thus be used as
a global identifier for the associated PCI device. With this commit
it is exposed at /sys/bus/pci/zpci/unique_uids
Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com>
---
Documentation/ABI/testing/sysfs-bus-pci | 9 +++++++++
drivers/pci/pci-sysfs.c | 21 +++++++++++++++++++++
2 files changed, 30 insertions(+)
diff --git a/Documentation/ABI/testing/sysfs-bus-pci b/Documentation/ABI/testing/sysfs-bus-pci
index 25c9c39770c6..812dd9d3f80d 100644
--- a/Documentation/ABI/testing/sysfs-bus-pci
+++ b/Documentation/ABI/testing/sysfs-bus-pci
@@ -375,3 +375,12 @@ Description:
The value comes from the PCI kernel device state and can be one
of: "unknown", "error", "D0", D1", "D2", "D3hot", "D3cold".
The file is read only.
+What: /sys/bus/pci/zpci/unique_uids
+Date: February 2021
+Contact: Niklas Schnelle <schnelle@linux.ibm.com>
+Description:
+ This attribute exposes the global state of UID Uniqueness on an
+ s390 Linux system. If this file contains '1' the per-device UID
+ attribute is guaranteed to provide a unique user defined
+ identifier for that PCI device. If this file contains '0' UIDs
+ may collide and do not provide a unique identifier.
diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c
index fb072f4b3176..61de66ab59cf 100644
--- a/drivers/pci/pci-sysfs.c
+++ b/drivers/pci/pci-sysfs.c
@@ -425,6 +425,24 @@ static ssize_t rescan_store(struct bus_type *bus, const char *buf, size_t count)
}
static BUS_ATTR_WO(rescan);
+#if defined(CONFIG_S390)
+static ssize_t unique_uids_show(struct bus_type *bus, char *buf)
+{
+ return sprintf(buf, "%i\n", zpci_unique_uid);
+}
+static BUS_ATTR_RO(unique_uids);
+
+static struct attribute *zpci_bus_attrs[] = {
+ &bus_attr_unique_uids.attr,
+ NULL,
+};
+
+static struct attribute_group zpci_bus_group = {
+ .name = "zpci",
+ .attrs = zpci_bus_attrs,
+};
+#endif
+
static struct attribute *pci_bus_attrs[] = {
&bus_attr_rescan.attr,
NULL,
@@ -436,6 +454,9 @@ static const struct attribute_group pci_bus_group = {
const struct attribute_group *pci_bus_groups[] = {
&pci_bus_group,
+#if defined(CONFIG_S390)
+ &zpci_bus_group,
+#endif
NULL,
};
--
2.17.1
next prev parent reply other threads:[~2021-02-04 9:44 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-04 9:43 [RFC v2 0/1] s390/pci: expose UID checking state in sysfs Niklas Schnelle
2021-02-04 9:43 ` Niklas Schnelle [this message]
2021-02-04 10:40 ` [RFC v2 1/1] PCI: Add s390 specific UID uniqueness attribute Greg Kroah-Hartman
2021-02-04 12:02 ` Niklas Schnelle
2021-02-04 13:38 ` Greg Kroah-Hartman
2021-02-04 14:41 ` Niklas Schnelle
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210204094353.63819-2-schnelle@linux.ibm.com \
--to=schnelle@linux.ibm.com \
--cc=bhelgaas@google.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=mihajlov@linux.ibm.com \
--cc=oberpar@linux.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).