[tip: x86/sev] x86/virt/sev: Drop support for SNP hotplug
From: tip-bot2 for Tycho Andersen (AMD)
Date: Tue Mar 10 2026 - 06:47:51 EST
The following commit has been merged into the x86/sev branch of tip:
Commit-ID: 959d3f7565352fab844ae73a722631c5f615427f
Gitweb: https://git.kernel.org/tip/959d3f7565352fab844ae73a722631c5f615427f
Author: Tycho Andersen (AMD) <tycho@xxxxxxxxxx>
AuthorDate: Mon, 09 Mar 2026 12:00:43 -06:00
Committer: Borislav Petkov (AMD) <bp@xxxxxxxxx>
CommitterDate: Mon, 09 Mar 2026 21:48:33 +01:00
x86/virt/sev: Drop support for SNP hotplug
During an SNP_INIT(_EX), the SEV firmware checks that all CPUs have the SNP
syscfg bit set, and fails if they do not. As such, it does not make
sense to have offline CPUs: the firmware will fail initialization because
of the offlined ones that the kernel did not initialize.
Further, there is a bug: during SNP_INIT(_EX) the firmware requires the MFDM
syscfg bit to be set in addition to having SNP enabled, which the previous
hotplug code did not do. Since k8_check_syscfg_dram_mod_en() enforces this
be cleared, hotplug wouldn't work.
Signed-off-by: Tycho Andersen (AMD) <tycho@xxxxxxxxxx>
Signed-off-by: Borislav Petkov (AMD) <bp@xxxxxxxxx>
Reviewed-by: Tom Lendacky <thomas.lendacky@xxxxxxx>
Link: https://patch.msgid.link/20260309180053.2389118-2-tycho@xxxxxxxxxx
---
arch/x86/virt/svm/sev.c | 32 +++++---------------------------
1 file changed, 5 insertions(+), 27 deletions(-)
diff --git a/arch/x86/virt/svm/sev.c b/arch/x86/virt/svm/sev.c
index a4f3a36..f404c60 100644
--- a/arch/x86/virt/svm/sev.c
+++ b/arch/x86/virt/svm/sev.c
@@ -130,33 +130,20 @@ static unsigned long snp_nr_leaked_pages;
#undef pr_fmt
#define pr_fmt(fmt) "SEV-SNP: " fmt
-static int __mfd_enable(unsigned int cpu)
+static __init void mfd_enable(void *arg)
{
- u64 val;
-
if (!cc_platform_has(CC_ATTR_HOST_SEV_SNP))
- return 0;
-
- rdmsrq(MSR_AMD64_SYSCFG, val);
-
- val |= MSR_AMD64_SYSCFG_MFDM;
-
- wrmsrq(MSR_AMD64_SYSCFG, val);
+ return;
- return 0;
+ msr_set_bit(MSR_AMD64_SYSCFG, MSR_AMD64_SYSCFG_MFDM_BIT);
}
-static __init void mfd_enable(void *arg)
-{
- __mfd_enable(smp_processor_id());
-}
-
-static int __snp_enable(unsigned int cpu)
+static __init void snp_enable(void *arg)
{
u64 val;
if (!cc_platform_has(CC_ATTR_HOST_SEV_SNP))
- return 0;
+ return;
rdmsrq(MSR_AMD64_SYSCFG, val);
@@ -164,13 +151,6 @@ static int __snp_enable(unsigned int cpu)
val |= MSR_AMD64_SYSCFG_SNP_VMPL_EN;
wrmsrq(MSR_AMD64_SYSCFG, val);
-
- return 0;
-}
-
-static __init void snp_enable(void *arg)
-{
- __snp_enable(smp_processor_id());
}
static void __init __snp_fixup_e820_tables(u64 pa)
@@ -553,8 +533,6 @@ int __init snp_rmptable_init(void)
on_each_cpu(snp_enable, NULL, 1);
skip_enable:
- cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, "x86/rmptable_init:online", __snp_enable, NULL);
-
/*
* Setting crash_kexec_post_notifiers to 'true' to ensure that SNP panic
* notifier is invoked to do SNP IOMMU shutdown before kdump.