]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
x86/fred: Fix early boot failures on SEV-ES/SNP guests
authorNikunj A Dadhania <nikunj@amd.com>
Wed, 18 Mar 2026 07:56:54 +0000 (07:56 +0000)
committerBorislav Petkov (AMD) <bp@alien8.de>
Mon, 23 Mar 2026 13:18:18 +0000 (14:18 +0100)
commit3645eb7e3915990a149460c151a00894cb586253
tree495902362d3ac5647dd81d769e8dff19e286ce65
parent411df123c017169922cc767affce76282b8e6c85
x86/fred: Fix early boot failures on SEV-ES/SNP guests

FRED-enabled SEV-(ES,SNP) guests fail to boot due to the following issues
in the early boot sequence:

* FRED does not have a #VC exception handler in the dispatch logic

* Early FRED #VC exceptions attempt to use uninitialized per-CPU GHCBs
  instead of boot_ghcb

Add X86_TRAP_VC case to fred_hwexc() with a new exc_vmm_communication()
function that provides the unified entry point FRED requires, dispatching
to existing user/kernel handlers based on privilege level. The function is
already declared via DECLARE_IDTENTRY_VC().

Fix early GHCB access by falling back to boot_ghcb in
__sev_{get,put}_ghcb() when per-CPU GHCBs are not yet initialized.

Fixes: 14619d912b65 ("x86/fred: FRED entry/exit and dispatch code")
Signed-off-by: Nikunj A Dadhania <nikunj@amd.com>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Reviewed-by: Tom Lendacky <thomas.lendacky@amd.com>
Cc: <stable@kernel.org> # 6.12+
Link: https://patch.msgid.link/20260318075654.1792916-4-nikunj@amd.com
arch/x86/coco/sev/noinstr.c
arch/x86/entry/entry_fred.c