From: Mike Larkin Subject: Re: SEV-SNP: Log SEV-SNP guestmode To: tech@openbsd.org Date: Wed, 29 Jul 2026 09:39:46 -0700 On Wed, Jul 29, 2026 at 03:51:58PM +0200, hshoexer wrote: > Hi, > > this diff is the first of series of diffs, that enable SEV-SNP guest > support for OpenBSD. > > NB: The definition SEV_STAT_SNP_ACTIVE is straight from the AMD > documentation. The use of "active" instead of "enabled" -- as with > the other definitions -- feels inconsistent. However, "SNP enabled" > in the context of SNP means the host system is able to run VMs using > SNP. And "SNP active" means, the guest is actually using SNP. And > not just e.g. SEV-ES. > > ok? > ok mlarkin > --------------------------------------------- > diff --git a/sys/arch/amd64/amd64/identcpu.c b/sys/arch/amd64/amd64/identcpu.c > index 51e8344d573..6c56d584eb0 100644 > --- a/sys/arch/amd64/amd64/identcpu.c > +++ b/sys/arch/amd64/amd64/identcpu.c > @@ -712,10 +712,13 @@ identifycpu(struct cpu_info *ci) > CPUID_AMDSEV_EDX_BITS); > amd64_pos_cbit = (ci->ci_feature_amdsev_ebx & 0x3f); > amd64_min_noes_asid = ci->ci_feature_amdsev_edx; > - if (cpu_sev_guestmode && CPU_IS_PRIMARY(ci)) > + if (cpu_sev_guestmode && CPU_IS_PRIMARY(ci)) { > printf("\n%s: SEV%s guest mode", ci->ci_dev->dv_xname, > - ISSET(cpu_sev_guestmode, SEV_STAT_ES_ENABLED) ? > - "-ES" : ""); > + ISSET(cpu_sev_guestmode, SEV_STAT_SNP_ACTIVE) ? > + "-SNP" : > + (ISSET(cpu_sev_guestmode, SEV_STAT_ES_ENABLED) ? > + "-ES" : "")); > + } > } > > printf("\n"); > diff --git a/sys/arch/amd64/include/specialreg.h b/sys/arch/amd64/include/specialreg.h > index 5240f19351a..299c8fbc6c4 100644 > --- a/sys/arch/amd64/include/specialreg.h > +++ b/sys/arch/amd64/include/specialreg.h > @@ -737,6 +737,7 @@ > #define MSR_SEV_STATUS 0xc0010131 > #define SEV_STAT_ENABLED 0x00000001 > #define SEV_STAT_ES_ENABLED 0x00000002 > +#define SEV_STAT_SNP_ACTIVE 0x00000004 > > #define MSR_LS_CFG 0xc0011020 > #define LS_CFG_DIS_LS2_SQUISH 0x02000000 >