Commit 99f3d279 authored by Thomas Gleixner's avatar Thomas Gleixner

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: default avatarThomas Gleixner <tglx@linutronix.de>
Reviewed-by: default avatarJason Gunthorpe <jgg@nvidia.com>
Acked-by: default avatarBjorn Helgaas <bhelgaas@google.com>
Link: https://lore.kernel.org/r/20221111122015.631728309@linutronix.de
parent d2a463b2
...@@ -762,6 +762,10 @@ int __pci_enable_msix_range(struct pci_dev *dev, struct msix_entry *entries, int ...@@ -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)) if (WARN_ON_ONCE(dev->msix_enabled))
return -EINVAL; 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) if (!pci_msi_supported(dev, nvec) || dev->current_state != PCI_D0)
return -EINVAL; return -EINVAL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment