i386: Update SGX CPUID info according to hardware/KVM/user input
commit1dec2e1f19fdb39a0340356ec2d77233837b3d68
authorSean Christopherson <sean.j.christopherson@intel.com>
Mon, 19 Jul 2021 11:21:15 +0000 (19 19:21 +0800)
committerPaolo Bonzini <pbonzini@redhat.com>
Thu, 30 Sep 2021 12:50:20 +0000 (30 14:50 +0200)
treea75b0ad171517dafb49696c7e0f991bd99b032ab
parenta04835414b8d1ba1af980692d5cf20f8fe4156a0
i386: Update SGX CPUID info according to hardware/KVM/user input

Expose SGX to the guest if and only if KVM is enabled and supports
virtualization of SGX.  While the majority of ENCLS can be emulated to
some degree, because SGX uses a hardware-based root of trust, the
attestation aspects of SGX cannot be emulated in software, i.e.
ultimately emulation will fail as software cannot generate a valid
quote/report.  The complexity of partially emulating SGX in Qemu far
outweighs the value added, e.g. an SGX specific simulator for userspace
applications can emulate SGX for development and testing purposes.

Note, access to the PROVISIONKEY is not yet advertised to the guest as
KVM blocks access to the PROVISIONKEY by default and requires userspace
to provide additional credentials (via ioctl()) to expose PROVISIONKEY.

Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
Signed-off-by: Yang Zhong <yang.zhong@intel.com>
Message-Id: <20210719112136.57018-13-yang.zhong@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
hw/i386/meson.build
hw/i386/sgx-stub.c [new file with mode: 0644]
hw/i386/sgx.c [new file with mode: 0644]
include/hw/i386/pc.h
include/hw/i386/sgx-epc.h
target/i386/cpu.c