summaryrefslogtreecommitdiff
path: root/arch/x86/kernel/cpu
diff options
context:
space:
mode:
authorDexuan Cui <decui@microsoft.com>2023-08-24 11:07:11 +0300
committerWei Liu <wei.liu@kernel.org>2023-08-25 03:04:57 +0300
commite3131f1c81448a87e08dffd21867312a5ce563d9 (patch)
treefff8b96a8664d6478e41917a305c53bcc7a79048 /arch/x86/kernel/cpu
parentb9b4fe3a72b60c8d74a9ffb61aa778f04eaddd87 (diff)
downloadlinux-e3131f1c81448a87e08dffd21867312a5ce563d9.tar.xz
x86/hyperv: Remove hv_isolation_type_en_snp
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 !ms_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 !ms_hyperv.paravisor_present is true there. Signed-off-by: Dexuan Cui <decui@microsoft.com> Reviewed-by: Michael Kelley <mikelley@microsoft.com> Reviewed-by: Tianyu Lan <tiala@microsoft.com> Signed-off-by: Wei Liu <wei.liu@kernel.org> Link: https://lore.kernel.org/r/20230824080712.30327-10-decui@microsoft.com
Diffstat (limited to 'arch/x86/kernel/cpu')
-rw-r--r--arch/x86/kernel/cpu/mshyperv.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/arch/x86/kernel/cpu/mshyperv.c b/arch/x86/kernel/cpu/mshyperv.c
index 4f51dac9eeb2..b63590ffc777 100644
--- a/arch/x86/kernel/cpu/mshyperv.c
+++ b/arch/x86/kernel/cpu/mshyperv.c
@@ -304,7 +304,7 @@ static void __init hv_smp_prepare_cpus(unsigned int max_cpus)
* Override wakeup_secondary_cpu_64 callback for SEV-SNP
* enlightened guest.
*/
- if (hv_isolation_type_en_snp()) {
+ if (!ms_hyperv.paravisor_present && hv_isolation_type_snp()) {
apic->wakeup_secondary_cpu_64 = hv_snp_boot_ap;
return;
}
@@ -440,10 +440,7 @@ static void __init ms_hyperv_init_platform(void)
if (hv_get_isolation_type() == HV_ISOLATION_TYPE_SNP) {
- if (ms_hyperv.paravisor_present)
- static_branch_enable(&isolation_type_snp);
- else
- static_branch_enable(&isolation_type_en_snp);
+ static_branch_enable(&isolation_type_snp);
} else if (hv_get_isolation_type() == HV_ISOLATION_TYPE_TDX) {
static_branch_enable(&isolation_type_tdx);
@@ -556,7 +553,8 @@ static void __init ms_hyperv_init_platform(void)
# ifdef CONFIG_SMP
smp_ops.smp_prepare_boot_cpu = hv_smp_prepare_boot_cpu;
- if (hv_root_partition || hv_isolation_type_en_snp())
+ if (hv_root_partition ||
+ (!ms_hyperv.paravisor_present && hv_isolation_type_snp()))
smp_ops.smp_prepare_cpus = hv_smp_prepare_cpus;
# endif