Skip to content

Commit 5efb962

Browse files
kaihuanghansendc
authored andcommitted
x86/tdx: Rename __tdx_module_call() to __tdcall()
__tdx_module_call() is only used by the TDX guest to issue TDCALL to the TDX module. Rename it to __tdcall() to match its behaviour, e.g., it cannot be used to make host-side SEAMCALL. Also rename tdx_module_call() which is a wrapper of __tdx_module_call() to tdcall(). 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/785d20d99fbcd0db8262c94da6423375422d8c75.1692096753.git.kai.huang%40intel.com
1 parent f0024db commit 5efb962

File tree

4 files changed

+17
-17
lines changed

4 files changed

+17
-17
lines changed

arch/x86/coco/tdx/tdcall.S

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@
4040
.section .noinstr.text, "ax"
4141

4242
/*
43-
* __tdx_module_call() - Used by TDX guests to request services from
44-
* the TDX module (does not include VMM services) using TDCALL instruction.
43+
* __tdcall() - Used by TDX guests to request services from the TDX
44+
* module (does not include VMM services) using TDCALL instruction.
4545
*
4646
* Transforms function call register arguments into the TDCALL register ABI.
4747
* After TDCALL operation, TDX module output is saved in @out (if it is
@@ -62,7 +62,7 @@
6262
*
6363
*-------------------------------------------------------------------------
6464
*
65-
* __tdx_module_call() function ABI:
65+
* __tdcall() function ABI:
6666
*
6767
* @fn (RDI) - TDCALL Leaf ID, moved to RAX
6868
* @rcx (RSI) - Input parameter 1, moved to RCX
@@ -77,9 +77,9 @@
7777
*
7878
* Return status of TDCALL via RAX.
7979
*/
80-
SYM_FUNC_START(__tdx_module_call)
80+
SYM_FUNC_START(__tdcall)
8181
TDX_MODULE_CALL host=0
82-
SYM_FUNC_END(__tdx_module_call)
82+
SYM_FUNC_END(__tdcall)
8383

8484
/*
8585
* TDX_HYPERCALL - Make hypercalls to a TDX VMM using TDVMCALL leaf of TDCALL

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

Lines changed: 1 addition & 1 deletion
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(TDG_MEM_PAGE_ACCEPT, tdcall_rcx, 0, 0, 0, NULL))
38+
if (__tdcall(TDG_MEM_PAGE_ACCEPT, tdcall_rcx, 0, 0, 0, NULL))
3939
return 0;
4040

4141
return accept_size;

arch/x86/coco/tdx/tdx.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,10 @@ EXPORT_SYMBOL_GPL(tdx_kvm_hypercall);
6666
* should only be used for calls that have no legitimate reason to fail
6767
* or where the kernel can not survive the call failing.
6868
*/
69-
static inline void tdx_module_call(u64 fn, u64 rcx, u64 rdx, u64 r8, u64 r9,
70-
struct tdx_module_output *out)
69+
static inline void tdcall(u64 fn, u64 rcx, u64 rdx, u64 r8, u64 r9,
70+
struct tdx_module_output *out)
7171
{
72-
if (__tdx_module_call(fn, rcx, rdx, r8, r9, out))
72+
if (__tdcall(fn, rcx, rdx, r8, r9, out))
7373
panic("TDCALL %lld failed (Buggy TDX module!)\n", fn);
7474
}
7575

@@ -91,9 +91,9 @@ int tdx_mcall_get_report0(u8 *reportdata, u8 *tdreport)
9191
{
9292
u64 ret;
9393

94-
ret = __tdx_module_call(TDG_MR_REPORT, virt_to_phys(tdreport),
95-
virt_to_phys(reportdata), TDREPORT_SUBTYPE_0,
96-
0, NULL);
94+
ret = __tdcall(TDG_MR_REPORT, virt_to_phys(tdreport),
95+
virt_to_phys(reportdata), TDREPORT_SUBTYPE_0,
96+
0, NULL);
9797
if (ret) {
9898
if (TDCALL_RETURN_CODE(ret) == TDCALL_INVALID_OPERAND)
9999
return -EINVAL;
@@ -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(TDG_VP_INFO, 0, 0, 0, 0, &out);
155+
tdcall(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(TDG_VP_VEINFO_GET, 0, 0, 0, 0, &out);
597+
tdcall(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(TDG_VM_WR, 0, TDCS_NOTIFY_ENABLES, 0, -1ULL, NULL);
817+
tdcall(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: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,8 @@ struct tdx_module_output {
9090
};
9191

9292
/* Used to communicate with the TDX module */
93-
u64 __tdx_module_call(u64 fn, u64 rcx, u64 rdx, u64 r8, u64 r9,
94-
struct tdx_module_output *out);
93+
u64 __tdcall(u64 fn, u64 rcx, u64 rdx, u64 r8, u64 r9,
94+
struct tdx_module_output *out);
9595

9696
bool tdx_accept_memory(phys_addr_t start, phys_addr_t end);
9797

0 commit comments

Comments
 (0)