[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220126152210.3044876-1-pbonzini@redhat.com>
Date: Wed, 26 Jan 2022 10:22:07 -0500
From: Paolo Bonzini <pbonzini@...hat.com>
To: linux-kernel@...r.kernel.org, kvm@...r.kernel.org
Cc: yang.zhong@...el.com, seanjc@...gle.com
Subject: [PATCH 0/3] KVM: x86: export supported_xcr0 via UAPI
While working on the QEMU support for AMX, I noticed that there is no
equivalent of ARCH_GET_XCOMP_SUPP in the KVM API. This is important
because KVM_GET_SUPPORTED_CPUID is meant to be passed (by simple-minded
VMMs) to KVM_SET_CPUID2, and therefore it cannot include any dynamic
xsave states that have not been enabled. Probing the availability of
dynamic xsave states therefore, requires a new ioctl or arch_prctl.
In order to avoid moving supported_xcr0 to the kernel from the KVM
module just for this use, and to ensure that the value can only be
probed if/after the KVM module has been loaded, this series goes
for the former option.
KVM_CHECK_EXTENSION cannot be used because it only has 32 bits of
output; in order to limit the growth of capabilities and ioctls, the
series adds a /dev/kvm variant of KVM_{GET,HAS}_DEVICE_ATTR that
can be used in the future and by other architectures. It then
implements it in x86 with just one group (0) and attribute
(KVM_X86_XCOMP_GUEST_SUPP).
The corresponding changes to the tests, in patches 1 and 3, are
designed so that the code will be covered (to the possible extent)
even when running the tests on systems that do not support AMX.
However, the patches have not been tested with AMX.
Thanks,
Paolo
Paolo Bonzini (3):
selftests: kvm: move vm_xsave_req_perm call to amx_test
KVM: x86: add system attribute to retrieve full set of supported xsave
states
selftests: kvm: check dynamic bits against KVM_X86_XCOMP_GUEST_SUPP
Documentation/virt/kvm/api.rst | 4 +-
arch/x86/include/uapi/asm/kvm.h | 3 ++
arch/x86/kvm/x86.c | 45 +++++++++++++++++++
include/uapi/linux/kvm.h | 1 +
tools/arch/x86/include/uapi/asm/kvm.h | 3 ++
tools/include/uapi/linux/kvm.h | 1 +
.../selftests/kvm/include/kvm_util_base.h | 1 -
.../selftests/kvm/include/x86_64/processor.h | 1 +
tools/testing/selftests/kvm/lib/kvm_util.c | 7 ---
.../selftests/kvm/lib/x86_64/processor.c | 27 ++++++++---
tools/testing/selftests/kvm/x86_64/amx_test.c | 2 +
11 files changed, 80 insertions(+), 15 deletions(-)
--
2.31.1
Powered by blists - more mailing lists