Skip to content

Commit a6dd6f3

Browse files
committed
x86/tdx: Prepare for using "INFO" call for a second purpose
The TDG.VP.INFO TDCALL provides the guest with various details about the TDX system that the guest needs to run. Only one field is currently used: 'gpa_width' which tells the guest which PTE bits mark pages shared or private. A second field is now needed: the guest "TD attributes" to tell if virtualization exceptions are configured in a way that can harm the guest. Make the naming and calling convention more generic and discrete from the mask-centric one. Thanks to Sathya for the inspiration here, but there's no code, comments or changelogs left from where he started. Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com> Acked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com> Tested-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com> Cc: stable@vger.kernel.org
1 parent 9440c42 commit a6dd6f3

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

arch/x86/coco/tdx/tdx.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ static inline void tdx_module_call(u64 fn, u64 rcx, u64 rdx, u64 r8, u64 r9,
9898
panic("TDCALL %lld failed (Buggy TDX module!)\n", fn);
9999
}
100100

101-
static u64 get_cc_mask(void)
101+
static void tdx_parse_tdinfo(u64 *cc_mask)
102102
{
103103
struct tdx_module_output out;
104104
unsigned int gpa_width;
@@ -121,7 +121,7 @@ static u64 get_cc_mask(void)
121121
* The highest bit of a guest physical address is the "sharing" bit.
122122
* Set it for shared pages and clear it for private pages.
123123
*/
124-
return BIT_ULL(gpa_width - 1);
124+
*cc_mask = BIT_ULL(gpa_width - 1);
125125
}
126126

127127
/*
@@ -758,7 +758,7 @@ void __init tdx_early_init(void)
758758
setup_force_cpu_cap(X86_FEATURE_TDX_GUEST);
759759

760760
cc_set_vendor(CC_VENDOR_INTEL);
761-
cc_mask = get_cc_mask();
761+
tdx_parse_tdinfo(&cc_mask);
762762
cc_set_mask(cc_mask);
763763

764764
/*

0 commit comments

Comments
 (0)