From: Alex Williamson <alex.williamson@redhat.com>
To: Renjun Wang <rwang@panyi.ai>
Cc: "kvm@vger.kernel.org" <kvm@vger.kernel.org>
Subject: Re: VFIO PROBLEM: pci_alloc_irq_vectors function request 32 MSI interrupts vectors, but return 1 in KVM virtual machine.
Date: Mon, 6 Jan 2020 15:40:55 -0700 [thread overview]
Message-ID: <20200106154055.294322d0@w520.home> (raw)
In-Reply-To: <BJXPR01MB0534C845ED8D3942E95E7BC7DE250@BJXPR01MB0534.CHNPR01.prod.partner.outlook.cn>
On Sat, 28 Dec 2019 01:59:43 +0000
Renjun Wang <rwang@panyi.ai> wrote:
> Hi all:
> I have a question about PCI which troubled me for a few weeks.
> I have a virtual machine with ubuntu 16.4.03 on KVM platform. There
> is a PCIe device(Xilinx PCIe IP) plugged in the host machine, and
> passthrough to guest via VFIO feature. On the ubuntu operation
> system, I am developing the pcie driver. When I use
> pci_alloc_irq_vectors() function to allocate 32 msi vectors, but
> return 1. The command `lspci -vvv` output shows MSI: Enable+
> Count=1/32 Maskable+ 64bit+
>
> there is a similar case
> https://stackoverflow.com/questions/49821599/multiple-msi-vectors-linux-pci-alloc-irq-vectors-return-one-while-the-devi.
> But not working for KVM virtual machine.
>
> I do not known why the function pci_alloc_irq_vectors() returns one ?
When you say it's not working in the virtual machine with that
stackoverflow tip, does that mean your VM is running a Q35 machine type
with the intel-iommu device enabled in both QEMU and on the guest
command line? You should see "IR-PCI-MSI" in /proc/interrupts on host
and guest for the interrupt type if the interrupt remapping is enabled.
Linux doesn't support multiple MSI vectors without some kind of
interrupt remapper support. You probably have that on the host, but
you'll need it in the guest as well or else the guest kernel will limit
you to a single vector.
BTW, if you have any influence over the device, you really, really want
to use MSI-X for supporting multiple vectors. Thanks,
Alex
next prev parent reply other threads:[~2020-01-06 22:41 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-28 1:59 VFIO PROBLEM: pci_alloc_irq_vectors function request 32 MSI interrupts vectors, but return 1 in KVM virtual machine Renjun Wang
2020-01-06 22:40 ` Alex Williamson [this message]
2020-01-10 1:44 ` 回复: " Renjun Wang
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=20200106154055.294322d0@w520.home \
--to=alex.williamson@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=rwang@panyi.ai \
/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