Linux USB
 help / color / mirror / Atom feed
From: Wen Xiong <wenxiong@linux.ibm.com>
To: Michal Pecio <michal.pecio@gmail.com>
Cc: mathias.nyman@intel.com, Bjorn Helgaas <bhelgaas@google.com>,
	gregkh@linuxfoundation.org, linux-usb@vger.kernel.org,
	linux-kernel@vger.kernel.org, stable@vger.kernel.org,
	wenxiong@us.ibm.com, linux-pci@vger.kernel.org
Subject: Re: [PATCH V3] xhci: Reset TI USB controller on xhci shutdown
Date: Wed, 28 Oct 2026 15:50:11 -0500	[thread overview]
Message-ID: <c10dd783a61e66023b04aac7829c66ae@linux.ibm.com> (raw)
In-Reply-To: <20261028103616.29110069.michal.pecio@gmail.com>


> I tried to make this code a bit more "proper", by moving the
> pci_reset_function_locked() call to xhci-pci.c from xhci.c.
> 
> I found that when I actually run this, I get a warning from PCI:
> 
>   unlocked secondary bus reset via: __pci_reset_function_locked
> 

Hi Michal,

How about we add check TI/failling usb controller in xhci_halt and 
xhci_pci_shutdown?

Thanks,
Wendy
diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c
index a8889081ae82..af6ca5447f22 100644
--- a/drivers/usb/host/xhci-pci.c
+++ b/drivers/usb/host/xhci-pci.c
@@ -950,6 +950,10 @@ static void xhci_pci_shutdown(struct usb_hcd *hcd)
         /* Yet another workaround for spurious wakeups at shutdown with 
HSW */
         if (xhci->quirks & XHCI_SPURIOUS_WAKEUP)
                 pci_set_power_state(pdev, PCI_D3hot);
+
+       /* TI XHCI controllers do not come back after kexec without this 
hack */
+       if (xhci->quirks & XHCI_HALT_FAIL_TO_RESET)
+               pci_reset_function_locked(pdev);
  }
  
/*-------------------------------------------------------------------------*/
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.cW
index a9e47e178c28..67108692a354 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -120,6 +120,8 @@ void xhci_quiesce(struct xhci_hcd *xhci)
   */
  int xhci_halt(struct xhci_hcd *xhci)
  {
+       struct usb_hcd *hcd = xhci_to_hcd(xhci);
+       struct pci_dev *pdev = to_pci_dev(hcd->self.controller);
         int ret;

         xhci_dbg_trace(xhci, trace_xhci_dbg_init, "// Halt the HC");
@@ -130,6 +132,11 @@ int xhci_halt(struct xhci_hcd *xhci)
         if (ret) {
                 if (!(xhci->xhc_state & XHCI_STATE_DYING))
                         xhci_warn(xhci, "Host halt failed, %d\n", ret);
+
+               if (pdev->vendor == PCI_VENDOR_ID_TI &&
+                               pdev->device == 0x8241)
+                       xhci->quirks |= XHCI_HALT_FAIL_TO_RESET;
+
                 return ret;
         }



      parent reply	other threads:[~2026-10-28 20:50 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-21 16:06 [PATCH V3] xhci: Reset TI USB controller on xhci shutdown wenxiong
2026-10-21 16:16 ` sashiko-bot
2026-10-28  9:36 ` Michal Pecio
2026-10-28 15:41   ` Wen Xiong
2026-10-28 20:50   ` Wen Xiong [this message]

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=c10dd783a61e66023b04aac7829c66ae@linux.ibm.com \
    --to=wenxiong@linux.ibm.com \
    --cc=bhelgaas@google.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=mathias.nyman@intel.com \
    --cc=michal.pecio@gmail.com \
    --cc=stable@vger.kernel.org \
    --cc=wenxiong@us.ibm.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