linux-stable/arch/x86
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
..
boot x86/efistub: Use 1:1 file:memory mapping for PE/COFF .compat section 2024-02-05 10:24:51 +00:00
coco - Add support managing TDX host hardware 2024-01-18 13:41:48 -08:00
configs
crypto This update includes the following changes: 2024-01-10 12:23:43 -08:00
entry x86/entry_32: Add VERW just before userspace transition 2024-02-19 16:31:46 -08:00
events perf/x86/amd/core: Avoid register reset when CPU is dead 2024-03-26 18:17:27 -04:00
hyperv x86/hyperv: Use per cpu initial stack for vtl context 2024-03-26 18:17:30 -04:00
ia32
include x86/asm: Remove the __iomem annotation of movdir64b()'s dst argument 2024-03-26 18:16:30 -04:00
kernel x86/nmi: Fix the inverse "in NMI handler" check 2024-04-03 15:32:07 +02:00
kvm KVM: x86/xen: inject vCPU upcall vector when local APIC is enabled 2024-04-03 15:32:11 +02:00
lib x86/lib: Revert to _ASM_EXTABLE_UA() for {get,put}_user() fixups 2024-01-29 11:40:41 +01:00
math-emu
mm x86/sme: Fix memory encryption setting if enabled by default and not overridden 2024-03-26 18:16:29 -04:00
net Networking changes for 6.8. 2024-01-11 10:07:29 -08:00
pci pci-v6.8-changes 2024-01-17 16:23:17 -08:00
platform x86/cleanups changes for v6.8: 2024-01-08 17:23:32 -08:00
power
purgatory
ras
realmode x86/cleanups changes for v6.8: 2024-01-08 17:23:32 -08:00
tools x86, relocs: Ignore relocations in .notes section 2024-03-26 18:16:51 -04:00
um This pull request contains the following changes for UML: 2024-01-17 10:44:34 -08:00
video
virt
xen x86/xen: Add some null pointer checking to smp.c 2024-02-12 20:14:52 +01:00
.gitignore
Kbuild
Kconfig x86/rfds: Mitigate Register File Data Sampling (RFDS) 2024-03-15 10:48:13 -04:00
Kconfig.assembler
Kconfig.cpu x86/Kconfig: Transmeta Crusoe is CPU family 5, not 6 2024-02-09 16:28:19 +01:00
Kconfig.debug
Makefile kbuild: use 4-space indentation when followed by conditionals 2024-02-15 06:05:44 +09:00
Makefile.postlink
Makefile.um
Makefile_32.cpu