qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] KVM: Add system call KVM_VERIFY_MSI to verify MSI vector


From: chenxiang (M)
Subject: Re: [PATCH] KVM: Add system call KVM_VERIFY_MSI to verify MSI vector
Date: Tue, 15 Nov 2022 15:56:13 +0800
User-agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0

Hi Marc,


在 2022/11/10 18:28, Marc Zyngier 写道:
On Wed, 09 Nov 2022 06:21:18 +0000,
"chenxiang (M)" <chenxiang66@hisilicon.com> wrote:
Hi Marc,


在 2022/11/8 20:47, Marc Zyngier 写道:
On Tue, 08 Nov 2022 08:08:57 +0000,
chenxiang <chenxiang66@hisilicon.com> wrote:
From: Xiang Chen <chenxiang66@hisilicon.com>

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?
Before i reported the issue to community, you gave a suggestion about
the issue, but not sure whether i misundertood your meaning.
You can refer to the link for more details about the issue.
https://lkml.kernel.org/lkml/87cze9lcut.wl-maz@kernel.org/T/
Right. It would have been helpful to mention this earlier. Anyway, I
would really like this to be done without involving userspace at all.

But first, can you please confirm that the VM works as expected
despite the message?
Yes, it works well except the message.

If that's the case, we only need to handle the
case where this is a multi-MSI setup, and I think this can be done in
VFIO, without involving userspace.

It seems we can verify every kvm_msi for multi-MSI setup in function vfio_pci_set_msi_trigger(). If it is a invalid MSI vector, then we can decrease the numer of MSI vectors before calling vfio_msi_set_block().


Thanks,

        M.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]