linux-stable/arch/x86/kvm
David Woodhouse 052bcbedf1 KVM: x86/xen: inject vCPU upcall vector when local APIC is enabled
[ Upstream commit 8e62bf2bfa ]

Linux guests since commit b1c3497e60 ("x86/xen: Add support for
HVMOP_set_evtchn_upcall_vector") in v6.0 onwards will use the per-vCPU
upcall vector when it's advertised in the Xen CPUID leaves.

This upcall is injected through the guest's local APIC as an MSI, unlike
the older system vector which was merely injected by the hypervisor any
time the CPU was able to receive an interrupt and the upcall_pending
flags is set in its vcpu_info.

Effectively, that makes the per-CPU upcall edge triggered instead of
level triggered, which results in the upcall being lost if the MSI is
delivered when the local APIC is *disabled*.

Xen checks the vcpu_info->evtchn_upcall_pending flag when the local APIC
for a vCPU is software enabled (in fact, on any write to the SPIV
register which doesn't disable the APIC). Do the same in KVM since KVM
doesn't provide a way for userspace to intervene and trap accesses to
the SPIV register of a local APIC emulated by KVM.

Fixes: fde0451be8 ("KVM: x86/xen: Support per-vCPU event channel upcall via local APIC")
Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
Reviewed-by: Paul Durrant <paul@xen.org>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20240227115648.3104-3-dwmw2@infradead.org
Signed-off-by: Sean Christopherson <seanjc@google.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-04-03 15:32:11 +02:00
..
mmu KVM: x86/mmu: Retry fault before acquiring mmu_lock if mapping is changing 2024-02-23 10:14:34 -08:00
svm SEV: disable SEV-ES DebugSwap by default 2024-03-09 11:42:25 -05:00
vmx KVM/VMX: Move VERW closer to VMentry for MDS mitigation 2024-02-19 16:31:59 -08:00
.gitignore KVM: x86: use a separate asm-offsets.c file 2022-11-09 12:10:17 -05:00
cpuid.c Generic: 2024-01-17 13:03:37 -08:00
cpuid.h KVM: x86: Use KVM-governed feature framework to track "LAM enabled" 2023-11-28 17:54:09 -08:00
debugfs.c LoongArch KVM changes for v6.8 2024-01-02 13:16:29 -05:00
emulate.c KVM: x86: Introduce get_untagged_addr() in kvm_x86_ops and call it in emulator 2023-11-28 17:54:06 -08:00
fpu.h
governed_features.h KVM: x86: Use KVM-governed feature framework to track "LAM enabled" 2023-11-28 17:54:09 -08:00
hyperv.c KVM: x86: Give a hint when Win2016 might fail to boot due to XSAVES erratum 2024-01-31 16:21:00 -05:00
hyperv.h KVM: x86: Give a hint when Win2016 might fail to boot due to XSAVES erratum 2024-01-31 16:21:00 -05:00
i8254.c KVM: x86: Unify pr_fmt to use module name for all KVM modules 2022-12-29 15:47:35 -05:00
i8254.h KVM: x86: PIT: Preserve state of speaker port data bit 2022-06-08 13:06:20 -04:00
i8259.c KVM: x86: Fix poll command 2023-06-01 13:44:13 -07:00
ioapic.c KVM: x86/ioapic: Resample the pending state of an IRQ when unmasking 2023-03-27 10:13:28 -04:00
ioapic.h
irq.c KVM: x86/xen: Remove unneeded xen context from kvm_arch when !CONFIG_KVM_XEN 2023-12-07 09:33:42 -08:00
irq.h
irq_comm.c KVM: x86: Make Hyper-V emulation optional 2023-12-07 09:34:57 -08:00
Kconfig KVM: x86: Update KVM_SW_PROTECTED_VM docs to make it clear they're a WIP 2024-02-22 17:07:06 -08:00
kvm-asm-offsets.c KVM: SVM: move MSR_IA32_SPEC_CTRL save/restore to assembly 2022-11-09 12:25:53 -05:00
kvm_cache_regs.h KVM: x86: Add helpers to query individual CR0/CR4 bits 2023-03-22 10:10:53 -07:00
kvm_emulate.h KVM: x86: Introduce get_untagged_addr() in kvm_x86_ops and call it in emulator 2023-11-28 17:54:06 -08:00
kvm_onhyperv.c KVM: x86/mmu: Move filling of Hyper-V's TLB range struct into Hyper-V code 2023-04-10 15:17:29 -07:00
kvm_onhyperv.h KVM: x86: Move Hyper-V partition assist page out of Hyper-V emulation context 2023-12-07 09:34:01 -08:00
lapic.c KVM: x86/xen: inject vCPU upcall vector when local APIC is enabled 2024-04-03 15:32:11 +02:00
lapic.h KVM: x86: Split out logic to generate "readable" APIC regs mask to helper 2023-01-24 10:04:35 -08:00
Makefile KVM: x86: Make Hyper-V emulation optional 2023-12-07 09:34:57 -08:00
mmu.h KVM: x86: Use KVM-governed feature framework to track "LAM enabled" 2023-11-28 17:54:09 -08:00
mtrr.c KVM: x86/mmu: Zap SPTEs on MTRR update iff guest MTRRs are honored 2023-10-09 14:35:14 -07:00
pmu.c KVM: x86/pmu: Track emulated counter events instead of previous counter 2023-11-30 12:52:55 -08:00
pmu.h KVM: x86/pmu: Track emulated counter events instead of previous counter 2023-11-30 12:52:55 -08:00
reverse_cpuid.h KVM: x86: Use a switch statement and macros in __feature_translate() 2023-11-30 12:27:02 -08:00
smm.c KVM: x86: Remove redundant vcpu->arch.cr0 assignments 2023-09-27 12:57:48 -07:00
smm.h KVM: x86: smm: preserve interrupt shadow in SMRAM 2022-11-09 12:31:26 -05:00
trace.h KVM: x86/xen: Add CPL to Xen hypercall tracepoint 2022-11-28 13:31:01 -05:00
tss.h
x86.c KVM/x86: Export RFDS_NO and RFDS_CLEAR to guests 2024-03-15 10:48:13 -04:00
x86.h KVM: x86: Virtualize LAM for supervisor pointer 2023-11-28 17:54:07 -08:00
xen.c KVM: x86/xen: inject vCPU upcall vector when local APIC is enabled 2024-04-03 15:32:11 +02:00
xen.h KVM: x86/xen: inject vCPU upcall vector when local APIC is enabled 2024-04-03 15:32:11 +02:00