[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <62724437435e0cc6d5637ce7a4cb919b0b8bfea6.camel@intel.com>
Date: Tue, 6 Aug 2024 11:29:07 +0000
From: "Huang, Kai" <kai.huang@...el.com>
To: "Hansen, Dave" <dave.hansen@...el.com>, "seanjc@...gle.com"
<seanjc@...gle.com>, "bp@...en8.de" <bp@...en8.de>, "peterz@...radead.org"
<peterz@...radead.org>, "hpa@...or.com" <hpa@...or.com>, "mingo@...hat.com"
<mingo@...hat.com>, "Williams, Dan J" <dan.j.williams@...el.com>,
"kirill.shutemov@...ux.intel.com" <kirill.shutemov@...ux.intel.com>,
"pbonzini@...hat.com" <pbonzini@...hat.com>, "tglx@...utronix.de"
<tglx@...utronix.de>
CC: "Gao, Chao" <chao.gao@...el.com>, "kvm@...r.kernel.org"
<kvm@...r.kernel.org>, "binbin.wu@...ux.intel.com"
<binbin.wu@...ux.intel.com>, "linux-kernel@...r.kernel.org"
<linux-kernel@...r.kernel.org>, "Edgecombe, Rick P"
<rick.p.edgecombe@...el.com>, "x86@...nel.org" <x86@...nel.org>, "Yamahata,
Isaku" <isaku.yamahata@...el.com>
Subject: Re: [PATCH v2 07/10] x86/virt/tdx: Start to track all global metadata
in one structure
On Mon, 2024-08-05 at 20:51 -0700, Williams, Dan J wrote:
> Kai Huang wrote:
> > The TDX module provides a set of "global metadata fields". They report
> > things like TDX module version, supported features, and fields related
> > to create/run TDX guests and so on.
> >
> > Currently the kernel only reads "TD Memory Region" (TDMR) related fields
> > for module initialization. There are immediate needs which require the
> > TDX module initialization to read more global metadata including module
> > version, supported features and "Convertible Memory Regions" (CMRs).
> >
> > Also, KVM will need to read more metadata fields to support baseline TDX
> > guests. In the longer term, other TDX features like TDX Connect (which
> > supports assigning trusted IO devices to TDX guest) may also require
> > other kernel components such as pci/vt-d to access global metadata.
> >
> > To meet all those requirements, the idea is the TDX host core-kernel to
> > to provide a centralized, canonical, and read-only structure for the
> > global metadata that comes out from the TDX module for all kernel
> > components to use.
> >
> > As the first step, introduce a new 'struct tdx_sysinfo' to track all
> > global metadata fields.
> >
> > TDX categories global metadata fields into different "Class"es. E.g.,
> > the current TDMR related fields are under class "TDMR Info". Instead of
> > making 'struct tdx_sysinfo' a plain structure to contain all metadata
> > fields, organize them in smaller structures based on the "Class".
> >
> > This allows those metadata fields to be used in finer granularity thus
> > makes the code more clear. E.g., the current construct_tdmr() can just
> > take the structure which contains "TDMR Info" metadata fields.
> >
> > Start with moving 'struct tdx_tdmr_sysinfo' to 'struct tdx_sysinfo', and
> > rename 'struct tdx_tdmr_sysinfo' to 'struct tdx_sysinfo_tdmr_info' to
> > make it consistent with the "class name".
>
> How about 'struct tdx_sys_info' and 'struct tdx_sys_tdmr_info' to avoid
> duplicating 'info' in the symbol name?
Fine to me. Will do.
>
> Do pure renames indpendent of logic changes to make patches like
> this easier to read.
>
> I would also move the pure rename to the front of the patches so the
> reviewer spends as minimal amount of time with the deprecated name in
> the set.
OK. I'll split out the pure rename patch and move it to earlier place.
[...]
> > +
> > +/* Class "TDMR Info" */
> > +struct tdx_sysinfo_tdmr_info {
> > + u16 max_tdmrs;
> > + u16 max_reserved_per_tdmr;
> > + u16 pamt_entry_size[TDX_PS_NR];
> > +};
> > +
> > +struct tdx_sysinfo {
> > + struct tdx_sysinfo_tdmr_info tdmr_info;
> > +};
>
> I would just call this member 'tdmr' since the 'info' is already applied
> by being in tdx_sys_info.
Yeah fine to me. Thanks.
Powered by blists - more mailing lists