public inbox for linux-crypto@vger.kernel.org
 help / color / mirror / Atom feed
From: "Kalra, Ashish" <ashish.kalra@amd.com>
To: Tom Lendacky <thomas.lendacky@amd.com>,
	tglx@linutronix.de, mingo@redhat.com, bp@alien8.de,
	dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com,
	seanjc@google.com, pbonzini@redhat.com,
	herbert@gondor.apana.org.au
Cc: nikunj@amd.com, davem@davemloft.net, aik@amd.com,
	ardb@kernel.org, john.allen@amd.com, michael.roth@amd.com,
	Neeraj.Upadhyay@amd.com, linux-kernel@vger.kernel.org,
	kvm@vger.kernel.org, linux-crypto@vger.kernel.org
Subject: Re: [PATCH v3 3/3] crypto: ccp - Add AMD Seamless Firmware Servicing (SFS) driver
Date: Mon, 8 Sep 2025 16:32:24 -0500	[thread overview]
Message-ID: <e32770ac-2bc8-4e09-aad2-0fc219abfc8b@amd.com> (raw)
In-Reply-To: <3c96491c-dceb-2a6d-9c7c-b5faf663a184@amd.com>

Hello Tom,

On 9/8/2025 4:18 PM, Tom Lendacky wrote:
> On 8/20/25 17:19, Ashish Kalra wrote:
>> From: Ashish Kalra <ashish.kalra@amd.com>
>>
>> AMD Seamless Firmware Servicing (SFS) is a secure method to allow
>> non-persistent updates to running firmware and settings without
>> requiring BIOS reflash and/or system reset.
>>
>> SFS does not address anything that runs on the x86 processors and
>> it can be used to update ASP firmware, modules, register settings
>> and update firmware for other microprocessors like TMPM, etc.
>>
>> SFS driver support adds ioctl support to communicate the SFS
>> commands to the ASP/PSP by using the TEE mailbox interface.
>>
>> The Seamless Firmware Servicing (SFS) driver is added as a
>> PSP sub-device.
>>
>> For detailed information, please look at the SFS specifications:
>> https://www.amd.com/content/dam/amd/en/documents/epyc-technical-docs/specifications/58604.pdf
>>
>> Signed-off-by: Ashish Kalra <ashish.kalra@amd.com>
>> ---
>>  drivers/crypto/ccp/Makefile         |   3 +-
>>  drivers/crypto/ccp/psp-dev.c        |  20 ++
>>  drivers/crypto/ccp/psp-dev.h        |   8 +-
>>  drivers/crypto/ccp/sfs.c            | 302 ++++++++++++++++++++++++++++
>>  drivers/crypto/ccp/sfs.h            |  47 +++++
>>  include/linux/psp-platform-access.h |   2 +
>>  include/uapi/linux/psp-sfs.h        |  87 ++++++++
>>  7 files changed, 467 insertions(+), 2 deletions(-)
>>  create mode 100644 drivers/crypto/ccp/sfs.c
>>  create mode 100644 drivers/crypto/ccp/sfs.h
>>  create mode 100644 include/uapi/linux/psp-sfs.h
>>
> 
>> +
>> +	/*
>> +	 * SFS command buffer must be mapped as non-cacheable.
>> +	 */
>> +	ret = set_memory_uc((unsigned long)sfs_dev->command_buf, SFS_NUM_PAGES_CMDBUF);
>> +	if (ret) {
>> +		dev_dbg(dev, "Set memory uc failed\n");
>> +		goto cleanup_cmd_buf;
>> +	}
> 

Yes, i was restoring the memory attribute before freeing, but then i realized that if the buffer
is transitioned to HV_Fixed and can't be freed but can still potentially be re-used then who will
setup the buffer to Uncacheable again, but i guess that should not be an issue as SFS driver will 
do that setup again after being unloaded/reloaded again, so i will go ahead and restore the memory
attribute here and in sfs_dev_destroy().

Thanks,
Ashish

> You should restore the memory attribute before freeing it in
> sfs_dev_destroy() and below in the cleanup.
> 
> Thanks,
> Tom
> 
>> +
>> +	dev_dbg(dev, "Command buffer 0x%px marked uncacheable\n", sfs_dev->command_buf);
>> +
>> +	psp->sfs_data = sfs_dev;
>> +	sfs_dev->dev = dev;
>> +	sfs_dev->psp = psp;
>> +
>> +	ret = sfs_misc_init(sfs_dev);
>> +	if (ret)
>> +		goto cleanup_cmd_buf;
>> +
>> +	dev_notice(sfs_dev->dev, "SFS support is available\n");
>> +
>> +	return 0;
>> +
>> +cleanup_cmd_buf:
>> +	snp_free_hv_fixed_pages(page);
>> +
>> +cleanup_dev:
>> +	psp->sfs_data = NULL;
>> +	devm_kfree(dev, sfs_dev);
>> +
>> +	return ret;
>> +}

      reply	other threads:[~2025-09-08 21:32 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-20 22:17 [PATCH v3 0/3] crypto: ccp - Add AMD Seamless Firmware Servicing (SFS) driver Ashish Kalra
2025-08-20 22:19 ` [PATCH v3 1/3] x86/sev: Add new dump_rmp parameter to snp_leak_pages() API Ashish Kalra
2025-08-20 22:19 ` [PATCH v3 2/3] crypto: ccp - Add new HV-Fixed page allocation/free API Ashish Kalra
2025-09-08 20:59   ` Tom Lendacky
2025-08-20 22:19 ` [PATCH v3 3/3] crypto: ccp - Add AMD Seamless Firmware Servicing (SFS) driver Ashish Kalra
2025-09-08 21:18   ` Tom Lendacky
2025-09-08 21:32     ` Kalra, Ashish [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=e32770ac-2bc8-4e09-aad2-0fc219abfc8b@amd.com \
    --to=ashish.kalra@amd.com \
    --cc=Neeraj.Upadhyay@amd.com \
    --cc=aik@amd.com \
    --cc=ardb@kernel.org \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=davem@davemloft.net \
    --cc=herbert@gondor.apana.org.au \
    --cc=hpa@zytor.com \
    --cc=john.allen@amd.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=michael.roth@amd.com \
    --cc=mingo@redhat.com \
    --cc=nikunj@amd.com \
    --cc=pbonzini@redhat.com \
    --cc=seanjc@google.com \
    --cc=tglx@linutronix.de \
    --cc=thomas.lendacky@amd.com \
    --cc=x86@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