|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [RFC PATCH v2 00/13] hvm: New Xen HVM ABI proposal ("HVMv2", "FastABI")
Hello, This is a long-running proposal of a new hypervisor ABI for HVM guests, aimed at improving on some of the short-commings of the existing one. More precisely, here are some of the issues of the current hypervisor ABI (virtual addresses to C struct) : * With confidential computing (SEV/TDX/...), it is not possible to access guest virtual memory; hence we need to do hypercalls differently. * A lot of complex operations are unconditionally exposed to the guest and can't easily be turned off, that makes mitigating security issues more difficult. * Many features have no reliable enumeration for the guest to use. * Copying from/to guest virtual address is expensive; see numbers below. * It's not always easy to use from other languages than C and is subject to ABI compatibility issues [1]; and ultimately the reason CONFIG_COMPAT exists. It also happens to be a problem for Windows PV Drivers as Windows doesn't use SysV ABI. * OVMF can't implement UEFI time services due to quirks around shared_info page (which contains wallclock) that can be moved by the operating system [2]. (and probably many others) The idea is to rethink the ABI from the ground with some key ideas : * Start with a small core ABI (i.e just what modern guests needs) then expand it appropriately, ideally as optional expansions that can be turned off when not needed. * Try to avoid tricky cases with guest physmap manipulation. If would be better if it can be made optional for the guest. * Design it with HVM with HAP in mind i.e avoid expensive pagewalks. * Eventually at some point, have a way to make specific guest only support this new ABI. Some limitations with current implementation : * Guests needs to be patched, only PVH is considered for now. * A alternative approach needs to be implemented for shared_info/gnttab placement and enumeration (given that physmap manipulation is not longer available). (I have a somewhat experimental proposal by using E820, but I'm open for alternatives) * There is no toolstack/dom0 support in this ABI, to me, it should be considered separately (especially for SecureBoot). * Only long mode is supported (as FastABI uses x86_64-only registers) Open topics : * Should we use another name ? * Hypercalls outside of long mode ? * Proper way of exposing the Xen special pages to the guests ? (or at least, exposing the location) * ARM/RISC-V considerations * Ways to implement other hypercalls (yet another ABI ?) Teddy v1: https://lore.kernel.org/xen-devel/cover.1755785258.git.teddy.astie@xxxxxxxxxx/ [1] https://faultlore.com/blah/c-isnt-a-language/ [2] https://github.com/tianocore/edk2/blob/9ae00fddec5f651f2e93088370356235022366d8/OvmfPkg/Library/XenRealTimeClockLib/XenRealTimeClockLib.c#L97-L101 Cc: Baptiste Le Duc <baptiste.le-duc@xxxxxxxxxx> Cc: Oleksii Kurochko <oleksii.kurochko@xxxxxxxxx> Teddy Astie (13): x86/hvm: Use direct structures instead of guest handles common: Isolate XENVER_get_features into a separate function hvm: Introduce FastABI infrastructure fastabi: Introduce xen_version op fastabi: Introduce sched_op fastabi: Introduce event_channel_op fastabi: Introduce vcpu_op fastabi: Introduce hvm_op wip: fastabi: Introduce memory_op x86/fastabi: Expose to guest by default wip: fastabi: Introduce "strict" mode for FastABI wip: fastabi: Add evtchn_status helpers in struct wip: light: Introduce fixed memory layout .../guest-guide/fastabi/abi/event_channel.yml | 130 +++++++++++ docs/guest-guide/fastabi/abi/hvm.yml | 50 +++++ docs/guest-guide/fastabi/abi/memory.yml | 16 ++ docs/guest-guide/fastabi/abi/sched.yml | 48 +++++ docs/guest-guide/fastabi/abi/vcpu.yml | 139 ++++++++++++ docs/guest-guide/fastabi/abi/version.yml | 15 ++ docs/guest-guide/fastabi/index.rst | 26 +++ docs/guest-guide/x86/fastabi.rst | 58 +++++ docs/guest-guide/x86/index.rst | 1 + tools/include/xen-tools/common-macros.h | 4 + tools/libs/guest/xg_dom_x86.c | 84 ++++++++ tools/libs/light/libxl_create.c | 3 +- tools/libs/light/libxl_types.idl | 1 + tools/libs/light/libxl_x86.c | 75 +++++++ tools/xl/xl_parse.c | 2 + xen/arch/x86/cpuid.c | 3 + xen/arch/x86/domain.c | 67 ++++++ xen/arch/x86/hvm/hvm.c | 202 +++++++++++++----- xen/arch/x86/hvm/hypercall.c | 20 ++ xen/arch/x86/include/asm/fastabi.h | 18 ++ xen/common/Kconfig | 7 + xen/common/Makefile | 1 + xen/common/domain.c | 171 +++++++++++++++ xen/common/event_channel.c | 198 +++++++++++++++++ xen/common/fastabi.c | 42 ++++ xen/common/kernel.c | 118 ++++++---- xen/common/memory.c | 40 ++++ xen/common/sched/core.c | 145 +++++++++++-- xen/include/public/arch-x86/cpuid.h | 8 + xen/include/public/arch-x86/hvm/start_info.h | 9 + xen/include/public/event_channel.h | 5 + xen/include/public/fastabi.h | 11 + xen/include/public/memory.h | 12 ++ xen/include/xen/fastabi.h | 20 ++ 34 files changed, 1633 insertions(+), 116 deletions(-) create mode 100644 docs/guest-guide/fastabi/abi/event_channel.yml create mode 100644 docs/guest-guide/fastabi/abi/hvm.yml create mode 100644 docs/guest-guide/fastabi/abi/memory.yml create mode 100644 docs/guest-guide/fastabi/abi/sched.yml create mode 100644 docs/guest-guide/fastabi/abi/vcpu.yml create mode 100644 docs/guest-guide/fastabi/abi/version.yml create mode 100644 docs/guest-guide/fastabi/index.rst create mode 100644 docs/guest-guide/x86/fastabi.rst create mode 100644 xen/arch/x86/include/asm/fastabi.h create mode 100644 xen/common/fastabi.c create mode 100644 xen/include/public/fastabi.h create mode 100644 xen/include/xen/fastabi.h -- 2.56.1 -- Teddy Astie | Vates XCP-ng Developer XCP-ng & Xen Orchestra - Vates solutions web: https://vates.tech
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |