]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
x86/sev: Guard sev_evict_cache() with CONFIG_AMD_MEM_ENCRYPT
authorTom Lendacky <thomas.lendacky@amd.com>
Mon, 15 Sep 2025 16:04:12 +0000 (11:04 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 25 Sep 2025 09:16:49 +0000 (11:16 +0200)
commitc0603b80436d972d527e4c244b884b6e0bbf3465
tree57e1549808b3a0a6c5e51e19990ab8562e60280e
parent79a9ba8da904ad5432297a3791780b92512bf886
x86/sev: Guard sev_evict_cache() with CONFIG_AMD_MEM_ENCRYPT

commit 7f830e126dc357fc086905ce9730140fd4528d66 upstream.

The sev_evict_cache() is guest-related code and should be guarded by
CONFIG_AMD_MEM_ENCRYPT, not CONFIG_KVM_AMD_SEV.

CONFIG_AMD_MEM_ENCRYPT=y is required for a guest to run properly as an SEV-SNP
guest, but a guest kernel built with CONFIG_KVM_AMD_SEV=n would get the stub
function of sev_evict_cache() instead of the version that performs the actual
eviction. Move the function declarations under the appropriate #ifdef.

Fixes: 7b306dfa326f ("x86/sev: Evict cache lines during SNP memory validation")
Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Cc: stable@kernel.org # 6.16.x
Link: https://lore.kernel.org/r/70e38f2c4a549063de54052c9f64929705313526.1757708959.git.thomas.lendacky@amd.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/x86/include/asm/sev.h