Skip to contentSkip to conversation

xhci fixes for usb-linus

PATCH In review Mathias Nyman 5 participants 11 messages Jun 23, 2022 – Sep 13, 2023

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

cover xhci fixes for usb-linus

Hi Greg

A few xhci fixes for 5.19
Adding a couple PCI IDs, turning off port power in shutdown, and delay xHC interrupt generation until host is running.

Thanks
Mathias

Hongyu Xie (1):
xhci: Keep interrupt disabled in initialization until host is running.

Mathias Nyman (1):
xhci: turn off port power in shutdown

Tanveer Alam (1):
xhci-pci: Allow host runtime PM as default for Intel Raptor Lake xHCI

Utkarsh Patel (1):
xhci-pci: Allow host runtime PM as default for Intel Meteor Lake xHCI

 drivers/usb/host/xhci-hub.c |  2 +-
 drivers/usb/host/xhci-pci.c |  6 ++++-
 drivers/usb/host/xhci.c     | 50 ++++++++++++++++++++++++++-----------
 drivers/usb/host/xhci.h     |  2 ++
 4 files changed, 43 insertions(+), 17 deletions(-)
Signature · 1 line
2.25.1
#1 lore raw

PATCH 1/4 xhci: Keep interrupt disabled in initialization until host is running.

From: Hongyu Xie <[email protected]>

irq is disabled in xhci_quiesce(called by xhci_halt, with bit:2 cleared in USBCMD register), but xhci_run(called by usb_add_hcd) re-enable it. It's possible that you will receive thousands of interrupt requests after initialization for 2.0 roothub. And you will get a lot of warning like, "xHCI dying, ignoring interrupt. Shouldn't IRQs be disabled?". This amount of interrupt requests will cause the entire system to freeze.
This problem was first found on a device with ASM2142 host controller on it.

[tidy up old code while moving it, reword header -Mathias]
---
 drivers/usb/host/xhci.c | 35 ++++++++++++++++++++++-------------
 1 file changed, 22 insertions(+), 13 deletions(-)
drivers/usb/host/xhci.c +22 -13
index 9ac56e9ffc64..cb99bed5f755 100644
@@ -611,15 +611,37 @@ static int xhci_init(struct usb_hcd *hcd)
 
 static int xhci_run_finished(struct xhci_hcd *xhci)
 {
+	unsigned long	flags;
+	u32		temp;
+
+	/*
+	 * Enable interrupts before starting the host (xhci 4.2 and 5.5.2).
+	 * Protect the short window before host is running with a lock
+	 */
+	spin_lock_irqsave(&xhci->lock, flags);
+
+	xhci_dbg_trace(xhci, trace_xhci_dbg_init, "Enable interrupts");
+	temp = readl(&xhci->op_regs->command);
+	temp |= (CMD_EIE);
+	writel(temp, &xhci->op_regs->command);
+
+	xhci_dbg_trace(xhci, trace_xhci_dbg_init, "Enable primary interrupter");
+	temp = readl(&xhci->ir_set->irq_pending);
+	writel(ER_IRQ_ENABLE(temp), &xhci->ir_set->irq_pending);
+
 	if (xhci_start(xhci)) {
 		xhci_halt(xhci);
+		spin_unlock_irqrestore(&xhci->lock, flags);
 		return -ENODEV;
 	}
+
 	xhci->cmd_ring_state = CMD_RING_STATE_RUNNING;
 
 	if (xhci->quirks & XHCI_NEC_HOST)
 		xhci_ring_cmd_db(xhci);
 
+	spin_unlock_irqrestore(&xhci->lock, flags);
+
 	return 0;
 }
 
@@ -668,19 +690,6 @@ int xhci_run(struct usb_hcd *hcd)
 	temp |= (xhci->imod_interval / 250) & ER_IRQ_INTERVAL_MASK;
 	writel(temp, &xhci->ir_set->irq_control);
 
