lkml.org 
[lkml]   [2021]   [Dec]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 19/26] x86/tdx: Make pages shared in ioremap()
On Mon, Dec 27, 2021 at 05:14:36PM +0300, Kirill A. Shutemov wrote:
> On Mon, Dec 27, 2021 at 12:51:21PM +0100, Borislav Petkov wrote:
> > On Fri, Dec 24, 2021 at 02:03:00PM +0300, Kirill A. Shutemov wrote:
> > > Okay. Meanwhile I leave it this way:
> > >
> > > pgprot_t pgprot_cc_encrypted(pgprot_t prot)
> > > {
> > > if (cc_platform_has(CC_ATTR_MEM_ENCRYPT)) {
> > > if (cc_platform_has(CC_ATTR_GUEST_TDX))
> > > return __pgprot(pgprot_val(prot) & ~tdx_shared_mask());
> > > else if (sme_me_mask)
> > > return __pgprot(__sme_set(pgprot_val(prot)));
> > > else
> > > WARN_ON_ONCE(1);
> >
> > I'm wondering if defining a generic cc_attr especially for this:
> >
> > if (cc_platform_has(CC_ATTR_MEMORY_SHARING))
> >
> > to mean, the CC guest needs to do special stuff in order to share memory
> > with the host (naming sucks, ofc) would be cleaner?
>
> Looks like CC_ATTR_MEM_ENCRYPT already does this. The attribute doesn't
> have much meaning beyond that, no?

It means that *some* memory encryption - guest or host - is in use.

But my point about removing the outer check is bull - you need the
TDX/SEV checks too to figure out which mask to use.

So, reading Tom's latest email, having

cc_pgprot_encrypted(prot)

and
cc_pgprot_decrypted(prot)

in cc_platform.c and which hide all that logic inside doesn't sound like
a bad idea. And cc_platform.c already looks at sme_me_mask and we do
that there for the early path so I guess that's probably halfway fine...

Thx.

--
Regards/Gruss,
Boris.

https://people.kernel.org/tglx/notes-about-netiquette

\
 
 \ /
  Last update: 2021-12-28 19:40    [W:0.158 / U:9.260 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site