public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] usb: xhci-pci: Fix USB2-only root hub registration
       [not found]                       ` <CABpa4MC-pij0Fczh-mH3zc+Ey2ALX70OfxX=cG4om7R6WMdRBg@mail.gmail.com>
@ 2025-10-09 12:29                         ` Michal Pecio
  2025-10-09 12:49                           ` Arisa Snowbell
  0 siblings, 1 reply; 4+ messages in thread
From: Michal Pecio @ 2025-10-09 12:29 UTC (permalink / raw)
  To: Arisa Snowbell, Mathias Nyman, Greg Kroah-Hartman
  Cc: linux-usb, regressions, Niklas Neronin, linux-kernel

A recent change to hide USB3 root hubs of USB2-only controllers broke
registration of USB2 root hubs - allow_single_roothub is set too late,
and by this time xhci_run() has already deferred root hub registration
until after the shared HCD is added, which will never happen.

This makes such controllers unusable, but testers didn't notice since
they were only bothered by warnings about empty USB3 root hubs. The bug
caused problems to other people who actually use such HCs and I was
able to confirm it on an ordinary HC by patching to ignore USB3 ports.

Setting allow_single_roothub during early setup fixes things.

Reported-by: Arisa Snowbell <arisa.snowbell@gmail.com>
Closes: https://lore.kernel.org/linux-usb/CABpa4MA9unucCoKtSdzJyOLjHNVy+Cwgz5AnAxPkKw6vuox1Nw@mail.gmail.com/
Fixes: 719de070f764 ("usb: xhci-pci: add support for hosts with zero USB3 ports")
Suggested-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Michal Pecio <michal.pecio@gmail.com>
---


Arisa, does this version also work?


 drivers/usb/host/xhci-pci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c
index 13454bef14d3..cb7f5dd34333 100644
--- a/drivers/usb/host/xhci-pci.c
+++ b/drivers/usb/host/xhci-pci.c
@@ -580,6 +580,7 @@ static int xhci_pci_setup(struct usb_hcd *hcd)
 
 	/* imod_interval is the interrupt moderation value in nanoseconds. */
 	xhci->imod_interval = 40000;
+	xhci->allow_single_roothub = 1;
 
 	retval = xhci_gen_setup(hcd, xhci_pci_quirks);
 	if (retval)
@@ -643,7 +644,6 @@ int xhci_pci_common_probe(struct pci_dev *dev, const struct pci_device_id *id)
 	xhci = hcd_to_xhci(hcd);
 	xhci->reset = reset;
 
-	xhci->allow_single_roothub = 1;
 	if (!xhci_has_one_roothub(xhci)) {
 		xhci->shared_hcd = usb_create_shared_hcd(&xhci_pci_hc_driver, &dev->dev,
 							 pci_name(dev), hcd);
-- 
2.48.1

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

* Re: [PATCH] usb: xhci-pci: Fix USB2-only root hub registration
  2025-10-09 12:29                         ` [PATCH] usb: xhci-pci: Fix USB2-only root hub registration Michal Pecio
@ 2025-10-09 12:49                           ` Arisa Snowbell
  2025-10-09 13:08                             ` Mathias Nyman
  0 siblings, 1 reply; 4+ messages in thread
From: Arisa Snowbell @ 2025-10-09 12:49 UTC (permalink / raw)
  To: Michal Pecio
  Cc: Mathias Nyman, Greg Kroah-Hartman, linux-usb, regressions,
	Niklas Neronin, linux-kernel

This also works, thank you

- Arisa

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

* Re: [PATCH] usb: xhci-pci: Fix USB2-only root hub registration
  2025-10-09 12:49                           ` Arisa Snowbell
@ 2025-10-09 13:08                             ` Mathias Nyman
  0 siblings, 0 replies; 4+ messages in thread
From: Mathias Nyman @ 2025-10-09 13:08 UTC (permalink / raw)
  To: Arisa Snowbell, Michal Pecio
  Cc: Greg Kroah-Hartman, linux-usb, regressions, Niklas Neronin,
	linux-kernel

On 10/9/25 15:49, Arisa Snowbell wrote:
> This also works, thank you
> 
> - Arisa
> 

Thanks Michał and Arisa, I'll apply this patch with a
Tested-by: Arisa Snowbell <arisa.snowbell@gmail.com> tag,
and send it forward once 6.18-rc1 kernel is tagged

Thanks
Mathias

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

* [PATCH] usb: xhci-pci: Clean up xhci_pci_setup()
       [not found]                               ` <21741b98-4844-4218-8bd9-10b8bf5cd869@linux.intel.com>
@ 2025-11-14 14:06                                 ` Michal Pecio
  0 siblings, 0 replies; 4+ messages in thread
From: Michal Pecio @ 2025-11-14 14:06 UTC (permalink / raw)
  To: Mathias Nyman; +Cc: Greg Kroah-Hartman, linux-usb, linux-kernel

