From: Alexey Kardashevskiy <aik@amd.com>
To: Ashish Kalra <Ashish.Kalra@amd.com>,
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, thomas.lendacky@amd.com,
john.allen@amd.com, herbert@gondor.apana.org.au,
davem@davemloft.net
Cc: michael.roth@amd.com, dionnaglaze@google.com,
kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-crypto@vger.kernel.org, linux-coco@lists.linux.dev
Subject: Re: [PATCH v2 7/9] crypto: ccp: Add new SEV/SNP platform initialization API
Date: Fri, 27 Dec 2024 21:25:12 +1100 [thread overview]
Message-ID: <2cbe9026-ce18-42c6-b8fd-750c55dde5a3@amd.com> (raw)
In-Reply-To: <a6e6bb0d16e70be61c1ecb2460c90803b937d42a.1734392473.git.ashish.kalra@amd.com>
On 17/12/24 10:59, Ashish Kalra wrote:
> From: Ashish Kalra <ashish.kalra@amd.com>
>
> Add new SNP platform initialization API to allow separate SEV and SNP
> initialization.
>
> Signed-off-by: Ashish Kalra <ashish.kalra@amd.com>
> ---
> drivers/crypto/ccp/sev-dev.c | 15 +++++++++++++++
> include/linux/psp-sev.h | 17 +++++++++++++++++
> 2 files changed, 32 insertions(+)
>
> diff --git a/drivers/crypto/ccp/sev-dev.c b/drivers/crypto/ccp/sev-dev.c
> index 001e7a401a6d..53c438b2b712 100644
> --- a/drivers/crypto/ccp/sev-dev.c
> +++ b/drivers/crypto/ccp/sev-dev.c
> @@ -1375,6 +1375,21 @@ int sev_platform_init(struct sev_platform_init_args *args)
> }
> EXPORT_SYMBOL_GPL(sev_platform_init);
>
> +int sev_snp_platform_init(struct sev_platform_init_args *args)
> +{
> + int rc;
> +
> + if (!psp_master || !psp_master->sev_data)
> + return -ENODEV;
> +
> + mutex_lock(&sev_cmd_mutex);
I'm told that in 2024 we should use guard(mutex)(&sev_cmd_mutex) and
drop explicit mutex_unlock(). I'm not a huge fan but there is a point :)
> + rc = __sev_snp_init_locked(&args->error);
> + mutex_unlock(&sev_cmd_mutex);
> +
> + return rc;
> +}
> +EXPORT_SYMBOL_GPL(sev_snp_platform_init);
> +
> static int __sev_platform_shutdown_locked(int *error)
> {
> struct psp_device *psp = psp_master;
> diff --git a/include/linux/psp-sev.h b/include/linux/psp-sev.h
> index 335b29b31457..e50643aef8a9 100644
> --- a/include/linux/psp-sev.h
> +++ b/include/linux/psp-sev.h
> @@ -828,6 +828,21 @@ struct sev_data_snp_commit {
> */
> int sev_platform_init(struct sev_platform_init_args *args);
>
> +/**
> + * sev_snp_platform_init - perform SNP INIT command
> + *
> + * @args: struct sev_platform_init_args to pass in arguments
> + *
> + * Returns:
> + * 0 if the SEV successfully processed the command
> + * -%ENODEV if the SNP support is not enabled
> + * -%ENOMEM if the SNP range list allocation failed
> + * -%E2BIG if the HV_Fixed list is too big
> + * -%ETIMEDOUT if the SEV command timed out
> + * -%EIO if the SEV returned a non-zero return code
The only caller ignores these, may be drop the returning value and print
the errors inside sev_snp_platform_init() (if whatever
__sev_snp_init_locked() already prints is not enough)?
Also, looks like 5/9 6/9 7/9 can be squashed into one patch, they touch
the same files, equally do nothing until later patches, pretty straight
forward. Thanks,
> + */
> +int sev_snp_platform_init(struct sev_platform_init_args *args);
> +
> /**
> * sev_platform_status - perform SEV PLATFORM_STATUS command
> *
> @@ -955,6 +970,8 @@ sev_platform_status(struct sev_user_data_status *status, int *error) { return -E
>
> static inline int sev_platform_init(struct sev_platform_init_args *args) { return -ENODEV; }
>
> +static inline int sev_snp_platform_init(struct sev_platform_init_args *args) { return -ENODEV; }
> +
> static inline int
> sev_guest_deactivate(struct sev_data_deactivate *data, int *error) { return -ENODEV; }
>
--
Alexey
next prev parent reply other threads:[~2024-12-27 10:25 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-16 23:56 [PATCH v2 0/9] Move initializing SEV/SNP functionality to KVM Ashish Kalra
2024-12-16 23:57 ` [PATCH v2 1/9] crypto: ccp: Move dev_info/err messages for SEV/SNP initialization Ashish Kalra
2024-12-27 8:58 ` Alexey Kardashevskiy
2024-12-16 23:57 ` [PATCH v2 2/9] crypto: ccp: Fix implicit SEV/SNP init and shutdown in ioctls Ashish Kalra
2024-12-27 8:59 ` Alexey Kardashevskiy
2024-12-16 23:58 ` [PATCH v2 3/9] crypto: ccp: Reset TMR size at SNP Shutdown Ashish Kalra
2024-12-27 9:07 ` Alexey Kardashevskiy
2025-01-03 17:00 ` Tom Lendacky
2025-01-07 2:59 ` Alexey Kardashevskiy
2024-12-16 23:58 ` [PATCH v2 4/9] crypto: ccp: Register SNP panic notifier only if SNP is enabled Ashish Kalra
2024-12-17 22:51 ` Dionna Amalie Glaze
2024-12-27 9:13 ` Alexey Kardashevskiy
2024-12-16 23:58 ` [PATCH v2 5/9] crypto: ccp: Add new SEV platform shutdown API Ashish Kalra
2024-12-16 23:59 ` [PATCH v2 6/9] crypto: ccp: Add new SEV/SNP " Ashish Kalra
2024-12-16 23:59 ` [PATCH v2 7/9] crypto: ccp: Add new SEV/SNP platform initialization API Ashish Kalra
2024-12-27 10:25 ` Alexey Kardashevskiy [this message]
2024-12-16 23:59 ` [PATCH v2 8/9] KVM: SVM: Add support to initialize SEV/SNP functionality in KVM Ashish Kalra
2024-12-27 10:36 ` Alexey Kardashevskiy
2024-12-17 0:00 ` [PATCH v2 9/9] crypto: ccp: Move SEV/SNP Platform initialization to KVM Ashish Kalra
2024-12-27 10:29 ` Alexey Kardashevskiy
2024-12-17 16:00 ` [PATCH v2 0/9] Move initializing SEV/SNP functionality " Dionna Amalie Glaze
2024-12-17 21:16 ` Kalra, Ashish
2024-12-17 21:37 ` Sean Christopherson
2024-12-17 23:16 ` Kalra, Ashish
2024-12-18 18:11 ` Daniel P. Berrangé
2024-12-18 19:10 ` Sean Christopherson
2024-12-19 1:11 ` Kalra, Ashish
2024-12-19 22:04 ` Kalra, Ashish
2024-12-19 23:12 ` Dionna Amalie Glaze
2024-12-20 8:49 ` Daniel P. Berrangé
2024-12-20 16:25 ` Sean Christopherson
2024-12-20 19:52 ` Kalra, Ashish
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=2cbe9026-ce18-42c6-b8fd-750c55dde5a3@amd.com \
--to=aik@amd.com \
--cc=Ashish.Kalra@amd.com \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=davem@davemloft.net \
--cc=dionnaglaze@google.com \
--cc=herbert@gondor.apana.org.au \
--cc=hpa@zytor.com \
--cc=john.allen@amd.com \
--cc=kvm@vger.kernel.org \
--cc=linux-coco@lists.linux.dev \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=michael.roth@amd.com \
--cc=mingo@redhat.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
all inboxes | Powered by JetHome®