qemu-e2k/target/i386
David Woodhouse 18e83f28bf hw/xen: select kernel mode for per-vCPU event channel upcall vector
A guest which has configured the per-vCPU upcall vector may set the
HVM_PARAM_CALLBACK_IRQ param to fairly much anything other than zero.

For example, Linux v6.0+ after commit b1c3497e604 ("x86/xen: Add support
for HVMOP_set_evtchn_upcall_vector") will just do this after setting the
vector:

       /* Trick toolstack to think we are enlightened. */
       if (!cpu)
               rc = xen_set_callback_via(1);

That's explicitly setting the delivery to GSI#1, but it's supposed to be
overridden by the per-vCPU vector setting. This mostly works in Qemu
*except* for the logic to enable the in-kernel handling of event channels,
which falsely determines that the kernel cannot accelerate GSI delivery
in this case.

Add a kvm_xen_has_vcpu_callback_vector() to report whether vCPU#0 has
the vector set, and use that in xen_evtchn_set_callback_param() to
enable the kernel acceleration features even when the param *appears*
to be set to target a GSI.

Preserve the Xen behaviour that when HVM_PARAM_CALLBACK_IRQ is set to
*zero* the event channel delivery is disabled completely. (Which is
what that bizarre guest behaviour is working round in the first place.)

Cc: qemu-stable@nongnu.org
Fixes: 91cce75617 ("hw/xen: Add xen_evtchn device for event channel emulation")
Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
Reviewed-by: Paul Durrant <paul@xen.org>
2023-11-06 10:03:45 +00:00
..
hvf sysemu/kvm: Restrict hvf_get_supported_cpuid() to x86 targets 2023-10-07 19:02:32 +02:00
kvm hw/xen: select kernel mode for per-vCPU event channel upcall vector 2023-11-06 10:03:45 +00:00
nvmm migration: simplify blockers 2023-10-20 08:51:41 +02:00
tcg target/i386: validate VEX.W for AVX instructions 2023-10-25 17:35:07 +02:00
whpx migration: simplify blockers 2023-10-20 08:51:41 +02:00
arch_dump.c
arch_memory_mapping.c memory: follow Error API guidelines 2023-10-19 23:13:27 +02:00
cpu-dump.c
cpu-internal.h
cpu-param.h
cpu-qom.h
cpu-sysemu.c target/i386/cpu-sysemu: Inline kvm_apic_in_kernel() 2023-09-07 13:32:37 +02:00
cpu.c target/i386: check CPUID_PAE to determine 36 bit processor address space 2023-10-25 17:35:14 +02:00
cpu.h memory: follow Error API guidelines 2023-10-19 23:13:27 +02:00
gdbstub.c
helper.c target/i386/helper: Restrict KVM declarations to system emulation 2023-09-07 13:32:37 +02:00
helper.h
host-cpu.c
host-cpu.h
Kconfig
machine.c i386: spelling fixes 2023-09-20 07:54:34 +03:00
meson.build meson: Rename target_softmmu_arch -> target_system_arch 2023-10-07 19:03:07 +02:00
monitor.c
ops_sse.h target/i386: implement SHA instructions 2023-10-25 17:35:07 +02:00
sev-sysemu-stub.c
sev.c migration: simplify blockers 2023-10-20 08:51:41 +02:00
sev.h bulk: Do not declare function prototypes using 'extern' keyword 2023-08-31 19:47:43 +02:00
svm.h target/i386: check intercept for XSETBV 2023-10-17 15:20:53 +02:00
trace-events
trace.h
xsave_helper.c