From: Richard Cheng <icheng@nvidia.com>
To: bhelgaas@google.com
Cc: linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org,
jan@nvidia.com, newtonl@nvidia.com, sreddym@nvidia.com,
skomatineni@nvidia.com, vidyas@nvidia.com, kristinc@nvidia.com,
kaihengf@nvidia.com, mochs@nvidia.com,
Richard Cheng <icheng@nvidia.com>
Subject: [PATCH] PCI/NPEM: Set LED_HW_PLUGGABLE for hotplug-capable ports
Date: Thu, 2 Apr 2026 17:38:50 +0800 [thread overview]
Message-ID: <20260402093850.23075-1-icheng@nvidia.com> (raw)
NPEM registers LED classdevs on PCI endpoint that may be behind
hotplug-capable ports. During hot-removal, led_classdev_unregister()
calls led_set_brightness(LED_OFF) which PCI config on a disconnected
device, returning -ENODEV:
```
leds 0003:01:00.0:enclosure:ok: Setting an LED's brightness failed (-19)
```
The LED core already suppresses this for devices with LED_HW_PLUGGABLE
set, but NPEM never sets it. Add the flag since NPEM LEDs are on
hot-pluggable hardware by nature.
Fixes: 4e893545ef87 ("PCI/NPEM: Add Native PCIe Enclosure Management support")
Signed-off-by: Richard Cheng <icheng@nvidia.com>
Acked-by: Kai-Heng Feng <kaihengf@nvidia.com>
---
The bug was triggered on an ARM64 machine with CPU model Olympus.
Kernel version is v6.17.
The PCI topology is
```
$ sudo lspci -tv
-[0001:00]---00.0-[01]--+-00.0 Mellanox Technologies CX8 Family [ConnectX-8]
+-00.1 Mellanox Technologies CX8 Family [ConnectX-8]
+-00.2 Mellanox Technologies CX8 Family [ConnectX-8]
\-00.3 Mellanox Technologies CX8 Family [ConnectX-8]
-[0002:00]---00.0-[01]--
-+-[0003:00]---00.0-[01]----00.0 Montage Technology Co., Ltd. Device c002
\-[0003:80]---00.0-[81]----00.0 Montage Technology Co., Ltd. Device c002
-[0004:00]---00.0-[01]--
-+-[0005:00]---00.0-[01]----00.0 Samsung Electronics Co Ltd Device a810
+-[0005:40]---00.0-[41]----00.0 Samsung Electronics Co Ltd Device a810
+-[0005:c0]---00.0-[c1]----00.0 Intel Corporation I210 Gigabit Network Connection
\-[0005:e0]---00.0-[e1-e2]----00.0-[e2]--+-00.0 ASPEED Technology, Inc. ASPEED Graphics Family
\-02.0 ASPEED Technology, Inc. Device 2603
-+-[0006:00]---00.0-[01]--
\-[0006:80]---00.0-[81]--
```
We're targeting on 0003:01:00.0 CXL [0502]: Montage Technology Co., Ltd. Device [1b00:c002] (rev 03).
First use `sudo setpci -s 0003:00:00.0 0x1f4.w=0x0002` to set UnmaskLinkDisable in CXL DVSEC.
Then disable the link with `sudo setpci -v -s 0003:00:00.0 CAP_EXP+0x10.b=0x10:0x10`
Best regards,
Richard Cheng.
---
drivers/pci/npem.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/pci/npem.c b/drivers/pci/npem.c
index ffeeedf6e311..c51879fcd438 100644
--- a/drivers/pci/npem.c
+++ b/drivers/pci/npem.c
@@ -504,7 +504,7 @@ static int pci_npem_set_led_classdev(struct npem *npem, struct npem_led *nled)
led->brightness_get = brightness_get;
led->max_brightness = 1;
led->default_trigger = "none";
- led->flags = 0;
+ led->flags = LED_HW_PLUGGABLE;
ret = led_classdev_register(&npem->dev->dev, led);
if (ret)
--
2.43.0
next reply other threads:[~2026-04-02 9:39 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-02 9:38 Richard Cheng [this message]
2026-04-05 7:41 ` [PATCH] PCI/NPEM: Set LED_HW_PLUGGABLE for hotplug-capable ports Lukas Wunner
2026-04-06 17:35 ` Bjorn Helgaas
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=20260402093850.23075-1-icheng@nvidia.com \
--to=icheng@nvidia.com \
--cc=bhelgaas@google.com \
--cc=jan@nvidia.com \
--cc=kaihengf@nvidia.com \
--cc=kristinc@nvidia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=mochs@nvidia.com \
--cc=newtonl@nvidia.com \
--cc=skomatineni@nvidia.com \
--cc=sreddym@nvidia.com \
--cc=vidyas@nvidia.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