* [PATCH 02/15] PCI/MSI: forward MSIx vector enable error code in pci_alloc_irq_vectors_affinity
@ 2020-06-02 9:19 Piotr Stankiewicz
0 siblings, 0 replies; only message in thread
From: Piotr Stankiewicz @ 2020-06-02 9:19 UTC (permalink / raw)
To: Bjorn Helgaas; +Cc: linux-pci, linux-kernel, Piotr Stankiewicz
When debugging an issue where I was asking the PCI machinery to enable a
set of MSIx vectors, without falling back on MSI, I ran across a
behaviour which seems odd. The pci_alloc_irq_vectors_affinity will
always return -ENOSPC on failure, when allocating MSIx vectors only,
whereas with MSI fallback it will forward any error returned by
__pci_enable_msi_range. This is a confusing behaviour, so have the
pci_alloc_irq_vectors_affinity forward the error code from
__pci_enable_msix_range when appropriate.
Signed-off-by: Piotr Stankiewicz <piotr.stankiewicz@intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
---
drivers/pci/msi.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c
index 6b43a5455c7a..9db9ce5dddb3 100644
--- a/drivers/pci/msi.c
+++ b/drivers/pci/msi.c
@@ -1231,8 +1231,8 @@ int pci_alloc_irq_vectors_affinity(struct pci_dev *dev, unsigned int min_vecs,
}
}
- if (msix_vecs == -ENOSPC)
- return -ENOSPC;
+ if (msix_vecs == -ENOSPC || (flags & PCI_IRQ_MSI_TYPES) == PCI_IRQ_MSIX)
+ return msix_vecs;
return msi_vecs;
}
EXPORT_SYMBOL(pci_alloc_irq_vectors_affinity);
--
2.17.2
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2020-06-02 9:20 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-02 9:19 [PATCH 02/15] PCI/MSI: forward MSIx vector enable error code in pci_alloc_irq_vectors_affinity Piotr Stankiewicz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).