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
40The guest ioctl should be issued on a file descriptor of the /dev/sev-guest device.40The guest ioctl should be issued on a file descriptor of the /dev/sev-guest device.
41The ioctl accepts struct snp_user_guest_request. The input and output structure is41The ioctl accepts struct snp_user_guest_request. The input and output structure is
42specified through the req_data and resp_data field respectively. If the ioctl fails42specified through the req_data and resp_data field respectively. If the ioctl fails
43to execute due to a firmware error, then fw_err code will be set otherwise the43to execute due to a firmware error, then fw_err code will be set. Otherwise, fw_err
44fw_err will be set to 0x00000000000000ff.44will be set to 0x00000000ffffffff, i.e., the lower 32-bits are -1.
45 45
46The firmware checks that the message sequence counter is one greater than46The firmware checks that the message sequence counter is one greater than
47the guests message sequence counter. If guest driver fails to increment message47the 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
444 444
445static int __sev_platform_init_locked(int *error)445static int __sev_platform_init_locked(int *error)
446{446{
447 int rc = 0, psp_ret = SEV_RET_NO_FW_CALL;
447 struct psp_device *psp = psp_master;448 struct psp_device *psp = psp_master;
448 struct sev_device *sev;
449 int rc = 0, psp_ret = -1;
450 int (*init_function)(int *error);449 int (*init_function)(int *error);
450 struct sev_device *sev;
451 451
452 if (!psp || !psp->sev_data)452 if (!psp || !psp->sev_data)
453 return -ENODEV;453 return -ENODEV;
@@ -475,9 +475,11 @@ static int __sev_platform_init_locked(int *error) · 21 unmodified lines
475 * initialization function should succeed by replacing the state475 * initialization function should succeed by replacing the state
476 * with a reset state.476 * with a reset state.
477 */477 */
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.");
479 rc = init_function(&psp_ret);480 rc = init_function(&psp_ret);
480 }481 }
482
481 if (error)483 if (error)
482 *error = psp_ret;484 *error = psp_ret;
483 485
include/uapi/linux/psp-sev.h+7−0
@@ -36,6 +36,13 @@ enum { · 35 unmodified lines
36 * SEV Firmware status code36 * SEV Firmware status code
37 */37 */
38typedef enum {38typedef 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,
39 SEV_RET_SUCCESS = 0,46 SEV_RET_SUCCESS = 0,
40 SEV_RET_INVALID_PLATFORM_STATE,47 SEV_RET_INVALID_PLATFORM_STATE,
41 SEV_RET_INVALID_GUEST_STATE,48 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