From: Tom Lendacky <thomas.lendacky@amd.com>
To: John Allen <john.allen@amd.com>, linux-crypto@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, mario.limonciello@amd.com,
herbert@gondor.apana.org.au
Subject: Re: [PATCH] crypto: ccp - Dump SEV command buffer registers on SEV command error
Date: Thu, 12 Oct 2023 12:58:18 -0500 [thread overview]
Message-ID: <030bc89b-837c-4c4a-9ef9-8b7e461505a4@amd.com> (raw)
In-Reply-To: <20231010204432.899126-1-john.allen@amd.com>
On 10/10/23 15:44, John Allen wrote:
> PSP firmware may report additional error information in the SEV command
> buffer registers in situations where an error occurs as the result of an
> SEV command. In this case, check if the command buffer registers have been
> modified and if so, dump the contents.
>
> Signed-off-by: John Allen <john.allen@amd.com>
Reviewed-by: Tom Lendacky <thomas.lendacky@amd.com>
> ---
> drivers/crypto/ccp/sev-dev.c | 14 ++++++++++++++
> 1 file changed, 14 insertions(+)
>
> diff --git a/drivers/crypto/ccp/sev-dev.c b/drivers/crypto/ccp/sev-dev.c
> index f97166fba9d9..fcaccd0b5a65 100644
> --- a/drivers/crypto/ccp/sev-dev.c
> +++ b/drivers/crypto/ccp/sev-dev.c
> @@ -309,6 +309,7 @@ static int __sev_do_cmd_locked(int cmd, void *data, int *psp_ret)
> {
> struct psp_device *psp = psp_master;
> struct sev_device *sev;
> + unsigned int cmdbuff_hi, cmdbuff_lo;
> unsigned int phys_lsb, phys_msb;
> unsigned int reg, ret = 0;
> int buf_len;
> @@ -371,6 +372,19 @@ static int __sev_do_cmd_locked(int cmd, void *data, int *psp_ret)
> if (FIELD_GET(PSP_CMDRESP_STS, reg)) {
> dev_dbg(sev->dev, "sev command %#x failed (%#010lx)\n",
> cmd, FIELD_GET(PSP_CMDRESP_STS, reg));
> +
> + /*
> + * PSP firmware may report additional error information in the
> + * command buffer registers on error. Print contents of command
> + * buffer registers if they changed.
> + */
> + cmdbuff_hi = ioread32(sev->io_regs + sev->vdata->cmdbuff_addr_hi_reg);
> + cmdbuff_lo = ioread32(sev->io_regs + sev->vdata->cmdbuff_addr_lo_reg);
> + if (cmdbuff_hi != phys_msb || cmdbuff_lo != phys_lsb) {
> + dev_dbg(sev->dev, "Additional error information reported in cmdbuff:");
> + dev_dbg(sev->dev, " cmdbuff hi: %#010x\n", cmdbuff_hi);
> + dev_dbg(sev->dev, " cmdbuff lo: %#010x\n", cmdbuff_lo);
> + }
> ret = -EIO;
> } else {
> ret = sev_write_init_ex_file_if_required(cmd);
next prev parent reply other threads:[~2023-10-12 17:58 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-10 20:44 John Allen
2023-10-11 15:50 ` Mario Limonciello
2023-10-12 17:58 ` Tom Lendacky [this message]
2023-10-20 5:54 ` Herbert Xu
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=030bc89b-837c-4c4a-9ef9-8b7e461505a4@amd.com \
--to=thomas.lendacky@amd.com \
--cc=herbert@gondor.apana.org.au \
--cc=john.allen@amd.com \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mario.limonciello@amd.com \
/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®