]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
KVM: x86: Drop MAX_NR_RESERVED_IOAPIC_PINS, use KVM_MAX_IRQ_ROUTES directly
authorSean Christopherson <seanjc@google.com>
Sat, 6 Dec 2025 00:43:07 +0000 (16:43 -0800)
committerSean Christopherson <seanjc@google.com>
Mon, 12 Jan 2026 17:31:39 +0000 (09:31 -0800)
Directly use KVM_MAX_IRQ_ROUTES when checking the number of routes being
defined by userspace when creating a split IRQCHIP.  The restriction has
nothing to do with the I/O APIC, e.g. most modern userspace usage is for
routing MSIs.  Breaking the unnecessary dependency on the I/O APIC will
allow burying all of ioapic.h behind CONFIG_KVM_IOAPIC=y.

No functional change intended.

Link: https://patch.msgid.link/20251206004311.479939-6-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
arch/x86/kvm/ioapic.h
arch/x86/kvm/x86.c

index 913016acbbd5182d1ba2e23f7b308410fdad0725..ad238a6e63dcc32ecfb78df25a5cc010404308f5 100644 (file)
@@ -10,7 +10,6 @@ struct kvm;
 struct kvm_vcpu;
 
 #define IOAPIC_NUM_PINS  KVM_IOAPIC_NUM_PINS
-#define MAX_NR_RESERVED_IOAPIC_PINS KVM_MAX_IRQ_ROUTES
 #define IOAPIC_VERSION_ID 0x11 /* IOAPIC version */
 #define IOAPIC_EDGE_TRIG  0
 #define IOAPIC_LEVEL_TRIG 1
index ff8812f3a1293e6e4f0d39a82ee32bfe086b55e6..a847353588a189df48cf51cbe75970e73e074634 100644 (file)
@@ -6717,7 +6717,7 @@ int kvm_vm_ioctl_enable_cap(struct kvm *kvm,
        case KVM_CAP_SPLIT_IRQCHIP: {
                mutex_lock(&kvm->lock);
                r = -EINVAL;
-               if (cap->args[0] > MAX_NR_RESERVED_IOAPIC_PINS)
+               if (cap->args[0] > KVM_MAX_IRQ_ROUTES)
                        goto split_irqchip_unlock;
                r = -EEXIST;
                if (irqchip_in_kernel(kvm))