[PATCH v2 0/8] Fix x2apic enablement and allow up to 32768 CPUs without IR where supported

From: David Woodhouse
Date: Fri Oct 09 2020 - 06:46:29 EST



Fix the conditions for enabling x2apic on guests without interrupt
remapping, and support 15-bit Extended Destination ID to allow 32768
CPUs without IR on hypervisors that support it.

The last patch in the series now makes io_apic.c generate its RTE from
the MSI message created by the parent irqchip, and removes all the nasty
hackery where IRQ remapping drivers would frob I/OAPIC RTEs for
themselves directly. It's last because I'd quite like to see it tested
especially with Hyper-V and it doesn't actually eliminate the need for
io_apic.c to know about the 15-bit extension anyway.

v2:
• Minor cleanups.
• Move __irq_msi_compose_msg() to apic.c, make virt_ext_dest_id static.
• Generate I/OAPIC RTE directly from parent irqchip's MSI messages.
• Clean up HPET MSI support into hpet.c now that we can.

David Woodhouse (8):
x86/apic: Fix x2apic enablement without interrupt remapping
x86/msi: Only use high bits of MSI address for DMAR unit
x86/apic: Always provide irq_compose_msi_msg() method for vector domain
x86/ioapic: Handle Extended Destination ID field in RTE
x86/apic: Support 15 bits of APIC ID in MSI where available
x86/kvm: Add KVM_FEATURE_MSI_EXT_DEST_ID
x86/hpet: Move MSI support into hpet.c
x86/ioapic: Generate RTE directly from parent irqchip's MSI message

Documentation/virt/kvm/cpuid.rst | 4 +
arch/x86/include/asm/apic.h | 9 +--
arch/x86/include/asm/hpet.h | 11 ---
arch/x86/include/asm/hw_irq.h | 11 ++-
arch/x86/include/asm/io_apic.h | 3 +-
arch/x86/include/asm/msidef.h | 2 +
arch/x86/include/asm/x86_init.h | 2 +
arch/x86/include/uapi/asm/kvm_para.h | 1 +
arch/x86/kernel/apic/apic.c | 68 ++++++++++++++--
arch/x86/kernel/apic/io_apic.c | 66 +++++++++------
arch/x86/kernel/apic/msi.c | 152 +++--------------------------------
arch/x86/kernel/apic/vector.c | 6 ++
arch/x86/kernel/apic/x2apic_phys.c | 9 +++
arch/x86/kernel/hpet.c | 116 ++++++++++++++++++++++++--
arch/x86/kernel/kvm.c | 6 ++
arch/x86/kernel/x86_init.c | 1 +
drivers/iommu/amd/iommu.c | 14 ----
drivers/iommu/hyperv-iommu.c | 31 -------
drivers/iommu/intel/irq_remapping.c | 19 ++---
19 files changed, 276 insertions(+), 255 deletions(-)