xref: /openbmc/linux/arch/x86/include/asm/shared/tdx.h (revision 0da908c2)
14b05f815SKuppuswamy Sathyanarayanan /* SPDX-License-Identifier: GPL-2.0 */
24b05f815SKuppuswamy Sathyanarayanan #ifndef _ASM_X86_SHARED_TDX_H
34b05f815SKuppuswamy Sathyanarayanan #define _ASM_X86_SHARED_TDX_H
44b05f815SKuppuswamy Sathyanarayanan 
54c5b9aacSKirill A. Shutemov #include <linux/bits.h>
64c5b9aacSKirill A. Shutemov #include <linux/types.h>
74c5b9aacSKirill A. Shutemov 
84c5b9aacSKirill A. Shutemov #define TDX_HYPERCALL_STANDARD  0
94c5b9aacSKirill A. Shutemov 
104c5b9aacSKirill A. Shutemov #define TDX_HCALL_HAS_OUTPUT	BIT(0)
114c5b9aacSKirill A. Shutemov #define TDX_HCALL_ISSUE_STI	BIT(1)
124c5b9aacSKirill A. Shutemov 
134b05f815SKuppuswamy Sathyanarayanan #define TDX_CPUID_LEAF_ID	0x21
144b05f815SKuppuswamy Sathyanarayanan #define TDX_IDENT		"IntelTDX    "
154b05f815SKuppuswamy Sathyanarayanan 
164c5b9aacSKirill A. Shutemov #ifndef __ASSEMBLY__
174c5b9aacSKirill A. Shutemov 
184c5b9aacSKirill A. Shutemov /*
194c5b9aacSKirill A. Shutemov  * Used in __tdx_hypercall() to pass down and get back registers' values of
204c5b9aacSKirill A. Shutemov  * the TDCALL instruction when requesting services from the VMM.
214c5b9aacSKirill A. Shutemov  *
224c5b9aacSKirill A. Shutemov  * This is a software only structure and not part of the TDX module/VMM ABI.
234c5b9aacSKirill A. Shutemov  */
244c5b9aacSKirill A. Shutemov struct tdx_hypercall_args {
25*0da908c2SKirill A. Shutemov 	u64 r8;
26*0da908c2SKirill A. Shutemov 	u64 r9;
274c5b9aacSKirill A. Shutemov 	u64 r10;
284c5b9aacSKirill A. Shutemov 	u64 r11;
294c5b9aacSKirill A. Shutemov 	u64 r12;
304c5b9aacSKirill A. Shutemov 	u64 r13;
314c5b9aacSKirill A. Shutemov 	u64 r14;
324c5b9aacSKirill A. Shutemov 	u64 r15;
33*0da908c2SKirill A. Shutemov 	u64 rdi;
34*0da908c2SKirill A. Shutemov 	u64 rsi;
35*0da908c2SKirill A. Shutemov 	u64 rbx;
36*0da908c2SKirill A. Shutemov 	u64 rdx;
374c5b9aacSKirill A. Shutemov };
384c5b9aacSKirill A. Shutemov 
394c5b9aacSKirill A. Shutemov /* Used to request services from the VMM */
404c5b9aacSKirill A. Shutemov u64 __tdx_hypercall(struct tdx_hypercall_args *args, unsigned long flags);
414c5b9aacSKirill A. Shutemov 
424c5b9aacSKirill A. Shutemov /* Called from __tdx_hypercall() for unrecoverable failure */
434c5b9aacSKirill A. Shutemov void __tdx_hypercall_failed(void);
444c5b9aacSKirill A. Shutemov 
454c5b9aacSKirill A. Shutemov #endif /* !__ASSEMBLY__ */
464b05f815SKuppuswamy Sathyanarayanan #endif /* _ASM_X86_SHARED_TDX_H */
47