diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2022-11-11 14:55:11 +0100 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2022-11-17 15:15:22 +0100 |
commit | 99f3d279765725920aa5924fa445537a20129a6f (patch) | |
tree | a4ad34c7027edee85e9ffb8dccaf8e9b2cb59b01 /drivers/pci/msi | |
parent | PCI/MSI: Reject multi-MSI early (diff) | |
download | linux-99f3d279765725920aa5924fa445537a20129a6f.tar.xz linux-99f3d279765725920aa5924fa445537a20129a6f.zip |
PCI/MSI: Reject MSI-X early
Similar to PCI multi-MSI reject MSI-X enablement when a irq domain is
attached to the device which does not support MSI-X.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
Acked-by: Bjorn Helgaas <bhelgaas@google.com>
Link: https://lore.kernel.org/r/20221111122015.631728309@linutronix.de
Diffstat (limited to 'drivers/pci/msi')
-rw-r--r-- | drivers/pci/msi/msi.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/pci/msi/msi.c b/drivers/pci/msi/msi.c index bc84647c6dbd..0740acd10bde 100644 --- a/drivers/pci/msi/msi.c +++ b/drivers/pci/msi/msi.c @@ -762,6 +762,10 @@ int __pci_enable_msix_range(struct pci_dev *dev, struct msix_entry *entries, int if (WARN_ON_ONCE(dev->msix_enabled)) return -EINVAL; + /* Check MSI-X early on irq domain enabled architectures */ + if (!pci_msi_domain_supports(dev, MSI_FLAG_PCI_MSIX, ALLOW_LEGACY)) + return -ENOTSUPP; + if (!pci_msi_supported(dev, nvec) || dev->current_state != PCI_D0) return -EINVAL; |