mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] xhci: Reset controller on xhci shutdown
@ 2026-10-01 22:25 wenxiong
  2026-10-01 22:40 ` Mathias Nyman
  2026-10-02  8:29 ` Michal Pecio
  0 siblings, 2 replies; 8+ messages in thread
From: wenxiong @ 2026-10-01 22:25 UTC (permalink / raw)
  To: mathias.nyman, gregkh
  Cc: linux-usb, linux-kernel, stable, wenxiong, Wen Xiong, Brian King,
	Samuel Mendoza-Jonas, Joel Stanley

From: Wen Xiong <wenxiong@linux.ibm.com>

Fixes kexec boot. Without a hard reset, some USB chips will fail to
initialize in a kexec booted kernel.

Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
Signed-off-by: Joel Stanley <joel@jms.id.au>
Signed-off-by: Wen Xiong <wenxiong@linux.ibm.com>
---
 drivers/usb/host/xhci.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index a9e47e178c28..364bd61a4bd7 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -781,6 +781,9 @@ void xhci_shutdown(struct usb_hcd *hcd)
 	xhci_dbg_trace(xhci, trace_xhci_dbg_init,
 			"xhci_shutdown completed - status = %x",
 			readl(&xhci->op_regs->status));
+
+	/* TI XHCI controllers do not come back after kexec without this hack */
+	pci_reset_function_locked(to_pci_dev(hcd->self.sysdev));
 }
 EXPORT_SYMBOL_GPL(xhci_shutdown);
 
-- 
2.52.0


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

* Re: [PATCH] xhci: Reset controller on xhci shutdown
  2026-10-01 22:25 [PATCH] xhci: Reset controller on xhci shutdown wenxiong
@ 2026-10-01 22:40 ` Mathias Nyman
  2026-10-02 14:08   ` Wen Xiong
  2026-10-02  8:29 ` Michal Pecio
  1 sibling, 1 reply; 8+ messages in thread
From: Mathias Nyman @ 2026-10-01 22:40 UTC (permalink / raw)
  To: wenxiong, mathias.nyman, gregkh
  Cc: linux-usb, linux-kernel, stable, wenxiong, Brian King,
	Samuel Mendoza-Jonas, Joel Stanley

Hi

On 10/2/26 01:25, wenxiong@linux.ibm.com wrote:
> From: Wen Xiong <wenxiong@linux.ibm.com>
> 
> Fixes kexec boot. Without a hard reset, some USB chips will fail to
> initialize in a kexec booted kernel.
> 
> Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
> Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
> Signed-off-by: Joel Stanley <joel@jms.id.au>
> Signed-off-by: Wen Xiong <wenxiong@linux.ibm.com>
> ---
>   drivers/usb/host/xhci.c | 3 +++
>   1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
> index a9e47e178c28..364bd61a4bd7 100644
> --- a/drivers/usb/host/xhci.c
> +++ b/drivers/usb/host/xhci.c
> @@ -781,6 +781,9 @@ void xhci_shutdown(struct usb_hcd *hcd)
>   	xhci_dbg_trace(xhci, trace_xhci_dbg_init,
>   			"xhci_shutdown completed - status = %x",
>   			readl(&xhci->op_regs->status));
> +
> +	/* TI XHCI controllers do not come back after kexec without this hack */
> +	pci_reset_function_locked(to_pci_dev(hcd->self.sysdev));
>   }
>   EXPORT_SYMBOL_GPL(xhci_shutdown);
>   

Should be added to xhci-pci.c: xhci_pci_shutdown() instead.

Probably also limited to that specific TI xHC controller

Thanks
Mathias


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

* Re: [PATCH] xhci: Reset controller on xhci shutdown
  2026-10-01 22:25 [PATCH] xhci: Reset controller on xhci shutdown wenxiong
  2026-10-01 22:40 ` Mathias Nyman
@ 2026-10-02  8:29 ` Michal Pecio
  2026-10-02 14:05   ` Wen Xiong
  1 sibling, 1 reply; 8+ messages in thread
From: Michal Pecio @ 2026-10-02  8:29 UTC (permalink / raw)
  To: wenxiong
  Cc: mathias.nyman, gregkh, linux-usb, linux-kernel, stable, wenxiong,
	Brian King, Samuel Mendoza-Jonas, Joel Stanley

On Thu,  1 Oct 2026 18:25:27 -0400, wenxiong@linux.ibm.com wrote:
> From: Wen Xiong <wenxiong@linux.ibm.com>
> 
> Fixes kexec boot. Without a hard reset, some USB chips will fail to
> initialize in a kexec booted kernel.

What exactly happens after kexec?
Why a PCI reset in particular?
Are we sure it's not a bug elsewhere?

Regards,
Michal

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

* Re: [PATCH] xhci: Reset controller on xhci shutdown
  2026-10-02  8:29 ` Michal Pecio
@ 2026-10-02 14:05   ` Wen Xiong
  2026-10-02 14:18     ` Michal Pecio
  0 siblings, 1 reply; 8+ messages in thread
From: Wen Xiong @ 2026-10-02 14:05 UTC (permalink / raw)
  To: Michal Pecio
  Cc: mathias.nyman, gregkh, linux-usb, linux-kernel, stable, wenxiong,
	Brian King, Samuel Mendoza-Jonas, Joel Stanley

On 2026-10-02 03:29, Michal Pecio wrote:
> What exactly happens after kexec?
> Why a PCI reset in particular?
> Are we sure it's not a bug elsewhere?
> 
After executing a kexec boots on a bare metal machine, the USB 
controller disappeared.
With a PCI reset, the USB controller is showed up after a kexec kernel.

Thanks,
Wendy

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

* Re: [PATCH] xhci: Reset controller on xhci shutdown
  2026-10-01 22:40 ` Mathias Nyman
