Re: [PATCHv3 02/32] x86/coco: Add API to handle encryption mask

From: Borislav Petkov
Date: Mon Feb 21 2022 - 14:49:18 EST


On Mon, Feb 21, 2022 at 11:28:16AM -0800, Dave Hansen wrote:
> Why don't we just have:
>
> pgprot_t cc_mkenc(pgprot prot)
> pgprot_t cc_mkenc(pgprot prot)
>
> and *no* pgprot_{en,de}crypted()?

Yes, and can the above cc_get_mask() thing be:

cpa.mask_set = enc ? cc_mkenc(0) : cc_mkdec(0);
cpa.mask_clr = enc ? cc_mkdec(0) : cc_mkenc(0);

since we're going to feed it pgprot things?

And then you don't need a separate cc_get_mask() thing or whatever
- there's only those two mkenc and mkdec things converting pgprots
back'n'forth.

> sme_me_mask does look quite AMD-specialized, like its assembly
> manipulation. Even if it's just a copy of cc_mask, it would be nice to
> call that out so the relationship is crystal clear.

Yes, the ultimate goal is to have cc_mask be shared by both AMD and
Intel. We'll phase out sme_me_mask on the AMD side gradually while Intel
can use cc_mask directly.

Methinks.

Thx.

--
Regards/Gruss,
Boris.

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