Overhaul and cleanup APIC virtualization (Posted Interrupts on Intel VMX, AVIC on AMD SVM) to streamline things as much as possible, remove a bunch of cruft, and document the lurking gotchas along the way. Patch 01 is a fix from Paolo that's already been merged but hasn't made its way to kvm/queue. It's included here to avoid a number of conflicts. Based on kvm/queue, commit 1cf84614b04a ("KVM: x86: Exit to ...") v3: - Rebase to kvm/queue (and drop non-x86 patches as they've been queued). - Redo AVIC patches, sadly the vcpu_(un)blocking() hooks need to stay. - Add a patch to fix a missing (docuentation-only) barrier in nested posted interrupt delivery. [Paolo] - Collect reviews. v2: - https://lore.kernel.org/all/20211009021236.4122790-1-seanjc@xxxxxxxxxx/ - Collect reviews. [Christian, David] - Add patch to move arm64 WFI functionality out of hooks. [Marc] - Add RISC-V to the fun. - Add all the APICv fun. v1: https://lkml.kernel.org/r/20210925005528.1145584-1-seanjc@xxxxxxxxxx Paolo Bonzini (1): KVM: fix avic_set_running for preemptable kernels Sean Christopherson (25): KVM: nVMX: Ensure vCPU honors event request if posting nested IRQ fails KVM: VMX: Clean up PI pre/post-block WARNs KVM: VMX: Handle PI wakeup shenanigans during vcpu_put/load KVM: Drop unused kvm_vcpu.pre_pcpu field KVM: Move x86 VMX's posted interrupt list_head to vcpu_vmx KVM: VMX: Move preemption timer <=> hrtimer dance to common x86 KVM: x86: Unexport LAPIC's switch_to_{hv,sw}_timer() helpers KVM: x86: Remove defunct pre_block/post_block kvm_x86_ops hooks KVM: SVM: Signal AVIC doorbell iff vCPU is in guest mode KVM: SVM: Don't bother checking for "running" AVIC when kicking for IPIs KVM: SVM: Remove unnecessary APICv/AVIC update in vCPU unblocking path KVM: SVM: Use kvm_vcpu_is_blocking() in AVIC load to handle preemption KVM: SVM: Skip AVIC and IRTE updates when loading blocking vCPU iommu/amd: KVM: SVM: Use pCPU to infer IsRun state for IRTE KVM: VMX: Don't do full kick when triggering posted interrupt "fails" KVM: VMX: Wake vCPU when delivering posted IRQ even if vCPU == this vCPU KVM: VMX: Pass desired vector instead of bool for triggering posted IRQ KVM: VMX: Fold fallback path into triggering posted IRQ helper KVM: VMX: Don't do full kick when handling posted interrupt wakeup KVM: SVM: Drop AVIC's intermediate avic_set_running() helper KVM: SVM: Move svm_hardware_setup() and its helpers below svm_x86_ops KVM: SVM: Nullify vcpu_(un)blocking() hooks if AVIC is disabled KVM: x86: Skip APICv update if APICv is disable at the module level KVM: x86: Drop NULL check on kvm_x86_ops.check_apicv_inhibit_reasons KVM: x86: Unexport __kvm_request_apicv_update() arch/x86/include/asm/kvm-x86-ops.h | 2 - arch/x86/include/asm/kvm_host.h | 12 - arch/x86/kvm/hyperv.c | 3 + arch/x86/kvm/lapic.c | 2 - arch/x86/kvm/svm/avic.c | 116 ++++--- arch/x86/kvm/svm/svm.c | 479 ++++++++++++++--------------- arch/x86/kvm/svm/svm.h | 16 +- arch/x86/kvm/vmx/posted_intr.c | 234 +++++++------- arch/x86/kvm/vmx/posted_intr.h | 8 +- arch/x86/kvm/vmx/vmx.c | 66 ++-- arch/x86/kvm/vmx/vmx.h | 3 + arch/x86/kvm/x86.c | 41 ++- drivers/iommu/amd/iommu.c | 6 +- include/linux/amd-iommu.h | 6 +- include/linux/kvm_host.h | 3 - virt/kvm/kvm_main.c | 3 - 16 files changed, 510 insertions(+), 490 deletions(-) -- 2.34.1.400.ga245620fadb-goog