qemu-e2k/include
David Woodhouse ddf0fd9ae1 hw/xen: Support HVM_PARAM_CALLBACK_TYPE_GSI callback
The GSI callback (and later PCI_INTX) is a level triggered interrupt. It
is asserted when an event channel is delivered to vCPU0, and is supposed
to be cleared when the vcpu_info->evtchn_upcall_pending field for vCPU0
is cleared again.

Thankfully, Xen does *not* assert the GSI if the guest sets its own
evtchn_upcall_pending field; we only need to assert the GSI when we
have delivered an event for ourselves. So that's the easy part, kind of.

There's a slight complexity in that we need to hold the BQL before we
can call qemu_set_irq(), and we definitely can't do that while holding
our own port_lock (because we'll need to take that from the qemu-side
functions that the PV backend drivers will call). So if we end up
wanting to set the IRQ in a context where we *don't* already hold the
BQL, defer to a BH.

However, we *do* need to poll for the evtchn_upcall_pending flag being
cleared. In an ideal world we would poll that when the EOI happens on
the PIC/IOAPIC. That's how it works in the kernel with the VFIO eventfd
pairs — one is used to trigger the interrupt, and the other works in the
other direction to 'resample' on EOI, and trigger the first eventfd
again if the line is still active.

However, QEMU doesn't seem to do that. Even VFIO level interrupts seem
to be supported by temporarily unmapping the device's BARs from the
guest when an interrupt happens, then trapping *all* MMIO to the device
and sending the 'resample' event on *every* MMIO access until the IRQ
is cleared! Maybe in future we'll plumb the 'resample' concept through
QEMU's irq framework but for now we'll do what Xen itself does: just
check the flag on every vmexit if the upcall GSI is known to be
asserted.

Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
Reviewed-by: Paul Durrant <paul@xen.org>
2023-03-01 09:06:44 +00:00
..
authz
block block: Mark bdrv_co_refresh_total_sectors() and callers GRAPH_RDLOCK 2023-02-23 19:49:33 +01:00
chardev chardev: src buffer const for write functions 2022-09-29 14:38:05 +04:00
crypto crypto: TLS: introduce `check_pending` 2023-02-15 11:01:03 -05:00
disas remove unnecessary extern "C" blocks 2023-02-10 14:12:06 +01:00
exec replay: Extract core API to 'exec/replay-core.h' 2023-02-27 22:29:01 +01:00
fpu fpu: Add rebias bool, value and operation 2022-08-31 14:08:05 -03:00
hw i386/xen: add pc_machine_kvm_type to initialize XEN_EMULATE mode 2023-03-01 08:22:49 +00:00
io io: Add support for MSG_PEEK for socket channel 2023-02-06 19:22:56 +01:00
libdecnumber Replace config-time define HOST_WORDS_BIGENDIAN 2022-04-06 10:50:37 +02:00
migration migration: Rename res_{postcopy,precopy}_only 2023-02-15 20:04:30 +01:00
monitor i386/xen: add monitor commands to test event injection 2023-03-01 08:22:50 +00:00
net net: Move the code to collect available NIC models to a separate function 2023-02-17 13:31:33 +08:00
qapi rocker: Tweak stubbed out monitor commands' error messages 2023-02-23 14:10:17 +01:00
qemu qemu/typedefs: Sort in case-insensitive alphabetical order (again) 2023-02-27 22:29:01 +01:00
qom qom/object: Remove circular include dependency 2022-06-28 10:53:32 +02:00
scsi coroutine: Clean up superfluous inclusion of qemu/coroutine.h 2023-01-19 10:18:28 +01:00
semihosting semihosting: Allow optional use of semihosting from userspace 2022-09-13 17:18:21 +01:00
standard-headers linux-headers: Update to v6.2-rc8 2023-02-16 12:13:46 -07:00
sysemu hw/xen: Support HVM_PARAM_CALLBACK_TYPE_GSI callback 2023-03-01 09:06:44 +00:00
tcg tcg: Split out tcg_gen_nonatomic_cmpxchg_i{32,64} 2023-02-04 06:19:42 -10:00
ui Do not include "qemu/error-report.h" in headers that do not need it 2023-02-14 09:11:27 +01:00
user include: Include headers where needed 2023-01-08 01:54:22 -05:00
elf.h include/elf.h: add s390x note types 2022-10-26 12:54:59 +04:00
glib-compat.h compiler.h: replace QEMU_NORETURN with G_NORETURN 2022-04-21 17:03:51 +04:00
qemu-io.h
qemu-main.h ui/cocoa: Run qemu_init in the main thread 2022-09-23 14:36:33 +02:00