提交 90ec4287 编写于 作者: K Kai Huang 提交者: Zhiquan Li

x86/sgx: Initialize virtual EPC driver even when SGX driver is disabled

mainline inclusion
from mainline-5.13
commit faa7d3e6
category: feature
bugzilla: https://gitee.com/openeuler/intel-kernel/issues/I5EZEK
CVE: NA

Intel-SIG: commit faa7d3e6 x86/sgx: Initialize virtual EPC driver
even when SGX driver is disabled.
Backport for SGX virtualization support

--------------------------------

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: NKai Huang <kai.huang@intel.com>
Signed-off-by: NBorislav Petkov <bp@suse.de>
Reviewed-by: NSean Christopherson <seanjc@google.com>
Acked-by: NJarkko Sakkinen <jarkko@kernel.org>
Acked-by: NDave Hansen <dave.hansen@intel.com>
Link: https://lkml.kernel.org/r/d35d17a02bbf8feef83a536cec8b43746d4ea557.1616136308.git.kai.huang@intel.comSigned-off-by: NFan Du <fan.du@intel.com>
Signed-off-by: NZhiquan Li <zhiquan1.li@intel.com>
上级 ecdadaa2
...@@ -743,8 +743,17 @@ static int __init sgx_init(void) ...@@ -743,8 +743,17 @@ static int __init sgx_init(void)
goto err_page_cache; 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(); ret = sgx_drv_init();
if (ret)
if (sgx_vepc_init() && ret)
goto err_kthread; goto err_kthread;
return 0; return 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册