History

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. ]

Peter Gonda committed 3 years ago

Commit efb339a1 parent e8d018d3 files · +14 −5Browse files

Unified · Split

3 files
  1. Documentation/virt/coco/sev-guest.rst +2 −2
  2. drivers/crypto/ccp/sev-dev.c +5 −3
  3. include/uapi/linux/psp-sev.h +7 −0
Documentation/virt/coco/sev-guest.rst+2−2
@@ -40,8 +40,8 @@ along with a description: · 39 unmodified lines
4040 The guest ioctl should be issued on a file descriptor of the /dev/sev-guest device.
4141 The ioctl accepts struct snp_user_guest_request. The input and output structure is
4242 specified through the req_data and resp_data field respectively. If the ioctl fails
43−to execute due to a firmware error, then fw_err code will be set otherwise the
44−fw_err will be set to 0x00000000000000ff.
43+to execute due to a firmware error, then fw_err code will be set. Otherwise, fw_err
44+will be set to 0x00000000ffffffff, i.e., the lower 32-bits are -1.
4545
4646 The firmware checks that the message sequence counter is one greater than
4747 the guests message sequence counter. If guest driver fails to increment message
drivers/crypto/ccp/sev-dev.c+5−3
@@ -444,10 +444,10 @@ static int __sev_init_ex_locked(int *error) · 443 unmodified lines
444444
445445 static int __sev_platform_init_locked(int *error)
446446 {
447+ int rc = 0, psp_ret = SEV_RET_NO_FW_CALL;
447448 struct psp_device *psp = psp_master;
448− struct sev_device *sev;
449− int rc = 0, psp_ret = -1;
450449 int (*init_function)(int *error);
450+ struct sev_device *sev;
451451
452452 if (!psp || !psp->sev_data)
453453 return -ENODEV;
@@ -475,9 +475,11 @@ static int __sev_platform_init_locked(int *error) · 21 unmodified lines
475475 * initialization function should succeed by replacing the state
476476 * with a reset state.
477477 */
478− dev_err(sev->dev, "SEV: retrying INIT command because of SECURE_DATA_INVALID error. Retrying once to reset PSP SEV state.");
478+ dev_err(sev->dev,
479+"SEV: retrying INIT command because of SECURE_DATA_INVALID error. Retrying once to reset PSP SEV state.");
479480 rc = init_function(&psp_ret);
480481 }
482+
481483 if (error)
482484 *error = psp_ret;
483485
include/uapi/linux/psp-sev.h+7−0
@@ -36,6 +36,13 @@ enum { · 35 unmodified lines
3636 * SEV Firmware status code
3737 */
3838 typedef enum {
39+ /*
40+ * This error code is not in the SEV spec. Its purpose is to convey that
41+ * there was an error that prevented the SEV firmware from being called.
42+ * The SEV API error codes are 16 bits, so the -1 value will not overlap
43+ * with possible values from the specification.
44+ */
45+ SEV_RET_NO_FW_CALL = -1,
3946 SEV_RET_SUCCESS = 0,
4047 SEV_RET_INVALID_PLATFORM_STATE,
4148 SEV_RET_INVALID_GUEST_STATE,

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t