Re: [PATCH V2 1/9] x86/hyperv: Add sev-snp enlightened guest static key

From: Tianyu Lan
Date: Wed Jul 05 2023 - 10:43:51 EST


On 7/4/2023 10:17 PM, Michael Kelley (LINUX) wrote:
From: Tianyu Lan <ltykernel@xxxxxxxxx> Sent: Monday, June 26, 2023 8:23 PM

Introduce static key isolation_type_en_snp for enlightened
sev-snp guest check.

Signed-off-by: Tianyu Lan <tiala@xxxxxxxxxxxxx>
---
arch/x86/hyperv/ivm.c | 11 +++++++++++
arch/x86/include/asm/mshyperv.h | 3 +++
arch/x86/kernel/cpu/mshyperv.c | 9 +++++++--
drivers/hv/hv_common.c | 6 ++++++
include/asm-generic/mshyperv.h | 12 +++++++++---
5 files changed, 36 insertions(+), 5 deletions(-)

diff --git a/arch/x86/hyperv/ivm.c b/arch/x86/hyperv/ivm.c
index cc92388b7a99..5d3ee3124e00 100644
--- a/arch/x86/hyperv/ivm.c
+++ b/arch/x86/hyperv/ivm.c
@@ -409,3 +409,14 @@ bool hv_isolation_type_snp(void)
{
return static_branch_unlikely(&isolation_type_snp);
}
+
+DEFINE_STATIC_KEY_FALSE(isolation_type_en_snp);
+/*
+ * hv_isolation_type_en_snp - Check system runs in the AMD SEV-SNP based
+ * isolation enlightened VM.
+ */
+bool hv_isolation_type_en_snp(void)
+{
+ return static_branch_unlikely(&isolation_type_en_snp);
+}
+

Vitaly had suggested some renaming of this and related variables and
functions, which you had agreed to do. But I don't see that renaming
reflected in this patch or throughout the full patch set.


Hi Michael:
Thanks for your review. I am preparing a separating patchset to rework hv_isolation_type_en_snp() and hv_isolation_type_snp() according to Vitaly suggestion because it will touch more files and not affect SEV-SNP function.

Thanks.