[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <d19c81ef34856f72c964322a7390d6fa21976e6f.camel@intel.com>
Date: Thu, 27 Oct 2022 08:42:16 +0000
From: "Huang, Kai" <kai.huang@...el.com>
To: "Li, Xiaoyao" <xiaoyao.li@...el.com>,
"kvm@...r.kernel.org" <kvm@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
CC: "Hansen, Dave" <dave.hansen@...el.com>,
"Luck, Tony" <tony.luck@...el.com>,
"bagasdotme@...il.com" <bagasdotme@...il.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>,
"Christopherson,, Sean" <seanjc@...gle.com>,
"Chatre, Reinette" <reinette.chatre@...el.com>,
"pbonzini@...hat.com" <pbonzini@...hat.com>,
"linux-mm@...ck.org" <linux-mm@...ck.org>,
"Yamahata, Isaku" <isaku.yamahata@...el.com>,
"peterz@...radead.org" <peterz@...radead.org>,
"Shahar, Sagi" <sagis@...gle.com>,
"imammedo@...hat.com" <imammedo@...hat.com>,
"Gao, Chao" <chao.gao@...el.com>,
"Brown, Len" <len.brown@...el.com>,
"sathyanarayanan.kuppuswamy@...ux.intel.com"
<sathyanarayanan.kuppuswamy@...ux.intel.com>,
"Williams, Dan J" <dan.j.williams@...el.com>
Subject: Re: [PATCH v6 01/21] x86/tdx: Use enum to define page level of TDX
supported page sizes
On Thu, 2022-10-27 at 15:08 +0800, Li, Xiaoyao wrote:
> > @@ -663,27 +662,16 @@ static bool try_accept_one(phys_addr_t *start,
> > unsigned long len,
> > if (len < accept_size)
> > return false;
> >
> > + /* TDX only supports 4K/2M/1G page sizes */
>
> yes, a page can be mapped as 1G size to TD via secure/shared EPT. But
> for this particular TDX_ACCEPT_PAGE case, it only supports 4K and 2M
> currently, which is defined in TDX module spec.
I checked the TDX module public spec, and it appears you are right. But I am
not sure whether it will be changed in the future?
Anyway this patch doesn't intend to bring any functional change (I should have
stated this in the changelog), so I think fixing to this, if ever needed, should
be another patch.
Hi Isaku,
You suggested to introduce a helper, but this reminds me how KVM is going to use
this helper? KVM secure EPT can accept more levels than try_accept_one().
Perhaps I can just get rid of this helper? TDX host series only needs some
definitions to represent 4K/2M/1G page to get rid of using magic numbers.
>
> This also implies one thing can be improved in current kernel that
> trying accepting a page from 1G in tdx_enc_status_changed() can be
> optimized to from 2M. It can be changed to start from 1G when TDX
> supports accepting 1G page directly.
Ditto.
>
> > + if (pg_level < PG_LEVEL_4K || pg_level > PG_LEVEL_1G)
> > + return false;
> > /*
> > * Pass the page physical address to the TDX module to accept the
> > * pending, private page.
> > *
> > * Bits 2:0 of RCX encode page size: 0 - 4K, 1 - 2M, 2 - 1G.
>
> Maybe the “page size” can be adjusted to “TDX page level” accordingly.
Perhaps, but I think "page size" is also not that wrong, so I am reluctant to
change the existing comment. And let's see Isaku's response to my above
question first.
Powered by blists - more mailing lists