summaryrefslogtreecommitdiffstats
path: root/arch/x86/include/asm
diff options
context:
space:
mode:
authorKai Huang <kai.huang@intel.com>2023-12-08 09:07:25 -0800
committerDave Hansen <dave.hansen@linux.intel.com>2023-12-08 09:12:08 -0800
commitdf01f5ae07dd9ca0c755943a5cfcc4e78e480f99 (patch)
tree193371fe8009e8231a781cfcbd42901500c0ad1c /arch/x86/include/asm
parent1e66a7e275393055d98d2306771fe1feadeb1cd6 (diff)
downloadlinux-stable-df01f5ae07dd9ca0c755943a5cfcc4e78e480f99.tar.gz
linux-stable-df01f5ae07dd9ca0c755943a5cfcc4e78e480f99.tar.bz2
linux-stable-df01f5ae07dd9ca0c755943a5cfcc4e78e480f99.zip
x86/virt/tdx: Add SEAMCALL error printing for module initialization
The SEAMCALLs involved during the TDX module initialization are not expected to fail. In fact, they are not expected to return any non-zero code (except the "running out of entropy error", which can be handled internally already). Add yet another set of SEAMCALL wrappers, which treats all non-zero return code as error, to support printing SEAMCALL error upon failure for module initialization. Note the TDX module initialization doesn't use the _saved_ret() variant thus no wrapper is added for it. SEAMCALL assembly can also return kernel-defined error codes for three special cases: 1) TDX isn't enabled by the BIOS; 2) TDX module isn't loaded; 3) CPU isn't in VMX operation. Whether they can legally happen depends on the caller, so leave to the caller to print error message when desired. Also convert the SEAMCALL error codes to the kernel error codes in the new wrappers so that each SEAMCALL caller doesn't have to repeat the conversion. [ dhansen: Align the register dump with show_regs(). Zero-pad the contents, split on two lines and use consistent spacing. ] Signed-off-by: Kai Huang <kai.huang@intel.com> Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com> Reviewed-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com> Reviewed-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com> Reviewed-by: Dave Hansen <dave.hansen@linux.intel.com> Link: https://lore.kernel.org/all/20231208170740.53979-5-dave.hansen%40intel.com
Diffstat (limited to 'arch/x86/include/asm')
-rw-r--r--arch/x86/include/asm/tdx.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/arch/x86/include/asm/tdx.h b/arch/x86/include/asm/tdx.h
index 24c0357081bd..2c0f4162fe99 100644
--- a/arch/x86/include/asm/tdx.h
+++ b/arch/x86/include/asm/tdx.h
@@ -27,6 +27,7 @@
/*
* TDX module SEAMCALL leaf function error codes
*/
+#define TDX_SUCCESS 0ULL
#define TDX_RND_NO_ENTROPY 0x8000020300000000ULL
#ifndef __ASSEMBLY__