[PATCH v2 00/18] KVM: x86: Add I/O APIC kconfig, delete irq_comm.c

Sean Christopherson posted 18 patches 3 months, 3 weeks ago
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                       |  90 +++-
arch/x86/kvm/i8254.h                       |  17 +-
arch/x86/kvm/i8259.c                       |  17 +-
arch/x86/kvm/ioapic.c                      |  55 ++-
arch/x86/kvm/ioapic.h                      |  24 +-
arch/x86/kvm/irq.c                         | 427 ++++++++++++++++++-
arch/x86/kvm/irq.h                         |  35 +-
arch/x86/kvm/irq_comm.c                    | 469 ---------------------
arch/x86/kvm/lapic.c                       |   7 +-
arch/x86/kvm/trace.h                       |  80 ++++
arch/x86/kvm/x86.c                         | 164 +------
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, 746 insertions(+), 799 deletions(-)
delete mode 100644 arch/x86/kvm/irq_comm.c
[PATCH v2 00/18] KVM: x86: Add I/O APIC kconfig, delete irq_comm.c
Posted by Sean Christopherson 3 months, 3 weeks ago
Add CONFIG_KVM_IOAPIC to allow disabling support for KVM's I/O APIC (and PIC
and PIT) emulation, and delete irq_comm.c by moving its contents to other
files.

Vitaly and Kai, I didn't apply your review/ack to the Hyper-V patch, as I ended
up keeping the helper as kvm_hv_synic_set_irq() to fix the tracepoint
inconsistency and the bad changelog.

v2:
 - Keep kvm_hv_synic_set_irq() instead of renaming it kvm_hv_set_sint() to
   stay consistent with kvm_pic_set_irq() and kvm_ioapic_set_irq(), and with
   its tracepoint. [Vitaly, Kai]
 - Keep kvm_setup_default_irq_routine() instead of folding it into I/O APIC
   allocation, but rename it to kvm_setup_default_ioapic_and_pic_routing().
   [Paolo].
 - Move a bit more code out of x86.c (this time into i8254.c).
 - Guard more code with CONFIG_KVM_IOAPIC (e.g. struct kvm_pit).
 - Fix a changelog typo. [Kai]
 - Collect Kai's Acked-by. [Kai]

v1: https://lore.kernel.org/all/20250519232808.2745331-1-seanjc@google.com

Sean Christopherson (18):
  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: Move PIT ioctl helpers to i8254.c
  KVM: x86: Move KVM_{GET,SET}_IRQCHIP ioctl helpers to irq.c
  KVM: x86: Rename irqchip_kernel() to irqchip_full()
  KVM: x86: Move kvm_setup_default_irq_routing() into irq.c
  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                       |  90 +++-
 arch/x86/kvm/i8254.h                       |  17 +-
 arch/x86/kvm/i8259.c                       |  17 +-
 arch/x86/kvm/ioapic.c                      |  55 ++-
 arch/x86/kvm/ioapic.h                      |  24 +-
 arch/x86/kvm/irq.c                         | 427 ++++++++++++++++++-
 arch/x86/kvm/irq.h                         |  35 +-
 arch/x86/kvm/irq_comm.c                    | 469 ---------------------
 arch/x86/kvm/lapic.c                       |   7 +-
 arch/x86/kvm/trace.h                       |  80 ++++
 arch/x86/kvm/x86.c                         | 164 +------
 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, 746 insertions(+), 799 deletions(-)
 delete mode 100644 arch/x86/kvm/irq_comm.c


base-commit: 61374cc145f4a56377eaf87c7409a97ec7a34041
-- 
2.50.0.rc1.591.g9c95f17f64-goog
Re: [PATCH v2 00/18] KVM: x86: Add I/O APIC kconfig, delete irq_comm.c
Posted by Sean Christopherson 3 months, 1 week ago
On Wed, 11 Jun 2025 14:35:39 -0700, Sean Christopherson wrote:
> Add CONFIG_KVM_IOAPIC to allow disabling support for KVM's I/O APIC (and PIC
> and PIT) emulation, and delete irq_comm.c by moving its contents to other
> files.
> 
> Vitaly and Kai, I didn't apply your review/ack to the Hyper-V patch, as I ended
> up keeping the helper as kvm_hv_synic_set_irq() to fix the tracepoint
> inconsistency and the bad changelog.
> 
> [...]

Applied to kvm-x86 irqs, thanks!

[01/18] KVM: x86: Trigger I/O APIC route rescan in kvm_arch_irq_routing_update()
        https://github.com/kvm-x86/linux/commit/e295d2e7fbe6
[02/18] KVM: x86: Drop superfluous kvm_set_pic_irq() => kvm_pic_set_irq() wrapper
        https://github.com/kvm-x86/linux/commit/8a33b1f246ce
[03/18] KVM: x86: Drop superfluous kvm_set_ioapic_irq() => kvm_ioapic_set_irq() wrapper
        https://github.com/kvm-x86/linux/commit/05dc9eab3f00
[04/18] KVM: x86: Drop superfluous kvm_hv_set_sint() => kvm_hv_synic_set_irq() wrapper
        https://github.com/kvm-x86/linux/commit/20218e69e85b
[05/18] KVM: x86: Move PIT ioctl helpers to i8254.c
        https://github.com/kvm-x86/linux/commit/00b5ebf8db7c
[06/18] KVM: x86: Move KVM_{GET,SET}_IRQCHIP ioctl helpers to irq.c
        https://github.com/kvm-x86/linux/commit/b771b1616ff8
[07/18] KVM: x86: Rename irqchip_kernel() to irqchip_full()
        https://github.com/kvm-x86/linux/commit/c5a701955e2d
[08/18] KVM: x86: Move kvm_setup_default_irq_routing() into irq.c
        https://github.com/kvm-x86/linux/commit/df35135680fa
[09/18] KVM: x86: Move kvm_{request,free}_irq_source_id() to i8254.c (PIT)
        https://github.com/kvm-x86/linux/commit/77a74b8ff41a
[10/18] KVM: x86: Hardcode the PIT IRQ source ID to '2'
        https://github.com/kvm-x86/linux/commit/61423c413a74
[11/18] KVM: x86: Don't clear PIT's IRQ line status when destroying PIT
        https://github.com/kvm-x86/linux/commit/2c31aa747d78
[12/18] KVM: x86: Explicitly check for in-kernel PIC when getting ExtINT
        https://github.com/kvm-x86/linux/commit/cd9140ad8312
[13/18] KVM: Move x86-only tracepoints to x86's trace.h
        https://github.com/kvm-x86/linux/commit/2c938850d9d1
[14/18] KVM: x86: Add CONFIG_KVM_IOAPIC to allow disabling in-kernel I/O APIC
        https://github.com/kvm-x86/linux/commit/628a27731e3f
[15/18] KVM: Squash two CONFIG_HAVE_KVM_IRQCHIP #ifdefs into one
        https://github.com/kvm-x86/linux/commit/141db6cd79e2
[16/18] KVM: selftests: Fall back to split IRQ chip if full in-kernel chip is unsupported
        https://github.com/kvm-x86/linux/commit/8fd2a6d43a10
[17/18] KVM: x86: Move IRQ mask notifier infrastructure to I/O APIC emulation
        https://github.com/kvm-x86/linux/commit/37b1761fe895
[18/18] KVM: x86: Fold irq_comm.c into irq.c
        https://github.com/kvm-x86/linux/commit/e76c274513f2

--
https://github.com/kvm-x86/kvm-unit-tests/tree/next