linux-stable/arch
David Woodhouse ed85c3113a 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:19:30 +02:00
..
alpha rtc: Add support for configuring the UIP timeout for RTC reads 2024-01-31 16:17:01 -08:00
arc work around gcc bugs with 'asm goto' with outputs 2024-02-23 09:12:28 +01:00
arm arm: dts: marvell: Fix maxium->maxim typo in brownstone dts 2024-04-03 15:19:24 +02:00
arm64 arm64: dts: qcom: sc7280: Add additional MSI interrupts 2024-04-03 15:19:24 +02:00
csky work around gcc bugs with 'asm goto' with outputs 2024-02-23 09:12:28 +01:00
hexagon
ia64 ia64/cpu: Switch to arch_cpu_finalize_init() 2023-08-08 20:03:46 +02:00
loongarch LoongArch: Disable IRQ before init_fn() for nonboot CPUs 2024-03-01 13:26:31 +01:00
m68k m68k: Fix invalid .section syntax 2023-09-13 09:42:21 +02:00
microblaze mm: always expand the stack with the mmap write lock held 2023-07-01 13:16:25 +02:00
mips MIPS: Clear Cause.BD in instruction_pointer_set 2024-03-26 18:20:24 -04:00
nios2
openrisc mm: always expand the stack with the mmap write lock held 2023-07-01 13:16:25 +02:00
parisc parisc: Strip upper 32 bit of sum in csum_ipv6_magic for 64-bit builds 2024-04-03 15:19:28 +02:00
powerpc powerpc/fsl: Fix mfpmr build errors with newer binutils 2024-04-03 15:19:29 +02:00
riscv riscv: dts: sifive: add missing #interrupt-cells to pmic 2024-03-26 18:20:25 -04:00
s390 s390/vtime: fix average steal time calculation 2024-03-26 18:20:59 -04:00
sh sh: bios: Revive earlyprintk support 2023-11-20 11:52:07 +01:00
sparc sparc: vDSO: fix return value of __setup handler 2024-04-03 15:19:26 +02:00
um um: Fix adding '-no-pie' for clang 2024-02-23 09:12:38 +01:00
x86 KVM: x86/xen: inject vCPU upcall vector when local APIC is enabled 2024-04-03 15:19:30 +02:00
xtensa work around gcc bugs with 'asm goto' with outputs 2024-02-23 09:12:28 +01:00
.gitignore
Kconfig scs: add CONFIG_MMU dependency for vfree_atomic() 2024-02-23 09:12:32 +01:00