mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Pratik R. Sampat" <prsampat@amd.com>
To: Shantanu Sinha <shansinha@google.com>, thomas.lendacky@amd.com
Cc: mcgrof@kernel.org, russ.weight@linux.dev, dakr@kernel.org,
	ashish.kalra@amd.com, herbert@gondor.apana.org.au,
	davem@davemloft.net, linux-crypto@vger.kernel.org,
	linux-kernel@vger.kernel.org, gregkh@linuxfoundation.org,
	rafael@kernel.org, chao.gao@intel.com, aik@amd.com,
	tycho@kernel.org, nikunj@amd.com, michael.roth@amd.com
Subject: Re: [Patch v3 7/7] crypto/ccp: Implement SNP Download Firmware EX
Date: Wed, 7 Oct 2026 11:36:29 -0400	[thread overview]
Message-ID: <27c4fc52-c565-4173-b2e4-714ffc90a0fe@amd.com> (raw)
In-Reply-To: <20261006210914.2708183-1-shansinha@google.com>



On 10/6/26 4:09 PM, Shantanu Sinha wrote:
> On 10/6/26 12:55 PM, Pratik R. Sampat wrote:
>> On 10/6/26 12:32 PM, Tom Lendacky wrote:
>>> On 10/6/26 11:41, Pratik R. Sampat wrote:
>>>> However, a fresh allocation with SNP initialized just goes through
>>>> rmp_mark_pages_firmware(), so my understanding of what the new firmware needs
>>>> is the reclaim -> make shared -> mark firmware cycle, not necessarily new
>>>> memory.
>>>
>>> Sounds like some good info to have as a comment above the call then.
> 
> I had looked at cycling briefly, but it gets tricky. If we reclaim the
> pages in sev_fw_upload_shutdown_platform() and re-init gets skipped
> because of RESTORE_REQUIRED or a dead PSP, the buffers are still
> allocated but aren't marked as firmware pages, so all subsequent paths
> need to be aware of that.
> 
> Reclaiming after the update avoids that, but relies on the new image
> accepting a reclaim of pages the old image's INIT left behind, which I'm
> not sure works, though I haven't tested it.
> 
> In either case, failure handling also seemed tricky, and the fallback
> would just be free and re-allocate anyway.

Agreed.

> 
> The only issue I see with freeing is that the TMR is a 2M buffer that
> needs to be contiguous. If the new allocation fails, INIT carries on
> without a TMR and without any error (it's only logged in dmesg), even
> though SEV-ES is now disabled. It should be very rare (since we did
> just free the TMR and can probably get the same block back), but it
> seems worth mentioning in a comment.

Sure, I can add this to the comment too.

> 
>>> The memory holding the firmware on the call to the ASP has to be
>>> contiguous, so you're likely to fail on the alloc_pages() if the image
>>> is too large. Up to you if you want to keep it.
> 
> I think it's better to keep the explicit check and error message. If the
> size check falls through to the alloc_pages() failure, userspace sees
> device-busy, which doesn't communicate the right intent.
> 

Ack.

> One other small thing. If the platform data refresh in
> sev_fw_upload_write() fails after DLFW_EX has succeeded, it returns
> hw-error even when the PSP is still alive and the new image is running.
> I may be missing a reason for that, but would something like this make
> sense?
> 
>  	if (sev_get_api_version()) {
> -		dev_err(sev->dev, "SNP platform data refresh after firmware update failed\n");
> -		return FW_UPLOAD_ERR_HW_ERROR;
> +		dev_warn(sev->dev, "SNP platform data refresh after firmware update failed\n");
> +		return psp_dead ? FW_UPLOAD_ERR_HW_ERROR : FW_UPLOAD_ERR_NONE;
>  	}
> 

I haven't typically seen this fail for any other reason apart from potentially
failing the PSP call but I do see a few paths where this could potentially
happen. So, only returning an error when PSP is dead makes sense to me.

> Apart from these, everything else I tested in v3 works on Milan.

Thanks, for testing this out!

--Pratik

> 
> Thanks,
> Shantanu


      reply	other threads:[~2026-10-07 15:39 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-05 16:15 [Patch v3 0/7] Implement SNP live firmware update support Pratik R. Sampat
2026-10-05 16:15 ` [Patch v3 1/7] firmware_loader: Stop pinning modules on registration Pratik R. Sampat
2026-10-05 16:15 ` [Patch v3 2/7] firmware_loader: Stop pinning parent device per workqueue invocation Pratik R. Sampat
2026-10-05 16:15 ` [Patch v3 3/7] treewide: firmware_loader: Drop the unused @module argument Pratik R. Sampat
2026-10-05 16:15 ` [Patch v3 4/7] crypto: ccp - Factor out the release of the SEV firmware buffers Pratik R. Sampat
2026-10-05 16:15 ` [Patch v3 5/7] crypto: ccp - Allow SNP platform data to be queried after SNP INIT Pratik R. Sampat
2026-10-06 14:45   ` Tom Lendacky
2026-10-06 14:50     ` Pratik R. Sampat
2026-10-05 16:15 ` [Patch v3 6/7] crypto/ccp: Register with fw_uploader and always fail Pratik R. Sampat
2026-10-06 20:24   ` Shantanu Sinha
2026-10-07 15:36     ` Pratik R. Sampat
2026-10-07 13:55   ` Tom Lendacky
2026-10-05 16:15 ` [Patch v3 7/7] crypto/ccp: Implement SNP Download Firmware EX Pratik R. Sampat
2026-10-06 16:10   ` Tom Lendacky
2026-10-06 16:41     ` Pratik R. Sampat
2026-10-06 17:32       ` Tom Lendacky
2026-10-06 17:55         ` Pratik R. Sampat
2026-10-06 21:09           ` Shantanu Sinha
2026-10-07 15:36             ` Pratik R. Sampat [this message]

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=27c4fc52-c565-4173-b2e4-714ffc90a0fe@amd.com \
    --to=prsampat@amd.com \
    --cc=aik@amd.com \
    --cc=ashish.kalra@amd.com \
    --cc=chao.gao@intel.com \
    --cc=dakr@kernel.org \
    --cc=davem@davemloft.net \
    --cc=gregkh@linuxfoundation.org \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mcgrof@kernel.org \
    --cc=michael.roth@amd.com \
    --cc=nikunj@amd.com \
    --cc=rafael@kernel.org \
    --cc=russ.weight@linux.dev \
    --cc=shansinha@google.com \
    --cc=thomas.lendacky@amd.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®