Re: [PATCH v6 4/8] crypto: ccp: Fix uapi definitions of PSP errors

From: Tom Lendacky
Date: Wed Nov 13 2024 - 11:25:19 EST


On 11/12/24 17:22, Dionna Glaze wrote:
> From: Alexey Kardashevskiy <aik@xxxxxxx>
>
> Additions to the error enum after the explicit 0x27 setting for
> SEV_RET_INVALID_KEY leads to incorrect value assignments.
>
> Use explicit values to match the manufacturer specifications more
> clearly.
>
> Fixes: 3a45dc2b419e ("crypto: ccp: Define the SEV-SNP commands")
>
> CC: Sean Christopherson <seanjc@xxxxxxxxxx>
> CC: Paolo Bonzini <pbonzini@xxxxxxxxxx>
> CC: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
> CC: Ingo Molnar <mingo@xxxxxxxxxx>
> CC: Borislav Petkov <bp@xxxxxxxxx>
> CC: Dave Hansen <dave.hansen@xxxxxxxxxxxxxxx>
> CC: Ashish Kalra <ashish.kalra@xxxxxxx>
> CC: Tom Lendacky <thomas.lendacky@xxxxxxx>
> CC: John Allen <john.allen@xxxxxxx>
> CC: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
> CC: "David S. Miller" <davem@xxxxxxxxxxxxx>
> CC: Michael Roth <michael.roth@xxxxxxx>
> CC: Luis Chamberlain <mcgrof@xxxxxxxxxx>
> CC: Russ Weight <russ.weight@xxxxxxxxx>
> CC: Danilo Krummrich <dakr@xxxxxxxxxx>
> CC: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
> CC: "Rafael J. Wysocki" <rafael@xxxxxxxxxx>
> CC: Tianfei zhang <tianfei.zhang@xxxxxxxxx>
> CC: Alexey Kardashevskiy <aik@xxxxxxx>
> CC: stable@xxxxxxxxxxxxxxx
>
> Signed-off-by: Alexey Kardashevskiy <aik@xxxxxxx>
> Signed-off-by: Dionna Glaze <dionnaglaze@xxxxxxxxxx>

Reviewed-by: Tom Lendacky <thomas.lendacky@xxxxxxx>

> ---
> include/uapi/linux/psp-sev.h | 21 ++++++++++++++-------
> 1 file changed, 14 insertions(+), 7 deletions(-)
>
> diff --git a/include/uapi/linux/psp-sev.h b/include/uapi/linux/psp-sev.h
> index 832c15d9155bd..eeb20dfb1fdaa 100644
> --- a/include/uapi/linux/psp-sev.h
> +++ b/include/uapi/linux/psp-sev.h
> @@ -73,13 +73,20 @@ typedef enum {
> SEV_RET_INVALID_PARAM,
> SEV_RET_RESOURCE_LIMIT,
> SEV_RET_SECURE_DATA_INVALID,
> - SEV_RET_INVALID_KEY = 0x27,
> - SEV_RET_INVALID_PAGE_SIZE,
> - SEV_RET_INVALID_PAGE_STATE,
> - SEV_RET_INVALID_MDATA_ENTRY,
> - SEV_RET_INVALID_PAGE_OWNER,
> - SEV_RET_INVALID_PAGE_AEAD_OFLOW,
> - SEV_RET_RMP_INIT_REQUIRED,
> + SEV_RET_INVALID_PAGE_SIZE = 0x0019,
> + SEV_RET_INVALID_PAGE_STATE = 0x001A,
> + SEV_RET_INVALID_MDATA_ENTRY = 0x001B,
> + SEV_RET_INVALID_PAGE_OWNER = 0x001C,
> + SEV_RET_AEAD_OFLOW = 0x001D,
> + SEV_RET_EXIT_RING_BUFFER = 0x001F,
> + SEV_RET_RMP_INIT_REQUIRED = 0x0020,
> + SEV_RET_BAD_SVN = 0x0021,
> + SEV_RET_BAD_VERSION = 0x0022,
> + SEV_RET_SHUTDOWN_REQUIRED = 0x0023,
> + SEV_RET_UPDATE_FAILED = 0x0024,
> + SEV_RET_RESTORE_REQUIRED = 0x0025,
> + SEV_RET_RMP_INITIALIZATION_FAILED = 0x0026,
> + SEV_RET_INVALID_KEY = 0x0027,
> SEV_RET_MAX,
> } sev_ret_code;
>