]> rtime.felk.cvut.cz Git - jailhouse.git/commit
x86: Emulate interrupt remapping support to enable x2APIC usage
authorJan Kiszka <jan.kiszka@siemens.com>
Tue, 19 Aug 2014 13:47:47 +0000 (15:47 +0200)
committerJan Kiszka <jan.kiszka@siemens.com>
Thu, 28 Aug 2014 06:36:10 +0000 (08:36 +0200)
commit20b09b8625d5f9c5334a55f667822251e271dd5f
tree331383cc3119b05ac9bb98517e9a4a67c9a096f2
parente2c14a262c62cd6cbe23facbec08a96696e52209
x86: Emulate interrupt remapping support to enable x2APIC usage

If we want to use x2APIC on real hardware (virtual machines do not have
this limitation), interrupt remapping has to be enabled. As we take over
hardware control from Linux, we either have to switch the APIC modes on
handover (tricky specifically for x2APIC->xAPIC) or let Linux boot with
interrupt remapping already enable. We choose the latter way as the
cleaner one that also allow us to run Linux without xAPIC emulation
(non-root cells are expected to use the x2APIC unconditionally).

IR emulation requires both the interpretation of the interrupt remapping
table that Linux uses (vtd_get_remapped_root_int) as well as basic
queued invalidation emulation (vtd_emulate_qi_request). We also need to
handle FSTS register reads, but we simply return 0 here and let
Jailhouse report all faults.

Physical address provided by Linux via registers and data structures are
mapped on demand into the hypervisor. This avoids that we create a
static mapping that depends on Linux-controlled parameters (would be bad
for check-summing). We also make sure this way that the addressed memory
still belongs to Linux.

Returning IR and QI to Linux is more complex than stealing it because we
not only have to load overwritten registers with their original values:
the Invalidation Queue Head cannot be set by software. Instead, we need
to inject dummy invalidation wait requests until the hardware reaches
the value Linux expects.

Note that this IR emulation feature is solely designed to be used by the
root cell. Non-root cells have to continue to program the virtualized
interrupt registers of assigned devices.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
README
hypervisor/arch/x86/include/asm/apic.h
hypervisor/arch/x86/include/asm/cell.h
hypervisor/arch/x86/include/asm/vtd.h
hypervisor/arch/x86/ioapic.c
hypervisor/arch/x86/pci.c
hypervisor/arch/x86/vmx.c
hypervisor/arch/x86/vtd.c