From: Petr Vandrovec <petr@vmware.com>
To: <gregkh@linuxfoundation.org>
Cc: <hch@lst.de>, <linux-kernel@vger.kernel.org>,
<pv-drivers@vmware.com>, <petr@vandrovec.name>
Subject: [PATCH] vmw_vmci: Fix irq allocation
Date: Sat, 25 Mar 2017 23:51:12 -0700 [thread overview]
Message-ID: <20170326065112.iv65box7muvifxzw@petr-dev3.eng.vmware.com> (raw)
From: Petr Vandrovec <petr@vmware.com>
Change 3bb434 (vmw_vmci: switch to pci_irq_alloc_vectors) converted
vmw_vmci to use pci_irq_alloc_vectors. Unfortunately for the code
pci_irq_alloc_vectors returns number of allocated vectors on success,
rather than zero. So successful allocation was always treated as
an error, causing slew of warning messages, and then error that
device probe method returned unexpected value 2.
Checking that error is < 0 fixes problem.
While I was there, I've simplified allocation to do just one
pci_irq_alloc_vectors call: VMCI device currently supports only
two MSI-X vectors, so we either get two dedicated vectors, or
one shared vector. Nothing else can happen. So we can ask
for minimum=1, maximum=2, MSI-X | MSI | Legacy, and get back
best possible choice.
Signed-off-by: Petr Vandrovec <petr@vmware.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Fixes: 3bb434cdcc6a ("vmw_vmci: switch to pci_irq_alloc_vectors")
---
drivers/misc/vmw_vmci/vmci_guest.c | 16 +++++-----------
1 file changed, 5 insertions(+), 11 deletions(-)
diff --git a/drivers/misc/vmw_vmci/vmci_guest.c b/drivers/misc/vmw_vmci/vmci_guest.c
index 9d659542a335..6aea073841c8 100644
--- a/drivers/misc/vmw_vmci/vmci_guest.c
+++ b/drivers/misc/vmw_vmci/vmci_guest.c
@@ -464,7 +464,6 @@ static int vmci_guest_probe_device(struct pci_dev *pdev,
}
vmci_dev->dev = &pdev->dev;
- vmci_dev->exclusive_vectors = false;
vmci_dev->iobase = iobase;
tasklet_init(&vmci_dev->datagram_tasklet,
@@ -564,16 +563,11 @@ static int vmci_guest_probe_device(struct pci_dev *pdev,
* Enable interrupts. Try MSI-X first, then MSI, and then fallback on
* legacy interrupts.
*/
- error = pci_alloc_irq_vectors(pdev, VMCI_MAX_INTRS, VMCI_MAX_INTRS,
- PCI_IRQ_MSIX);
- if (error) {
- error = pci_alloc_irq_vectors(pdev, 1, 1,
- PCI_IRQ_MSIX | PCI_IRQ_MSI | PCI_IRQ_LEGACY);
- if (error)
- goto err_remove_bitmap;
- } else {
- vmci_dev->exclusive_vectors = true;
- }
+ error = pci_alloc_irq_vectors(pdev, 1, VMCI_MAX_INTRS,
+ PCI_IRQ_MSIX | PCI_IRQ_MSI | PCI_IRQ_LEGACY);
+ if (error < 0)
+ goto err_remove_bitmap;
+ vmci_dev->exclusive_vectors = error == VMCI_MAX_INTRS;
/*
* Request IRQ for legacy or MSI interrupts, or for first
--
2.11.0
next reply other threads:[~2017-03-26 7:06 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-26 6:51 Petr Vandrovec [this message]
2017-03-27 8:33 ` Christoph Hellwig
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170326065112.iv65box7muvifxzw@petr-dev3.eng.vmware.com \
--to=petr@vmware.com \
--cc=gregkh@linuxfoundation.org \
--cc=hch@lst.de \
--cc=linux-kernel@vger.kernel.org \
--cc=petr@vandrovec.name \
--cc=pv-drivers@vmware.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®