From: Tom Lendacky <thomas.lendacky@amd.com>
To: Ashish Kalra <Ashish.Kalra@amd.com>,
corbet@lwn.net, seanjc@google.com, pbonzini@redhat.com,
tglx@linutronix.de, mingo@redhat.com, bp@alien8.de,
dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com,
john.allen@amd.com, herbert@gondor.apana.org.au,
davem@davemloft.net, akpm@linux-foundation.org,
rostedt@goodmis.org, paulmck@kernel.org
Cc: nikunj@amd.com, Neeraj.Upadhyay@amd.com, aik@amd.com,
ardb@kernel.org, michael.roth@amd.com, arnd@arndb.de,
linux-doc@vger.kernel.org, linux-crypto@vger.kernel.org,
linux-kernel@vger.kernel.org, kvm@vger.kernel.org
Subject: Re: [PATCH v5 5/7] crypto: ccp - Add support to enable CipherTextHiding on SNP_INIT_EX
Date: Mon, 7 Jul 2025 11:49:19 -0500 [thread overview]
Message-ID: <a3c5017f-d9bf-828f-90e1-61d0c1add14f@amd.com> (raw)
In-Reply-To: <68885411fddfdba2fe0c3ab023dc5d5eb108689b.1751397223.git.ashish.kalra@amd.com>
On 7/1/25 15:15, Ashish Kalra wrote:
> From: Ashish Kalra <ashish.kalra@amd.com>
>
> Ciphertext hiding needs to be enabled on SNP_INIT_EX.
How about:
In order for ciphertext hiding to be enabled, it must be specified on
the SNP_INIT_EX command as part of SNP initialization.
>
> Enhance sev_platform_init_args by adding a new argument that enables the
> KVM module to specify whether the Ciphertext Hiding feature should be
> activated during SNP initialization. Additionally, this argument will
> allow for the definition of the maximum ASID that can be used for an
> SEV-SNP guest when Ciphertext Hiding is enabled.
Modify the sev_platform_init_args structure used as input to
sev_platform_init(), to add a field that, when non-zero, indicates
ciphertext hiding should be enabled and indicates the maximum ASID that
can be used for an SEV-SNP guest.
I think that reads a bit cleaner and clearer.
>
> Signed-off-by: Ashish Kalra <ashish.kalra@amd.com>
> ---
> drivers/crypto/ccp/sev-dev.c | 12 +++++++++---
> include/linux/psp-sev.h | 10 ++++++++--
> 2 files changed, 17 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/crypto/ccp/sev-dev.c b/drivers/crypto/ccp/sev-dev.c
> index 3f2bbba93617..c883ccf8c3ff 100644
> --- a/drivers/crypto/ccp/sev-dev.c
> +++ b/drivers/crypto/ccp/sev-dev.c
> @@ -1186,7 +1186,7 @@ static int snp_filter_reserved_mem_regions(struct resource *rs, void *arg)
> return 0;
> }
>
> -static int __sev_snp_init_locked(int *error)
> +static int __sev_snp_init_locked(int *error, unsigned int max_snp_asid)
> {
> struct psp_device *psp = psp_master;
> struct sev_data_snp_init_ex data;
> @@ -1247,6 +1247,12 @@ static int __sev_snp_init_locked(int *error)
> }
>
> memset(&data, 0, sizeof(data));
> +
> + if (max_snp_asid) {
> + data.ciphertext_hiding_en = 1;
> + data.max_snp_asid = max_snp_asid;
> + }
> +
> data.init_rmp = 1;
> data.list_paddr_en = 1;
> data.list_paddr = __psp_pa(snp_range_list);
> @@ -1433,7 +1439,7 @@ static int _sev_platform_init_locked(struct sev_platform_init_args *args)
> if (sev->sev_plat_status.state == SEV_STATE_INIT)
> return 0;
>
> - rc = __sev_snp_init_locked(&args->error);
> + rc = __sev_snp_init_locked(&args->error, args->max_snp_asid);
> if (rc && rc != -ENODEV)
> return rc;
>
> @@ -1516,7 +1522,7 @@ static int snp_move_to_init_state(struct sev_issue_cmd *argp, bool *shutdown_req
> {
> int error, rc;
>
> - rc = __sev_snp_init_locked(&error);
> + rc = __sev_snp_init_locked(&error, 0);
> if (rc) {
> argp->error = SEV_RET_INVALID_PLATFORM_STATE;
> return rc;
> diff --git a/include/linux/psp-sev.h b/include/linux/psp-sev.h
> index ca19fddfcd4d..b6eda9c560ee 100644
> --- a/include/linux/psp-sev.h
> +++ b/include/linux/psp-sev.h
> @@ -748,10 +748,13 @@ struct sev_data_snp_guest_request {
> struct sev_data_snp_init_ex {
> u32 init_rmp:1;
> u32 list_paddr_en:1;
> - u32 rsvd:30;
> + u32 rapl_dis:1;
> + u32 ciphertext_hiding_en:1;
> + u32 rsvd:28;
> u32 rsvd1;
> u64 list_paddr;
> - u8 rsvd2[48];
> + u16 max_snp_asid;
> + u8 rsvd2[46];
> } __packed;
>
> /**
> @@ -800,10 +803,13 @@ struct sev_data_snp_shutdown_ex {
> * @probe: True if this is being called as part of CCP module probe, which
> * will defer SEV_INIT/SEV_INIT_EX firmware initialization until needed
> * unless psp_init_on_probe module param is set
> + * @max_snp_asid: maximum ASID usable for SEV-SNP guest if
> + * CipherTextHiding feature is to be enabled
when non-zero, enable ciphertext hiding and specify the maximum ASID
that can be used for an SEV-SNP guest.
Thanks,
Tom
> */
> struct sev_platform_init_args {
> int error;
> bool probe;
> + unsigned int max_snp_asid;
> };
>
> /**
next prev parent reply other threads:[~2025-07-07 16:49 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-01 20:14 [PATCH v5 0/7] Add SEV-SNP CipherTextHiding feature support Ashish Kalra
2025-07-01 20:14 ` [PATCH v5 1/7] crypto: ccp - New bit-field definitions for SNP_PLATFORM_STATUS command Ashish Kalra
2025-07-01 20:15 ` [PATCH v5 2/7] crypto: ccp - Cache SEV platform status and platform state Ashish Kalra
2025-07-07 15:37 ` Tom Lendacky
2025-07-01 20:15 ` [PATCH v5 3/7] crypto: ccp - Add support for SNP_FEATURE_INFO command Ashish Kalra
2025-07-07 16:01 ` Tom Lendacky
2025-07-01 20:15 ` [PATCH v5 4/7] crypto: ccp - Introduce new API interface to indicate SEV-SNP Ciphertext hiding feature Ashish Kalra
2025-07-07 16:19 ` Tom Lendacky
2025-07-01 20:15 ` [PATCH v5 5/7] crypto: ccp - Add support to enable CipherTextHiding on SNP_INIT_EX Ashish Kalra
2025-07-07 16:49 ` Tom Lendacky [this message]
2025-07-01 20:16 ` [PATCH v5 6/7] KVM: SEV: Introduce new min,max sev_es and sev_snp asid variables Ashish Kalra
2025-07-07 16:57 ` Tom Lendacky
2025-07-01 20:16 ` [PATCH v5 7/7] KVM: SEV: Add SEV-SNP CipherTextHiding support Ashish Kalra
2025-07-02 21:46 ` Kim Phillips
2025-07-02 22:43 ` Kalra, Ashish
2025-07-07 6:16 ` Kalra, Ashish
2025-07-07 21:32 ` Kim Phillips
2025-07-07 17:35 ` Tom Lendacky
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=a3c5017f-d9bf-828f-90e1-61d0c1add14f@amd.com \
--to=thomas.lendacky@amd.com \
--cc=Ashish.Kalra@amd.com \
--cc=Neeraj.Upadhyay@amd.com \
--cc=aik@amd.com \
--cc=akpm@linux-foundation.org \
--cc=ardb@kernel.org \
--cc=arnd@arndb.de \
--cc=bp@alien8.de \
--cc=corbet@lwn.net \
--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-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=michael.roth@amd.com \
--cc=mingo@redhat.com \
--cc=nikunj@amd.com \
--cc=paulmck@kernel.org \
--cc=pbonzini@redhat.com \
--cc=rostedt@goodmis.org \
--cc=seanjc@google.com \
--cc=tglx@linutronix.de \
--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;
as well as URLs for NNTP newsgroup(s).