x86/HVM: allow per-domain usage of hardware virtualized APIC
authorJane Malalane <jane.malalane@citrix.com>
Mon, 11 Jul 2022 10:15:05 +0000 (12:15 +0200)
committerJan Beulich <jbeulich@suse.com>
Mon, 11 Jul 2022 10:15:05 +0000 (12:15 +0200)
commit2ce11ce249a3981bac50914c6a90f681ad7a4222
tree50aa378759a97c8d13db3ec6e231f7d4cffcae2c
parent6b2b9b3405092c3ad38d7342988a584b8efa674c
x86/HVM: allow per-domain usage of hardware virtualized APIC

Introduce a new per-domain creation x86 specific flag to
select whether hardware assisted virtualization should be used for
x{2}APIC.

A per-domain option is added to xl in order to select the usage of
x{2}APIC hardware assisted virtualization, as well as a global
configuration option.

Having all APIC interaction exit to Xen for emulation is slow and can
induce much overhead. Hardware can speed up x{2}APIC by decoding the
APIC access and providing a VM exit with a more specific exit reason
than a regular EPT fault or by altogether avoiding a VM exit.

On the other hand, being able to disable x{2}APIC hardware assisted
virtualization can be useful for testing and debugging purposes.

Note:

- vmx_install_vlapic_mapping doesn't require modifications regardless
of whether the guest has "Virtualize APIC accesses" enabled or not,
i.e., setting the APIC_ACCESS_ADDR VMCS field is fine so long as
virtualize_apic_accesses is supported by the CPU.

- Both per-domain and global assisted_x{2}apic options are not part of
the migration stream, unless explicitly set in the respective
configuration files. Default settings of assisted_x{2}apic done
internally by the toolstack, based on host capabilities at create
time, are not migrated.

Suggested-by: Andrew Cooper <andrew.cooper3@citrix.com>
Signed-off-by: Jane Malalane <jane.malalane@citrix.com>
Acked-by: Christian Lindig <christian.lindig@citrix.com>
Reviewed-by: "Roger Pau Monné" <roger.pau@citrix.com>
Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
Reviewed-by: George Dunlap <george.dunlap@citrix.com>
23 files changed:
docs/man/xl.cfg.5.pod.in
docs/man/xl.conf.5.pod.in
tools/golang/xenlight/helpers.gen.go
tools/golang/xenlight/types.gen.go
tools/include/libxl.h
tools/libs/light/libxl_arch.h
tools/libs/light/libxl_arm.c
tools/libs/light/libxl_create.c
tools/libs/light/libxl_types.idl
tools/libs/light/libxl_x86.c
tools/ocaml/libs/xc/xenctrl.ml
tools/ocaml/libs/xc/xenctrl.mli
tools/ocaml/libs/xc/xenctrl_stubs.c
tools/xl/xl.c
tools/xl/xl.h
tools/xl/xl_parse.c
xen/arch/x86/domain.c
xen/arch/x86/hvm/vmx/vmcs.c
xen/arch/x86/hvm/vmx/vmx.c
xen/arch/x86/include/asm/hvm/domain.h
xen/arch/x86/include/asm/hvm/hvm.h
xen/arch/x86/traps.c
xen/include/public/arch-x86/xen.h