Index | Thread | Search

From:
Aaron Debebe <aaron_debebe@genua.de>
Subject:
SEV: fix command id mask
To:
<tech@openbsd.org>
Cc:
<hshoexer@genua.de>
Date:
Tue, 13 Aug 2024 16:08:21 +0200

Download raw body.

Thread
Hi,

according to the AMD-SEV API spec (version 0.24), the mask for the
command id (`cmd`) is supposed to be of length 10 (Bits [25:16]),
rather than of length 6. This ensures that all command ids will be
properly processed by the PSP.

Cya,
aaron

-------------------------------------------------------------------
diff --git a/sys/dev/ic/ccp.c b/sys/dev/ic/ccp.c
index 79650a6c63a..d8f17735e3c 100644
--- a/sys/dev/ic/ccp.c
+++ b/sys/dev/ic/ccp.c
@@ -228,7 +228,7 @@ ccp_docmd(struct ccp_softc *sc, int cmd, uint64_t paddr)
 
 	plo = ((paddr >> 0) & 0xffffffff);
 	phi = ((paddr >> 32) & 0xffffffff);
-	cmdword = (cmd & 0x3f) << 16;
+	cmdword = (cmd & 0x3ff) << 16;
 	if (!cold)
 		cmdword |= PSP_CMDRESP_IOC;