[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <91b1fbc8-7308-43d1-a27a-90dc21fa7f40@suse.com>
Date: Tue, 24 Oct 2023 16:31:43 +0300
From: Nikolay Borisov <nik.borisov@...e.com>
To: "Huang, Kai" <kai.huang@...el.com>,
"kvm@...r.kernel.org" <kvm@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Cc: "sathyanarayanan.kuppuswamy@...ux.intel.com"
<sathyanarayanan.kuppuswamy@...ux.intel.com>,
"Hansen, Dave" <dave.hansen@...el.com>,
"david@...hat.com" <david@...hat.com>,
"bagasdotme@...il.com" <bagasdotme@...il.com>,
"ak@...ux.intel.com" <ak@...ux.intel.com>,
"kirill.shutemov@...ux.intel.com" <kirill.shutemov@...ux.intel.com>,
"Christopherson,, Sean" <seanjc@...gle.com>,
"mingo@...hat.com" <mingo@...hat.com>,
"pbonzini@...hat.com" <pbonzini@...hat.com>,
"tglx@...utronix.de" <tglx@...utronix.de>,
"Yamahata, Isaku" <isaku.yamahata@...el.com>,
"Luck, Tony" <tony.luck@...el.com>,
"hpa@...or.com" <hpa@...or.com>,
"peterz@...radead.org" <peterz@...radead.org>,
"Shahar, Sagi" <sagis@...gle.com>,
"imammedo@...hat.com" <imammedo@...hat.com>,
"bp@...en8.de" <bp@...en8.de>, "Gao, Chao" <chao.gao@...el.com>,
"rafael@...nel.org" <rafael@...nel.org>,
"Brown, Len" <len.brown@...el.com>,
"Huang, Ying" <ying.huang@...el.com>,
"Williams, Dan J" <dan.j.williams@...el.com>,
"x86@...nel.org" <x86@...nel.org>
Subject: Re: [PATCH v14 12/23] x86/virt/tdx: Allocate and set up PAMTs for
TDMRs
On 24.10.23 г. 13:49 ч., Huang, Kai wrote:
> 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).
The reason being self-documenting code. In particular when looking at
the signature of tdmr_get_pamt_sz if the 2nd argument was enum
tdx_ps_size or some such it would be immediately evident what this
parameter is all about. Right now it's just a plain int which can be
anything. Indeed, this is mostly cosmetic so hence it's minor.
Powered by blists - more mailing lists