All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dionna Glaze <dionnaglaze@google.com>
To: linux-kernel@vger.kernel.org, x86@kernel.org
Cc: Dionna Glaze <dionnaglaze@google.com>,
	Thomas Lendacky <Thomas.Lendacky@amd.com>,
	Paolo Bonzini <pbonzini@redhat.com>,
	Joerg Roedel <jroedel@suse.de>, Ingo Molnar <mingo@redhat.com>,
	Andy Lutomirsky <luto@kernel.org>
Subject: [PATCH v5 1/4] ccp: Name -1 return value as SEV_RET_NO_FW_CALL
Date: Wed,  2 Nov 2022 15:18:33 +0000	[thread overview]
Message-ID: <20221102151836.1310509-2-dionnaglaze@google.com> (raw)
In-Reply-To: <20221102151836.1310509-1-dionnaglaze@google.com>

The PSP can return a "firmware error" code of -1 in circumstances where
the PSP is not actually called. To make this protocol unambiguous, we
add a constant naming the return value.

From: Peter Gonda <pgonda@google.com>
Cc: Thomas Lendacky <Thomas.Lendacky@amd.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Joerg Roedel <jroedel@suse.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Andy Lutomirsky <luto@kernel.org>

Signed-off-by: Dionna Glaze <dionnaglaze@google.com>
---
 drivers/crypto/ccp/sev-dev.c | 2 +-
 include/uapi/linux/psp-sev.h | 7 +++++++
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/crypto/ccp/sev-dev.c b/drivers/crypto/ccp/sev-dev.c
index 06fc7156c04f..97eb3544ab36 100644
--- a/drivers/crypto/ccp/sev-dev.c
+++ b/drivers/crypto/ccp/sev-dev.c
@@ -444,7 +444,7 @@ static int __sev_platform_init_locked(int *error)
 {
 	struct psp_device *psp = psp_master;
 	struct sev_device *sev;
-	int rc = 0, psp_ret = -1;
+	int rc = 0, psp_ret = SEV_RET_NO_FW_CALL;
 	int (*init_function)(int *error);
 
 	if (!psp || !psp->sev_data)
diff --git a/include/uapi/linux/psp-sev.h b/include/uapi/linux/psp-sev.h
index 91b4c63d5cbf..1ad7f0a7e328 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 but is added to convey that
+	 * there was an error that prevented the SEV Firmware from being called.
+	 * This is (u32)-1 since the firmware error code is represented as a
+	 * 32-bit integer.
+	 */
+	SEV_RET_NO_FW_CALL = 0xffffffff,
 	SEV_RET_SUCCESS = 0,
 	SEV_RET_INVALID_PLATFORM_STATE,
 	SEV_RET_INVALID_GUEST_STATE,
-- 
2.38.1.273.g43a17bfeac-goog


  reply	other threads:[~2022-11-02 15:19 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-02 15:18 [PATCH v5 0/4] Add throttling detection to sev-guest Dionna Glaze
2022-11-02 15:18 ` Dionna Glaze [this message]
2022-11-02 17:30   ` [PATCH v5 1/4] ccp: Name -1 return value as SEV_RET_NO_FW_CALL Tom Lendacky
2022-11-02 18:46     ` Borislav Petkov
2022-11-02 15:18 ` [PATCH v5 2/4] x86/sev: Change snp_guest_issue_request's fw_err Dionna Glaze
2022-11-02 15:18 ` [PATCH v5 3/4] virt/coco/sev-guest: Remove err in handle_guest_request Dionna Glaze
2022-11-02 15:18 ` [PATCH v5 4/4] virt/coco/sev-guest: interpret VMM errors from guest request Dionna Glaze
2022-11-03 15:26 ` [PATCH v5 0/4] Add throttling detection to sev-guest Peter Gonda
2022-11-03 19:03   ` Dionna Amalie Glaze

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=20221102151836.1310509-2-dionnaglaze@google.com \
    --to=dionnaglaze@google.com \
    --cc=Thomas.Lendacky@amd.com \
    --cc=jroedel@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=mingo@redhat.com \
    --cc=pbonzini@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.