All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH 0/2] KVM: x86: Add a new attribute to control dynamic XSTATE components
@ 2022-08-23 23:14 Chang S. Bae
  2022-08-23 23:14 ` [RFC PATCH 1/2] KVM: x86: Add a new system attribute for dynamic XSTATE component Chang S. Bae
  2022-08-23 23:14 ` [RFC PATCH 2/2] selftests: kvm: Use the KVM API to enable dynamic XSTATE features Chang S. Bae
  0 siblings, 2 replies; 8+ messages in thread
From: Chang S. Bae @ 2022-08-23 23:14 UTC (permalink / raw)
  To: kvm, pbonzini; +Cc: linux-kernel, yang.zhong, chang.seok.bae

Hi KVM folks,

While documenting the ARCH_{REQ|GET}_XCOMP_GUEST_PERM options [1], I came
to think of this new attribute as it can provide more consistent way of
enabling dynamic features for QEMU/KVM.

== Background ==

The new x86 arch_prctl() options [2] help to support dynamic AMX state
enabling. As the VCPU permission should be separate, additional options are
added for the userspace VMM like QEMU: ARCH_GET_XCOMP_GUEST_PERM and
ARCH_REQ_XCOMP_GUEST_PERM.

== Problem ==

KVM has already established a set of ioctls to control VM attributes. It
has the attribute to expose the KVM-supported XSTATE components [3].
This interface, however, is not necessarily compatible with those
arch_prctl() options. KVM may choose and expose some of the host-supported
features. Then using the host-provided interface may not comply with this
KVM policy.

== Solution ==

The patchset adds a new attribute to control XSTATE permission:
KVM_X86_XCOMP_GUEST_PERM, and it is available through the
KVM_GET_DEVICE_ATTR/KVM_SET_DEVICE_ATTR APIs. The KVM AMX test is updated
to use this. Then QEMU may switch to keep using the KVM API, which is more
consistent.

[1]: https://lore.kernel.org/lkml/ec95b28f-51a1-a9cf-7d72-a3a865797c7d@intel.com/
[2]: https://docs.kernel.org/x86/xstate.html
[3]: https://gitlab.com/qemu-project/qemu/-/blob/master/linux-headers/asm-x86/kvm.h#L456

Chang S. Bae (2):
  KVM: x86: Add a new system attribute for dynamic XSTATE component
  selftests: kvm: Use the KVM API to enable dynamic XSTATE features

 arch/x86/include/asm/fpu/api.h                |  1 +
 arch/x86/include/uapi/asm/kvm.h               |  1 +
 arch/x86/kernel/fpu/xstate.c                  |  6 ++++
 arch/x86/kvm/x86.c                            | 31 +++++++++++++++++++
 tools/arch/x86/include/uapi/asm/kvm.h         |  1 +
 .../selftests/kvm/lib/x86_64/processor.c      | 22 +++++++++----
 6 files changed, 56 insertions(+), 6 deletions(-)


base-commit: 1c23f9e627a7b412978b4e852793c5e3c3efc555
-- 
2.17.1


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

end of thread, other threads:[~2022-08-25 21:54 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-08-23 23:14 [RFC PATCH 0/2] KVM: x86: Add a new attribute to control dynamic XSTATE components Chang S. Bae
2022-08-23 23:14 ` [RFC PATCH 1/2] KVM: x86: Add a new system attribute for dynamic XSTATE component Chang S. Bae
2022-08-24 21:42   ` Sean Christopherson
2022-08-24 22:49     ` Chang S. Bae
2022-08-25 16:19       ` Sean Christopherson
2022-08-25 20:45         ` Chang S. Bae
2022-08-25 21:54           ` Sean Christopherson
2022-08-23 23:14 ` [RFC PATCH 2/2] selftests: kvm: Use the KVM API to enable dynamic XSTATE features Chang S. Bae

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.