Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1646118 > unrolled thread

[PATCH] PCI/msi: fix the pci_alloc_irq_vectors_affinity stub

Started byChristoph Hellwig <hch@lst.de>
First post2017-05-20 15:30 +0200
Last post2017-05-20 19:10 +0200
Articles 2 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH] PCI/msi: fix the pci_alloc_irq_vectors_affinity stub Christoph Hellwig <hch@lst.de> - 2017-05-20 15:30 +0200
    [PATCH v2] PCI/msi: fix the pci_alloc_irq_vectors_affinity stub Christoph Hellwig <hch@lst.de> - 2017-05-20 19:10 +0200

#1646118 — [PATCH] PCI/msi: fix the pci_alloc_irq_vectors_affinity stub

FromChristoph Hellwig <hch@lst.de>
Date2017-05-20 15:30 +0200
Subject[PATCH] PCI/msi: fix the pci_alloc_irq_vectors_affinity stub
Message-ID<tJcCe-20L-1@gated-at.bofh.it>
We need to return an error for any call that asks for MSI / MSI-X
vectors only, so that non-trivial fallback logic can work properly.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reported-by: Steven Rostedt <rostedt@goodmis.org>
Fixes: aff17164 ("PCI: Provide sensible IRQ vector alloc/free routines")
---
 include/linux/pci.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/pci.h b/include/linux/pci.h
index 33c2b0b77429..5a7fd3b6a7b9 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -1342,7 +1342,7 @@ pci_alloc_irq_vectors_affinity(struct pci_dev *dev, unsigned int min_vecs,
 			       unsigned int max_vecs, unsigned int flags,
 			       const struct irq_affinity *aff_desc)
 {
-	if (min_vecs > 1)
+	if (min_vecs > 1 || !(flags & PCI_IRQ_LEGACY))
 		return -EINVAL;
 	return 1;
 }
-- 
2.11.0

[toc] | [next] | [standalone]


#1646164 — [PATCH v2] PCI/msi: fix the pci_alloc_irq_vectors_affinity stub

FromChristoph Hellwig <hch@lst.de>
Date2017-05-20 19:10 +0200
Subject[PATCH v2] PCI/msi: fix the pci_alloc_irq_vectors_affinity stub
Message-ID<tJg37-4h7-11@gated-at.bofh.it>
In reply to#1646118
We need to return an error for any call that asks for MSI / MSI-X
vectors only, so that non-trivial fallback logic can work properly.

Also valid dev->irq and use the "correct" errno value based on feedback
from Linus.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reported-by: Steven Rostedt <rostedt@goodmis.org>
Fixes: aff17164 ("PCI: Provide sensible IRQ vector alloc/free routines")
---

Changes from V1:
 - use == comparism
 - return -ENOSPC
 - verify dev->irq

 include/linux/pci.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/include/linux/pci.h b/include/linux/pci.h
index 33c2b0b77429..fc2e832d7b9c 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -1342,9 +1342,9 @@ pci_alloc_irq_vectors_affinity(struct pci_dev *dev, unsigned int min_vecs,
 			       unsigned int max_vecs, unsigned int flags,
 			       const struct irq_affinity *aff_desc)
 {
-	if (min_vecs > 1)
-		return -EINVAL;
-	return 1;
+	if ((flags & PCI_IRQ_LEGACY) && min_vecs == 1 && dev->irq)
+		return 1;
+	return -ENOSPC;
 }
 
 static inline void pci_free_irq_vectors(struct pci_dev *dev)
-- 
2.11.0

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web