From 685bac510b52571edd08c51a862f4c26658a3504 Mon Sep 17 00:00:00 2001 From: Changyuan Lyu Date: Tue, 1 Dec 2026 21:28:13 -0800 Subject: [PATCH] fix(x86): mask CPUID_USER_DIS in SEV-SNP CPUID leaf 0x8000_0021 Linux 6.18 KVM_GET_SUPPORTED_CPUID sets bit 17 (CPUID_USER_DIS / X86_FEATURE_GP_ON_USER_CPUID) in CPUID leaf 0x8000_0021 EAX, which AMD SEV-SNP firmware rejects during SNP_LAUNCH_UPDATE for the CPUID page. Define CpuidExt21EAx::CPUID_USER_DIS (1 << 17) and clear it alongside NO_SMM_CTL_MSR in snp_adjust_cpuids(). Signed-off-by: Changyuan Lyu --- alioth/src/arch/x86_64/cpuid.rs | 1 + alioth/src/board/board_amd64/sev.rs | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/alioth/src/arch/x86_64/cpuid.rs b/alioth/src/arch/x86_64/cpuid.rs index 9cf93e28..5859b33b 100644 --- a/alioth/src/arch/x86_64/cpuid.rs +++ b/alioth/src/arch/x86_64/cpuid.rs @@ -71,5 +71,6 @@ bitfield! { bitflags! { pub struct CpuidExt21EAx(u32) { NO_SMM_CTL_MSR = 1 << 9; + CPUID_USER_DIS = 1 << 17; } } diff --git a/alioth/src/board/board_amd64/sev.rs b/alioth/src/board/board_amd64/sev.rs index b0a8db04..5e45ac11 100644 --- a/alioth/src/board/board_amd64/sev.rs +++ b/alioth/src/board/board_amd64/sev.rs @@ -94,7 +94,7 @@ fn snp_adjust_cpuids(cpuids: &mut HashMap) { index: None, }; if let Some(out) = cpuids.get_mut(&in_) { - out.eax &= !CpuidExt21EAx::NO_SMM_CTL_MSR.bits(); + out.eax &= !(CpuidExt21EAx::NO_SMM_CTL_MSR | CpuidExt21EAx::CPUID_USER_DIS).bits(); } for index in 0..=4 {