xref: /linux/arch/x86/virt/vmx/tdx/seamcall.S (revision 0ea5c948cb64bab5bc7a5516774eb8536f05aa0d)
1*c33621b4SKai Huang/* SPDX-License-Identifier: GPL-2.0 */
2*c33621b4SKai Huang#include <linux/linkage.h>
3*c33621b4SKai Huang#include <asm/frame.h>
4*c33621b4SKai Huang
5*c33621b4SKai Huang#include "tdxcall.S"
6*c33621b4SKai Huang
7*c33621b4SKai Huang/*
8*c33621b4SKai Huang * __seamcall() - Host-side interface functions to SEAM software
9*c33621b4SKai Huang * (the P-SEAMLDR or the TDX module).
10*c33621b4SKai Huang *
11*c33621b4SKai Huang * __seamcall() function ABI:
12*c33621b4SKai Huang *
13*c33621b4SKai Huang * @fn   (RDI)  - SEAMCALL Leaf number, moved to RAX
14*c33621b4SKai Huang * @args (RSI)  - struct tdx_module_args for input
15*c33621b4SKai Huang *
16*c33621b4SKai Huang * Only RCX/RDX/R8-R11 are used as input registers.
17*c33621b4SKai Huang *
18*c33621b4SKai Huang * Return (via RAX) TDX_SEAMCALL_VMFAILINVALID if the SEAMCALL itself
19*c33621b4SKai Huang * fails, or the completion status of the SEAMCALL leaf function.
20*c33621b4SKai Huang */
21*c33621b4SKai HuangSYM_FUNC_START(__seamcall)
22*c33621b4SKai Huang	TDX_MODULE_CALL host=1
23*c33621b4SKai HuangSYM_FUNC_END(__seamcall)
24*c33621b4SKai Huang
25*c33621b4SKai Huang/*
26*c33621b4SKai Huang * __seamcall_ret() - Host-side interface functions to SEAM software
27*c33621b4SKai Huang * (the P-SEAMLDR or the TDX module), with saving output registers to
28*c33621b4SKai Huang * the 'struct tdx_module_args' used as input.
29*c33621b4SKai Huang *
30*c33621b4SKai Huang * __seamcall_ret() function ABI:
31*c33621b4SKai Huang *
32*c33621b4SKai Huang * @fn   (RDI)  - SEAMCALL Leaf number, moved to RAX
33*c33621b4SKai Huang * @args (RSI)  - struct tdx_module_args for input and output
34*c33621b4SKai Huang *
35*c33621b4SKai Huang * Only RCX/RDX/R8-R11 are used as input/output registers.
36*c33621b4SKai Huang *
37*c33621b4SKai Huang * Return (via RAX) TDX_SEAMCALL_VMFAILINVALID if the SEAMCALL itself
38*c33621b4SKai Huang * fails, or the completion status of the SEAMCALL leaf function.
39*c33621b4SKai Huang */
40*c33621b4SKai HuangSYM_FUNC_START(__seamcall_ret)
41*c33621b4SKai Huang	TDX_MODULE_CALL host=1 ret=1
42*c33621b4SKai HuangSYM_FUNC_END(__seamcall_ret)
43*c33621b4SKai Huang
44*c33621b4SKai Huang/*
45*c33621b4SKai Huang * __seamcall_saved_ret() - Host-side interface functions to SEAM software
46*c33621b4SKai Huang * (the P-SEAMLDR or the TDX module), with saving output registers to the
47*c33621b4SKai Huang * 'struct tdx_module_args' used as input.
48*c33621b4SKai Huang *
49*c33621b4SKai Huang * __seamcall_saved_ret() function ABI:
50*c33621b4SKai Huang *
51*c33621b4SKai Huang * @fn   (RDI)  - SEAMCALL Leaf number, moved to RAX
52*c33621b4SKai Huang * @args (RSI)  - struct tdx_module_args for input and output
53*c33621b4SKai Huang *
54*c33621b4SKai Huang * All registers in @args are used as input/output registers.
55*c33621b4SKai Huang *
56*c33621b4SKai Huang * Return (via RAX) TDX_SEAMCALL_VMFAILINVALID if the SEAMCALL itself
57*c33621b4SKai Huang * fails, or the completion status of the SEAMCALL leaf function.
58*c33621b4SKai Huang */
59*c33621b4SKai HuangSYM_FUNC_START(__seamcall_saved_ret)
60*c33621b4SKai Huang	TDX_MODULE_CALL host=1 ret=1 saved=1
61*c33621b4SKai HuangSYM_FUNC_END(__seamcall_saved_ret)
62