-	/* Set the HCD state before we enable the irqs */
-	temp = readl(&xhci->op_regs->command);
-	temp |= (CMD_EIE);
-	xhci_dbg_trace(xhci, trace_xhci_dbg_init,
-			"// Enable interrupts, cmd = 0x%x.", temp);
-	writel(temp, &xhci->op_regs->command);
-
-	temp = readl(&xhci->ir_set->irq_pending);
-	xhci_dbg_trace(xhci, trace_xhci_dbg_init,
-			"// Enabling event ring interrupter %p by writing 0x%x to irq_pending",
-			xhci->ir_set, (unsigned int) ER_IRQ_ENABLE(temp));
-	writel(ER_IRQ_ENABLE(temp), &xhci->ir_set->irq_pending);
-
 	if (xhci->quirks & XHCI_NEC_HOST) {
 		struct xhci_command *command;
 
Signature · 1 line
2.25.1
#2 lore raw

Re: [PATCH 1/4] xhci: Keep interrupt disabled in initialization until host is running.

Quoted 72 lines · Mathias Nyman

From: Hongyu Xie <[email protected]>

irq is disabled in xhci_quiesce(called by xhci_halt, with bit:2 cleared in USBCMD register), but xhci_run(called by usb_add_hcd) re-enable it. It's possible that you will receive thousands of interrupt requests after initialization for 2.0 roothub. And you will get a lot of warning like, "xHCI dying, ignoring interrupt. Shouldn't IRQs be disabled?". This amount of interrupt requests will cause the entire system to freeze.
This problem was first found on a device with ASM2142 host controller on it.

[tidy up old code while moving it, reword header -Mathias]
---
  drivers/usb/host/xhci.c | 35 ++++++++++++++++++++++-------------
  1 file changed, 22 insertions(+), 13 deletions(-)
drivers/usb/host/xhci.c +22 -6
index 9ac56e9ffc64..cb99bed5f755 100644
@@ -611,15 +611,37 @@ static int xhci_init(struct usb_hcd *hcd)
 
  static int xhci_run_finished(struct xhci_hcd *xhci)
  {
+	unsigned long	flags;
+	u32		temp;
+
+	/*
+	 * Enable interrupts before starting the host (xhci 4.2 and 5.5.2).
+	 * Protect the short window before host is running with a lock
+	 */
+	spin_lock_irqsave(&xhci->lock, flags);
+
+	xhci_dbg_trace(xhci, trace_xhci_dbg_init, "Enable interrupts");
+	temp = readl(&xhci->op_regs->command);
+	temp |= (CMD_EIE);
+	writel(temp, &xhci->op_regs->command);
+
+	xhci_dbg_trace(xhci, trace_xhci_dbg_init, "Enable primary interrupter");
+	temp = readl(&xhci->ir_set->irq_pending);
+	writel(ER_IRQ_ENABLE(temp), &xhci->ir_set->irq_pending);
+
  	if (xhci_start(xhci)) {
  		xhci_halt(xhci);
+		spin_unlock_irqrestore(&xhci->lock, flags);
  		return -ENODEV;
  	}
+
  	xhci->cmd_ring_state = CMD_RING_STATE_RUNNING;
 
  	if (xhci->quirks & XHCI_NEC_HOST)
  		xhci_ring_cmd_db(xhci);
 
+	spin_unlock_irqrestore(&xhci->lock, flags);
+
  	return 0;
  }
 
@@ -668,19 +690,6 @@ int xhci_run(struct usb_hcd *hcd)
  	temp |= (xhci->imod_interval / 250) & ER_IRQ_INTERVAL_MASK;
  	writel(temp, &xhci->ir_set->irq_control);
 
-	/* Set the HCD state before we enable the irqs */
-	temp = readl(&xhci->op_regs->command);
-	temp |= (CMD_EIE);
-	xhci_dbg_trace(xhci, trace_xhci_dbg_init,
-			"// Enable interrupts, cmd = 0x%x.", temp);
-	writel(temp, &xhci->op_regs->command);

drivers/usb/host/xhci.c int xhci_run(struct usb_hcd *hcd) · line 695

Quoted 10 lines
drivers/usb/host/xhci.c +0 -7
-
-	temp = readl(&xhci->ir_set->irq_pending);
-	xhci_dbg_trace(xhci, trace_xhci_dbg_init,
-			"// Enabling event ring interrupter %p by writing 0x%x to irq_pending",
-			xhci->ir_set, (unsigned int) ER_IRQ_ENABLE(temp));
-	writel(ER_IRQ_ENABLE(temp), &xhci->ir_set->irq_pending);
-
  	if (xhci->quirks & XHCI_NEC_HOST) {
  		struct xhci_command *command;
 

This is not available to older kernels [< 5.19]. Can we get this backported to 5.15 as well? Please let me know if there is some other way to do it.

Cc <[email protected]> # 5.15

Thanks,
Prashanth K

maintainer
#3 lore raw

Re: [PATCH 1/4] xhci: Keep interrupt disabled in initialization until host is running.

Quoted 82 lines · Prashanth K
Quoted 66 lines · Mathias Nyman

From: Hongyu Xie <[email protected]>

irq is disabled in xhci_quiesce(called by xhci_halt, with bit:2 cleared in USBCMD register), but xhci_run(called by usb_add_hcd) re-enable it. It's possible that you will receive thousands of interrupt requests after initialization for 2.0 roothub. And you will get a lot of warning like, "xHCI dying, ignoring interrupt. Shouldn't IRQs be disabled?". This amount of interrupt requests will cause the entire system to freeze.
This problem was first found on a device with ASM2142 host controller on it.

[tidy up old code while moving it, reword header -Mathias]
---
  drivers/usb/host/xhci.c | 35 ++++++++++++++++++++++-------------
  1 file changed, 22 insertions(+), 13 deletions(-)
drivers/usb/host/xhci.c +22 -5
index 9ac56e9ffc64..cb99bed5f755 100644
@@ -611,15 +611,37 @@ static int xhci_init(struct usb_hcd *hcd)
  static int xhci_run_finished(struct xhci_hcd *xhci)
  {
+	unsigned long	flags;
+	u32		temp;
+
+	/*
+	 * Enable interrupts before starting the host (xhci 4.2 and 5.5.2).
+	 * Protect the short window before host is running with a lock
+	 */
+	spin_lock_irqsave(&xhci->lock, flags);
+
+	xhci_dbg_trace(xhci, trace_xhci_dbg_init, "Enable interrupts");
+	temp = readl(&xhci->op_regs->command);
+	temp |= (CMD_EIE);
+	writel(temp, &xhci->op_regs->command);
+
+	xhci_dbg_trace(xhci, trace_xhci_dbg_init, "Enable primary interrupter");
+	temp = readl(&xhci->ir_set->irq_pending);
+	writel(ER_IRQ_ENABLE(temp), &xhci->ir_set->irq_pending);
+
  	if (xhci_start(xhci)) {
  		xhci_halt(xhci);
+		spin_unlock_irqrestore(&xhci->lock, flags);
  		return -ENODEV;
  	}
+
  	xhci->cmd_ring_state = CMD_RING_STATE_RUNNING;
  	if (xhci->quirks & XHCI_NEC_HOST)
  		xhci_ring_cmd_db(xhci);
+	spin_unlock_irqrestore(&xhci->lock, flags);
+
  	return 0;
  }
@@ -668,19 +690,6 @@ int xhci_run(struct usb_hcd *hcd)
  	temp |= (xhci->imod_interval / 250) & ER_IRQ_INTERVAL_MASK;
  	writel(temp, &xhci->ir_set->irq_control);
-	/* Set the HCD state before we enable the irqs */
-	temp = readl(&xhci->op_regs->command);
-	temp |= (CMD_EIE);
-	xhci_dbg_trace(xhci, trace_xhci_dbg_init,
-			"// Enable interrupts, cmd = 0x%x.", temp);

drivers/usb/host/xhci.c int xhci_run(struct usb_hcd *hcd) · line 693

Quoted 10 lines
drivers/usb/host/xhci.c +0 -8
-	writel(temp, &xhci->op_regs->command);
-
-	temp = readl(&xhci->ir_set->irq_pending);
-	xhci_dbg_trace(xhci, trace_xhci_dbg_init,
-			"// Enabling event ring interrupter %p by writing 0x%x to irq_pending",
-			xhci->ir_set, (unsigned int) ER_IRQ_ENABLE(temp));
-	writel(ER_IRQ_ENABLE(temp), &xhci->ir_set->irq_pending);
-
  	if (xhci->quirks & XHCI_NEC_HOST) {
  		struct xhci_command *command;

This is not available to older kernels [< 5.19]. Can we get this backported to 5.15 as well? Please let me know if there is some other way to do it.

Quoted 1 line
Cc <[email protected]> # 5.15

<formletter>

This is not the correct way to submit patches for inclusion in the stable kernel tree. Please read:
https://www.kernel.org/doc/html/latest/process/stable-kernel-rules.html
for how to do this properly.

</formletter>

#4 lore raw

PATCH 2/4 xhci: turn off port power in shutdown

In reply to Mathias Nyman

If ports are not turned off in shutdown then runtime suspended self-powered USB devices may survive in U3 link state over S5.

During subsequent boot, if firmware sends an IPC command to program the port in DISCONNECT state, it will time out, causing significant delay in the boot time.

Turning off roothub port power is also recommended in xhci specification 4.19.4 "Port Power" in the additional note.

---
 drivers/usb/host/xhci-hub.c |  2 +-
 drivers/usb/host/xhci.c     | 15 +++++++++++++--
 drivers/usb/host/xhci.h     |  2 ++
 3 files changed, 16 insertions(+), 3 deletions(-)
drivers/usb/host/xhci-hub.c +1 -1
index c54f2bc23d3f..0fdc014c9401 100644
@@ -652,7 +652,7 @@ struct xhci_hub *xhci_get_rhub(struct usb_hcd *hcd)
  * It will release and re-aquire the lock while calling ACPI
  * method.
  */
-static void xhci_set_port_power(struct xhci_hcd *xhci, struct usb_hcd *hcd,
+void xhci_set_port_power(struct xhci_hcd *xhci, struct usb_hcd *hcd,
 				u16 index, bool on, unsigned long *flags)
 	__must_hold(&xhci->lock)
 {
drivers/usb/host/xhci.c +13 -2
index cb99bed5f755..65858f607437 100644
@@ -791,6 +791,8 @@ static void xhci_stop(struct usb_hcd *hcd)
 void xhci_shutdown(struct usb_hcd *hcd)
 {
 	struct xhci_hcd *xhci = hcd_to_xhci(hcd);
+	unsigned long flags;
+	int i;
 
 	if (xhci->quirks & XHCI_SPURIOUS_REBOOT)
 		usb_disable_xhci_ports(to_pci_dev(hcd->self.sysdev));
@@ -806,12 +808,21 @@ void xhci_shutdown(struct usb_hcd *hcd)
 		del_timer_sync(&xhci->shared_hcd->rh_timer);
 	}
 
-	spin_lock_irq(&xhci->lock);
+	spin_lock_irqsave(&xhci->lock, flags);
 	xhci_halt(xhci);
+
+	/* Power off USB2 ports*/
+	for (i = 0; i < xhci->usb2_rhub.num_ports; i++)
+		xhci_set_port_power(xhci, xhci->main_hcd, i, false, &flags);
+
+	/* Power off USB3 ports*/
+	for (i = 0; i < xhci->usb3_rhub.num_ports; i++)
+		xhci_set_port_power(xhci, xhci->shared_hcd, i, false, &flags);
+
 	/* Workaround for spurious wakeups at shutdown with HSW */
 	if (xhci->quirks & XHCI_SPURIOUS_WAKEUP)
 		xhci_reset(xhci, XHCI_RESET_SHORT_USEC);
-	spin_unlock_irq(&xhci->lock);
+	spin_unlock_irqrestore(&xhci->lock, flags);
 
 	xhci_cleanup_msix(xhci);
 
drivers/usb/host/xhci.h +2 -0
index 0bd76c94a4b1..28aaf031f9a8 100644
@@ -2196,6 +2196,8 @@ int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, u16 wIndex,
 int xhci_hub_status_data(struct usb_hcd *hcd, char *buf);
 int xhci_find_raw_port_number(struct usb_hcd *hcd, int port1);
 struct xhci_hub *xhci_get_rhub(struct usb_hcd *hcd);
+void xhci_set_port_power(struct xhci_hcd *xhci, struct usb_hcd *hcd, u16 index,
+			 bool on, unsigned long *flags);
 
 void xhci_hc_died(struct xhci_hcd *xhci);
 
Signature · 1 line
2.25.1
#5 lore raw

Re: [PATCH 2/4] xhci: turn off port power in shutdown

Quoted 73 lines · Mathias Nyman

If ports are not turned off in shutdown then runtime suspended self-powered USB devices may survive in U3 link state over S5.

During subsequent boot, if firmware sends an IPC command to program the port in DISCONNECT state, it will time out, causing significant delay in the boot time.

Turning off roothub port power is also recommended in xhci specification 4.19.4 "Port Power" in the additional note.

---
  drivers/usb/host/xhci-hub.c |  2 +-
  drivers/usb/host/xhci.c     | 15 +++++++++++++--
  drivers/usb/host/xhci.h     |  2 ++
  3 files changed, 16 insertions(+), 3 deletions(-)
drivers/usb/host/xhci-hub.c +1 -1
index c54f2bc23d3f..0fdc014c9401 100644
@@ -652,7 +652,7 @@ struct xhci_hub *xhci_get_rhub(struct usb_hcd *hcd)
   * It will release and re-aquire the lock while calling ACPI
   * method.
   */
-static void xhci_set_port_power(struct xhci_hcd *xhci, struct usb_hcd *hcd,
+void xhci_set_port_power(struct xhci_hcd *xhci, struct usb_hcd *hcd,
  				u16 index, bool on, unsigned long *flags)
  	__must_hold(&xhci->lock)
  {
drivers/usb/host/xhci.c +13 -2
index cb99bed5f755..65858f607437 100644
@@ -791,6 +791,8 @@ static void xhci_stop(struct usb_hcd *hcd)
  void xhci_shutdown(struct usb_hcd *hcd)
  {
  	struct xhci_hcd *xhci = hcd_to_xhci(hcd);
+	unsigned long flags;
+	int i;
 
  	if (xhci->quirks & XHCI_SPURIOUS_REBOOT)
  		usb_disable_xhci_ports(to_pci_dev(hcd->self.sysdev));
@@ -806,12 +808,21 @@ void xhci_shutdown(struct usb_hcd *hcd)
  		del_timer_sync(&xhci->shared_hcd->rh_timer);
  	}
 
-	spin_lock_irq(&xhci->lock);
+	spin_lock_irqsave(&xhci->lock, flags);
  	xhci_halt(xhci);
+
+	/* Power off USB2 ports*/
+	for (i = 0; i < xhci->usb2_rhub.num_ports; i++)
+		xhci_set_port_power(xhci, xhci->main_hcd, i, false, &flags);
+
+	/* Power off USB3 ports*/
+	for (i = 0; i < xhci->usb3_rhub.num_ports; i++)
+		xhci_set_port_power(xhci, xhci->shared_hcd, i, false, &flags);
+
  	/* Workaround for spurious wakeups at shutdown with HSW */
  	if (xhci->quirks & XHCI_SPURIOUS_WAKEUP)
  		xhci_reset(xhci, XHCI_RESET_SHORT_USEC);
-	spin_unlock_irq(&xhci->lock);
+	spin_unlock_irqrestore(&xhci->lock, flags);
 
  	xhci_cleanup_msix(xhci);
 
drivers/usb/host/xhci.h +0 -0
index 0bd76c94a4b1..28aaf031f9a8 100644

drivers/usb/host/xhci.h int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, u16 wIndex, · line 2203

Quoted 8 lines
drivers/usb/host/xhci.h +2 -0
@@ -2196,6 +2196,8 @@ int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, u16 wIndex,
  int xhci_hub_status_data(struct usb_hcd *hcd, char *buf);
  int xhci_find_raw_port_number(struct usb_hcd *hcd, int port1);
  struct xhci_hub *xhci_get_rhub(struct usb_hcd *hcd);
+void xhci_set_port_power(struct xhci_hcd *xhci, struct usb_hcd *hcd, u16 index,
+			 bool on, unsigned long *flags);
 
  void xhci_hc_died(struct xhci_hcd *xhci);
 

fyi: there is a report [1] about a regression introduced by this patch.

Joey

[1] https://bugzilla.kernel.org/show_bug.cgi?id=216243

#6 lore raw

Re: [PATCH 2/4] xhci: turn off port power in shutdown

Quoted 79 lines · Joey Corleone
Quoted 69 lines · Mathias Nyman

If ports are not turned off in shutdown then runtime suspended self-powered USB devices may survive in U3 link state over S5.

During subsequent boot, if firmware sends an IPC command to program the port in DISCONNECT state, it will time out, causing significant delay in the boot time.

Turning off roothub port power is also recommended in xhci specification 4.19.4 "Port Power" in the additional note.

---
  drivers/usb/host/xhci-hub.c |  2 +- drivers/usb/host/xhci.c     | 15 +++++++++++++-- drivers/usb/host/xhci.h     |  2 ++

  3 files changed, 16 insertions(+), 3 deletions(-)
drivers/usb/host/xhci-hub.c +1 -1
index c54f2bc23d3f..0fdc014c9401 100644
@@ -652,7 +652,7 @@ struct xhci_hub *xhci_get_rhub(struct usb_hcd *hcd)
    * It will release and re-aquire the lock while calling ACPI
    * method.
    */
-static void xhci_set_port_power(struct xhci_hcd *xhci, struct usb_hcd *hcd,
+void xhci_set_port_power(struct xhci_hcd *xhci, struct usb_hcd *hcd,
                   u16 index, bool on, unsigned long *flags)
       __must_hold(&xhci->lock)
   {
drivers/usb/host/xhci.c +13 -2
index cb99bed5f755..65858f607437 100644
@@ -791,6 +791,8 @@ static void xhci_stop(struct usb_hcd *hcd)
   void xhci_shutdown(struct usb_hcd *hcd)
   {
       struct xhci_hcd *xhci = hcd_to_xhci(hcd);
+    unsigned long flags;
+    int i;
       if (xhci->quirks & XHCI_SPURIOUS_REBOOT)
           usb_disable_xhci_ports(to_pci_dev(hcd->self.sysdev));
@@ -806,12 +808,21 @@ void xhci_shutdown(struct usb_hcd *hcd)
           del_timer_sync(&xhci->shared_hcd->rh_timer);
       }
-    spin_lock_irq(&xhci->lock);
+    spin_lock_irqsave(&xhci->lock, flags);
       xhci_halt(xhci);
+
+    /* Power off USB2 ports*/
+    for (i = 0; i < xhci->usb2_rhub.num_ports; i++)
+        xhci_set_port_power(xhci, xhci->main_hcd, i, false, &flags);
+
+    /* Power off USB3 ports*/
+    for (i = 0; i < xhci->usb3_rhub.num_ports; i++)
+        xhci_set_port_power(xhci, xhci->shared_hcd, i, false, &flags);
+
       /* Workaround for spurious wakeups at shutdown with HSW */
       if (xhci->quirks & XHCI_SPURIOUS_WAKEUP)
           xhci_reset(xhci, XHCI_RESET_SHORT_USEC);
-    spin_unlock_irq(&xhci->lock);
+    spin_unlock_irqrestore(&xhci->lock, flags);
       xhci_cleanup_msix(xhci);
drivers/usb/host/xhci.h +0 -0
index 0bd76c94a4b1..28aaf031f9a8 100644

drivers/usb/host/xhci.h int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, u16 wIndex, · line 2201

Quoted 6 lines
drivers/usb/host/xhci.h +2 -0
@@ -2196,6 +2196,8 @@ int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, u16 wIndex,
   int xhci_hub_status_data(struct usb_hcd *hcd, char *buf);
   int xhci_find_raw_port_number(struct usb_hcd *hcd, int port1);
   struct xhci_hub *xhci_get_rhub(struct usb_hcd *hcd);
+void xhci_set_port_power(struct xhci_hcd *xhci, struct usb_hcd *hcd, u16 index,
+             bool on, unsigned long *flags);
   void xhci_hc_died(struct xhci_hcd *xhci);

fyi: there is a report [1] about a regression introduced by this patch.

Quoted 3 lines

Joey

[1] https://bugzilla.kernel.org/show_bug.cgi?id=216243

Thanks for the notice, I'm away until August.
If it starts to cause more issues then this one incident then it should be reverted.

Will take a look at this when I return.
Meanwhile a log with xhci dynamic debug enabled could better show what is going on

mount -t debugfs none /sys/kernel/debug
echo 'module xhci_hcd =p' >/sys/kernel/debug/dynamic_debug/control

Thanks
Mathias

#7 lore raw

Re: [PATCH 2/4] xhci: turn off port power in shutdown #forregzbot

In reply to Joey Corleone

[TLDR: I'm adding this regression report to the list of tracked regressions; all text from me you find below is based on a few templates paragraphs you might have encountered already already in similar form.]

TWIMC: this mail is primarily send for documentation purposes and for regzbot, my Linux kernel regression tracking bot. These mails usually contain '#forregzbot' in the subject, to make them easy to spot and filter.

Hi, this is your Linux kernel regression tracker.

Quoted 18 lines · Joey Corleone
Quoted 10 lines · Mathias Nyman

If ports are not turned off in shutdown then runtime suspended self-powered USB devices may survive in U3 link state over S5.

During subsequent boot, if firmware sends an IPC command to program the port in DISCONNECT state, it will time out, causing significant delay in the boot time.

Turning off roothub port power is also recommended in xhci specification 4.19.4 "Port Power" in the additional note.

Quoted 7 lines

---
  drivers/usb/host/xhci-hub.c |  2 +- drivers/usb/host/xhci.c     | 15 +++++++++++++-- drivers/usb/host/xhci.h     |  2 ++

  3 files changed, 16 insertions(+), 3 deletions(-)
Quoted 7 lines

[...]

fyi: there is a report [1] about a regression introduced by this patch.

Joey

[1] https://bugzilla.kernel.org/show_bug.cgi?id=216243

To be sure below issue doesn't fall through the cracks unnoticed, I'm adding it to regzbot, my Linux kernel regression tracking bot:

#regzbot ^introduced 9245c6c1f0095d1e9d7862253680cb1e53e65e7 #regzbot title xhci: machine does not power off #regzbot link: https://bugzilla.kernel.org/show_bug.cgi?id=216243
#regzbot ignore-activity

This isn't a regression? This issue or a fix for it are already discussed somewhere else? It was fixed already? You want to clarify when the regression started to happen? Or point out I got the title or something else totally wrong? Then just reply -- ideally with also telling regzbot about it, as explained here:
https://linux-regtracking.leemhuis.info/tracked-regression/

Reminder for developers: When fixing the issue, add 'Link:' tags pointing to the report (the mail this one replies to), as explained for in the Linux kernel's documentation; above webpage explains why this is important for tracked regressions.

Ciao, Thorsten (wearing his 'the Linux kernel's regression tracker' hat)

P.S.: As the Linux kernel's regression tracker I deal with a lot of reports and sometimes miss something important when writing mails like this. If that's the case here, don't hesitate to tell me in a public reply, it's in everyone's interest to set the public record straight.

#8 lore raw

Re: [PATCH 2/4] xhci: turn off port power in shutdown #forregzbot

Quoted 6 lines · Thorsten Leemhuis

TWIMC: this mail is primarily send for documentation purposes and for regzbot, my Linux kernel regression tracking bot. These mails usually contain '#forregzbot' in the subject, to make them easy to spot and filter.

On 19.07.22 15:42, Joey Corleone wrote:

Quoted 8 lines
Quoted 3 lines · Mathias Nyman

[1] https://bugzilla.kernel.org/show_bug.cgi?id=216243

To be sure below issue doesn't fall through the cracks unnoticed, I'm adding it to regzbot, my Linux kernel regression tracking bot:

#regzbot ^introduced 9245c6c1f0095d1e9d7862253680cb1e53e65e7

#regzbot introduced: 83810f84ecf11dfc
#regzbot fixed-by: 8531aa1659f72

#9 lore raw

PATCH 3/4 xhci-pci: Allow host runtime PM as default for Intel Raptor Lake xHCI

In reply to Mathias Nyman

From: Tanveer Alam <[email protected]>

In the same way as Intel Alder Lake TCSS (Type-C Subsystem) the Raptor Lake TCSS xHCI needs to be runtime suspended whenever possible to allow the TCSS hardware block to enter D3cold and thus save energy.

---
 drivers/usb/host/xhci-pci.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/usb/host/xhci-pci.c +3 -1
index fac9492a8bda..d66ea276ccec 100644
@@ -61,6 +61,7 @@
 #define PCI_DEVICE_ID_INTEL_ALDER_LAKE_XHCI		0x461e
 #define PCI_DEVICE_ID_INTEL_ALDER_LAKE_N_XHCI		0x464e
 #define PCI_DEVICE_ID_INTEL_ALDER_LAKE_PCH_XHCI	0x51ed
+#define PCI_DEVICE_ID_INTEL_RAPTOR_LAKE_XHCI		0xa71e
 
 #define PCI_DEVICE_ID_AMD_RENOIR_XHCI			0x1639
 #define PCI_DEVICE_ID_AMD_PROMONTORYA_4			0x43b9
@@ -269,7 +270,8 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci)
 	     pdev->device == PCI_DEVICE_ID_INTEL_MAPLE_RIDGE_XHCI ||
 	     pdev->device == PCI_DEVICE_ID_INTEL_ALDER_LAKE_XHCI ||
 	     pdev->device == PCI_DEVICE_ID_INTEL_ALDER_LAKE_N_XHCI ||
-	     pdev->device == PCI_DEVICE_ID_INTEL_ALDER_LAKE_PCH_XHCI))
+	     pdev->device == PCI_DEVICE_ID_INTEL_ALDER_LAKE_PCH_XHCI ||
+	     pdev->device == PCI_DEVICE_ID_INTEL_RAPTOR_LAKE_XHCI))
 		xhci->quirks |= XHCI_DEFAULT_PM_RUNTIME_ALLOW;
 
 	if (pdev->vendor == PCI_VENDOR_ID_ETRON &&
Signature · 1 line
2.25.1
#10 lore raw

PATCH 4/4 xhci-pci: Allow host runtime PM as default for Intel Meteor Lake xHCI

In reply to Mathias Nyman

From: Utkarsh Patel <[email protected]>

Meteor Lake TCSS(Type-C Subsystem) xHCI needs to be runtime suspended whenever possible to allow the TCSS hardware block to enter D3cold and thus save energy.

---
 drivers/usb/host/xhci-pci.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/usb/host/xhci-pci.c +3 -1
index d66ea276ccec..dce6c0ec8d34 100644
@@ -62,6 +62,7 @@
 #define PCI_DEVICE_ID_INTEL_ALDER_LAKE_N_XHCI		0x464e
 #define PCI_DEVICE_ID_INTEL_ALDER_LAKE_PCH_XHCI	0x51ed
 #define PCI_DEVICE_ID_INTEL_RAPTOR_LAKE_XHCI		0xa71e
+#define PCI_DEVICE_ID_INTEL_METEOR_LAKE_XHCI		0x7ec0
 
 #define PCI_DEVICE_ID_AMD_RENOIR_XHCI			0x1639
 #define PCI_DEVICE_ID_AMD_PROMONTORYA_4			0x43b9
@@ -271,7 +272,8 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci)
 	     pdev->device == PCI_DEVICE_ID_INTEL_ALDER_LAKE_XHCI ||
 	     pdev->device == PCI_DEVICE_ID_INTEL_ALDER_LAKE_N_XHCI ||
 	     pdev->device == PCI_DEVICE_ID_INTEL_ALDER_LAKE_PCH_XHCI ||
-	     pdev->device == PCI_DEVICE_ID_INTEL_RAPTOR_LAKE_XHCI))
+	     pdev->device == PCI_DEVICE_ID_INTEL_RAPTOR_LAKE_XHCI ||
+	     pdev->device == PCI_DEVICE_ID_INTEL_METEOR_LAKE_XHCI))
 		xhci->quirks |= XHCI_DEFAULT_PM_RUNTIME_ALLOW;
 
 	if (pdev->vendor == PCI_VENDOR_ID_ETRON &&
Signature · 1 line
2.25.1