All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kim Phillips <kim.phillips@amd.com>
To: Sean Christopherson <seanjc@google.com>,
	Paolo Bonzini <pbonzini@redhat.com>,
	K Prateek Nayak <kprateek.nayak@amd.com>,
	"Nikunj A Dadhania" <nikunj@amd.com>,
	Tom Lendacky <thomas.lendacky@amd.com>,
	"Michael Roth" <michael.roth@amd.com>,
	Borislav Petkov <borislav.petkov@amd.com>,
	Borislav Petkov <bp@alien8.de>, Naveen Rao <naveen.rao@amd.com>,
	Dave Hansen <dave.hansen@linux.intel.com>, <tglx@kernel.org>,
	<mingo@redhat.com>, <ardb@kernel.org>, <hpa@zytor.com>
Cc: <linux-kernel@vger.kernel.org>, <x86@kernel.org>,
	<kvm@vger.kernel.org>, Kim Phillips <kim.phillips@amd.com>,
	Nathan Fontenot <nathan.fontenot@amd.com>
Subject: [PATCH 3/3] x86/sev: Distinguish CC-blob failures from generic SNP-unsupported
Date: Tue, 17 Nov 2026 16:32:57 -0600	[thread overview]
Message-ID: <20261117223257.748178-4-kim.phillips@amd.com> (raw)
In-Reply-To: <20261117223257.748178-1-kim.phillips@amd.com>

Both find_cc_blob() implementations terminate with GHCB_SNP_UNSUPPORTED
when the Confidential Computing blob they located has a bad header magic.
That reason code is otherwise used for a hypervisor that genuinely does
not support SNP, so a corrupt or misplaced blob - a firmware or bootloader
bug in the guest's own boot chain - is indistinguishable from an
unsupported host.

Add a GHCB_TERM_CC_BLOB Linux-specific reason code and use it for the two
invalid-blob-magic checks. The sites that truly represent an
unsupported-SNP hypervisor, including the CC-blob/SNP-enablement
discrepancy check in sme_enable(), are left on GHCB_SNP_UNSUPPORTED.

Signed-off-by: Kim Phillips <kim.phillips@amd.com>
---
 arch/x86/boot/compressed/sev.c      | 2 +-
 arch/x86/boot/startup/sev-startup.c | 2 +-
 arch/x86/include/asm/sev-common.h   | 1 +
 3 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/arch/x86/boot/compressed/sev.c b/arch/x86/boot/compressed/sev.c
index c6512f2ea31e..2deaf8bfaaa7 100644
--- a/arch/x86/boot/compressed/sev.c
+++ b/arch/x86/boot/compressed/sev.c
@@ -274,7 +274,7 @@ static struct cc_blob_sev_info *find_cc_blob(struct boot_params *bp)
 
 found_cc_info:
 	if (cc_info->magic != CC_BLOB_SEV_HDR_MAGIC)
-		sev_es_terminate(SEV_TERM_SET_GEN, GHCB_SNP_UNSUPPORTED);
+		sev_es_terminate(SEV_TERM_SET_LINUX, GHCB_TERM_CC_BLOB);
 
 	return cc_info;
 }
diff --git a/arch/x86/boot/startup/sev-startup.c b/arch/x86/boot/startup/sev-startup.c
index 789e99d38d17..75b40aefb856 100644
--- a/arch/x86/boot/startup/sev-startup.c
+++ b/arch/x86/boot/startup/sev-startup.c
@@ -145,7 +145,7 @@ static struct cc_blob_sev_info *__init find_cc_blob(struct boot_params *bp)
 
 found_cc_info:
 	if (cc_info->magic != CC_BLOB_SEV_HDR_MAGIC)
-		sev_es_terminate(SEV_TERM_SET_GEN, GHCB_SNP_UNSUPPORTED);
+		sev_es_terminate(SEV_TERM_SET_LINUX, GHCB_TERM_CC_BLOB);
 
 	return cc_info;
 }
diff --git a/arch/x86/include/asm/sev-common.h b/arch/x86/include/asm/sev-common.h
index 3717796c4673..ee251fa5e266 100644
--- a/arch/x86/include/asm/sev-common.h
+++ b/arch/x86/include/asm/sev-common.h
@@ -212,6 +212,7 @@ struct snp_psc_desc {
 #define GHCB_TERM_VC_FAIL		13	/* #VC exception handling failure */
 #define GHCB_TERM_GHCB_SETUP		14	/* GHCB setup/mapping failure */
 #define GHCB_TERM_NEGOTIATE		15	/* HV GHCB protocol negotiation failure */
+#define GHCB_TERM_CC_BLOB		16	/* CC blob header magic is invalid */
 
 #define GHCB_RESP_CODE(v)		((v) & GHCB_MSR_INFO_MASK)
 
-- 
2.43.0


      parent reply	other threads:[~2026-11-17 22:33 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-17 22:32 [PATCH 0/3] x86/sev: Make guest termination reasons identifiable Kim Phillips
2026-11-17 22:32 ` [PATCH 1/3] x86/sev: Report distinct termination reasons for generic requests Kim Phillips
2026-11-17 22:45   ` sashiko-bot
2026-11-17 22:32 ` [PATCH 2/3] x86/sev: Report distinct termination reasons in do_vc_no_ghcb() Kim Phillips
2026-11-17 22:32 ` Kim Phillips [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261117223257.748178-4-kim.phillips@amd.com \
    --to=kim.phillips@amd.com \
    --cc=ardb@kernel.org \
    --cc=borislav.petkov@amd.com \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=kprateek.nayak@amd.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=michael.roth@amd.com \
    --cc=mingo@redhat.com \
    --cc=nathan.fontenot@amd.com \
    --cc=naveen.rao@amd.com \
    --cc=nikunj@amd.com \
    --cc=pbonzini@redhat.com \
    --cc=seanjc@google.com \
    --cc=tglx@kernel.org \
    --cc=thomas.lendacky@amd.com \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.