Re: [Patch v5 7/7] crypto: ccp - Implement SNP Download Firmware EX
From: Pratik R. Sampat
Date: Wed Nov 11 2026 - 15:21:22 EST
On 11/11/26 5:57 AM, Herbert Xu wrote:
> On Wed, Oct 21, 2026 at 05:05:03PM +0000, Pratik R. Sampat wrote:
>> Implement SNP live firmware update using the DOWNLOAD_FIRMWARE_EX
>> command.
>>
>> DOWNLOAD_FIRMWARE_EX requires the legacy SEV platform to be UNINIT. If
>> it is WORKING then legacy guests are running and the update is refused
>> as busy. If it is INIT, shut it down, release the buffers the firmware
>> owns across that shutdown, run the update, and bring the platform back
>> up afterwards. SNP is never taken down, so SNP guests are unaffected.
>>
>> To test run the following with your sbin file in FW:
>>
>> echo 1 > /sys/class/firmware/sev/loading
>> cat <firmware.sbin> > /sys/class/firmware/sev/data
>> echo 0 > /sys/class/firmware/sev/loading
>>
>> The COMMIT bit is left clear, so the image is only loaded provisionally
>> and the admin decides when to make it permanent with ioctl(/dev/sev,
>> SNP_COMMIT). To roll back, do not commit and upload the previous image
>> the same way.
>>
>> Co-developed-by: Tycho Andersen (AMD) <tycho@xxxxxxxxxx>
>> Signed-off-by: Tycho Andersen (AMD) <tycho@xxxxxxxxxx>
>> Signed-off-by: Pratik R. Sampat <prsampat@xxxxxxx>
>> ---
>> v4..v5:
>> * Report original firmware error on rollback failure - Tycho, Shantanu
>> ---
>> drivers/crypto/ccp/sev-dev.c | 297 ++++++++++++++++++++++++++++++++++-
>> drivers/crypto/ccp/sev-dev.h | 2 +
>> include/linux/psp-sev.h | 19 +++
>> 3 files changed, 317 insertions(+), 1 deletion(-)
>
> Sashiko has a comment on this patch:
>
> https://sashiko.dev/#/patchset/cover.1792599491.git.prsampat%40amd.com
>
Thanks for pointing them out, I had missed looking at Sashiko.
I'll refresh the platform status before sev_fw_upload_reinit_platform() to fix
the stale version report.
Calling sev_get_api_version (or a new __locked version rather) before re-init
should also close the short race window.
I'll respin the patches with these changes.
Thanks!
--Pratik
> Thanks,