Re: [PATCHv2 22/29] x86/tdx: Make pages shared in ioremap()

Borislav Petkov
2022-02-15T10:50:44Z

On Tue, Feb 15, 2022 at 01:09:26AM +0300, Kirill A. Shutemov wrote:
> pgprotval_t cc_enc(pgprotval_t protval)
> {
> if (sme_me_mask)
> return __sme_set(protval);
> else if (cpu_feature_enabled(X86_FEATURE_TDX_GUEST))
> return protval & ~tdx_shared_mask();
^^^^^^^^^^^^^^^^^^^

LGTM.

Btw, what about sticking the mask tdx_shared_mask() returns into a
proper u64 variable and using it everywhere, just like sme_me_mask?

We could unify it later into a common encryption mask, see thread
starting here:

https://lore.kernel.org/r/YgZ427v95xcdOKSC@zn.tnic

--
Regards/Gruss,
Boris.