Skip to content

Commit

Permalink
x86/tdx: Rename tdx_parse_tdinfo() to tdx_setup()
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Dave Hansen <[email protected]>
Reviewed-by: Kuppuswamy Sathyanarayanan <[email protected]>
Reviewed-by: Kai Huang <[email protected]>
Link: https://lore.kernel.org/all/20241104103803.195705-3-kirill.shutemov%40linux.intel.com
  • Loading branch information
kiryl authored and hansendc committed Nov 7, 2024
1 parent 5081e8f commit b064043
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions arch/x86/coco/tdx/tdx.c
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ static void __noreturn tdx_panic(const char *msg)
__tdx_hypercall(&args);
}

static void tdx_parse_tdinfo(u64 *cc_mask)
static void tdx_setup(u64 *cc_mask)
{
struct tdx_module_args args = {};
unsigned int gpa_width;
Expand All @@ -219,6 +219,9 @@ static void tdx_parse_tdinfo(u64 *cc_mask)
gpa_width = args.rcx & GENMASK(5, 0);
*cc_mask = BIT_ULL(gpa_width - 1);

/* Kernel does not use NOTIFY_ENABLES and does not need random #VEs */
tdg_vm_wr(TDCS_NOTIFY_ENABLES, 0, -1ULL);

/*
* The kernel can not handle #VE's when accessing normal kernel
* memory. Ensure that no #VE will be delivered for accesses to
Expand Down Expand Up @@ -969,11 +972,11 @@ void __init tdx_early_init(void)
setup_force_cpu_cap(X86_FEATURE_TSC_RELIABLE);

cc_vendor = CC_VENDOR_INTEL;
tdx_parse_tdinfo(&cc_mask);
cc_set_mask(cc_mask);

/* Kernel does not use NOTIFY_ENABLES and does not need random #VEs */
tdg_vm_wr(TDCS_NOTIFY_ENABLES, 0, -1ULL);
/* Configure the TD */
tdx_setup(&cc_mask);

cc_set_mask(cc_mask);

/*
* All bits above GPA width are reserved and kernel treats shared bit
Expand Down

0 comments on commit b064043

Please sign in to comment.