public inbox for linux-coco@lists.linux.dev
 help / color / mirror / Atom feed
From: Tom Lendacky <thomas.lendacky@amd.com>
To: Ashish Kalra <Ashish.Kalra@amd.com>,
	john.allen@amd.com, herbert@gondor.apana.org.au,
	davem@davemloft.net, bp@alien8.de
Cc: linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-coco@lists.linux.dev
Subject: Re: [PATCH] crypto: ccp - allow callers to use HV-Fixed page API when SEV is disabled
Date: Mon, 9 Feb 2026 16:42:08 -0600	[thread overview]
Message-ID: <d7b552b0-78d4-4d4d-a710-7366e23d80e0@amd.com> (raw)
In-Reply-To: <20260206212645.125485-1-Ashish.Kalra@amd.com>

On 2/6/26 15:26, Ashish Kalra wrote:
> From: Ashish Kalra <ashish.kalra@amd.com>
> 
> When SEV is disabled, the HV-Fixed page allocation call fails, which in
> turn causes SFS initialization to fail.
> 
> Fix the HV-Fixed API so callers (for example, SFS) can use it even when
> SEV is disabled by performing normal page allocation and freeing.
> 
> Fixes: e09701dcdd9c ("crypto: ccp - Add new HV-Fixed page allocation/free API")
> Cc: stable@vger.kernel.org
> Signed-off-by: Ashish Kalra <ashish.kalra@amd.com>

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

> ---
>  drivers/crypto/ccp/sev-dev.c | 10 ++++------
>  1 file changed, 4 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/crypto/ccp/sev-dev.c b/drivers/crypto/ccp/sev-dev.c
> index 1cdadddb744e..0d90b5f6a454 100644
> --- a/drivers/crypto/ccp/sev-dev.c
> +++ b/drivers/crypto/ccp/sev-dev.c
> @@ -1105,15 +1105,12 @@ struct page *snp_alloc_hv_fixed_pages(unsigned int num_2mb_pages)
>  {
>  	struct psp_device *psp_master = psp_get_master_device();
>  	struct snp_hv_fixed_pages_entry *entry;
> -	struct sev_device *sev;
>  	unsigned int order;
>  	struct page *page;
>  
> -	if (!psp_master || !psp_master->sev_data)
> +	if (!psp_master)
>  		return NULL;
>  
> -	sev = psp_master->sev_data;
> -
>  	order = get_order(PMD_SIZE * num_2mb_pages);
>  
>  	/*
> @@ -1126,7 +1123,8 @@ struct page *snp_alloc_hv_fixed_pages(unsigned int num_2mb_pages)
>  	 * This API uses SNP_INIT_EX to transition allocated pages to HV_Fixed
>  	 * page state, fail if SNP is already initialized.
>  	 */
> -	if (sev->snp_initialized)
> +	if (psp_master->sev_data &&
> +	    ((struct sev_device *)psp_master->sev_data)->snp_initialized)
>  		return NULL;
>  
>  	/* Re-use freed pages that match the request */
> @@ -1162,7 +1160,7 @@ void snp_free_hv_fixed_pages(struct page *page)
>  	struct psp_device *psp_master = psp_get_master_device();
>  	struct snp_hv_fixed_pages_entry *entry, *nentry;
>  
> -	if (!psp_master || !psp_master->sev_data)
> +	if (!psp_master)
>  		return;
>  
>  	/*


  reply	other threads:[~2026-02-09 22:42 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-06 21:26 [PATCH] crypto: ccp - allow callers to use HV-Fixed page API when SEV is disabled Ashish Kalra
2026-02-09 22:42 ` Tom Lendacky [this message]
2026-02-28  8:43 ` Herbert Xu

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=d7b552b0-78d4-4d4d-a710-7366e23d80e0@amd.com \
    --to=thomas.lendacky@amd.com \
    --cc=Ashish.Kalra@amd.com \
    --cc=bp@alien8.de \
    --cc=davem@davemloft.net \
    --cc=herbert@gondor.apana.org.au \
    --cc=john.allen@amd.com \
    --cc=linux-coco@lists.linux.dev \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox