[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230806115024.k3oc6u3yu42q7h5l@box.shutemov.name>
Date: Sun, 6 Aug 2023 14:50:24 +0300
From: kirill.shutemov@...ux.intel.com
To: Kai Huang <kai.huang@...el.com>
Cc: peterz@...radead.org, linux-kernel@...r.kernel.org,
dave.hansen@...el.com, tglx@...utronix.de, bp@...en8.de,
mingo@...hat.com, hpa@...or.com, x86@...nel.org, seanjc@...gle.com,
pbonzini@...hat.com, isaku.yamahata@...el.com,
sathyanarayanan.kuppuswamy@...ux.intel.com,
n.borisov.lkml@...il.com
Subject: Re: [PATCH v3 12/12] x86/virt/tdx: Adjust 'struct tdx_module_args'
to use x86 "register index" layout
On Wed, Jul 26, 2023 at 11:25:14PM +1200, Kai Huang wrote:
> For TDX guest, KVM needs to call __seamcall_saved_ret() to make the
> TDH.VP.ENTER SEAMCALL to enter the guest, possibly taking all registers
> in 'struct tdx_module_args' as input/output.
>
> KVM caches guest's GPRs in 'kvm_vcpu_arch::regs[]', which follows the
> "register index" hardware layout of x86 GPRs. On the other hand, the
> __seamcall_saved_ret() takes the pointer of 'struct tdx_module_args' as
> argument, thus there's a mismatch.
>
> KVM could choose to copy input registers from 'vcpu::regs[]' to a
> 'struct tdx_module_args' and use that as argument to make the SEAMCALL,
> but such memory copy isn't desired and should be avoided if possible.
I doubt the copy will be visible on any profile.
I personally don't like that kvm implementation detail leaks here. It
suppose to be generic TDX code.
--
Kiryl Shutsemau / Kirill A. Shutemov
Powered by blists - more mailing lists