Skip to content

Commit b064043

Browse files
kirylhansendc
authored andcommitted
x86/tdx: Rename tdx_parse_tdinfo() to tdx_setup()
Rename tdx_parse_tdinfo() to tdx_setup() and move setting NOTIFY_ENABLES there. The function will be extended to adjust TD configuration. Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com> Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com> Reviewed-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com> Reviewed-by: Kai Huang <kai.huang@intel.com> Link: https://lore.kernel.org/all/20241104103803.195705-3-kirill.shutemov%40linux.intel.com
1 parent 5081e8f commit b064043

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

arch/x86/coco/tdx/tdx.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ static void __noreturn tdx_panic(const char *msg)
194194
__tdx_hypercall(&args);
195195
}
196196

197-
static void tdx_parse_tdinfo(u64 *cc_mask)
197+
static void tdx_setup(u64 *cc_mask)
198198
{
199199
struct tdx_module_args args = {};
200200
unsigned int gpa_width;
@@ -219,6 +219,9 @@ static void tdx_parse_tdinfo(u64 *cc_mask)
219219
gpa_width = args.rcx & GENMASK(5, 0);
220220
*cc_mask = BIT_ULL(gpa_width - 1);
221221

222+
/* Kernel does not use NOTIFY_ENABLES and does not need random #VEs */
223+
tdg_vm_wr(TDCS_NOTIFY_ENABLES, 0, -1ULL);
224+
222225
/*
223226
* The kernel can not handle #VE's when accessing normal kernel
224227
* memory. Ensure that no #VE will be delivered for accesses to
@@ -969,11 +972,11 @@ void __init tdx_early_init(void)
969972
setup_force_cpu_cap(X86_FEATURE_TSC_RELIABLE);
970973

971974
cc_vendor = CC_VENDOR_INTEL;
972-
tdx_parse_tdinfo(&cc_mask);
973-
cc_set_mask(cc_mask);
974975

975-
/* Kernel does not use NOTIFY_ENABLES and does not need random #VEs */
976-
tdg_vm_wr(TDCS_NOTIFY_ENABLES, 0, -1ULL);
976+
/* Configure the TD */
977+
tdx_setup(&cc_mask);
978+
979+
cc_set_mask(cc_mask);
977980

978981
/*
979982
* All bits above GPA width are reserved and kernel treats shared bit

0 commit comments

Comments
 (0)