From: David Woodhouse <[email protected]> The VSM work¹ drives planes from userspace, which takes a little more API than the planes series² itself provides: an explicit userspace opt-in (enabling KVM_CAP_PLANES with the plane count, before any vCPU is created), KVM_GET/SET_PLANE_RUN_STATE vCPU ioctls, and the mechanics to go with them — per-plane requests fanned out to the twin vCPUs, XCR0 shared across twins (with every twin's fpstate sized for the dynamic xfeatures that allows), and APICv inhibited while planes are enabled (for now). With selftests, including Paolo's plane infrastructure tests from the original planes RFC³, ported forward.
Posted separately from the VSM RFC v2 (to follow) so this part can be reviewed — or folded — with the rest of the planes series. Based on that series² with my fixes⁴ applied (including two follow-up patches on that thread); the whole stack is at ⁵. ¹ https://lore.kernel.org/kvm/[email protected]/ ² https://lore.kernel.org/kvm/[email protected]/ ³ https://lore.kernel.org/all/[email protected]/ ⁴ https://lore.kernel.org/kvm/[email protected]/ ⁵ https://git.infradead.org/?p=users/dwmw2/linux.git;a=shortlog;h=refs/heads/vsm2/planes-uapi David Woodhouse (12): KVM: x86: Let userspace opt in to multiple planes with KVM_CAP_PLANES KVM: selftests: Add x86 planes lifecycle test KVM: Add KVM_GET/SET_PLANE_RUN_STATE vCPU ioctls KVM: selftests: Cover plane run-state ioctls in planes_test KVM: planes: Fan out per-plane requests to twin vCPUs KVM: x86: Inhibit APICv when VM planes are enabled KVM: planes: Enlarge every twin's fpstate for dynamic xfeatures KVM: x86: Let userspace choose state for plane twins to share KVM: planes: Let plane twins share XCR0 KVM: planes: Let plane twins share DR6 KVM: selftests: Check CPUID handling of plane twins KVM: selftests: Cover plane state sharing Paolo Bonzini (1): KVM: selftests: Add VM plane infrastructure and tests Documentation/virt/kvm/api.rst | 129 +++- arch/powerpc/kvm/trace.h | 3 +- arch/x86/include/asm/kvm_host.h | 8 +- arch/x86/include/uapi/asm/kvm.h | 4 + arch/x86/kvm/cpuid.c | 25 +- arch/x86/kvm/mmu/mmu.c | 13 +- arch/x86/kvm/regs.c | 1 + arch/x86/kvm/svm/svm.h | 3 +- arch/x86/kvm/trace.h | 3 +- arch/x86/kvm/vmx/main.c | 3 +- arch/x86/kvm/x86.c | 221 ++++++- arch/x86/kvm/x86.h | 21 + include/linux/kvm_host.h | 36 +- include/uapi/linux/kvm.h | 7 + tools/testing/selftests/kvm/Makefile.kvm | 3 + .../testing/selftests/kvm/include/kvm_util.h | 73 +++ .../selftests/kvm/include/x86/processor.h | 14 + tools/testing/selftests/kvm/lib/kvm_util.c | 74 ++- .../testing/selftests/kvm/lib/x86/processor.c | 47 +- tools/testing/selftests/kvm/plane_test.c | 137 ++++ .../selftests/kvm/x86/plane_x86_test.c | 331 ++++++++++ tools/testing/selftests/kvm/x86/planes_test.c | 605 ++++++++++++++++++ virt/kvm/kvm_main.c | 138 +++- 23 files changed, 1852 insertions(+), 47 deletions(-) create mode 100644 tools/testing/selftests/kvm/plane_test.c create mode 100644 tools/testing/selftests/kvm/x86/plane_x86_test.c create mode 100644 tools/testing/selftests/kvm/x86/planes_test.c -- 2.50.1
