linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] KVM: x86: export supported_xcr0 via UAPI
@ 2022-01-26 15:22 Paolo Bonzini
  2022-01-26 15:22 ` [PATCH 1/3] selftests: kvm: move vm_xsave_req_perm call to amx_test Paolo Bonzini
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Paolo Bonzini @ 2022-01-26 15:22 UTC (permalink / raw)
  To: linux-kernel, kvm; +Cc: yang.zhong, seanjc

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


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2022-01-28 12:34 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-01-26 15:22 [PATCH 0/3] KVM: x86: export supported_xcr0 via UAPI Paolo Bonzini
2022-01-26 15:22 ` [PATCH 1/3] selftests: kvm: move vm_xsave_req_perm call to amx_test Paolo Bonzini
2022-01-26 15:22 ` [PATCH 2/3] KVM: x86: add system attribute to retrieve full set of supported xsave states Paolo Bonzini
2022-01-27 15:35   ` Sean Christopherson
2022-01-28  2:41     ` Yang Zhong
2022-01-28  6:07     ` Yang Zhong
2022-01-28 12:33     ` Paolo Bonzini
2022-01-26 15:22 ` [PATCH 3/3] selftests: kvm: check dynamic bits against KVM_X86_XCOMP_GUEST_SUPP Paolo Bonzini
2022-01-27  5:39 ` [PATCH 0/3] KVM: x86: export supported_xcr0 via UAPI Yang Zhong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).