[PATCH 04/16] KVM: Guard the per-plane KVM_SIGNAL_MSI cases with __KVM_HAVE_MSI

From: David Woodhouse

Date: Wed Nov 11 2026 - 17:34:07 EST


From: David Woodhouse <dwmw@xxxxxxxxxxxx>

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/20260608144252.351443-39-joro@xxxxxxxxxx/
Reported-by: Sriram Nambakam <snambakam@xxxxxxxxxxxxxxxxxxx>
Closes: https://lore.kernel.org/all/20261104065536.15232-1-snambakam@xxxxxxxxxxxxxxxxxxx/
Signed-off-by: David Woodhouse <dwmw@xxxxxxxxxxxx>
---
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