diff options
author | Kai Huang <kai.huang@intel.com> | 2021-03-19 20:23:02 +1300 |
---|---|---|
committer | Borislav Petkov <bp@suse.de> | 2021-04-06 09:43:41 +0200 |
commit | faa7d3e6f3b983a28bf0f88f82dcb1c162e61105 (patch) | |
tree | 807ce54240c2d5124ab7c71406ea2d12df679897 /arch/x86/kernel/cpu | |
parent | 332bfc7becf479de8a55864cc5ed0024baea28aa (diff) | |
download | linux-stable-faa7d3e6f3b983a28bf0f88f82dcb1c162e61105.tar.gz linux-stable-faa7d3e6f3b983a28bf0f88f82dcb1c162e61105.tar.bz2 linux-stable-faa7d3e6f3b983a28bf0f88f82dcb1c162e61105.zip |
x86/sgx: Initialize virtual EPC driver even when SGX driver is disabled
Modify sgx_init() to always try to initialize the virtual EPC driver,
even if the SGX driver is disabled. The SGX driver might be disabled
if SGX Launch Control is in locked mode, or not supported in the
hardware at all. This allows (non-Linux) guests that support non-LC
configurations to use SGX.
[ bp: De-silli-fy the test. ]
Signed-off-by: Kai Huang <kai.huang@intel.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Reviewed-by: Sean Christopherson <seanjc@google.com>
Acked-by: Jarkko Sakkinen <jarkko@kernel.org>
Acked-by: Dave Hansen <dave.hansen@intel.com>
Link: https://lkml.kernel.org/r/d35d17a02bbf8feef83a536cec8b43746d4ea557.1616136308.git.kai.huang@intel.com
Diffstat (limited to 'arch/x86/kernel/cpu')
-rw-r--r-- | arch/x86/kernel/cpu/sgx/main.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/arch/x86/kernel/cpu/sgx/main.c b/arch/x86/kernel/cpu/sgx/main.c index b227629b1e9c..1c8a228b0104 100644 --- a/arch/x86/kernel/cpu/sgx/main.c +++ b/arch/x86/kernel/cpu/sgx/main.c @@ -743,8 +743,17 @@ static int __init sgx_init(void) goto err_page_cache; } + /* + * Always try to initialize the native *and* KVM drivers. + * The KVM driver is less picky than the native one and + * can function if the native one is not supported on the + * current system or fails to initialize. + * + * Error out only if both fail to initialize. + */ ret = sgx_drv_init(); - if (ret) + + if (sgx_vepc_init() && ret) goto err_kthread; return 0; |