x86: report Interrupt Controller Virtualization capabilities
authorJane Malalane <jane.malalane@citrix.com>
Mon, 11 Jul 2022 10:13:59 +0000 (12:13 +0200)
committerJan Beulich <jbeulich@suse.com>
Mon, 11 Jul 2022 10:13:59 +0000 (12:13 +0200)
commit6b2b9b3405092c3ad38d7342988a584b8efa674c
tree8a8ecbb34cb70172a520cee4f7e2d408797f318f
parenta58fca51abd46a88d87390fce333c90376e68367
x86: report Interrupt Controller Virtualization capabilities

Add XEN_SYSCTL_PHYSCAP_X86_ASSISTED_XAPIC and
XEN_SYSCTL_PHYSCAP_X86_ASSISTED_X2APIC to report accelerated xAPIC and
x2APIC, on x86 hardware. This is so that xAPIC and x2APIC virtualization
can subsequently be enabled on a per-domain basis.
No such features are currently implemented on AMD hardware.

HW assisted xAPIC virtualization will be reported if HW, at the
minimum, supports virtualize_apic_accesses as this feature alone means
that an access to the APIC page will cause an APIC-access VM exit. An
APIC-access VM exit provides a VMM with information about the access
causing the VM exit, unlike a regular EPT fault, thus simplifying some
internal handling.

HW assisted x2APIC virtualization will be reported if HW supports
virtualize_x2apic_mode and, at least, either apic_reg_virt or
virtual_intr_delivery. This also means that
sysctl follows the conditionals in vmx_vlapic_msr_changed().

For that purpose, also add an arch-specific "capabilities" parameter
to struct xen_sysctl_physinfo.

Note that this interface is intended to be compatible with AMD so that
AVIC support can be introduced in a future patch. Unlike Intel that
has multiple controls for APIC Virtualization, AMD has one global
'AVIC Enable' control bit, so fine-graining of APIC virtualization
control cannot be done on a common interface.

Suggested-by: Andrew Cooper <andrew.cooper3@citrix.com>
Signed-off-by: Jane Malalane <jane.malalane@citrix.com>
Reviewed-by: "Roger Pau Monné" <roger.pau@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.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>
Acked-by: Christian Lindig <christian.lindig@citrix.com>
17 files changed:
tools/golang/xenlight/helpers.gen.go
tools/golang/xenlight/types.gen.go
tools/include/libxl.h
tools/libs/light/libxl.c
tools/libs/light/libxl_arch.h
tools/libs/light/libxl_arm.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_info.c
xen/arch/x86/hvm/hvm.c
xen/arch/x86/hvm/vmx/vmcs.c
xen/arch/x86/include/asm/hvm/hvm.h
xen/arch/x86/sysctl.c
xen/include/public/sysctl.h