All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/4] Don't make noise about disconnected USB4 devices
@ 2025-06-09  1:58 Mario Limonciello
  2025-06-09  1:58 ` [PATCH 1/4] PCI: Don't show errors on inaccessible PCI devices Mario Limonciello
                   ` (5 more replies)
  0 siblings, 6 replies; 16+ messages in thread
From: Mario Limonciello @ 2025-06-09  1:58 UTC (permalink / raw)
  To: mario.limonciello, bhelgaas, gregkh, mathias.nyman; +Cc: linux-pci, linux-usb

From: Mario Limonciello <mario.limonciello@amd.com>

When a USB4 or TBT3 dock is disconnected a lot of warnings and errors
are emitted related to the PCIe tunnels and XHCI controllers in th
dock.

The messages are loud, but it's mostly because the functions that
emit the messages don't check whether the device is actually alive.
The PCIe hotplug services mark the device as perm dead, so that
can be used to hide some of the messsages.

In the XHCI driver the device is marked as dying already, so that
can also be used to hide messages.

Mario Limonciello (4):
  PCI: Don't show errors on inaccessible PCI devices
  PCI: Fix runtime PM usage count underflow
  usb: xhci: Avoid showing errors during surprise removal
  usb: xhci: Avoid showing warnings for dying controller

 drivers/pci/pci-driver.c     | 3 ++-
 drivers/pci/pci.c            | 5 +++--
 drivers/usb/host/xhci-ring.c | 7 +++++--
 drivers/usb/host/xhci.c      | 6 ++++--
 4 files changed, 14 insertions(+), 7 deletions(-)

-- 
2.43.0


^ permalink raw reply	[flat|nested] 16+ messages in thread
* [PATCH 3/4] usb: xhci: Avoid showing errors during surprise removal
@ 2025-06-09  2:05 Mario Limonciello
  0 siblings, 0 replies; 16+ messages in thread
From: Mario Limonciello @ 2025-06-09  2:05 UTC (permalink / raw)
  To: mario.limonciello; +Cc: bhelgaas, linux-pci

From: Mario Limonciello <mario.limonciello@amd.com>

When a USB4 dock is unplugged from a system it won't respond to ring
events. The PCI core handles the surprise removal event and notifies
all PCI drivers. The XHCI PCI driver sets a flag that the device is
being removed as well.

When that flag is set don't show messages in the cleanup path for
marking the controller dead.

Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
---
 drivers/usb/host/xhci-ring.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
index e038ad3375dc9..997628f8d06e5 100644
--- a/drivers/usb/host/xhci-ring.c
+++ b/drivers/usb/host/xhci-ring.c
@@ -1377,12 +1377,15 @@ static void xhci_kill_endpoint_urbs(struct xhci_hcd *xhci,
  */
 void xhci_hc_died(struct xhci_hcd *xhci)
 {
+	bool notify;
 	int i, j;
 
 	if (xhci->xhc_state & XHCI_STATE_DYING)
 		return;
 
-	xhci_err(xhci, "xHCI host controller not responding, assume dead\n");
+	notify = !(xhci->xhc_state & XHCI_STATE_REMOVING);
+	if (notify)
+		xhci_err(xhci, "xHCI host controller not responding, assume dead\n");
 	xhci->xhc_state |= XHCI_STATE_DYING;
 
 	xhci_cleanup_command_queue(xhci);
@@ -1396,7 +1399,7 @@ void xhci_hc_died(struct xhci_hcd *xhci)
 	}
 
 	/* inform usb core hc died if PCI remove isn't already handling it */
-	if (!(xhci->xhc_state & XHCI_STATE_REMOVING))
+	if (notify)
 		usb_hc_died(xhci_to_hcd(xhci));
 }
 
-- 
2.43.0


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

end of thread, other threads:[~2025-06-09 15:45 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-09  1:58 [PATCH 0/4] Don't make noise about disconnected USB4 devices Mario Limonciello
2025-06-09  1:58 ` [PATCH 1/4] PCI: Don't show errors on inaccessible PCI devices Mario Limonciello
2025-06-09 15:09   ` Lukas Wunner
2025-06-09 15:41     ` Mario Limonciello
2025-06-09  1:58 ` [PATCH 2/4] PCI: Fix runtime PM usage count underflow Mario Limonciello
2025-06-09 15:16   ` Lukas Wunner
2025-06-09  1:58 ` [PATCH 3/4] usb: xhci: Avoid showing errors during surprise removal Mario Limonciello
2025-06-09 12:42   ` Mathias Nyman
2025-06-09 13:07     ` Mario Limonciello
2025-06-09 14:52       ` Mathias Nyman
2025-06-09  1:58 ` [PATCH 4/4] usb: xhci: Avoid showing warnings for dying controller Mario Limonciello
2025-06-09 12:47   ` Mathias Nyman
2025-06-09  9:19 ` [PATCH 0/4] Don't make noise about disconnected USB4 devices Michał Pecio
2025-06-09 13:05   ` Mario Limonciello
2025-06-09 15:20 ` Lukas Wunner
  -- strict thread matches above, loose matches on Subject: below --
2025-06-09  2:05 [PATCH 3/4] usb: xhci: Avoid showing errors during surprise removal Mario Limonciello

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.