Re: [PATCHv2 03/29] x86/tdx: Add __tdx_module_call() and __tdx_hypercall() helper functions
From: Kirill A. Shutemov
Date: Fri Feb 04 2022 - 08:18:20 EST
On Fri, Feb 04, 2022 at 11:12:39PM +1300, Kai Huang wrote:
>
> > --- a/arch/x86/include/asm/tdx.h
> > +++ b/arch/x86/include/asm/tdx.h
> > @@ -8,6 +8,25 @@
> > #define TDX_CPUID_LEAF_ID 0x21
> > #define TDX_IDENT "IntelTDX "
>
> Seems above two are not required by assembly file? If so also move them to
> within #ifndef __ASSEMBLY__?
Why? It is harmless.
> >
> > +#define TDX_SEAMCALL_VMFAILINVALID 0x8000FF00FFFF0000ULL
> > +
> > +#ifndef __ASSEMBLY__
> > +
> > +/*
> > + * Used to gather the output registers values of the TDCALL and SEAMCALL
> > + * instructions when requesting services from the TDX module.
> > + *
> > + * This is a software only structure and not part of the TDX module/VMM ABI.
> > + */
> > +struct tdx_module_output {
> > + u64 rcx;
> > + u64 rdx;
> > + u64 r8;
> > + u64 r9;
> > + u64 r10;
> > + u64 r11;
> > +};
> > +
>
> Is declaration of __tdx_module_call() outside of CONFIG_INTEL_TDX_GUEST?
No, it is defined within CONFIG_INTEL_TDX_GUEST. Why? Host side has to
build their helper anyway.
> > #ifdef CONFIG_INTEL_TDX_GUEST
> >
> > void __init tdx_early_init(void);
> > @@ -18,4 +37,5 @@ static inline void tdx_early_init(void) { };
> >
> > #endif /* CONFIG_INTEL_TDX_GUEST */
> >
> > +#endif /* !__ASSEMBLY__ */
> > #endif /* _ASM_X86_TDX_H */
--
Kirill A. Shutemov