On Tue, 08 Nov 2022 08:08:57 +0000, chenxiang <chenxiang66@xxxxxxxxxxxxx> wrote: > > From: Xiang Chen <chenxiang66@xxxxxxxxxxxxx> > > Currently the numbers of MSI vectors come from register PCI_MSI_FLAGS > which should be power-of-2, but 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, we can see some exception print as following for > above scenaro: > vfio-pci 0000:3a:00.1: irq bypass producer (token 000000008f08224d) registration fails:66311 > > In order to verify whether a MSI vector is valid, add KVM_VERIFY_MSI to do > that. If there is a mapping, return 0, otherwise return negative value. > > This is the kernel part of adding system call KVM_VERIFY_MSI. Exposing something that is an internal implementation detail to userspace feels like the absolute wrong way to solve this issue. Can you please characterise the issue you're having? Is it that vfio tries to enable an interrupt for which there is no virtual ITS mapping? Shouldn't we instead try and manage this in the kernel? Thanks, M. -- Without deviation from the norm, progress is not possible.