[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YgFIaJ8ijgQQ04Nv@zn.tnic>
Date: Mon, 7 Feb 2022 17:27:20 +0100
From: Borislav Petkov <bp@...en8.de>
To: "Kirill A. Shutemov" <kirill.shutemov@...ux.intel.com>
Cc: tglx@...utronix.de, mingo@...hat.com, dave.hansen@...el.com,
luto@...nel.org, peterz@...radead.org,
sathyanarayanan.kuppuswamy@...ux.intel.com, aarcange@...hat.com,
ak@...ux.intel.com, dan.j.williams@...el.com, david@...hat.com,
hpa@...or.com, jgross@...e.com, jmattson@...gle.com,
joro@...tes.org, jpoimboe@...hat.com, knsathya@...nel.org,
pbonzini@...hat.com, sdeep@...are.com, seanjc@...gle.com,
tony.luck@...el.com, vkuznets@...hat.com, wanpengli@...cent.com,
x86@...nel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCHv2 22/29] x86/tdx: Make pages shared in ioremap()
On Mon, Jan 24, 2022 at 06:02:08PM +0300, Kirill A. Shutemov wrote:
> -/*
> - * Macros to add or remove encryption attribute
> - */
> -#define pgprot_encrypted(prot) __pgprot(__sme_set(pgprot_val(prot)))
> -#define pgprot_decrypted(prot) __pgprot(__sme_clr(pgprot_val(prot)))
Why can't you simply define
cc_set() and cc_clear()
helpers which either call the __sme variants or __tdx variants, the
latter you can define the same way, respectively, as the __sme ones.
And then you do:
#define pgprot_encrypted(prot) __pgprot(cc_set(pgprot_val(prot)))
#define pgprot_decrypted(prot) __pgprot(cc_clear(pgprot_val(prot)))
And just so that it works as early as possible, you can define a global
tdx_shared_mask or so which gets initialized the moment you have
td_info.gpa_width.
And then you don't need to export anything or other ifdefferies - you
just make sure you have that mask defined as early as needed.
Thx.
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette
Powered by blists - more mailing lists