On Tue, 2023-10-24 at 08:53 +0300, Nikolay Borisov wrote: > > On 17.10.23 г. 13:14 ч., Kai Huang wrote: > > <snip> > > > arch/x86/Kconfig | 1 + > > arch/x86/include/asm/shared/tdx.h | 1 + > > arch/x86/virt/vmx/tdx/tdx.c | 215 +++++++++++++++++++++++++++++- > > arch/x86/virt/vmx/tdx/tdx.h | 1 + > > 4 files changed, 213 insertions(+), 5 deletions(-) > > > > diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig > > index 864e43b008b1..ee4ac117aa3c 100644 > > --- a/arch/x86/Kconfig > > +++ b/arch/x86/Kconfig > > @@ -1946,6 +1946,7 @@ config INTEL_TDX_HOST > > depends on KVM_INTEL > > depends on X86_X2APIC > > select ARCH_KEEP_MEMBLOCK > > + depends on CONTIG_ALLOC > > help > > Intel Trust Domain Extensions (TDX) protects guest VMs from malicious > > host and certain physical attacks. This option enables necessary TDX > > diff --git a/arch/x86/include/asm/shared/tdx.h b/arch/x86/include/asm/shared/tdx.h > > index abcca86b5af3..cb59fe329b00 100644 > > --- a/arch/x86/include/asm/shared/tdx.h > > +++ b/arch/x86/include/asm/shared/tdx.h > > @@ -58,6 +58,7 @@ > > #define TDX_PS_4K 0 > > #define TDX_PS_2M 1 > > #define TDX_PS_1G 2 > > +#define TDX_PS_NR (TDX_PS_1G + 1) > > nit: I'd prefer if you those defines are turned into an enum and > subsequently this enum type can be used in the definition of > tdmr_get_pamt_sz(). However, at this point I consider this a > bikeshedding and you can do that iff you are going to respin the series > due to other feedback as well. > > <snip> Thanks for comments. But to be honest I don't get why enum is better, and I would like to leave this to future work if really needed. Please note these TDX_PS_xx are also used by TDX guest code (see patch 2).