summaryrefslogtreecommitdiff
path: root/drivers/pci/msi/msi.c
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2022-11-11 16:55:09 +0300
committerThomas Gleixner <tglx@linutronix.de>2022-11-17 17:15:22 +0300
commitd2a463b297415ca6dd4d60bb1c867dd7c931587b (patch)
treea6a2c0b1123cd0e5934f46a31c56301cef9134a2 /drivers/pci/msi/msi.c
parentbab65e48cb064d67b488efb6888c06fd977a8245 (diff)
downloadlinux-d2a463b297415ca6dd4d60bb1c867dd7c931587b.tar.xz
PCI/MSI: Reject multi-MSI early
When hierarchical MSI interrupt domains are enabled then there is no point to do tons of work and detect the missing support for multi-MSI late in the allocation path. Just query the domain feature flags right away. The query function is going to be used for other purposes later and has a mode argument which influences the result: ALLOW_LEGACY returns true when: - there is no irq domain attached (legacy support) - there is a irq domain attached which has the feature flag set DENY_LEGACY returns only true when: - there is a irq domain attached which has the feature flag set This allows to use the function universally without ifdeffery in the calling code. 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.574339988@linutronix.de
Diffstat (limited to 'drivers/pci/msi/msi.c')
-rw-r--r--drivers/pci/msi/msi.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/pci/msi/msi.c b/drivers/pci/msi/msi.c
index 794ec97c5b70..bc84647c6dbd 100644
--- a/drivers/pci/msi/msi.c
+++ b/drivers/pci/msi/msi.c
@@ -347,6 +347,10 @@ static int msi_capability_init(struct pci_dev *dev, int nvec,
struct msi_desc *entry;
int ret;
+ /* Reject multi-MSI early on irq domain enabled architectures */
+ if (nvec > 1 && !pci_msi_domain_supports(dev, MSI_FLAG_MULTI_PCI_MSI, ALLOW_LEGACY))
+ return 1;
+
/*
* Disable MSI during setup in the hardware, but mark it enabled
* so that setup code can evaluate it.