linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH pci-next v1 0/1] PCI/sysfs: Expose PCIe device serial number
@ 2025-07-13  1:17 Matthew Wood
  2025-07-13  1:17 ` [PATCH pci-next v1 1/1] " Matthew Wood
  2025-07-15 11:19 ` [PATCH pci-next v1 0/1] " Jonathan Cameron
  0 siblings, 2 replies; 5+ messages in thread
From: Matthew Wood @ 2025-07-13  1:17 UTC (permalink / raw)
  To: Bjorn Helgaas; +Cc: linux-pci, linux-kernel

Add a single sysfs read-only interface for reading PCIe device serial
numbers from userspace in a programmatic way. This device attribute
uses the same 2-byte dashed formatting as lspci serial number capability
output:

    more /sys/devices/pci0000:c0/0000:c0:01.1/0000:c1:00.0/0000:c2:1f.0/0000:cc:00.0/device_serial_number
    00-80-ee-00-00-00-41-80

Accompanying lspci output:

    sudo lspci -vvv -s cc:00.0
        cc:00.0 Serial Attached SCSI controller: Broadcom / LSI PCIe Switch management endpoint (rev b0)
            Subsystem: Broadcom / LSI Device 0144
            ...
            Capabilities: [100 v1] Device Serial Number 00-80-ee-00-00-00-41-80
            ...

If a device doesn't support the serial number capability, userspace will receive
an empty read:

    more /sys/devices/pci0000:00/0000:00:07.1/device_serial_number
    echo $?
    0


Matthew Wood (1):
  PCI/sysfs: Expose PCIe device serial number

 drivers/pci/pci-sysfs.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

-- 
2.50.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2025-07-16  9:23 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-13  1:17 [PATCH pci-next v1 0/1] PCI/sysfs: Expose PCIe device serial number Matthew Wood
2025-07-13  1:17 ` [PATCH pci-next v1 1/1] " Matthew Wood
2025-07-15 11:19 ` [PATCH pci-next v1 0/1] " Jonathan Cameron
2025-07-15 15:59   ` Matthew Wood
2025-07-16  9:23     ` Jonathan Cameron

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).