On Tue, Aug 13, 2024 at 04:00:09PM +0800, Yuan Yao wrote: > On Mon, Aug 12, 2024 at 03:48:13PM -0700, Rick Edgecombe wrote: > > From: Isaku Yamahata <isaku.yamahata@xxxxxxxxx> > > @@ -293,6 +303,15 @@ static inline u8 tdx_sysinfo_nr_tdcs_pages(void) > > return tdx_sysinfo->td_ctrl.tdcs_base_size / PAGE_SIZE; > > } > > > > +static inline u8 tdx_sysinfo_nr_tdcx_pages(void) > > tdx_sysinfo_nr_tdcx_pages() is very similar to > tdx_sysinfo_nr_tdcs_pages() which is introduced in patch 13. > > It's easy to use either of them in wrong place and hard to > review, these 2 functions have same signature so compiler > has no way to prevent us from using them incorrectly. > TDX 1.5 spec defines these additional pages for TD and vCPU to > "TDCX" pages, so how about we name them like: > > u8 tdx_sysinfo_nr_td_tdcx_pages(void); > u8 tdx_sysinfo_nr_vcpu_tdcx_pages(void); > > Above name matchs spec more, and easy to distinguish and review. Good idea to clarify the naming. For patch 13/25, Nikolay suggested precalculating the values and dropping the helpers. So we could have kvm_tdx->nr_td_tdcx_pages and kvm_tdx->nr_vcpu_tdcx_pages following your naming suggestion. Regards, Tony