Message ID | 66e6aa1dc1bade544b81120d7976cb0601f0528b.1649219184.git.kai.huang@intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | TDX host kernel support | expand |
On 4/5/22 9:49 PM, Kai Huang wrote: > Do the TDX module global initialization which requires calling > TDH.SYS.INIT once on any logical cpu. IMO, you could add some more background details to this commit log. Like why you are doing it and what it does?. I know that you already explained some background in previous patches. But including brief details here will help to review the commit without checking the previous commits.
On Wed, 2022-04-20 at 15:27 -0700, Sathyanarayanan Kuppuswamy wrote: > > On 4/5/22 9:49 PM, Kai Huang wrote: > > Do the TDX module global initialization which requires calling > > TDH.SYS.INIT once on any logical cpu. > > IMO, you could add some more background details to this commit log. Like > why you are doing it and what it does?. I know that you already > explained some background in previous patches. But including brief > details here will help to review the commit without checking the > previous commits. > OK I guess I can add "the first step is global initialization", etc.
diff --git a/arch/x86/virt/vmx/tdx/tdx.c b/arch/x86/virt/vmx/tdx/tdx.c index faf8355965a5..5c2f3a30be2f 100644 --- a/arch/x86/virt/vmx/tdx/tdx.c +++ b/arch/x86/virt/vmx/tdx/tdx.c @@ -463,11 +463,20 @@ static int __tdx_detect(void) static int init_tdx_module(void) { + int ret; + + /* TDX module global initialization */ + ret = seamcall(TDH_SYS_INIT, 0, 0, 0, 0, NULL, NULL); + if (ret) + goto out; + /* * Return -EFAULT until all steps of TDX module * initialization are done. */ - return -EFAULT; + ret = -EFAULT; +out: + return ret; } static void shutdown_tdx_module(void) diff --git a/arch/x86/virt/vmx/tdx/tdx.h b/arch/x86/virt/vmx/tdx/tdx.h index dcc1f6dfe378..f0983b1936d8 100644 --- a/arch/x86/virt/vmx/tdx/tdx.h +++ b/arch/x86/virt/vmx/tdx/tdx.h @@ -38,6 +38,7 @@ struct p_seamldr_info { /* * TDX module SEAMCALL leaf functions */ +#define TDH_SYS_INIT 33 #define TDH_SYS_LP_SHUTDOWN 44 struct tdx_module_output;
Do the TDX module global initialization which requires calling TDH.SYS.INIT once on any logical cpu. Signed-off-by: Kai Huang <kai.huang@intel.com> --- arch/x86/virt/vmx/tdx/tdx.c | 11 ++++++++++- arch/x86/virt/vmx/tdx/tdx.h | 1 + 2 files changed, 11 insertions(+), 1 deletion(-)