From: Jason Gunthorpe <jgg@ziepe.ca>
To: chenxiang <chenxiang66@hisilicon.com>
Cc: alex.williamson@redhat.com, maz@kernel.org, kvm@vger.kernel.org,
qemu-devel@nongnu.org, linuxarm@huawei.com
Subject: Re: [PATCH v2] vfio/pci: Verify each MSI vector to avoid invalid MSI vectors
Date: Thu, 24 Nov 2022 14:00:44 -0400 [thread overview]
Message-ID: <Y3+xTLC0io6wvPpf@ziepe.ca> (raw)
In-Reply-To: <1669167756-196788-1-git-send-email-chenxiang66@hisilicon.com>
On Wed, Nov 23, 2022 at 09:42:36AM +0800, chenxiang via wrote:
> From: Xiang Chen <chenxiang66@hisilicon.com>
>
> Currently the number of MSI vectors comes from register PCI_MSI_FLAGS
> which should be power-of-2 in qemu, in some scenaries it is not the same as
> the number that driver requires in guest, for example, a PCI driver wants
> to allocate 6 MSI vecotrs in guest, but as the limitation, it will allocate
> 8 MSI vectors. So it requires 8 MSI vectors in qemu while the driver in
> guest only wants to allocate 6 MSI vectors.
>
> When GICv4.1 is enabled, it iterates over all possible MSIs and enable the
> forwarding while the guest has only created some of mappings in the virtual
> ITS, so some calls fail. The exception print is as following:
> vfio-pci 0000:3a:00.1: irq bypass producer (token 000000008f08224d) registration
> fails:66311
With Thomas's series to make MSI more dynamic this could spell future
problems, as future kernels might have different ordering.
It is just architecturally wrong to tie the MSI programming at the PCI
level with the current state of the guest's virtual interrupt
controller.
Physical hardware doesn't do this, virtual emulation shouldn't either.
People are taking too many liberties with trapping the PCI MSI
registers through VFIO. :(
Jason
next prev parent reply other threads:[~2022-11-24 18:00 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-23 1:42 [PATCH v2] vfio/pci: Verify each MSI vector to avoid invalid MSI vectors chenxiang
2022-11-23 12:08 ` Marc Zyngier
2022-11-23 19:55 ` Alex Williamson
2022-11-24 13:19 ` Marc Zyngier
2022-11-26 6:33 ` chenxiang (M)
2022-11-26 10:58 ` Marc Zyngier
2022-11-24 18:00 ` Jason Gunthorpe [this message]
2022-11-26 11:15 ` Marc Zyngier
2022-11-28 18:01 ` Jason Gunthorpe
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=Y3+xTLC0io6wvPpf@ziepe.ca \
--to=jgg@ziepe.ca \
--cc=alex.williamson@redhat.com \
--cc=chenxiang66@hisilicon.com \
--cc=kvm@vger.kernel.org \
--cc=linuxarm@huawei.com \
--cc=maz@kernel.org \
--cc=qemu-devel@nongnu.org \
/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