From nobody Mon Mar 23 19:52:07 2026 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6BFD13ACF03; Mon, 23 Mar 2026 13:58:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774274308; cv=none; b=iY6L9fkbSJz7osmEpRcWSXOgQLypTw15UCE+JlfCEPTuExnmSxF6bFv67/EQlRscoMazheD8dl/PzTS9spYl1B0MzdGjpyeIUyIv3v75ZD8FgMRZlnYud6NFd27zf1MW3y1WxSER9KTqg+kl/kwaMXXdZ8JoUbx4LS7xF6Huzc4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774274308; c=relaxed/simple; bh=nb53tLTaUG19HY/EdzhjwALY3cMp54swfML5XbJ5v18=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=JBSbHKE2ENYPTDqfQUln9lfW12yDC1xAW8EQD34a7nQWafz1Mp+Y67/YRHEbX6fxxdfmPk4VTOuor6sGx5ElDrMB+mNAKkLEsxj+qBEoQKI8Y73gBFNFeJGtq88RRbeVatdi6LkrD9AgwxcaoUNcm0wh8xbfTuDJuet4v17lFdU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=xWxgHCVS; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=Ye6AtbAT; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="xWxgHCVS"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="Ye6AtbAT" Date: Mon, 23 Mar 2026 13:58:24 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1774274305; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=auPJi4/eQ8KkznSVZ2vXv3atiCow5puytv6+SXlWtXk=; b=xWxgHCVSZnawx1c6R3oMML7m1/3Q1iEUkJSxC3/+AP0LZHhKHpbu9MC3tNBWBi6G//vfoW CyztAmvbgJAyH7/La8pH+L7dLTY8STjaZWythbVis/2D1BtZ8EvT6CJEFJN/poshxhZ0Ri EVojT0IxyzJnDss9p/g4chRkj8Ssg8E18/JWEXCLrOaiHx7782h/p6jE2TYDusAADkOxUI EU8p30rbZVj/PwZQDIUpAaGKZ8SXnUJKcEIpIEkhRWlDvx7o/pfZcrDnXIWb9fz1xFZGGc Fa5J3/BaDDPsDzrjIzyo9rteVZzpo+zLiuFTe0Ez5kYX/mA9zdZQcMYcrMXmSw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1774274305; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=auPJi4/eQ8KkznSVZ2vXv3atiCow5puytv6+SXlWtXk=; b=Ye6AtbATzzm/Xwgh19SZBhXDNi/AULdVDmrF53rGxeNL/deEqXEnIeI9s2Ja7eYehWJvgC FC8Z57YXDtdCS5BA== From: "tip-bot2 for Nikunj A Dadhania" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/urgent] x86/fred: Fix early boot failures on SEV-ES/SNP guests Cc: Nikunj A Dadhania , "Borislav Petkov (AMD)" , Tom Lendacky , , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20260318075654.1792916-4-nikunj@amd.com> References: <20260318075654.1792916-4-nikunj@amd.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <177427430468.1647592.17086743256324859346.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Precedence: bulk Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable The following commit has been merged into the x86/urgent branch of tip: Commit-ID: 3645eb7e3915990a149460c151a00894cb586253 Gitweb: https://git.kernel.org/tip/3645eb7e3915990a149460c151a00894c= b586253 Author: Nikunj A Dadhania AuthorDate: Wed, 18 Mar 2026 07:56:54=20 Committer: Borislav Petkov (AMD) CommitterDate: Mon, 23 Mar 2026 14:18:18 +01:00 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 Signed-off-by: Borislav Petkov (AMD) Reviewed-by: Tom Lendacky Cc: # 6.12+ Link: https://patch.msgid.link/20260318075654.1792916-4-nikunj@amd.com --- arch/x86/coco/sev/noinstr.c | 6 ++++++ arch/x86/entry/entry_fred.c | 14 ++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/arch/x86/coco/sev/noinstr.c b/arch/x86/coco/sev/noinstr.c index 9d94aca..5afd663 100644 --- a/arch/x86/coco/sev/noinstr.c +++ b/arch/x86/coco/sev/noinstr.c @@ -121,6 +121,9 @@ noinstr struct ghcb *__sev_get_ghcb(struct ghcb_state *= state) =20 WARN_ON(!irqs_disabled()); =20 + if (!sev_cfg.ghcbs_initialized) + return boot_ghcb; + data =3D this_cpu_read(runtime_data); ghcb =3D &data->ghcb_page; =20 @@ -164,6 +167,9 @@ noinstr void __sev_put_ghcb(struct ghcb_state *state) =20 WARN_ON(!irqs_disabled()); =20 + if (!sev_cfg.ghcbs_initialized) + return; + data =3D this_cpu_read(runtime_data); ghcb =3D &data->ghcb_page; =20 diff --git a/arch/x86/entry/entry_fred.c b/arch/x86/entry/entry_fred.c index 88c757a..fbe2d10 100644 --- a/arch/x86/entry/entry_fred.c +++ b/arch/x86/entry/entry_fred.c @@ -177,6 +177,16 @@ static noinstr void fred_extint(struct pt_regs *regs) } } =20 +#ifdef CONFIG_AMD_MEM_ENCRYPT +noinstr void exc_vmm_communication(struct pt_regs *regs, unsigned long err= or_code) +{ + if (user_mode(regs)) + return user_exc_vmm_communication(regs, error_code); + else + return kernel_exc_vmm_communication(regs, error_code); +} +#endif + static noinstr void fred_hwexc(struct pt_regs *regs, unsigned long error_c= ode) { /* Optimize for #PF. That's the only exception which matters performance = wise */ @@ -207,6 +217,10 @@ static noinstr void fred_hwexc(struct pt_regs *regs, u= nsigned long error_code) #ifdef CONFIG_X86_CET case X86_TRAP_CP: return exc_control_protection(regs, error_code); #endif +#ifdef CONFIG_AMD_MEM_ENCRYPT + case X86_TRAP_VC: return exc_vmm_communication(regs, error_code); +#endif + default: return fred_bad_type(regs, error_code); } =20