This function will be called again when/if the shared HCD is added.
Little to do in this case, so handle it right at the beginning and
forget about it later. Don't bother passing xhci_pci_quirks for the
shared HCD, because quirks are detected in the first run.

Organize the rest so that xhci properties are assigned and visible
before any core initialization begins.

Signed-off-by: Michal Pecio <michal.pecio@gmail.com>
---

I forgot about this patch, here it is rebased on the final fix
which went into mainline a few weeks ago.

 drivers/usb/host/xhci-pci.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c
index d292adc65e5a..6e704d684bcb 100644
--- a/drivers/usb/host/xhci-pci.c
+++ b/drivers/usb/host/xhci-pci.c
@@ -568,7 +568,7 @@ static void xhci_pme_acpi_rtd3_enable(struct pci_dev *dev) { }
 static void xhci_find_lpm_incapable_ports(struct usb_hcd *hcd, struct usb_device *hdev) { }
 #endif /* CONFIG_ACPI */
 
-/* called during probe() after chip reset completes */
+/* called during probe() after chip reset completes and again on the shared HCD */
 static int xhci_pci_setup(struct usb_hcd *hcd)
 {
 	struct xhci_hcd		*xhci;
@@ -576,20 +576,20 @@ static int xhci_pci_setup(struct usb_hcd *hcd)
 	int			retval;
 	u8			sbrn;
 
+	/* nothing PCI-specific for the shared HCD, just core setup and no quirks */
+	if (!usb_hcd_is_primary_hcd(hcd))
+		return xhci_gen_setup(hcd, NULL);
+
 	xhci = hcd_to_xhci(hcd);
 
 	/* imod_interval is the interrupt moderation value in nanoseconds. */
 	xhci->imod_interval = 40000;
+	xhci->allow_single_roothub = 1;
 
 	retval = xhci_gen_setup(hcd, xhci_pci_quirks);
 	if (retval)
 		return retval;
 
-	if (!usb_hcd_is_primary_hcd(hcd))
-		return 0;
-
-	xhci->allow_single_roothub = 1;
-
 	if (xhci->quirks & XHCI_PME_STUCK_QUIRK)
 		xhci_pme_acpi_rtd3_enable(pdev);
 
-- 
2.48.1

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

end of thread, other threads:[~2025-11-14 14:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <CABpa4MA9unucCoKtSdzJyOLjHNVy+Cwgz5AnAxPkKw6vuox1Nw@mail.gmail.com>
     [not found] ` <20251007231709.6c16802e.michal.pecio@gmail.com>
     [not found]   ` <CABpa4MCUnLUR_0Vzgd=rTr0+Hot=nxHirKrX6xtJWowDoLhWJw@mail.gmail.com>
     [not found]     ` <CABpa4MCg7yixe7O8Pp+YwvpxeC=1JPhMhAap12RjtV6pcxFYgQ@mail.gmail.com>
     [not found]       ` <20251008082055.5646dadc.michal.pecio@gmail.com>
     [not found]         ` <CABpa4MCm8hQXvtSYqUA+Dh3rCLVM5rTC1p+FsgmFemv+Vyz=RA@mail.gmail.com>
     [not found]           ` <20251008130532.49922d58.michal.pecio@gmail.com>
     [not found]             ` <CABpa4MAsvK68CyQ7bVdie1j2m2O2YAEuFJHq8D-65uFT3FzKzQ@mail.gmail.com>
     [not found]               ` <20251008223406.13f16f19.michal.pecio@gmail.com>
     [not found]                 ` <CABpa4MBGW=OJi+j34TbL2g=zyTg7-rxqpHYfAW-1DXTPk=g5Fw@mail.gmail.com>
     [not found]                   ` <CABpa4MBDvgJcgJf3_E7k1dBXs7v1tW-79dmc_sQDVM1bES5YDQ@mail.gmail.com>
     [not found]                     ` <20251009131444.2c221922.michal.pecio@gmail.com>
     [not found]                       ` <CABpa4MC-pij0Fczh-mH3zc+Ey2ALX70OfxX=cG4om7R6WMdRBg@mail.gmail.com>
2025-10-09 12:29                         ` [PATCH] usb: xhci-pci: Fix USB2-only root hub registration Michal Pecio
2025-10-09 12:49                           ` Arisa Snowbell
2025-10-09 13:08                             ` Mathias Nyman
     [not found]                       ` <90c03eeb-3913-4968-88c0-0de09023a2b5@linux.intel.com>
     [not found]                         ` <20251009152703.72e780b4.michal.pecio@gmail.com>
     [not found]                           ` <b8c2423f-aa9d-442a-ae2f-3c4d78949b38@linux.intel.com>
     [not found]                             ` <20251013092250.699bf60f.michal.pecio@gmail.com>
     [not found]                               ` <21741b98-4844-4218-8bd9-10b8bf5cd869@linux.intel.com>
2025-11-14 14:06                                 ` [PATCH] usb: xhci-pci: Clean up xhci_pci_setup() Michal Pecio

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