From: David Woodhouse <[email protected]>

KVM_SIGNAL_MSI fails with -ENOTTY on both the VM fd and plane fds,
while KVM_CHECK_EXTENSION still reports KVM_CAP_SIGNAL_MSI. A VMM that
sends MSIs through the ioctl, such as QEMU with a split irqchip, cannot
inject device interrupts at all.

The new cases in kvm_vm_ioctl() and __kvm_plane_ioctl() test
CONFIG_HAVE_KVM_MSI, which no Kconfig defines; the macro architectures
set is __KVM_HAVE_MSI, as the old VM-fd case used. So both compile
away. Use __KVM_HAVE_MSI.

test_plane_msi in the x86 planes selftest, added later in this series,
catches this.

Fixes the per-plane KVM_SIGNAL_MSI cases added by "kvm: Make
KVM_SIGNAL_MSI per plane".

Fixes: https://lore.kernel.org/all/[email protected]/
Reported-by: Sriram Nambakam <[email protected]>
Closes: 
https://lore.kernel.org/all/[email protected]/
Signed-off-by: David Woodhouse <[email protected]>
---
 virt/kvm/kvm_main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index 0136156df252..95de904f0c61 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -5016,7 +5016,7 @@ static long __kvm_plane_ioctl(struct kvm_plane *plane, 
unsigned int ioctl, unsig
        case KVM_CREATE_VCPU:
                r = kvm_plane_ioctl_create_vcpu(plane, arg);
                break;
-#ifdef CONFIG_HAVE_KVM_MSI
+#ifdef __KVM_HAVE_MSI
        case KVM_SIGNAL_MSI: {
                void __user *argp = (void __user *)arg;
                struct kvm_msi msi;
@@ -5662,7 +5662,7 @@ static long kvm_vm_ioctl(struct file *filp,
                r = kvm_vm_ioctl_create_plane(kvm, arg);
                break;
        case KVM_CREATE_VCPU:
-#ifdef CONFIG_HAVE_KVM_MSI
+#ifdef __KVM_HAVE_MSI
        case KVM_SIGNAL_MSI:
 #endif
 #ifdef CONFIG_HAVE_KVM_IRQ_ROUTING
-- 
2.50.1


Reply via email to