Elliott Hughes | 180edef | 2023-11-02 00:08:05 +0000 | [diff] [blame^] | 1 | /* |
| 2 | * This file is auto-generated. Modifications will be lost. |
| 3 | * |
| 4 | * See https://android.googlesource.com/platform/bionic/+/master/libc/kernel/ |
| 5 | * for more information. |
| 6 | */ |
Christopher Ferris | 76a1d45 | 2018-06-27 14:12:29 -0700 | [diff] [blame] | 7 | #ifndef __PSP_SEV_USER_H__ |
| 8 | #define __PSP_SEV_USER_H__ |
| 9 | #include <linux/types.h> |
| 10 | enum { |
| 11 | SEV_FACTORY_RESET = 0, |
| 12 | SEV_PLATFORM_STATUS, |
| 13 | SEV_PEK_GEN, |
| 14 | SEV_PEK_CSR, |
| 15 | SEV_PDH_GEN, |
| 16 | SEV_PDH_CERT_EXPORT, |
| 17 | SEV_PEK_CERT_IMPORT, |
Christopher Ferris | 9ce2884 | 2018-10-25 12:11:39 -0700 | [diff] [blame] | 18 | SEV_GET_ID, |
Christopher Ferris | aeddbcf | 2019-07-08 12:45:46 -0700 | [diff] [blame] | 19 | SEV_GET_ID2, |
Christopher Ferris | 76a1d45 | 2018-06-27 14:12:29 -0700 | [diff] [blame] | 20 | SEV_MAX, |
| 21 | }; |
| 22 | typedef enum { |
Christopher Ferris | 37c3f3c | 2023-07-10 10:59:05 -0700 | [diff] [blame] | 23 | SEV_RET_NO_FW_CALL = - 1, |
Christopher Ferris | 76a1d45 | 2018-06-27 14:12:29 -0700 | [diff] [blame] | 24 | SEV_RET_SUCCESS = 0, |
| 25 | SEV_RET_INVALID_PLATFORM_STATE, |
| 26 | SEV_RET_INVALID_GUEST_STATE, |
| 27 | SEV_RET_INAVLID_CONFIG, |
| 28 | SEV_RET_INVALID_LEN, |
| 29 | SEV_RET_ALREADY_OWNED, |
| 30 | SEV_RET_INVALID_CERTIFICATE, |
| 31 | SEV_RET_POLICY_FAILURE, |
| 32 | SEV_RET_INACTIVE, |
| 33 | SEV_RET_INVALID_ADDRESS, |
| 34 | SEV_RET_BAD_SIGNATURE, |
| 35 | SEV_RET_BAD_MEASUREMENT, |
| 36 | SEV_RET_ASID_OWNED, |
| 37 | SEV_RET_INVALID_ASID, |
| 38 | SEV_RET_WBINVD_REQUIRED, |
| 39 | SEV_RET_DFFLUSH_REQUIRED, |
| 40 | SEV_RET_INVALID_GUEST, |
| 41 | SEV_RET_INVALID_COMMAND, |
| 42 | SEV_RET_ACTIVE, |
| 43 | SEV_RET_HWSEV_RET_PLATFORM, |
| 44 | SEV_RET_HWSEV_RET_UNSAFE, |
| 45 | SEV_RET_UNSUPPORTED, |
Christopher Ferris | d32ca14 | 2020-02-04 16:16:51 -0800 | [diff] [blame] | 46 | SEV_RET_INVALID_PARAM, |
| 47 | SEV_RET_RESOURCE_LIMIT, |
| 48 | SEV_RET_SECURE_DATA_INVALID, |
Christopher Ferris | 76a1d45 | 2018-06-27 14:12:29 -0700 | [diff] [blame] | 49 | SEV_RET_MAX, |
| 50 | } sev_ret_code; |
| 51 | struct sev_user_data_status { |
| 52 | __u8 api_major; |
| 53 | __u8 api_minor; |
| 54 | __u8 state; |
| 55 | __u32 flags; |
| 56 | __u8 build; |
| 57 | __u32 guest_count; |
Colin Cross | 4ac3322 | 2022-12-15 15:45:35 -0800 | [diff] [blame] | 58 | } __attribute__((__packed__)); |
Christopher Ferris | 8177cdf | 2020-08-03 11:53:55 -0700 | [diff] [blame] | 59 | #define SEV_STATUS_FLAGS_CONFIG_ES 0x0100 |
Christopher Ferris | 76a1d45 | 2018-06-27 14:12:29 -0700 | [diff] [blame] | 60 | struct sev_user_data_pek_csr { |
| 61 | __u64 address; |
| 62 | __u32 length; |
Colin Cross | 4ac3322 | 2022-12-15 15:45:35 -0800 | [diff] [blame] | 63 | } __attribute__((__packed__)); |
Christopher Ferris | 76a1d45 | 2018-06-27 14:12:29 -0700 | [diff] [blame] | 64 | struct sev_user_data_pek_cert_import { |
| 65 | __u64 pek_cert_address; |
| 66 | __u32 pek_cert_len; |
| 67 | __u64 oca_cert_address; |
| 68 | __u32 oca_cert_len; |
Colin Cross | 4ac3322 | 2022-12-15 15:45:35 -0800 | [diff] [blame] | 69 | } __attribute__((__packed__)); |
Christopher Ferris | 76a1d45 | 2018-06-27 14:12:29 -0700 | [diff] [blame] | 70 | struct sev_user_data_pdh_cert_export { |
| 71 | __u64 pdh_cert_address; |
| 72 | __u32 pdh_cert_len; |
| 73 | __u64 cert_chain_address; |
| 74 | __u32 cert_chain_len; |
Colin Cross | 4ac3322 | 2022-12-15 15:45:35 -0800 | [diff] [blame] | 75 | } __attribute__((__packed__)); |
Christopher Ferris | 9ce2884 | 2018-10-25 12:11:39 -0700 | [diff] [blame] | 76 | struct sev_user_data_get_id { |
| 77 | __u8 socket1[64]; |
| 78 | __u8 socket2[64]; |
Colin Cross | 4ac3322 | 2022-12-15 15:45:35 -0800 | [diff] [blame] | 79 | } __attribute__((__packed__)); |
Christopher Ferris | aeddbcf | 2019-07-08 12:45:46 -0700 | [diff] [blame] | 80 | struct sev_user_data_get_id2 { |
| 81 | __u64 address; |
| 82 | __u32 length; |
Colin Cross | 4ac3322 | 2022-12-15 15:45:35 -0800 | [diff] [blame] | 83 | } __attribute__((__packed__)); |
Christopher Ferris | 76a1d45 | 2018-06-27 14:12:29 -0700 | [diff] [blame] | 84 | struct sev_issue_cmd { |
| 85 | __u32 cmd; |
| 86 | __u64 data; |
| 87 | __u32 error; |
Colin Cross | 4ac3322 | 2022-12-15 15:45:35 -0800 | [diff] [blame] | 88 | } __attribute__((__packed__)); |
Christopher Ferris | 76a1d45 | 2018-06-27 14:12:29 -0700 | [diff] [blame] | 89 | #define SEV_IOC_TYPE 'S' |
| 90 | #define SEV_ISSUE_CMD _IOWR(SEV_IOC_TYPE, 0x0, struct sev_issue_cmd) |
| 91 | #endif |