RE: [PATCH 9/9] x86/hyperv: Remove hv_isolation_type_en_snp

Dexuan Cui
2023-08-16T04:15:06Z

> From: Dexuan Cui <decui@microsoft.com>
> Sent: Friday, August 11, 2023 3:19 PM
> To: ak@linux.intel.com; arnd@arndb.de; bp@alien8.de;
> ...
> In ms_hyperv_init_platform(), do not distinguish between a SNP VM with
> the paravisor and a SNP VM without the paravisor.
>
> Replace hv_isolation_type_en_snp() with
> !hyperv_paravisor_present && hv_isolation_type_snp().
>
> The hv_isolation_type_en_snp() in drivers/hv/hv.c and
> drivers/hv/hv_common.c can be changed to hv_isolation_type_snp() since
> we know !hyperv_paravisor_present is true there.
>
> Signed-off-by: Dexuan Cui <decui@microsoft.com>

Some of the existing hv_isolation_type_snp()'s need to test
hyperv_paravisor_present as well, e.g.

diff --git a/arch/x86/hyperv/hv_init.c b/arch/x86/hyperv/hv_init.c
@@ -52,7 +52,7 @@ static int hyperv_init_ghcb(void)
void *ghcb_va;
void **ghcb_base;

- if (!hv_isolation_type_snp())
+ if (!hyperv_paravisor_present || !hv_isolation_type_snp())
return 0;

if (!hv_ghcb_pg)

The new version of this patch is here:
https://github.com/dcui/tdx/commit/323de396984e3c222ded23dce46155ae48a1992a

After Tianyu posts his v6 of the fully enlightened SNP patchset,
I'll rebase to his patchset and post v2.