From: Mike Larkin Subject: Re: SEV-ES guest: Only claim early GHCB pages when we actuall are SEV-ES guest To: tech@openbsd.org Date: Wed, 2 Jul 2025 11:47:12 -0700 On Tue, Jul 01, 2025 at 10:37:57AM +0200, Hans-Jörg Höxer wrote: > Hi, > > as suggested by bluhm@, only claim GHCB pages when we are actually > running SEV-ES guest mode. > I think this is overoptimization but ok mlarkin if this is the way you want to head. -ml > Take care, > HJ. > > --- > commit d2444d09c945baad0e5d9283a50d466d7de7b400 > Author: Hans-Joerg Hoexer > Date: Mon Jun 30 15:29:35 2025 +0200 > > SEV-ES guest: Only claim early GHCB pages when we actuall are SEV-ES guest > > diff --git a/sys/arch/amd64/amd64/machdep.c b/sys/arch/amd64/amd64/machdep.c > index 9b0badd610d..e0e8862d375 100644 > --- a/sys/arch/amd64/amd64/machdep.c > +++ b/sys/arch/amd64/amd64/machdep.c > @@ -1470,9 +1470,10 @@ init_x86_64(paddr_t first_avail) > /* > * locore0 mapped 2 pages for use as GHCB before pmap is initialized. > */ > - if (ISSET(cpu_sev_guestmode, SEV_STAT_ES_ENABLED)) > + if (ISSET(cpu_sev_guestmode, SEV_STAT_ES_ENABLED)) { > cpu_init_early_vctrap(first_avail); > - first_avail += 2 * NBPG; > + first_avail += 2 * NBPG; > + } > > /* > * locore0 mapped 3 pages for use before the pmap is initialized