Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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@kernel.org>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Reviewed-by: Tom Lendacky <thomas.lendacky@amd.com>
Link: https://patch.msgid.link/20260309180053.2389118-2-tycho@kernel.org

authored by

Tycho Andersen (AMD) and committed by
Borislav Petkov (AMD)
959d3f75 1f318b96

+6 -28
+6 -28
arch/x86/virt/svm/sev.c
··· 130 130 #undef pr_fmt 131 131 #define pr_fmt(fmt) "SEV-SNP: " fmt 132 132 133 - static int __mfd_enable(unsigned int cpu) 134 - { 135 - u64 val; 136 - 137 - if (!cc_platform_has(CC_ATTR_HOST_SEV_SNP)) 138 - return 0; 139 - 140 - rdmsrq(MSR_AMD64_SYSCFG, val); 141 - 142 - val |= MSR_AMD64_SYSCFG_MFDM; 143 - 144 - wrmsrq(MSR_AMD64_SYSCFG, val); 145 - 146 - return 0; 147 - } 148 - 149 133 static __init void mfd_enable(void *arg) 150 134 { 151 - __mfd_enable(smp_processor_id()); 135 + if (!cc_platform_has(CC_ATTR_HOST_SEV_SNP)) 136 + return; 137 + 138 + msr_set_bit(MSR_AMD64_SYSCFG, MSR_AMD64_SYSCFG_MFDM_BIT); 152 139 } 153 140 154 - static int __snp_enable(unsigned int cpu) 141 + static __init void snp_enable(void *arg) 155 142 { 156 143 u64 val; 157 144 158 145 if (!cc_platform_has(CC_ATTR_HOST_SEV_SNP)) 159 - return 0; 146 + return; 160 147 161 148 rdmsrq(MSR_AMD64_SYSCFG, val); 162 149 ··· 151 164 val |= MSR_AMD64_SYSCFG_SNP_VMPL_EN; 152 165 153 166 wrmsrq(MSR_AMD64_SYSCFG, val); 154 - 155 - return 0; 156 - } 157 - 158 - static __init void snp_enable(void *arg) 159 - { 160 - __snp_enable(smp_processor_id()); 161 167 } 162 168 163 169 static void __init __snp_fixup_e820_tables(u64 pa) ··· 533 553 on_each_cpu(snp_enable, NULL, 1); 534 554 535 555 skip_enable: 536 - cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, "x86/rmptable_init:online", __snp_enable, NULL); 537 - 538 556 /* 539 557 * Setting crash_kexec_post_notifiers to 'true' to ensure that SNP panic 540 558 * notifier is invoked to do SNP IOMMU shutdown before kdump.