Re: [PATCH v10 13/50] crypto: ccp: Define the SEV-SNP commands

From: Borislav Petkov
Date: Fri Nov 24 2023 - 09:37:27 EST


On Mon, Oct 16, 2023 at 08:27:42AM -0500, Michael Roth wrote:
> diff --git a/include/linux/psp-sev.h b/include/linux/psp-sev.h
> index 7fd17e82bab4..a7f92e74564d 100644
> --- a/include/linux/psp-sev.h
> +++ b/include/linux/psp-sev.h
> @@ -78,6 +78,36 @@ enum sev_cmd {
> SEV_CMD_DBG_DECRYPT = 0x060,
> SEV_CMD_DBG_ENCRYPT = 0x061,
>
> + /* SNP specific commands */
> + SEV_CMD_SNP_INIT = 0x81,

The other commands start with "0x0" - pls do that too here or unify with
a pre-patch.

> + SEV_CMD_SNP_SHUTDOWN = 0x82,
> + SEV_CMD_SNP_PLATFORM_STATUS = 0x83,
> + SEV_CMD_SNP_DF_FLUSH = 0x84,
> + SEV_CMD_SNP_INIT_EX = 0x85,
> + SEV_CMD_SNP_SHUTDOWN_EX = 0x86,
> + SEV_CMD_SNP_DECOMMISSION = 0x90,
> + SEV_CMD_SNP_ACTIVATE = 0x91,
> + SEV_CMD_SNP_GUEST_STATUS = 0x92,
> + SEV_CMD_SNP_GCTX_CREATE = 0x93,
> + SEV_CMD_SNP_GUEST_REQUEST = 0x94,
> + SEV_CMD_SNP_ACTIVATE_EX = 0x95,
> + SEV_CMD_SNP_LAUNCH_START = 0xA0,
> + SEV_CMD_SNP_LAUNCH_UPDATE = 0xA1,
> + SEV_CMD_SNP_LAUNCH_FINISH = 0xA2,
> + SEV_CMD_SNP_DBG_DECRYPT = 0xB0,
> + SEV_CMD_SNP_DBG_ENCRYPT = 0xB1,
> + SEV_CMD_SNP_PAGE_SWAP_OUT = 0xC0,
> + SEV_CMD_SNP_PAGE_SWAP_IN = 0xC1,
> + SEV_CMD_SNP_PAGE_MOVE = 0xC2,
> + SEV_CMD_SNP_PAGE_MD_INIT = 0xC3,
> + SEV_CMD_SNP_PAGE_SET_STATE = 0xC6,
> + SEV_CMD_SNP_PAGE_RECLAIM = 0xC7,
> + SEV_CMD_SNP_PAGE_UNSMASH = 0xC8,
> + SEV_CMD_SNP_CONFIG = 0xC9,
> + SEV_CMD_SNP_DOWNLOAD_FIRMWARE_EX = 0xCA,

You don't have to vertically align those to a different column due to
this command's name not fitting - just do:

SEV_CMD_SNP_CONFIG = 0x0C9,
SEV_CMD_SNP_DOWNLOAD_FIRMWARE_EX = 0x0CA,
SEV_CMD_SNP_COMMIT = 0x0CB,




> + SEV_CMD_SNP_COMMIT = 0xCB,
> + SEV_CMD_SNP_VLEK_LOAD = 0xCD,
> +
> SEV_CMD_MAX,
> };

...

> +/**
> + * struct sev_data_snp_launch_start - SNP_LAUNCH_START command params
> + *
> + * @gctx_addr: system physical address of guest context page
> + * @policy: guest policy
> + * @ma_gctx_addr: system physical address of migration agent
> + * @imi_en: launch flow is launching an IMI for the purpose of

What is an "IMI"?

Define it once for the readers pls.

--
Regards/Gruss,
Boris.

https://people.kernel.org/tglx/notes-about-netiquette