]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
usb: xhci: request MSI/-X according to requested amount
authorNiklas Neronin <niklas.neronin@linux.intel.com>
Wed, 6 Nov 2024 10:14:51 +0000 (12:14 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 6 Nov 2024 12:26:15 +0000 (13:26 +0100)
Variable 'max_interrupters' contains the maximum supported interrupters
or the maximum interrupters the user has requested. Thus, it should be
used instead of HCS_MAX_INTRS().

User set 'max_interrupters' value is validated in xhci_gen_setup(),
otherwise 'max_interrupters' value is 'HCS_MAX_INTRS(xhci->hcs_params1)'.

Signed-off-by: Niklas Neronin <niklas.neronin@linux.intel.com>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Link: https://lore.kernel.org/r/20241106101459.775897-26-mathias.nyman@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/host/xhci-pci.c

index b1f4dd3f9effc4b44b92c4dba43f40337c3221d0..47c4f70793e49e11ca02b4f9f2e1e6e7c5698c07 100644 (file)
@@ -149,14 +149,11 @@ static int xhci_try_enable_msi(struct usb_hcd *hcd)
        hcd->irq = 0;
 
        /*
-        * calculate number of MSI-X vectors supported.
-        * - HCS_MAX_INTRS: the max number of interrupts the host can handle,
-        *   with max number of interrupters based on the xhci HCSPARAMS1.
-        * - num_online_cpus: maximum MSI-X vectors per CPUs core.
-        *   Add additional 1 vector to ensure always available interrupt.
+        * Calculate number of MSI/MSI-X vectors supported.
+        * - max_interrupters: the max number of interrupts requested, capped to xhci HCSPARAMS1.
+        * - num_online_cpus: one vector per CPUs core, with at least one overall.
         */
-       xhci->nvecs = min(num_online_cpus() + 1,
-                         HCS_MAX_INTRS(xhci->hcs_params1));
+       xhci->nvecs = min(num_online_cpus() + 1, xhci->max_interrupters);
 
        /* TODO: Check with MSI Soc for sysdev */
        xhci->nvecs = pci_alloc_irq_vectors(pdev, 1, xhci->nvecs,