linux/arch/x86/coco/sev
Nikunj A Dadhania 3645eb7e39 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: 14619d912b ("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
2026-03-23 14:18:18 +01:00
..
core.c x86/sev: Allow IBPB-on-Entry feature for SNP guests 2026-03-02 11:08:59 +01:00
internal.h x86/sev: Rename sev_es_ghcb_handle_msr() to __vc_handle_msr() 2026-01-19 15:23:48 +01:00
Makefile - Make the SEV internal header really internal and carve out the SVSM-specific 2026-02-10 19:19:06 -08:00
noinstr.c x86/fred: Fix early boot failures on SEV-ES/SNP guests 2026-03-23 14:18:18 +01:00
svsm.c x86/sev: Carve out the SVSM code into a separate compilation unit 2025-12-31 13:18:23 +01:00
vc-handle.c x86/sev: Rename sev_es_ghcb_handle_msr() to __vc_handle_msr() 2026-01-19 15:23:48 +01:00
vc-shared.c x86/coco/sev: Convert has_cpuflag() to use cpu_feature_enabled() 2025-11-11 16:42:31 +01:00