Index | Thread | Search

From:
hshoexer <hshoexer@yerbouti.franken.de>
Subject:
SEV-SNP: Indicate SEV-SNP with sysctl machdep.vmmode
To:
tech@openbsd.org
Date:
Wed, 29 Jul 2026 15:54:27 +0200

Download raw body.

Thread
Hi,

this adds the SEV-SNP indication to sysctl machdep.vmmode node.

ok?

Take care,
HJ.

diff --git a/sys/arch/amd64/amd64/machdep.c b/sys/arch/amd64/amd64/machdep.c
index 00d9b97cfc0..f52fb83d803 100644
--- a/sys/arch/amd64/amd64/machdep.c
+++ b/sys/arch/amd64/amd64/machdep.c
@@ -575,7 +575,9 @@ cpu_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp,
 		return (sysctl_rdquad(oldp, oldlenp, newp, tsc_frequency));
 	case CPU_VMMODE:
 		if (ISSET(cpu_ecxfeature, CPUIDECX_HV)) {
-			if (ISSET(cpu_sev_guestmode, SEV_STAT_ES_ENABLED))
+			if (ISSET(cpu_sev_guestmode, SEV_STAT_SNP_ACTIVE))
+				strlcpy(vmmode, "SEV-SNP", sizeof(vmmode));
+			else if (ISSET(cpu_sev_guestmode, SEV_STAT_ES_ENABLED))
 				strlcpy(vmmode, "SEV-ES", sizeof(vmmode));
 			else if (ISSET(cpu_sev_guestmode, SEV_STAT_ENABLED))
 				strlcpy(vmmode, "SEV", sizeof(vmmode));