[PATCH 3/3] x86/sev: Distinguish CC-blob failures from generic SNP-unsupported

From: Kim Phillips

Date: Tue Nov 17 2026 - 17:34:02 EST


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@xxxxxxx>
---
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