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 */ 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, 18 SEV_GET_ID, 19 SEV_GET_ID2, 20 SNP_PLATFORM_STATUS, 21 SNP_COMMIT, 22 SNP_SET_CONFIG, 23 SNP_VLEK_LOAD, 24 SEV_MAX, 25 }; 26 typedef enum { 27 SEV_RET_NO_FW_CALL = - 1, 28 SEV_RET_SUCCESS = 0, 29 SEV_RET_INVALID_PLATFORM_STATE, 30 SEV_RET_INVALID_GUEST_STATE, 31 SEV_RET_INAVLID_CONFIG, 32 SEV_RET_INVALID_CONFIG = SEV_RET_INAVLID_CONFIG, 33 SEV_RET_INVALID_LEN, 34 SEV_RET_ALREADY_OWNED, 35 SEV_RET_INVALID_CERTIFICATE, 36 SEV_RET_POLICY_FAILURE, 37 SEV_RET_INACTIVE, 38 SEV_RET_INVALID_ADDRESS, 39 SEV_RET_BAD_SIGNATURE, 40 SEV_RET_BAD_MEASUREMENT, 41 SEV_RET_ASID_OWNED, 42 SEV_RET_INVALID_ASID, 43 SEV_RET_WBINVD_REQUIRED, 44 SEV_RET_DFFLUSH_REQUIRED, 45 SEV_RET_INVALID_GUEST, 46 SEV_RET_INVALID_COMMAND, 47 SEV_RET_ACTIVE, 48 SEV_RET_HWSEV_RET_PLATFORM, 49 SEV_RET_HWSEV_RET_UNSAFE, 50 SEV_RET_UNSUPPORTED, 51 SEV_RET_INVALID_PARAM, 52 SEV_RET_RESOURCE_LIMIT, 53 SEV_RET_SECURE_DATA_INVALID, 54 SEV_RET_INVALID_KEY = 0x27, 55 SEV_RET_INVALID_PAGE_SIZE, 56 SEV_RET_INVALID_PAGE_STATE, 57 SEV_RET_INVALID_MDATA_ENTRY, 58 SEV_RET_INVALID_PAGE_OWNER, 59 SEV_RET_INVALID_PAGE_AEAD_OFLOW, 60 SEV_RET_RMP_INIT_REQUIRED, 61 SEV_RET_MAX, 62 } sev_ret_code; 63 struct sev_user_data_status { 64 __u8 api_major; 65 __u8 api_minor; 66 __u8 state; 67 __u32 flags; 68 __u8 build; 69 __u32 guest_count; 70 } __attribute__((__packed__)); 71 #define SEV_STATUS_FLAGS_CONFIG_ES 0x0100 72 struct sev_user_data_pek_csr { 73 __u64 address; 74 __u32 length; 75 } __attribute__((__packed__)); 76 struct sev_user_data_pek_cert_import { 77 __u64 pek_cert_address; 78 __u32 pek_cert_len; 79 __u64 oca_cert_address; 80 __u32 oca_cert_len; 81 } __attribute__((__packed__)); 82 struct sev_user_data_pdh_cert_export { 83 __u64 pdh_cert_address; 84 __u32 pdh_cert_len; 85 __u64 cert_chain_address; 86 __u32 cert_chain_len; 87 } __attribute__((__packed__)); 88 struct sev_user_data_get_id { 89 __u8 socket1[64]; 90 __u8 socket2[64]; 91 } __attribute__((__packed__)); 92 struct sev_user_data_get_id2 { 93 __u64 address; 94 __u32 length; 95 } __attribute__((__packed__)); 96 struct sev_user_data_snp_status { 97 __u8 api_major; 98 __u8 api_minor; 99 __u8 state; 100 __u8 is_rmp_initialized : 1; 101 __u8 rsvd : 7; 102 __u32 build_id; 103 __u32 mask_chip_id : 1; 104 __u32 mask_chip_key : 1; 105 __u32 vlek_en : 1; 106 __u32 rsvd1 : 29; 107 __u32 guest_count; 108 __u64 current_tcb_version; 109 __u64 reported_tcb_version; 110 } __attribute__((__packed__)); 111 struct sev_user_data_snp_config { 112 __u64 reported_tcb; 113 __u32 mask_chip_id : 1; 114 __u32 mask_chip_key : 1; 115 __u32 rsvd : 30; 116 __u8 rsvd1[52]; 117 } __attribute__((__packed__)); 118 struct sev_user_data_snp_vlek_load { 119 __u32 len; 120 __u8 vlek_wrapped_version; 121 __u8 rsvd[3]; 122 __u64 vlek_wrapped_address; 123 } __attribute__((__packed__)); 124 struct sev_user_data_snp_wrapped_vlek_hashstick { 125 __u8 data[432]; 126 } __attribute__((__packed__)); 127 struct sev_issue_cmd { 128 __u32 cmd; 129 __u64 data; 130 __u32 error; 131 } __attribute__((__packed__)); 132 #define SEV_IOC_TYPE 'S' 133 #define SEV_ISSUE_CMD _IOWR(SEV_IOC_TYPE, 0x0, struct sev_issue_cmd) 134 #endif 135