x86/cpu/intel: Allow SGX virtualization without Launch Control support
authorSean Christopherson <sean.j.christopherson@intel.com>
Fri, 19 Mar 2021 07:22:58 +0000 (20:22 +1300)
committerBorislav Petkov <bp@suse.de>
Tue, 6 Apr 2021 07:43:41 +0000 (09:43 +0200)
commit332bfc7becf479de8a55864cc5ed0024baea28aa
tree5cae589db8171a7f4a408c37b7f38695631a6147
parent540745ddbc70eabdc7dbd3fcc00fe4fb17cd59ba
x86/cpu/intel: Allow SGX virtualization without Launch Control support

The kernel will currently disable all SGX support if the hardware does
not support launch control.  Make it more permissive to allow SGX
virtualization on systems without Launch Control support.  This will
allow KVM to expose SGX to guests that have less-strict requirements on
the availability of flexible launch control.

Improve error message to distinguish between three cases.  There are two
cases where SGX support is completely disabled:
1) SGX has been disabled completely by the BIOS
2) SGX LC is locked by the BIOS.  Bare-metal support is disabled because
   of LC unavailability.  SGX virtualization is unavailable (because of
   Kconfig).
One where it is partially available:
3) SGX LC is locked by the BIOS.  Bare-metal support is disabled because
   of LC unavailability.  SGX virtualization is supported.

Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
Co-developed-by: Kai Huang <kai.huang@intel.com>
Signed-off-by: Kai Huang <kai.huang@intel.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Acked-by: Jarkko Sakkinen <jarkko@kernel.org>
Acked-by: Dave Hansen <dave.hansen@intel.com>
Link: https://lkml.kernel.org/r/b3329777076509b3b601550da288c8f3c406a865.1616136308.git.kai.huang@intel.com
arch/x86/kernel/cpu/feat_ctl.c