Skip to content

Commit f0024db

Browse files
kaihuanghansendc
authored andcommitted
x86/tdx: Make macros of TDCALLs consistent with the spec
The TDX spec names all TDCALLs with prefix "TDG". Currently, the kernel doesn't follow such convention for the macros of those TDCALLs but uses prefix "TDX_" for all of them. Although it's arguable whether the TDX spec names those TDCALLs properly, it's better for the kernel to follow the spec when naming those macros. Change all macros of TDCALLs to make them consistent with the spec. As a bonus, they get distinguished easily from the host-side SEAMCALLs, which all have prefix "TDH". No functional change intended. 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> Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org> Link: https://lore.kernel.org/all/516dccd0bd8fb9a0b6af30d25bb2d971aa03d598.1692096753.git.kai.huang%40intel.com
1 parent 03a423d commit f0024db

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

arch/x86/coco/tdx/tdx-shared.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ static unsigned long try_accept_one(phys_addr_t start, unsigned long len,
3535
}
3636

3737
tdcall_rcx = start | page_size;
38-
if (__tdx_module_call(TDX_ACCEPT_PAGE, tdcall_rcx, 0, 0, 0, NULL))
38+
if (__tdx_module_call(TDG_MEM_PAGE_ACCEPT, tdcall_rcx, 0, 0, 0, NULL))
3939
return 0;
4040

4141
return accept_size;
@@ -45,7 +45,7 @@ bool tdx_accept_memory(phys_addr_t start, phys_addr_t end)
4545
{
4646
/*
4747
* For shared->private conversion, accept the page using
48-
* TDX_ACCEPT_PAGE TDX module call.
48+
* TDG_MEM_PAGE_ACCEPT TDX module call.
4949
*/
5050
while (start < end) {
5151
unsigned long len = end - start;

arch/x86/coco/tdx/tdx.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ int tdx_mcall_get_report0(u8 *reportdata, u8 *tdreport)
9191
{
9292
u64 ret;
9393

94-
ret = __tdx_module_call(TDX_GET_REPORT, virt_to_phys(tdreport),
94+
ret = __tdx_module_call(TDG_MR_REPORT, virt_to_phys(tdreport),
9595
virt_to_phys(reportdata), TDREPORT_SUBTYPE_0,
9696
0, NULL);
9797
if (ret) {
@@ -152,7 +152,7 @@ static void tdx_parse_tdinfo(u64 *cc_mask)
152152
* Guest-Host-Communication Interface (GHCI), section 2.4.2 TDCALL
153153
* [TDG.VP.INFO].
154154
*/
155-
tdx_module_call(TDX_GET_INFO, 0, 0, 0, 0, &out);
155+
tdx_module_call(TDG_VP_INFO, 0, 0, 0, 0, &out);
156156

157157
/*
158158
* The highest bit of a guest physical address is the "sharing" bit.
@@ -594,7 +594,7 @@ void tdx_get_ve_info(struct ve_info *ve)
594594
* Note, the TDX module treats virtual NMIs as inhibited if the #VE
595595
* valid flag is set. It means that NMI=>#VE will not result in a #DF.
596596
*/
597-
tdx_module_call(TDX_GET_VEINFO, 0, 0, 0, 0, &out);
597+
tdx_module_call(TDG_VP_VEINFO_GET, 0, 0, 0, 0, &out);
598598

599599
/* Transfer the output parameters */
600600
ve->exit_reason = out.rcx;
@@ -814,7 +814,7 @@ void __init tdx_early_init(void)
814814
cc_set_mask(cc_mask);
815815

816816
/* Kernel does not use NOTIFY_ENABLES and does not need random #VEs */
817-
tdx_module_call(TDX_WR, 0, TDCS_NOTIFY_ENABLES, 0, -1ULL, NULL);
817+
tdx_module_call(TDG_VM_WR, 0, TDCS_NOTIFY_ENABLES, 0, -1ULL, NULL);
818818

819819
/*
820820
* All bits above GPA width are reserved and kernel treats shared bit

arch/x86/include/asm/shared/tdx.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@
1111
#define TDX_IDENT "IntelTDX "
1212

1313
/* TDX module Call Leaf IDs */
14-
#define TDX_GET_INFO 1
15-
#define TDX_GET_VEINFO 3
16-
#define TDX_GET_REPORT 4
17-
#define TDX_ACCEPT_PAGE 6
18-
#define TDX_WR 8
14+
#define TDG_VP_INFO 1
15+
#define TDG_VP_VEINFO_GET 3
16+
#define TDG_MR_REPORT 4
17+
#define TDG_MEM_PAGE_ACCEPT 6
18+
#define TDG_VM_WR 8
1919

2020
/* TDCS fields. To be used by TDG.VM.WR and TDG.VM.RD module calls */
2121
#define TDCS_NOTIFY_ENABLES 0x9100000000000010

0 commit comments

Comments
 (0)