This series is prep work for the big device posted IRQs overhaul[1], in which Paolo suggested getting rid of arch/x86/kvm/irq_comm.c[2]. As I started chipping away bits of irq_comm.c to make the final code movement to irq.c as small as possible, I realized that (a) a rather large amount of irq_comm.c was actually I/O APIC code and (b) this would be a perfect opportunity to further isolate the I/O APIC code. So, a bit of hacking later and voila, CONFIG_KVM_IOAPIC. Similar to KVM's SMM and Xen Kconfigs, this is something we would enable in production straightaway, if we could magically fast-forwarded our kernel, as fully disabling I/O APIC emulation puts a decent chunk of guest-visible surface entirely out of reach. Side topic, Paolo's recollection that irq_comm.c was to hold common APIs between x86 and Itanium was spot on. Though when I read Paolo's mail, I parsed "ia64" as x86-64. I got quite a good laugh when I eventually realized that he really did mean ia64 :-) [1] https://lore.kernel.org/all/20250404193923.1413163-1-seanjc@xxxxxxxxxx [2] https://lore.kernel.org/all/cf4d9b81-c1ab-40a6-8c8c-36ad36b9be63@xxxxxxxxxx Sean Christopherson (15): KVM: x86: Trigger I/O APIC route rescan in kvm_arch_irq_routing_update() KVM: x86: Drop superfluous kvm_set_pic_irq() => kvm_pic_set_irq() wrapper KVM: x86: Drop superfluous kvm_set_ioapic_irq() => kvm_ioapic_set_irq() wrapper KVM: x86: Drop superfluous kvm_hv_set_sint() => kvm_hv_synic_set_irq() wrapper KVM: x86: Fold kvm_setup_default_irq_routing() into kvm_ioapic_init() KVM: x86: Move kvm_{request,free}_irq_source_id() to i8254.c (PIT) KVM: x86: Hardcode the PIT IRQ source ID to '2' KVM: x86: Don't clear PIT's IRQ line status when destroying PIT KVM: x86: Explicitly check for in-kernel PIC when getting ExtINT KVM: Move x86-only tracepoints to x86's trace.h KVM: x86: Add CONFIG_KVM_IOAPIC to allow disabling in-kernel I/O APIC KVM: Squash two CONFIG_HAVE_KVM_IRQCHIP #ifdefs into one KVM: selftests: Fall back to split IRQ chip if full in-kernel chip is unsupported KVM: x86: Move IRQ mask notifier infrastructure to I/O APIC emulation KVM: x86: Fold irq_comm.c into irq.c arch/x86/include/asm/kvm_host.h | 22 +- arch/x86/kvm/Kconfig | 10 + arch/x86/kvm/Makefile | 7 +- arch/x86/kvm/hyperv.c | 10 +- arch/x86/kvm/hyperv.h | 3 +- arch/x86/kvm/i8254.c | 11 +- arch/x86/kvm/i8254.h | 3 +- arch/x86/kvm/i8259.c | 17 +- arch/x86/kvm/ioapic.c | 87 +++- arch/x86/kvm/ioapic.h | 22 +- arch/x86/kvm/irq.c | 336 ++++++++++++++- arch/x86/kvm/irq.h | 3 +- arch/x86/kvm/irq_comm.c | 469 --------------------- arch/x86/kvm/lapic.c | 7 +- arch/x86/kvm/trace.h | 80 ++++ arch/x86/kvm/x86.c | 37 +- include/linux/kvm_host.h | 9 +- include/trace/events/kvm.h | 84 +--- tools/testing/selftests/kvm/lib/kvm_util.c | 13 +- virt/kvm/irqchip.c | 2 - 20 files changed, 577 insertions(+), 655 deletions(-) delete mode 100644 arch/x86/kvm/irq_comm.c base-commit: 3f7b307757ecffc1c18ede9ee3cf9ce8101f3cc9 -- 2.49.0.1101.gccaa498523-goog