[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <9c23f44576a4c2757ebceaca453f387ba9abb764.camel@intel.com>
Date: Fri, 30 Jun 2023 09:58:19 +0000
From: "Huang, Kai" <kai.huang@...el.com>
To: "peterz@...radead.org" <peterz@...radead.org>
CC: "kvm@...r.kernel.org" <kvm@...r.kernel.org>,
"Raj, Ashok" <ashok.raj@...el.com>,
"Luck, Tony" <tony.luck@...el.com>,
"david@...hat.com" <david@...hat.com>,
"bagasdotme@...il.com" <bagasdotme@...il.com>,
"Hansen, Dave" <dave.hansen@...el.com>,
"ak@...ux.intel.com" <ak@...ux.intel.com>,
"Wysocki, Rafael J" <rafael.j.wysocki@...el.com>,
"kirill.shutemov@...ux.intel.com" <kirill.shutemov@...ux.intel.com>,
"Chatre, Reinette" <reinette.chatre@...el.com>,
"Christopherson,, Sean" <seanjc@...gle.com>,
"pbonzini@...hat.com" <pbonzini@...hat.com>,
"mingo@...hat.com" <mingo@...hat.com>,
"tglx@...utronix.de" <tglx@...utronix.de>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-mm@...ck.org" <linux-mm@...ck.org>,
"Yamahata, Isaku" <isaku.yamahata@...el.com>,
"nik.borisov@...e.com" <nik.borisov@...e.com>,
"hpa@...or.com" <hpa@...or.com>, "Shahar, Sagi" <sagis@...gle.com>,
"imammedo@...hat.com" <imammedo@...hat.com>,
"bp@...en8.de" <bp@...en8.de>, "Gao, Chao" <chao.gao@...el.com>,
"Brown, Len" <len.brown@...el.com>,
"sathyanarayanan.kuppuswamy@...ux.intel.com"
<sathyanarayanan.kuppuswamy@...ux.intel.com>,
"Huang, Ying" <ying.huang@...el.com>,
"Williams, Dan J" <dan.j.williams@...el.com>,
"x86@...nel.org" <x86@...nel.org>
Subject: Re: [PATCH v12 08/22] x86/virt/tdx: Get information about TDX module
and TDX-capable memory
On Fri, 2023-06-30 at 11:34 +0200, Peter Zijlstra wrote:
> On Thu, Jun 29, 2023 at 09:15:39AM +0000, Huang, Kai wrote:
>
> > Sure. How about below?
> >
> > + /*
> > + * TDH.SYS.INFO writes the TDSYSINFO_STRUCT and the CMR array
> > + * to the buffers provided by the kernel (via RCX and R8
> > + * respectively). The buffer size of the TDSYSINFO_STRUCT
> > + * (via RDX) and the maximum entries of the CMR array (via R9)
> > + * passed to this SEAMCALL must be at least the size of
> > + * TDSYSINFO_STRUCT and MAX_CMRS respectively.
> > + *
> > + * Upon a successful return, R9 contains the actual entries
> > + * written to the CMR array.
> > + */
> > sysinfo_pa = __pa(sysinfo);
> > cmr_array_pa = __pa(cmr_array);
> > ret = seamcall(TDH_SYS_INFO, sysinfo_pa, TDSYSINFO_STRUCT_SIZE,
>
> > Or should I just repeat the spec like below?
>
> > + /*
> > + * TDH.SYS.INFO writes the TDSYSINFO_STRUCT and the CMR array
> > + * to the buffers provided by the kernel:
> > + *
> > + * Input:
> > + * - RCX: The buffer of TDSYSINFO_STRUCT
> > + * - RDX: The size of the TDSYSINFO_STRUCT buffer, must be at
> > + * at least the size of TDSYSINFO_STRUCT
> > + * - R8: The buffer of the CMR array
> > + * - R9: The entry number of the array, must be at least
> > + * MAX_CMRS.
> > + *
> > + * Output (successful):
> > + * - RDX: The actual bytes written to the TDSYSINFO_STRUCT
> > + * buffer
> > + * - R9: The actual entries written to the CMR array.
> > + */
> > sysinfo_pa = __pa(sysinfo);
> > cmr_array_pa = __pa(cmr_array);
> > ret = seamcall(TDH_SYS_INFO, sysinfo_pa, TDSYSINFO_STRUCT_SIZE,
>
> Either of them work for me, thanks!
I will choose the first one since it's shorter. Thanks!
>
> > > SDM doesn't seem to be the place. That doesn't
> > > even list TDCALL/SEAMCALL in Volume 2 :-( Let alone describe the magic
> > > values.
> > >
> >
> > TDX has it's own specs at here:
> >
> > https://www.intel.com/content/www/us/en/developer/articles/technical/intel-trust-domain-extensions.html
> >
> > For this one you can find it in here:
> >
> > https://cdrdv2.intel.com/v1/dl/getContent/733568
>
> Yeah, eventually found it. I still think both TDCALL and SEAMCALL should
> be listed in SDM Vol.2 instruction listing -- every valid instruction
> should be found there IMO.
>
> I also feel strongly that a global ABI should be decided upon for them
> and the SDM would be a good place to mention that. leaving this to
> individual calls like now is a giant pain in the rear.
Yeah I agree how the specs are organized is not ideal. We have been having pain
during our development too.
>
> As is, we have TDCALL leaf-0 with a giant regset but every other leaf
> has (c,d,8,9) for input and +(10,11) for output. Lets fix that in stone.
>
> Obviously I also very strongly feel any such ABI must not confict with
> pre-existing calling conventions -- IOW, using BP is out, must not
> happen.
Fully agreed.
Powered by blists - more mailing lists