qemu-e2k/hw
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
..
9pfs migration: simplify blockers 2023-10-20 08:51:41 +02:00
acpi virtio,pc,pci: features, cleanups 2023-10-23 14:45:29 -07:00
adc
alpha
arm hw/arm: xlnx-versal-virt: Add AMD/Xilinx TRNG device 2023-11-02 14:42:03 +00:00
audio hw/audio/es1370: trace lost interrupts 2023-10-10 12:31:05 +00:00
avr
block virtio-blk: remove batch notification BH 2023-10-31 15:42:17 +01:00
char target-arm queue: 2023-11-03 10:04:12 +08:00
core target-arm queue: 2023-11-03 10:04:12 +08:00
cpu
cris
cxl hw/cxl: Fix local variable shadowing of cap_hdrs 2023-10-06 10:56:54 +02:00
display target-arm queue: 2023-11-03 10:04:12 +08:00
dma hw/dma: Declare link using static DEFINE_PROP_LINK() macro 2023-10-19 23:13:28 +02:00
gpio
hppa hw/hppa: Add new HP C3700 machine 2023-10-20 00:47:38 +02:00
hyperv
i2c target-arm queue: 2023-11-03 10:04:12 +08:00
i386 hw/xen: select kernel mode for per-vCPU event channel upcall vector 2023-11-06 10:03:45 +00:00
ide migration: Use vmstate_register_any() for isa-ide 2023-11-01 16:13:58 +01:00
input target-arm queue: 2023-11-03 10:04:12 +08:00
intc Migration Pull request (20231102) 2023-11-03 09:57:32 +08:00
ipack
ipmi hw/ipmi: Don't call vmstate_register() from instance_init() functions 2023-11-01 16:13:58 +01:00
isa virtio,pc,pci: features, cleanups 2023-10-23 14:45:29 -07:00
loongarch hw/acpi: Realize ACPI_GED sysbus device before accessing it 2023-10-19 23:13:28 +02:00
m68k m68k: Instantiate the ESP SCSI controller for the NeXTcube machine 2023-11-02 07:26:06 +01:00
mem memory-device,vhost: Support automatic decision on the number of memslots 2023-10-12 14:15:22 +02:00
microblaze
mips virtio,pc,pci: features, cleanups 2023-10-23 14:45:29 -07:00
misc hw/misc: Introduce AMD/Xilix Versal TRNG device 2023-11-02 14:42:03 +00:00
net migration: Use vmstate_register_any() 2023-11-01 16:13:58 +01:00
nios2
nubus
nvme
nvram migration: Use vmstate_register_any() for eeprom93xx 2023-11-01 16:13:58 +01:00
openrisc
pci migration: Use vmstate_register_any() 2023-11-01 16:13:58 +01:00
pci-bridge hw/pci-bridge/cxl-upstream: Add serial number extended capability support 2023-10-04 18:15:06 -04:00
pci-host target/hppa: Add emulation of a C3700 HP-PARISC workstation 2023-10-20 06:46:26 -07:00
pcmcia hw/pcmcia/pxa2xx: Inline pxa2xx_pcmcia_init() 2023-10-27 12:48:57 +01:00
ppc migration: Hack to maintain backwards compatibility for ppc 2023-11-01 16:13:58 +01:00
rdma hw/rdma/vmw/pvrdma_cmd: Use correct struct in query_port() 2023-10-21 15:00:22 +03:00
remote migration: simplify blockers 2023-10-20 08:51:41 +02:00
riscv target/riscv: move KVM only files to kvm subdir 2023-10-12 12:20:24 +10:00
rtc
rx
s390x hw/s390x/s390-stattrib: Don't call register_savevm_live() during instance_init() 2023-11-01 16:13:58 +01:00
scsi cpr: relax vhost migration blockers 2023-11-01 16:13:59 +01:00
sd hw/sd/pxa2xx: Do not open-code sysbus_create_simple() 2023-10-27 12:48:57 +01:00
sensor
sh4
smbios
sparc
sparc64 hw/sparc64/ebus: Access memory regions via pci_address_space_io() 2023-10-19 23:13:28 +02:00
ssi
timer migration: Use vmstate_register_any() 2023-11-01 16:13:58 +01:00
tpm
tricore
ufs hw/ufs: Modify lu.c to share codes with SCSI subsystem 2023-10-30 10:28:04 +09:00
usb hw/usb: Silence compiler warnings in USB code when compiling with -Wshadow 2023-10-06 13:27:48 +02:00
vfio migration: simplify notifiers 2023-10-20 08:51:41 +02:00
virtio cpr: relax vhost migration blockers 2023-11-01 16:13:59 +01:00
watchdog hw/watchdog/wdt_imx2: Trace timer activity 2023-11-02 13:36:45 +00:00
xen hw/xen: cleanup sourcesets 2023-10-18 10:01:01 +02:00
xenpv
xtensa
Kconfig
meson.build