Index | Thread | Search

From:
Hans-Jörg Höxer <hshoexer@genua.de>
Subject:
SEV-ES guest: Only claim early GHCB pages when we actuall are SEV-ES guest
To:
<tech@openbsd.org>
Date:
Tue, 1 Jul 2025 10:37:57 +0200

Download raw body.

Thread
Hi,

as suggested by bluhm@, only claim GHCB pages when we are actually
running SEV-ES guest mode.

Take care,
HJ.

---
commit d2444d09c945baad0e5d9283a50d466d7de7b400
Author: Hans-Joerg Hoexer <hshoexer@genua.de>
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