Skip to content

KVM: x86: SGX vs. XCR0 cleanups

Sean Christopherson kvm lkml 2 versions – Applied

Status from this message: Queued, thanks. But why patch 3? Small functions are nice and remove the need to remember what is in EDX:EAX of CPUID[0xD,0].

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest3 patches 2 repliesApplied
  2. v13 patches 19 repliesSuperseded

Changes in v2 from the cover letter

- Collect reviews/testing. [Kai]
- Require FP+SSE to always be set in XFRM, and exempt them from the XFRM vs. XCR0 check. [Kai]

Patches in v2 Applied

#Subject and filesSizeRepliesApplied
1/3KVM: VMX: Don't rely _only_ on CPUID to enforce XCR0 restrictions for ECREATEarch/x86/kvm/vmx/sgx.c+9 -20 replies
2/3KVM: x86: Don't adjust guest's CPUID.0x12.1 (allowed SGX enclave XFRM)arch/x86/kvm/cpuid.c+0 -160 replies
3/3KVM: x86: Open code supported XCR0 calculation in kvm_vcpu_after_set_cpuid()arch/x86/kvm/cpuid.c+10 -170 replies

Reviews trailers per patch

All 3 patches have a Reviewed-by or Acked-by.

PatchKai Huang
1/3R-b T-b
2/3R-b T-b
3/3R-b T-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [PATCH v2 0/3] KVM: x86: SGX vs. XCR0 cleanups

Stop adjusting the guest's CPUID info for the allowed XFRM (a.k.a. XCR0) for SGX enclaves. Past me didn't understand the roles and responsibilities between userspace and KVM with respect to CPUID leafs, i.e. I thought I was being helpful by having KVM adjust the entries.

This is clearly an ABI change, but QEMU does the right thing and AFAIK no other VMMs support SGX (yet), so I'm hopeful/confident that we can excise the ugly before userspace starts depending on the bad behavior.

v2:
- Collect reviews/testing. [Kai]
- Require FP+SSE to always be set in XFRM, and exempt them from the XFRM vs. XCR0 check. [Kai]

v1: https://lore.kernel.org/all/[email protected]

Sean Christopherson (3):
KVM: VMX: Don't rely _only_ on CPUID to enforce XCR0 restrictions for
ECREATE
KVM: x86: Don't adjust guest's CPUID.0x12.1 (allowed SGX enclave XFRM)
KVM: x86: Open code supported XCR0 calculation in
kvm_vcpu_after_set_cpuid()

 arch/x86/kvm/cpuid.c   | 43 ++++++++++--------------------------------
 arch/x86/kvm/vmx/sgx.c | 11 +++++++++--
 2 files changed, 19 insertions(+), 35 deletions(-)

base-commit: 5c291b93e5d665380dbecc6944973583f9565ee5

Signature · 1 line
2.40.1.495.gc816e09b53d-goog