@@ -172,10 +172,19 @@ static int __always_unused seamcall(u64 fn, u64 rcx, u64 rdx, u64 r8, u64 r9,
static int init_tdx_module(void)
{
+ int ret;
+
+ /*
+ * TDX module global initialization. All '0's are just
+ * unused parameters.
+ */
+ ret = seamcall(TDH_SYS_INIT, 0, 0, 0, 0, NULL, NULL);
+ if (ret)
+ return ret;
+
/*
* TODO:
*
- * - TDX module global initialization.
* - TDX module per-cpu initialization.
* - Get TDX module information and TDX-capable memory regions.
* - Build the list of TDX-usable memory regions.
@@ -4,6 +4,18 @@
#include <linux/types.h>
+/*
+ * This file contains both macros and data structures defined by the TDX
+ * architecture and Linux defined software data structures and functions.
+ * The two should not be mixed together for better readability. The
+ * architectural definitions come first.
+ */
+
+ /*
+ * TDX module SEAMCALL leaf functions
+ */
+#define TDH_SYS_INIT 33
+
/* Kernel defined TDX module status during module initialization. */
enum tdx_module_status_t {
TDX_MODULE_UNKNOWN,