@ 2026-10-02 14:08   ` Wen Xiong
  0 siblings, 0 replies; 8+ messages in thread
From: Wen Xiong @ 2026-10-02 14:08 UTC (permalink / raw)
  To: Mathias Nyman
  Cc: mathias.nyman, gregkh, linux-usb, linux-kernel, stable, wenxiong,
	Brian King, Samuel Mendoza-Jonas, Joel Stanley


> Should be added to xhci-pci.c: xhci_pci_shutdown() instead.
> 
> Probably also limited to that specific TI xHC controller
> 
Hi Mathias,

I will try that.

Thanks,
Wendy

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

* Re: [PATCH] xhci: Reset controller on xhci shutdown
  2026-10-02 14:05   ` Wen Xiong
@ 2026-10-02 14:18     ` Michal Pecio
  2026-10-05 13:01       ` Wen Xiong
  0 siblings, 1 reply; 8+ messages in thread
From: Michal Pecio @ 2026-10-02 14:18 UTC (permalink / raw)
  To: Wen Xiong
  Cc: mathias.nyman, gregkh, linux-usb, linux-kernel, stable, wenxiong,
	Brian King, Samuel Mendoza-Jonas, Joel Stanley

On Fri, 02 Oct 2026 09:05:36 -0500, Wen Xiong wrote:
> On 2026-10-02 03:29, Michal Pecio wrote:
> > What exactly happens after kexec?
> > Why a PCI reset in particular?
> > Are we sure it's not a bug elsewhere?
> >   
> After executing a kexec boots on a bare metal machine, the USB 
> controller disappeared.

Sure, but what does it mean exactly?
Not even showing up in lspci output?

Is this our problem and not PCI subsystem's?
Are we sure it's not a bug elsewhere?

(Last time somebody reported issues with kexec,
it turned out to be an obscure Intel IOMMU bug).

Regards,
Michal

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

* Re: [PATCH] xhci: Reset controller on xhci shutdown
  2026-10-02 14:18     ` Michal Pecio
@ 2026-10-05 13:01       ` Wen Xiong
  2026-10-06 10:55         ` Michal Pecio
  0 siblings, 1 reply; 8+ messages in thread
From: Wen Xiong @ 2026-10-05 13:01 UTC (permalink / raw)
  To: Michal Pecio
  Cc: mathias.nyman, gregkh, linux-usb, linux-kernel, stable, wenxiong,
	Brian King, Samuel Mendoza-Jonas, Joel Stanley


> Sure, but what does it mean exactly?
> Not even showing up in lspci output?

When executing "kexec -e", saw the error:
xhci_hcd 0005:01:00.0: Host halt failed. -110

USB device is still showed up in lspci but lsusb didn't show any
USB devices.
  #lspci|grep USB
0005:01:00.0 USB controller: Texas Instruments TUSB73x0 SuperSpeed USB 
3.0 xHCI Host Controller (rev 02)
[root@localhost ~]# lsusb

looks we saw a frozen USB subsystem during suspend/shutdown.

> Is this our problem and not PCI subsystem's?
> Are we sure it's not a bug elsewhere?
> 
> (Last time somebody reported issues with kexec,
> it turned out to be an obscure Intel IOMMU bug).

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

* Re: [PATCH] xhci: Reset controller on xhci shutdown
  2026-10-05 13:01       ` Wen Xiong
@ 2026-10-06 10:55         ` Michal Pecio
  0 siblings, 0 replies; 8+ messages in thread
From: Michal Pecio @ 2026-10-06 10:55 UTC (permalink / raw)
  To: Wen Xiong
  Cc: mathias.nyman, gregkh, linux-usb, linux-kernel, stable, wenxiong,
	Brian King, Samuel Mendoza-Jonas, Joel Stanley

On Mon, 05 Oct 2026 08:01:46 -0500, Wen Xiong wrote:
> When executing "kexec -e", saw the error:
> xhci_hcd 0005:01:00.0: Host halt failed. -110

That's interesting, because we call xhci_halt() in xhci_shutdown().
So the xHC should already be halted before the new kernel boots and
then xhci_halt() should succeed immediately.

It seems unlikely that anything restarts the xHC (or is there a FW
involved?), so either this TI chip reacts badly to trying to halt
it again or the first halt (befor kexec) already fails, or perhaps
something is broken outside xhci_hcd.

Are you able to capture the original kernel's dmesg (through serial,
netconsole, etc) and see if the same "Host halt failed" is there?

And if you enable dynamic debug before kexec,

  echo 'module xhci_hcd +p' >/proc/dynamic_debug/control

what's printed by the debug message at the end of xhci_shutdown()?

Do you also get errors from quirk_usb_handoff_xhci() by any chance?

Regards,
Michal

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

end of thread, other threads:[~2026-10-06 10:55 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-01 22:25 [PATCH] xhci: Reset controller on xhci shutdown wenxiong
2026-10-01 22:40 ` Mathias Nyman
2026-10-02 14:08   ` Wen Xiong
2026-10-02  8:29 ` Michal Pecio
2026-10-02 14:05   ` Wen Xiong
2026-10-02 14:18     ` Michal Pecio
2026-10-05 13:01       ` Wen Xiong
2026-10-06 10:55         ` Michal Pecio

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®