]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
x86/sev: Separate MSR and GHCB based snp_cpuid() via a callback
authorArd Biesheuvel <ardb@kernel.org>
Thu, 28 Aug 2025 10:22:04 +0000 (12:22 +0200)
committerBorislav Petkov (AMD) <bp@alien8.de>
Thu, 28 Aug 2025 14:52:05 +0000 (16:52 +0200)
commite2e29752357f32feb69a68e9e6e7361405b3f289
treeba3d1295d204d30c4f7bc249d5680b7fd1a6eb68
parent1b237f190eb3d36f52dffe07a40b5eb210280e00
x86/sev: Separate MSR and GHCB based snp_cpuid() via a callback

There are two distinct callers of snp_cpuid(): the MSR protocol and the GHCB
page based interface.

The snp_cpuid() logic does not care about the distinction, which only matters
at a lower level. But the fact that it supports both interfaces means that the
GHCB page based logic is pulled into the early startup code where PA to VA
conversions are problematic, given that it runs from the 1:1 mapping of memory.

So keep snp_cpuid() itself in the startup code, but factor out the hypervisor
calls via a callback, so that the GHCB page handling can be moved out.

Code refactoring only - no functional change intended.

Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Reviewed-by: Tom Lendacky <thomas.lendacky@amd.com>
Link: https://lore.kernel.org/20250828102202.1849035-25-ardb+git@google.com
arch/x86/boot/startup/sev-shared.c
arch/x86/coco/sev/vc-shared.c
arch/x86/include/asm/sev.h