From: "tip-bot2 for Peter Gonda" <tip-bot2@linutronix.de>
To: linux-tip-commits@vger.kernel.org
Cc: Peter Gonda <pgonda@google.com>,
Dionna Glaze <dionnaglaze@google.com>,
"Borislav Petkov (AMD)" <bp@alien8.de>,
x86@kernel.org, linux-kernel@vger.kernel.org
Subject: [tip: x86/sev] crypto: ccp - Name -1 return value as SEV_RET_NO_FW_CALL
Date: Tue, 21 Mar 2023 15:28:27 -0000 [thread overview]
Message-ID: <167941250712.5837.17612643714782256267.tip-bot2@tip-bot2> (raw)
In-Reply-To: <20221207010210.2563293-2-dionnaglaze@google.com>
The following commit has been merged into the x86/sev branch of tip:
Commit-ID: efb339a83368ab25de1a18c0fdff85e01c13a1ea
Gitweb: https://git.kernel.org/tip/efb339a83368ab25de1a18c0fdff85e01c13a1ea
Author: Peter Gonda <pgonda@google.com>
AuthorDate: Tue, 07 Mar 2023 20:24:39 +01:00
Committer: Borislav Petkov (AMD) <bp@alien8.de>
CommitterDate: Tue, 21 Mar 2023 11:37:32 +01:00
crypto: ccp - Name -1 return value as SEV_RET_NO_FW_CALL
The PSP can return a "firmware error" code of -1 in circumstances where
the PSP has not actually been called. To make this protocol unambiguous,
name the value SEV_RET_NO_FW_CALL.
[ bp: Massage a bit. ]
Signed-off-by: Peter Gonda <pgonda@google.com>
Signed-off-by: Dionna Glaze <dionnaglaze@google.com>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Link: https://lore.kernel.org/r/20221207010210.2563293-2-dionnaglaze@google.com
---
Documentation/virt/coco/sev-guest.rst | 4 ++--
drivers/crypto/ccp/sev-dev.c | 8 +++++---
include/uapi/linux/psp-sev.h | 7 +++++++
3 files changed, 14 insertions(+), 5 deletions(-)
diff --git a/Documentation/virt/coco/sev-guest.rst b/Documentation/virt/coco/sev-guest.rst
index bf593e8..aa3e4c6 100644
--- a/Documentation/virt/coco/sev-guest.rst
+++ b/Documentation/virt/coco/sev-guest.rst
@@ -40,8 +40,8 @@ along with a description:
The guest ioctl should be issued on a file descriptor of the /dev/sev-guest device.
The ioctl accepts struct snp_user_guest_request. The input and output structure is
specified through the req_data and resp_data field respectively. If the ioctl fails
-to execute due to a firmware error, then fw_err code will be set otherwise the
-fw_err will be set to 0x00000000000000ff.
+to execute due to a firmware error, then fw_err code will be set. Otherwise, fw_err
+will be set to 0x00000000ffffffff, i.e., the lower 32-bits are -1.
The firmware checks that the message sequence counter is one greater than
the guests message sequence counter. If guest driver fails to increment message
diff --git a/drivers/crypto/ccp/sev-dev.c b/drivers/crypto/ccp/sev-dev.c
index e2f2592..823c67a 100644
--- a/drivers/crypto/ccp/sev-dev.c
+++ b/drivers/crypto/ccp/sev-dev.c
@@ -444,10 +444,10 @@ static int __sev_init_ex_locked(int *error)
static int __sev_platform_init_locked(int *error)
{
+ int rc = 0, psp_ret = SEV_RET_NO_FW_CALL;
struct psp_device *psp = psp_master;
- struct sev_device *sev;
- int rc = 0, psp_ret = -1;
int (*init_function)(int *error);
+ struct sev_device *sev;
if (!psp || !psp->sev_data)
return -ENODEV;
@@ -475,9 +475,11 @@ static int __sev_platform_init_locked(int *error)
* initialization function should succeed by replacing the state
* with a reset state.
*/
- dev_err(sev->dev, "SEV: retrying INIT command because of SECURE_DATA_INVALID error. Retrying once to reset PSP SEV state.");
+ dev_err(sev->dev,
+"SEV: retrying INIT command because of SECURE_DATA_INVALID error. Retrying once to reset PSP SEV state.");
rc = init_function(&psp_ret);
}
+
if (error)
*error = psp_ret;
diff --git a/include/uapi/linux/psp-sev.h b/include/uapi/linux/psp-sev.h
index 91b4c63..1c9da48 100644
--- a/include/uapi/linux/psp-sev.h
+++ b/include/uapi/linux/psp-sev.h
@@ -36,6 +36,13 @@ enum {
* SEV Firmware status code
*/
typedef enum {
+ /*
+ * This error code is not in the SEV spec. Its purpose is to convey that
+ * there was an error that prevented the SEV firmware from being called.
+ * The SEV API error codes are 16 bits, so the -1 value will not overlap
+ * with possible values from the specification.
+ */
+ SEV_RET_NO_FW_CALL = -1,
SEV_RET_SUCCESS = 0,
SEV_RET_INVALID_PLATFORM_STATE,
SEV_RET_INVALID_GUEST_STATE,
next prev parent reply other threads:[~2023-03-21 15:29 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-07 1:02 [PATCH v9 0/4] Add throttling detection to sev-guest Dionna Glaze
2022-12-07 1:02 ` [PATCH v9 1/4] crypto: ccp - Name -1 return value as SEV_RET_NO_FW_CALL Dionna Glaze
2022-12-22 15:31 ` Borislav Petkov
2022-12-26 14:26 ` Tom Lendacky
2023-03-21 15:28 ` tip-bot2 for Peter Gonda [this message]
2022-12-07 1:02 ` [PATCH v9 2/4] x86/sev: Change snp_guest_issue_request's fw_err Dionna Glaze
2022-12-07 1:02 ` [PATCH v9 3/4] virt: sev-guest: Remove err in handle_guest_request Dionna Glaze
2022-12-07 1:02 ` [PATCH v9 4/4] virt: sev-guest: interpret VMM errors from guest request Dionna Glaze
2023-01-02 16:10 ` [PATCH v9 0/4] Add throttling detection to sev-guest Borislav Petkov
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=167941250712.5837.17612643714782256267.tip-bot2@tip-bot2 \
--to=tip-bot2@linutronix.de \
--cc=bp@alien8.de \
--cc=dionnaglaze@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=pgonda@google.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®