[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <2fd6826f9df6793f030d949af8a71dc77f946817.1646007267.git.kai.huang@intel.com>
Date: Mon, 28 Feb 2022 15:12:55 +1300
From: Kai Huang <kai.huang@...el.com>
To: x86@...nel.org
Cc: tglx@...utronix.de, mingo@...hat.com, bp@...en8.de,
dave.hansen@...el.com, luto@...nel.org, kvm@...r.kernel.org,
pbonzini@...hat.com, seanjc@...gle.com, hpa@...or.com,
peterz@...radead.org, kirill.shutemov@...ux.intel.com,
sathyanarayanan.kuppuswamy@...ux.intel.com, tony.luck@...el.com,
ak@...ux.intel.com, dan.j.williams@...el.com,
chang.seok.bae@...el.com, keescook@...omium.org,
hengqi.arch@...edance.com, laijs@...ux.alibaba.com,
metze@...ba.org, linux-kernel@...r.kernel.org, kai.huang@...el.com
Subject: [RFC PATCH 07/21] x86/virt/tdx: Do TDX module global initialization
Do the TDX module global initialization which requires calling
TDH.SYS.INIT once on any logical cpu.
Signed-off-by: Kai Huang <kai.huang@...el.com>
---
arch/x86/virt/vmx/tdx.c | 11 ++++++++++-
arch/x86/virt/vmx/tdx.h | 1 +
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/arch/x86/virt/vmx/tdx.c b/arch/x86/virt/vmx/tdx.c
index 17f16ec6cb28..197c721d5388 100644
--- a/arch/x86/virt/vmx/tdx.c
+++ b/arch/x86/virt/vmx/tdx.c
@@ -464,11 +464,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.h b/arch/x86/virt/vmx/tdx.h
index dcc1f6dfe378..f0983b1936d8 100644
--- a/arch/x86/virt/vmx/tdx.h
+++ b/arch/x86/virt/vmx/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;
--
2.33.1
Powered by blists - more mailing lists