[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YKQDNg3keYJGnEwg@zn.tnic>
Date: Tue, 18 May 2021 20:11:02 +0200
From: Borislav Petkov <bp@...en8.de>
To: Brijesh Singh <brijesh.singh@....com>
Cc: x86@...nel.org, linux-kernel@...r.kernel.org, kvm@...r.kernel.org,
tglx@...utronix.de, jroedel@...e.de, thomas.lendacky@....com,
pbonzini@...hat.com, mingo@...hat.com, dave.hansen@...el.com,
rientjes@...gle.com, seanjc@...gle.com, peterz@...radead.org,
hpa@...or.com, tony.luck@...el.com
Subject: Re: [PATCH Part1 RFC v2 08/20] x86/mm: Add sev_snp_active() helper
On Fri, Apr 30, 2021 at 07:16:04AM -0500, Brijesh Singh wrote:
> The sev_snp_active() helper can be used by the guest to query whether the
> SNP - Secure Nested Paging feature is active.
>
> Signed-off-by: Brijesh Singh <brijesh.singh@....com>
> ---
> arch/x86/include/asm/mem_encrypt.h | 2 ++
> arch/x86/include/asm/msr-index.h | 2 ++
> arch/x86/mm/mem_encrypt.c | 9 +++++++++
> 3 files changed, 13 insertions(+)
>
> diff --git a/arch/x86/include/asm/mem_encrypt.h b/arch/x86/include/asm/mem_encrypt.h
> index 31c4df123aa0..d99aa260d328 100644
> --- a/arch/x86/include/asm/mem_encrypt.h
> +++ b/arch/x86/include/asm/mem_encrypt.h
> @@ -54,6 +54,7 @@ void __init sev_es_init_vc_handling(void);
> bool sme_active(void);
> bool sev_active(void);
> bool sev_es_active(void);
> +bool sev_snp_active(void);
>
> #define __bss_decrypted __section(".bss..decrypted")
>
> @@ -79,6 +80,7 @@ static inline void sev_es_init_vc_handling(void) { }
> static inline bool sme_active(void) { return false; }
> static inline bool sev_active(void) { return false; }
> static inline bool sev_es_active(void) { return false; }
> +static inline bool sev_snp_active(void) { return false; }
Uff, yet another sev-something helper. So I already had this idea:
https://lore.kernel.org/kvm/20210421144402.GB5004@zn.tnic/
How about you add the sev_feature_enabled() thing
which will return a boolean value depending on which SEV feature has
been queried and instead of having yet another helper, do
if (sev_feature_enabled(SEV_SNP))
or so?
I.e., just add the facility and the SNP bit - we will convert the rest
in time.
So that we can redesign this cleanly...
Thx.
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette
Powered by blists - more mailing lists