[PATCH] crypto: ccp: Add additional information about an SEV firmware upgrade

Tom Lendacky posted 1 patch 1 year, 5 months ago
drivers/crypto/ccp/sev-dev.c | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
[PATCH] crypto: ccp: Add additional information about an SEV firmware upgrade
Posted by Tom Lendacky 1 year, 5 months ago
Print additional information, in the form of the old and new versions of
the SEV firmware, so that it can be seen what the base firmware was before
the upgrade.

Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
---
 drivers/crypto/ccp/sev-dev.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/drivers/crypto/ccp/sev-dev.c b/drivers/crypto/ccp/sev-dev.c
index 9810edbb272d..3b89f23afcd7 100644
--- a/drivers/crypto/ccp/sev-dev.c
+++ b/drivers/crypto/ccp/sev-dev.c
@@ -1629,8 +1629,6 @@ static int sev_update_firmware(struct device *dev)
 
 	if (ret)
 		dev_dbg(dev, "Failed to update SEV firmware: %#x\n", error);
-	else
-		dev_info(dev, "SEV firmware update successful\n");
 
 	__free_pages(p, order);
 
@@ -2382,6 +2380,7 @@ void sev_pci_init(void)
 {
 	struct sev_device *sev = psp_master->sev_data;
 	struct sev_platform_init_args args = {0};
+	u8 api_major, api_minor, build;
 	int rc;
 
 	if (!sev)
@@ -2392,9 +2391,19 @@ void sev_pci_init(void)
 	if (sev_get_api_version())
 		goto err;
 
+	api_major = sev->api_major;
+	api_minor = sev->api_minor;
+	build     = sev->build;
+
 	if (sev_update_firmware(sev->dev) == 0)
 		sev_get_api_version();
 
+	if (api_major != sev->api_major || api_minor != sev->api_minor ||
+	    build != sev->build)
+		dev_info(sev->dev, "SEV firmware updated from %d.%d.%d to %d.%d.%d\n",
+			 api_major, api_minor, build,
+			 sev->api_major, sev->api_minor, sev->build);
+
 	/* Initialize the platform */
 	args.probe = true;
 	rc = sev_platform_init(&args);
-- 
2.43.2
Re: [PATCH] crypto: ccp: Add additional information about an SEV firmware upgrade
Posted by Herbert Xu 1 year, 5 months ago
On Wed, Aug 14, 2024 at 03:42:40PM -0500, Tom Lendacky wrote:
> Print additional information, in the form of the old and new versions of
> the SEV firmware, so that it can be seen what the base firmware was before
> the upgrade.
> 
> Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
> ---
>  drivers/crypto/ccp/sev-dev.c | 13 +++++++++++--
>  1 file changed, 11 insertions(+), 2 deletions(-)

Patch applied.  Thanks.
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
Re: [PATCH] crypto: ccp: Add additional information about an SEV firmware upgrade
Posted by Kalra, Ashish 1 year, 5 months ago
On 8/14/2024 3:42 PM, Tom Lendacky wrote:

> Print additional information, in the form of the old and new versions of
> the SEV firmware, so that it can be seen what the base firmware was before
> the upgrade.
>
> Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
> ---
>  drivers/crypto/ccp/sev-dev.c | 13 +++++++++++--
>  1 file changed, 11 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/crypto/ccp/sev-dev.c b/drivers/crypto/ccp/sev-dev.c
> index 9810edbb272d..3b89f23afcd7 100644
> --- a/drivers/crypto/ccp/sev-dev.c
> +++ b/drivers/crypto/ccp/sev-dev.c
> @@ -1629,8 +1629,6 @@ static int sev_update_firmware(struct device *dev)
>  
>  	if (ret)
>  		dev_dbg(dev, "Failed to update SEV firmware: %#x\n", error);
> -	else
> -		dev_info(dev, "SEV firmware update successful\n");
>  
>  	__free_pages(p, order);
>  
> @@ -2382,6 +2380,7 @@ void sev_pci_init(void)
>  {
>  	struct sev_device *sev = psp_master->sev_data;
>  	struct sev_platform_init_args args = {0};
> +	u8 api_major, api_minor, build;
>  	int rc;
>  
>  	if (!sev)
> @@ -2392,9 +2391,19 @@ void sev_pci_init(void)
>  	if (sev_get_api_version())
>  		goto err;
>  
> +	api_major = sev->api_major;
> +	api_minor = sev->api_minor;
> +	build     = sev->build;
> +
>  	if (sev_update_firmware(sev->dev) == 0)
>  		sev_get_api_version();
>  
> +	if (api_major != sev->api_major || api_minor != sev->api_minor ||
> +	    build != sev->build)
> +		dev_info(sev->dev, "SEV firmware updated from %d.%d.%d to %d.%d.%d\n",
> +			 api_major, api_minor, build,
> +			 sev->api_major, sev->api_minor, sev->build);
> +
>  	/* Initialize the platform */
>  	args.probe = true;
>  	rc = sev_platform_init(&args);
Reviewed-by: Ashish Kalra <ashish.kalra@amd.com>