Index | Thread | Search

From:
Hans-Jörg Höxer <Hans-Joerg_Hoexer@genua.de>
Subject:
Re: SEV: fix command id mask
To:
Aaron Debebe <aaron_debebe@genua.de>
Cc:
<tech@openbsd.org>, <Hans-Joerg_Hoexer@genua.de>
Date:
Tue, 13 Aug 2024 16:18:11 +0200

Download raw body.

Thread
Hi,

On Tue, Aug 13, 2024 at 04:08:21PM +0200, Aaron Debebe wrote:
> ...
> 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.

yes, you're right!  The mask should be 0x3ff.

Thanks!

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