All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tom Lendacky <thomas.lendacky@amd.com>
To: Tycho Andersen <tycho@kernel.org>,
	Ashish Kalra <ashish.kalra@amd.com>,
	John Allen <john.allen@amd.com>,
	Herbert Xu <herbert@gondor.apana.org.au>,
	"David S . Miller" <davem@davemloft.net>
Cc: linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org,
	Alexey Kardashevskiy <aik@amd.com>
Subject: Re: [PATCH 2/2] crypto/ccp: narrow scope of snp_range_list
Date: Mon, 5 Jan 2026 11:43:17 -0600	[thread overview]
Message-ID: <620951cd-af90-46ca-83e8-5d9f625ecfbf@amd.com> (raw)
In-Reply-To: <20260105172218.39993-2-tycho@kernel.org>

On 1/5/26 11:22, Tycho Andersen wrote:
> From: "Tycho Andersen (AMD)" <tycho@kernel.org>
> 
> snp_range_list is only used in __sev_snp_init_locked() in the SNP_INIT_EX
> case, move the declaration there and add a __free() cleanup helper for it
> instead of waiting until shutdown.
> 
> Fixes: 1ca5614b84ee ("crypto: ccp: Add support to initialize the AMD-SP for SEV-SNP")
> Reviewed-by: Alexey Kardashevskiy <aik@amd.com>
> Signed-off-by: Tycho Andersen (AMD) <tycho@kernel.org>

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

> ---
>  drivers/crypto/ccp/sev-dev.c | 13 +------------
>  1 file changed, 1 insertion(+), 12 deletions(-)
> 
> diff --git a/drivers/crypto/ccp/sev-dev.c b/drivers/crypto/ccp/sev-dev.c
> index 6e6011e363e3..1cdadddb744e 100644
> --- a/drivers/crypto/ccp/sev-dev.c
> +++ b/drivers/crypto/ccp/sev-dev.c
> @@ -127,13 +127,6 @@ static size_t sev_es_tmr_size = SEV_TMR_SIZE;
>  #define NV_LENGTH (32 * 1024)
>  static void *sev_init_ex_buffer;
>  
> -/*
> - * SEV_DATA_RANGE_LIST:
> - *   Array containing range of pages that firmware transitions to HV-fixed
> - *   page state.
> - */
> -static struct sev_data_range_list *snp_range_list;
> -
>  static void __sev_firmware_shutdown(struct sev_device *sev, bool panic);
>  
>  static int snp_shutdown_on_panic(struct notifier_block *nb,
> @@ -1361,6 +1354,7 @@ static int snp_filter_reserved_mem_regions(struct resource *rs, void *arg)
>  
>  static int __sev_snp_init_locked(int *error, unsigned int max_snp_asid)
>  {
> +	struct sev_data_range_list *snp_range_list __free(kfree) = NULL;
>  	struct psp_device *psp = psp_master;
>  	struct sev_data_snp_init_ex data;
>  	struct sev_device *sev;
> @@ -2780,11 +2774,6 @@ static void __sev_firmware_shutdown(struct sev_device *sev, bool panic)
>  		sev_init_ex_buffer = NULL;
>  	}
>  
> -	if (snp_range_list) {
> -		kfree(snp_range_list);
> -		snp_range_list = NULL;
> -	}
> -
>  	__sev_snp_shutdown_locked(&error, panic);
>  }
>  


  reply	other threads:[~2026-01-05 17:43 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-05 17:22 [PATCH 1/2] crypto: ccp - Fix a case where SNP_SHUTDOWN is missed Tycho Andersen
2026-01-05 17:22 ` [PATCH 2/2] crypto/ccp: narrow scope of snp_range_list Tycho Andersen
2026-01-05 17:43   ` Tom Lendacky [this message]
2026-01-23  6:01 ` [PATCH 1/2] crypto: ccp - Fix a case where SNP_SHUTDOWN is missed Herbert Xu
2026-03-03 22:35 ` Guenter Roeck
2026-03-04 14:59   ` Tycho Andersen
2026-03-04 19:54     ` Guenter Roeck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=620951cd-af90-46ca-83e8-5d9f625ecfbf@amd.com \
    --to=thomas.lendacky@amd.com \
    --cc=aik@amd.com \
    --cc=ashish.kalra@amd.com \
    --cc=davem@davemloft.net \
    --cc=herbert@gondor.apana.org.au \
    --cc=john.allen@amd.com \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tycho@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.