aboutsummaryrefslogtreecommitdiff
path: root/arch/x86/coco/tdx/tdx-shared.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86/coco/tdx/tdx-shared.c')
-rw-r--r--arch/x86/coco/tdx/tdx-shared.c37
1 files changed, 7 insertions, 30 deletions
diff --git a/arch/x86/coco/tdx/tdx-shared.c b/arch/x86/coco/tdx/tdx-shared.c
index 344b3818f4c3..78e413269791 100644
--- a/arch/x86/coco/tdx/tdx-shared.c
+++ b/arch/x86/coco/tdx/tdx-shared.c
@@ -70,45 +70,22 @@ bool tdx_accept_memory(phys_addr_t start, phys_addr_t end)
return true;
}
-noinstr u64 __tdx_hypercall(struct tdx_hypercall_args *args)
+noinstr u64 __tdx_hypercall(struct tdx_module_args *args)
{
- struct tdx_module_args margs = {
- .rcx = TDVMCALL_EXPOSE_REGS_MASK,
- .rdx = args->rdx,
- .r8 = args->r8,
- .r9 = args->r9,
- .r10 = args->r10,
- .r11 = args->r11,
- .r12 = args->r12,
- .r13 = args->r13,
- .r14 = args->r14,
- .r15 = args->r15,
- .rbx = args->rbx,
- .rdi = args->rdi,
- .rsi = args->rsi,
- };
+ /*
+ * For TDVMCALL explicitly set RCX to the bitmap of shared registers.
+ * The caller isn't expected to set @args->rcx anyway.
+ */
+ args->rcx = TDVMCALL_EXPOSE_REGS_MASK;
/*
* Failure of __tdcall_saved_ret() indicates a failure of the TDVMCALL
* mechanism itself and that something has gone horribly wrong with
* the TDX module. __tdx_hypercall_failed() never returns.
*/
- if (__tdcall_saved_ret(TDG_VP_VMCALL, &margs))
+ if (__tdcall_saved_ret(TDG_VP_VMCALL, args))
__tdx_hypercall_failed();
- args->r8 = margs.r8;
- args->r9 = margs.r9;
- args->r10 = margs.r10;
- args->r11 = margs.r11;
- args->r12 = margs.r12;
- args->r13 = margs.r13;
- args->r14 = margs.r14;
- args->r15 = margs.r15;
- args->rdi = margs.rdi;
- args->rsi = margs.rsi;
- args->rbx = margs.rbx;
- args->rdx = margs.rdx;
-
/* TDVMCALL leaf return code is in R10 */
return args->r10;
}