qemu/target/i386/kvm
Sean Christopherson db88806523 i386: Add get/set/migrate support for SGX_LEPUBKEYHASH MSRs
On real hardware, on systems that supports SGX Launch Control, those
MSRs are initialized to digest of Intel's signing key; on systems that
don't support SGX Launch Control, those MSRs are not available but
hardware always uses digest of Intel's signing key in EINIT.

KVM advertises SGX LC via CPUID if and only if the MSRs are writable.
Unconditionally initialize those MSRs to digest of Intel's signing key
when CPU is realized and reset to reflect the fact. This avoids
potential bug in case kvm_arch_put_registers() is called before
kvm_arch_get_registers() is called, in which case guest's virtual
SGX_LEPUBKEYHASH MSRs will be set to 0, although KVM initializes those
to digest of Intel's signing key by default, since KVM allows those MSRs
to be updated by Qemu to support live migration.

Save/restore the SGX Launch Enclave Public Key Hash MSRs if SGX Launch
Control (LC) is exposed to the guest. Likewise, migrate the MSRs if they
are writable by the guest.

Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
Signed-off-by: Kai Huang <kai.huang@intel.com>
Signed-off-by: Yang Zhong <yang.zhong@intel.com>
Message-Id: <20210719112136.57018-11-yang.zhong@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2021-09-30 14:50:20 +02:00
..
hyperv-proto.h i386: Hyper-V SynIC requires POST_MESSAGES/SIGNAL_EVENTS privileges 2021-07-13 09:13:29 -04:00
hyperv-stub.c i386: move kvm accel files into kvm/ 2020-12-16 14:06:52 -05:00
hyperv.c i386: move kvm accel files into kvm/ 2020-12-16 14:06:52 -05:00
hyperv.h i386: move kvm accel files into kvm/ 2020-12-16 14:06:52 -05:00
kvm_i386.h i386: expand Hyper-V features during CPU feature expansion time 2021-07-13 09:13:29 -04:00
kvm-cpu.c i386: do not call cpudef-only models functions for max, host, base 2021-07-23 15:47:13 +02:00
kvm-cpu.h i386: split cpu accelerators from cpu.c, using AccelCPUClass 2021-05-10 15:41:49 -04:00
kvm-stub.c i386: expand Hyper-V features during CPU feature expansion time 2021-07-13 09:13:29 -04:00
kvm.c i386: Add get/set/migrate support for SGX_LEPUBKEYHASH MSRs 2021-09-30 14:50:20 +02:00
meson.build i386: split cpu accelerators from cpu.c, using AccelCPUClass 2021-05-10 15:41:49 -04:00
trace-events docs: fix references to docs/devel/tracing.rst 2021-06-02 06:51:09 +02:00
trace.h i386: move kvm accel files into kvm/ 2020-12-16 14:06:52 -05:00