Re: [PATCH v4 12/12] x86/virt/tdx: Adjust 'struct tdx_module_args' to use x86 "register index" layout
From: kirill . shutemov
Date: Fri Aug 25 2023 - 19:45:30 EST
On Tue, Aug 15, 2023 at 11:02:06PM +1200, Kai Huang wrote:
> diff --git a/arch/x86/include/asm/shared/tdx.h b/arch/x86/include/asm/shared/tdx.h
> index 74fc466dfdcd..8d1427562c63 100644
> --- a/arch/x86/include/asm/shared/tdx.h
> +++ b/arch/x86/include/asm/shared/tdx.h
> @@ -58,24 +58,31 @@
> * Used in __tdcall*() to gather the input/output registers' values of the
> * TDCALL instruction when requesting services from the TDX module. This is a
> * software only structure and not part of the TDX module/VMM ABI
> + *
> + * Note those *_unused are not used by the TDX_MODULE_CALL assembly.
> + * The layout of this structure also matches KVM's kvm_vcpu_arch::regs[]
> + * layout, which follows the "register index" order of x86 GPRs. KVM
> + * then can simply type cast kvm_vcpu_arch::regs[] to this structure to
> + * avoid the extra memory copy between two structures when making
> + * TDH.VP.ENTER SEAMCALL.
I still don't like KVM details leak here. I don't feel strong enough about
it to NAK the patch, but...
--
Kiryl Shutsemau / Kirill A. Shutemov