Skip to content

Commit 9d4f1c0

Browse files
committed
Merge branch 'pci/npem'
- Initialize leds class earlier (with an unfortunate Makefile ordering change) so the PCI NPEM driver can use it (Mariusz Tkaczyk) - Add Native PCIe Enclosure Management (NPEM) support for sysfs control of NVMe RAID storage indicators (ok/fail/locate/rebuild/etc) (Mariusz Tkaczyk) - Add support for the ACPI _DSM PCIe SSD status LED management, which is functionally similar to NPEM but mediated by platform firmware (Mariusz Tkaczyk) * pci/npem: PCI/NPEM: Add _DSM PCIe SSD status LED management PCI/NPEM: Add Native PCIe Enclosure Management support leds: Init leds class earlier
2 parents e642aa6 + 759ec28 commit 9d4f1c0

10 files changed

Lines changed: 730 additions & 1 deletion

File tree

Documentation/ABI/testing/sysfs-bus-pci

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -500,3 +500,75 @@ Description:
500500
console drivers from the device. Raw users of pci-sysfs
501501
resourceN attributes must be terminated prior to resizing.
502502
Success of the resizing operation is not guaranteed.
503+
504+
What: /sys/bus/pci/devices/.../leds/*:enclosure:*/brightness
505+
What: /sys/class/leds/*:enclosure:*/brightness
506+
Date: August 2024
507+
KernelVersion: 6.12
508+
Description:
509+
LED indications on PCIe storage enclosures which are controlled
510+
through the NPEM interface (Native PCIe Enclosure Management,
511+
PCIe r6.1 sec 6.28) are accessible as led class devices, both
512+
below /sys/class/leds and below NPEM-capable PCI devices.
513+
514+
Although these led class devices could be manipulated manually,
515+
in practice they are typically manipulated automatically by an
516+
application such as ledmon(8).
517+
518+
The name of a led class device is as follows:
519+
<bdf>:enclosure:<indication>
520+
where:
521+
522+
- <bdf> is the domain, bus, device and function number
523+
(e.g. 10000:02:05.0)
524+
- <indication> is a short description of the LED indication
525+
526+
Valid indications per PCIe r6.1 table 6-27 are:
527+
528+
- ok (drive is functioning normally)
529+
- locate (drive is being identified by an admin)
530+
- fail (drive is not functioning properly)
531+
- rebuild (drive is part of an array that is rebuilding)
532+
- pfa (drive is predicted to fail soon)
533+
- hotspare (drive is marked to be used as a replacement)
534+
- ica (drive is part of an array that is degraded)
535+
- ifa (drive is part of an array that is failed)
536+
- idt (drive is not the right type for the connector)
537+
- disabled (drive is disabled, removal is safe)
538+
- specific0 to specific7 (enclosure-specific indications)
539+
540+
Broadly, the indications fall into one of these categories:
541+
542+
- to signify drive state (ok, locate, fail, idt, disabled)
543+
- to signify drive role or state in a software RAID array
544+
(rebuild, pfa, hotspare, ica, ifa)
545+
- to signify any other role or state (specific0 to specific7)
546+
547+
Mandatory indications per PCIe r6.1 sec 7.9.19.2 comprise:
548+
ok, locate, fail, rebuild. All others are optional.
549+
A led class device is only visible if the corresponding
550+
indication is supported by the device.
551+
552+
To manipulate the indications, write 0 (LED_OFF) or 1 (LED_ON)
553+
to the "brightness" file. Note that manipulating an indication
554+
may implicitly manipulate other indications at the vendor's
555+
discretion. E.g. when the user lights up the "ok" indication,
556+
the vendor may choose to automatically turn off the "fail"
557+
indication. The current state of an indication can be
558+
retrieved by reading its "brightness" file.
559+
560+
The PCIe Base Specification allows vendors leeway to choose
561+
different colors or blinking patterns for the indications,
562+
but they typically follow the IBPI standard. E.g. the "locate"
563+
indication is usually presented as one or two LEDs blinking at
564+
4 Hz frequency:
565+
https://en.wikipedia.org/wiki/International_Blinking_Pattern_Interpretation
566+
567+
PCI Firmware Specification r3.3 sec 4.7 defines a DSM interface
568+
to facilitate shared access by operating system and platform
569+
firmware to a device's NPEM registers. The kernel will use
570+
this DSM interface where available, instead of accessing NPEM
571+
registers directly. The DSM interface does not support the
572+
enclosure-specific indications "specific0" to "specific7",
573+
hence the corresponding led class devices are unavailable if
574+
the DSM interface is used.

drivers/Makefile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ obj-$(CONFIG_PINCTRL) += pinctrl/
1717
obj-$(CONFIG_GPIOLIB) += gpio/
1818
obj-y += pwm/
1919

20+
# LEDs must come before PCI, it is needed by NPEM driver
21+
obj-y += leds/
22+
2023
obj-y += pci/
2124

2225
obj-$(CONFIG_PARISC) += parisc/
@@ -130,7 +133,6 @@ obj-$(CONFIG_CPU_IDLE) += cpuidle/
130133
obj-y += mmc/
131134
obj-y += ufs/
132135
obj-$(CONFIG_MEMSTICK) += memstick/
133-
obj-y += leds/
134136
obj-$(CONFIG_INFINIBAND) += infiniband/
135137
obj-y += firmware/
136138
obj-$(CONFIG_CRYPTO) += crypto/

drivers/pci/Kconfig

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,15 @@ config PCI_IOV
143143

144144
If unsure, say N.
145145

146+
config PCI_NPEM
147+
bool "Native PCIe Enclosure Management"
148+
depends on LEDS_CLASS=y
149+
help
150+
Support for Native PCIe Enclosure Management. It allows managing LED
151+
indications in storage enclosures. Enclosure must support following
152+
indications: OK, Locate, Fail, Rebuild, other indications are
153+
optional.
154+
146155
config PCI_PRI
147156
bool "PCI PRI support"
148157
select PCI_ATS

drivers/pci/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ obj-$(CONFIG_XEN_PCIDEV_FRONTEND) += xen-pcifront.o
3535
obj-$(CONFIG_VGA_ARB) += vgaarb.o
3636
obj-$(CONFIG_PCI_DOE) += doe.o
3737
obj-$(CONFIG_PCI_DYNAMIC_OF_NODES) += of_property.o
38+
obj-$(CONFIG_PCI_NPEM) += npem.o
3839

3940
# Endpoint library must be initialized before its users
4041
obj-$(CONFIG_PCI_ENDPOINT) += endpoint/

0 commit comments

Comments
 (0)