From: Tom Lendacky <thomas.lendacky@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, 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 v3 1/7] crypto: ccp: Move dev_info/err messages for SEV/SNP initialization
Date: Tue, 7 Jan 2025 08:29:46 -0600 [thread overview]
Message-ID: <47ea6ab2-b802-3953-2e4a-7c90c54b0f46@amd.com> (raw)
In-Reply-To: <707efae1123d13115bd8517324b58c763e9377d8.1735931639.git.ashish.kalra@amd.com>
On 1/3/25 13:59, Ashish Kalra wrote:
> From: Ashish Kalra <ashish.kalra@amd.com>
>
> Remove dev_info and dev_err messages related to SEV/SNP initialization
> from callers and instead move those inside __sev_platform_init_locked()
> and __sev_snp_init_locked().
>
> This allows both _sev_platform_init_locked() and various SEV/SNP ioctls
> to call __sev_platform_init_locked() and __sev_snp_init_locked() for
> implicit SEV/SNP initialization and shutdown without additionally
> printing any errors/success messages.
This doesn't take into account Alexey's comment about which command
failed. I agree with him and you shouldn't use a common exit point.
Thanks,
Tom
>
> Signed-off-by: Ashish Kalra <ashish.kalra@amd.com>
> ---
> drivers/crypto/ccp/sev-dev.c | 23 ++++++++++++++++++-----
> 1 file changed, 18 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/crypto/ccp/sev-dev.c b/drivers/crypto/ccp/sev-dev.c
> index af018afd9cd7..1c1c33d3ed9a 100644
> --- a/drivers/crypto/ccp/sev-dev.c
> +++ b/drivers/crypto/ccp/sev-dev.c
> @@ -1177,19 +1177,27 @@ static int __sev_snp_init_locked(int *error)
>
> rc = __sev_do_cmd_locked(cmd, arg, error);
> if (rc)
> - return rc;
> + goto err;
>
> /* Prepare for first SNP guest launch after INIT. */
> wbinvd_on_all_cpus();
> rc = __sev_do_cmd_locked(SEV_CMD_SNP_DF_FLUSH, NULL, error);
> if (rc)
> - return rc;
> + goto err;
>
> sev->snp_initialized = true;
> dev_dbg(sev->dev, "SEV-SNP firmware initialized\n");
>
> + dev_info(sev->dev, "SEV-SNP API:%d.%d build:%d\n", sev->api_major,
> + sev->api_minor, sev->build);
> +
> sev_es_tmr_size = SNP_TMR_SIZE;
>
> + return 0;
> +
> +err:
> + dev_err(sev->dev, "SEV-SNP: failed to INIT rc %d, error %#x\n",
> + rc, *error);
> return rc;
> }
>
> @@ -1268,7 +1276,7 @@ static int __sev_platform_init_locked(int *error)
>
> rc = __sev_platform_init_handle_init_ex_path(sev);
> if (rc)
> - return rc;
> + goto err;
>
> rc = __sev_do_init_locked(&psp_ret);
> if (rc && psp_ret == SEV_RET_SECURE_DATA_INVALID) {
> @@ -1288,7 +1296,7 @@ static int __sev_platform_init_locked(int *error)
> *error = psp_ret;
>
> if (rc)
> - return rc;
> + goto err;
>
> sev->state = SEV_STATE_INIT;
>
> @@ -1296,7 +1304,7 @@ static int __sev_platform_init_locked(int *error)
> wbinvd_on_all_cpus();
> rc = __sev_do_cmd_locked(SEV_CMD_DF_FLUSH, NULL, error);
> if (rc)
> - return rc;
> + goto err;
>
> dev_dbg(sev->dev, "SEV firmware initialized\n");
>
> @@ -1304,6 +1312,11 @@ static int __sev_platform_init_locked(int *error)
> sev->api_minor, sev->build);
>
> return 0;
> +
> +err:
> + dev_err(sev->dev, "SEV: failed to INIT error %#x, rc %d\n",
> + psp_ret, rc);
> + return rc;
> }
>
> static int _sev_platform_init_locked(struct sev_platform_init_args *args)
next prev parent reply other threads:[~2025-01-07 14:29 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-03 19:58 [PATCH v3 0/7] Move initializing SEV/SNP functionality to KVM Ashish Kalra
2025-01-03 19:59 ` [PATCH v3 1/7] crypto: ccp: Move dev_info/err messages for SEV/SNP initialization Ashish Kalra
2025-01-06 17:17 ` Dionna Amalie Glaze
2025-01-06 23:08 ` Kalra, Ashish
2025-01-07 14:29 ` Tom Lendacky [this message]
2025-01-03 20:00 ` [PATCH v3 2/7] crypto: ccp: Fix implicit SEV/SNP init and shutdown in ioctls Ashish Kalra
2025-01-06 18:01 ` Dionna Amalie Glaze
2025-01-06 23:48 ` Kalra, Ashish
2025-01-07 19:08 ` Kalra, Ashish
2025-01-07 3:29 ` Alexey Kardashevskiy
2025-01-07 18:53 ` Kalra, Ashish
2025-01-03 20:00 ` [PATCH v3 3/7] crypto: ccp: Reset TMR size at SNP Shutdown Ashish Kalra
2025-01-03 20:00 ` [PATCH v3 4/7] crypto: ccp: Register SNP panic notifier only if SNP is enabled Ashish Kalra
2025-01-06 19:08 ` Dionna Amalie Glaze
2025-01-03 20:01 ` [PATCH v3 5/7] crypto: ccp: Add new SEV/SNP platform shutdown API Ashish Kalra
2025-01-06 19:14 ` Dionna Amalie Glaze
2025-01-03 20:01 ` [PATCH v3 6/7] KVM: SVM: Add support to initialize SEV/SNP functionality in KVM Ashish Kalra
2025-01-07 16:42 ` Tom Lendacky
2025-01-07 18:34 ` Kalra, Ashish
2025-01-07 20:56 ` Kalra, Ashish
2025-01-08 17:22 ` Tom Lendacky
2025-01-09 0:27 ` Kalra, Ashish
2025-01-10 22:41 ` Kalra, Ashish
2025-01-11 0:40 ` Sean Christopherson
2025-01-11 0:41 ` Dionna Amalie Glaze
2025-01-11 0:49 ` Sean Christopherson
2025-01-13 15:03 ` Kalra, Ashish
2025-01-14 21:14 ` Kalra, Ashish
2025-01-14 22:31 ` Sean Christopherson
2025-01-15 22:26 ` Kalra, Ashish
2025-01-03 20:02 ` [PATCH v3 7/7] crypto: ccp: Move SEV/SNP Platform initialization to KVM Ashish Kalra
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=47ea6ab2-b802-3953-2e4a-7c90c54b0f46@amd.com \
--to=thomas.lendacky@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=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