Index | Thread | Search

From:
Mike Larkin <mlarkin@nested.page>
Subject:
Re: SEV-SNP: Indicate SEV-SNP with sysctl machdep.vmmode
To:
tech@openbsd.org
Date:
Wed, 29 Jul 2026 09:40:02 -0700

Download raw body.

Thread
On Wed, Jul 29, 2026 at 03:54:27PM +0200, hshoexer wrote:
> Hi,
>
> this adds the SEV-SNP indication to sysctl machdep.vmmode node.
>
> ok?
>

ok mlarkin

> 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));
>