Skip to content

Commit 70b7d65

Browse files
committed
Merge tag 'irq-urgent-2025-06-08' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull irq fix from Thomas Gleixner: "A single fix for the PCI/MSI code: The conversion to per device MSI domains created a MSI domain with size 1 instead of sizing it to the maximum possible number of MSI interrupts for the device. This "worked" as the subsequent allocations resized the domain, but the recent change to move the prepare() call into the domain creation path broke this works by chance mechanism. Size the domain properly at creation time" * tag 'irq-urgent-2025-06-08' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: PCI/MSI: Size device MSI domain with the maximum number of vectors
2 parents 35b574a + 9cc82d9 commit 70b7d65

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

drivers/pci/msi/irqdomain.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,7 @@ static bool pci_create_device_domain(struct pci_dev *pdev, const struct msi_doma
271271
/**
272272
* pci_setup_msi_device_domain - Setup a device MSI interrupt domain
273273
* @pdev: The PCI device to create the domain on
274+
* @hwsize: The maximum number of MSI vectors
274275
*
275276
* Return:
276277
* True when:
@@ -287,7 +288,7 @@ static bool pci_create_device_domain(struct pci_dev *pdev, const struct msi_doma
287288
* - The device is removed
288289
* - MSI is disabled and a MSI-X domain is created
289290
*/
290-
bool pci_setup_msi_device_domain(struct pci_dev *pdev)
291+
bool pci_setup_msi_device_domain(struct pci_dev *pdev, unsigned int hwsize)
291292
{
292293
if (WARN_ON_ONCE(pdev->msix_enabled))
293294
return false;
@@ -297,7 +298,7 @@ bool pci_setup_msi_device_domain(struct pci_dev *pdev)
297298
if (pci_match_device_domain(pdev, DOMAIN_BUS_PCI_DEVICE_MSIX))
298299
msi_remove_device_irq_domain(&pdev->dev, MSI_DEFAULT_DOMAIN);
299300

300-
return pci_create_device_domain(pdev, &pci_msi_template, 1);
301+
return pci_create_device_domain(pdev, &pci_msi_template, hwsize);
301302
}
302303

303304
/**

drivers/pci/msi/msi.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -439,16 +439,16 @@ int __pci_enable_msi_range(struct pci_dev *dev, int minvec, int maxvec,
439439
if (nvec < minvec)
440440
return -ENOSPC;
441441

442-
if (nvec > maxvec)
443-
nvec = maxvec;
444-
445442
rc = pci_setup_msi_context(dev);
446443
if (rc)
447444
return rc;
448445

449-
if (!pci_setup_msi_device_domain(dev))
446+
if (!pci_setup_msi_device_domain(dev, nvec))
450447
return -ENODEV;
451448

449+
if (nvec > maxvec)
450+
nvec = maxvec;
451+
452452
for (;;) {
453453
if (affd) {
454454
nvec = irq_calc_affinity_vectors(minvec, nvec, affd);

drivers/pci/msi/msi.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ enum support_mode {
107107
};
108108

109109
bool pci_msi_domain_supports(struct pci_dev *dev, unsigned int feature_mask, enum support_mode mode);
110-
bool pci_setup_msi_device_domain(struct pci_dev *pdev);
110+
bool pci_setup_msi_device_domain(struct pci_dev *pdev, unsigned int hwsize);
111111
bool pci_setup_msix_device_domain(struct pci_dev *pdev, unsigned int hwsize);
112112

113113
/* Legacy (!IRQDOMAIN) fallbacks */

0 commit comments

Comments
 (0)