Skip to contentSkip to conversation

xhci fixes for usb-linus

PATCH In review Mathias Nyman 2 participants 4 messages Mar 6, 2020 – Mar 7, 2020

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover xhci fixes for usb-linus

Hi Greg

A couple minor xhci fixes for usb-linus, fixing xhci trace events and adding a quirk flag for a AMD xhci host.

-Mathias

Alberto Mattea (1):
usb: xhci: apply XHCI_SUSPEND_DELAY to AMD XHCI controller 1022:145c

Steven Rostedt (VMware) (1):
xhci: Do not open code __print_symbolic() in xhci trace events

 drivers/usb/host/xhci-pci.c   |  3 ++-
 drivers/usb/host/xhci-trace.h | 23 ++++++-----------------
 2 files changed, 8 insertions(+), 18 deletions(-)
Signature · 1 line
2.17.1
#1 lore raw

PATCH 1/2 xhci: Do not open code __print_symbolic() in xhci trace events

From: "Steven Rostedt (VMware)" <[email protected]>

libtraceevent (used by perf and trace-cmd) failed to parse the xhci_urb_dequeue trace event. This is because the user space trace event format parsing is not a full C compiler. It can handle some basic logic, but is not meant to be able to handle everything C can do.

In cases where a trace event field needs to be converted from a number to a string, there's the __print_symbolic() macro that should be used:

See samples/trace_events/trace-events-sample.h

Some xhci trace events open coded the __print_symbolic() causing the user spaces tools to fail to parse it. This has to be replaced with __print_symbolic() instead.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=206531

Fixes 5abdc2e6e12ff ("usb: host: xhci: add urb_enqueue/dequeue/giveback tracers")
---
 drivers/usb/host/xhci-trace.h | 23 ++++++-----------------
 1 file changed, 6 insertions(+), 17 deletions(-)
drivers/usb/host/xhci-trace.h +6 -17
index 56eb867803a6..b19582b2a72c 100644
@@ -289,23 +289,12 @@ DECLARE_EVENT_CLASS(xhci_log_urb,
 	),
 	TP_printk("ep%d%s-%s: urb %p pipe %u slot %d length %d/%d sgs %d/%d stream %d flags %08x",
 			__entry->epnum, __entry->dir_in ? "in" : "out",
-			({ char *s;
-			switch (__entry->type) {
-			case USB_ENDPOINT_XFER_INT:
-				s = "intr";
-				break;
-			case USB_ENDPOINT_XFER_CONTROL:
-				s = "control";
-				break;
-			case USB_ENDPOINT_XFER_BULK:
-				s = "bulk";
-				break;
-			case USB_ENDPOINT_XFER_ISOC:
-				s = "isoc";
-				break;
-			default:
-				s = "UNKNOWN";
-			} s; }), __entry->urb, __entry->pipe, __entry->slot_id,
+			__print_symbolic(__entry->type,
+				   { USB_ENDPOINT_XFER_INT,	"intr" },
+				   { USB_ENDPOINT_XFER_CONTROL,	"control" },
+				   { USB_ENDPOINT_XFER_BULK,	"bulk" },
+				   { USB_ENDPOINT_XFER_ISOC,	"isoc" }),
+			__entry->urb, __entry->pipe, __entry->slot_id,
 			__entry->actual, __entry->length, __entry->num_mapped_sgs,
 			__entry->num_sgs, __entry->stream, __entry->flags
 		)
Signature · 1 line
2.17.1
#2 lore raw

PATCH 2/2 usb: xhci: apply XHCI_SUSPEND_DELAY to AMD XHCI controller 1022:145c

In reply to Mathias Nyman

From: Alberto Mattea <[email protected]>

This controller timeouts during suspend (S3) with

[  240.521724] xhci_hcd 0000:30:00.3: WARN: xHC save state timeout
[  240.521729] xhci_hcd 0000:30:00.3: ERROR mismatched command completion event

thus preventing the system from entering S3.
Moreover it remains in an undefined state where some connected devices stop working until a reboot.
Apply the XHCI_SUSPEND_DELAY quirk to make it suspend properly.

---
 drivers/usb/host/xhci-pci.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/usb/host/xhci-pci.c +2 -1
index 5e9b537df631..1fddc41fa1f3 100644
@@ -136,7 +136,8 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci)
 		xhci->quirks |= XHCI_AMD_PLL_FIX;
 
 	if (pdev->vendor == PCI_VENDOR_ID_AMD &&
-		(pdev->device == 0x15e0 ||
+		(pdev->device == 0x145c ||
+		 pdev->device == 0x15e0 ||
 		 pdev->device == 0x15e1 ||
 		 pdev->device == 0x43bb))
 		xhci->quirks |= XHCI_SUSPEND_DELAY;
Signature · 1 line
2.17.1
maintainer
#3 lore raw

Re: [PATCH 2/2] usb: xhci: apply XHCI_SUSPEND_DELAY to AMD XHCI controller 1022:145c

Hi

[This is an automated email]

This commit has been processed because it contains a -stable tag. The stable tag indicates that it's relevant for the following trees: all

The bot has tested the following trees: v5.5.8, v5.4.24, v4.19.108, v4.14.172, v4.9.215, v4.4.215.

v5.5.8: Build OK!
v5.4.24: Build OK!
v4.19.108: Build OK!
v4.14.172: Build OK!
v4.9.215: Failed to apply! Possible dependencies:
191edc5e2e51 ("xhci: Fix front USB ports on ASUS PRIME B350M-A") 4750bc78efdb ("usb: host: xhci support option to disable the xHCI USB2 HW LPM") 488dc164914f ("xhci: remove WARN_ON if dma mask is not set for platform devices") 4c39d4b949d3 ("usb: xhci: use bus->sysdev for DMA configuration") 621faf4f6a18 ("xhci: Fix USB ports for Dell Inspiron 5775")

v4.4.215: Failed to apply! Possible dependencies:
191edc5e2e51 ("xhci: Fix front USB ports on ASUS PRIME B350M-A") 21939f003ad0 ("usb: host: xhci-plat: enable BROKEN_PED quirk if platform requested") 41135de1e7fd ("usb: xhci: add quirk flag for broken PED bits") 4750bc78efdb ("usb: host: xhci support option to disable the xHCI USB2 HW LPM") 488dc164914f ("xhci: remove WARN_ON if dma mask is not set for platform devices") 4c39d4b949d3 ("usb: xhci: use bus->sysdev for DMA configuration") 4efb2f694114 ("usb: host: xhci-plat: add struct xhci_plat_priv") 621faf4f6a18 ("xhci: Fix USB ports for Dell Inspiron 5775") 69307ccb9ad7 ("usb: xhci: bInterval quirk for TI TUSB73x0") 76f9502fe761 ("xhci: plat: adapt to unified device property interface") 9da5a1092b13 ("xhci: Bad Ethernet performance plugged in ASM1042A host") a3aef3793071 ("xhci: get rid of platform data")
dec08194ffec ("xhci: Limit USB2 port wake support for AMD Promontory hosts") def4e6f7b419 ("xhci: refactor and cleanup endpoint initialization.")

NOTE: The patch will not be queued to stable trees until it is upstream.

How should we proceed with this patch?

Signature · 2 lines
Thanks
Sasha