lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20251114150608.7829fd51.michal.pecio@gmail.com>
Date: Fri, 14 Nov 2025 15:06:08 +0100
From: Michal Pecio <michal.pecio@...il.com>
To: Mathias Nyman <mathias.nyman@...ux.intel.com>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
 linux-usb@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH] usb: xhci-pci: Clean up xhci_pci_setup()

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@...il.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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