1 /**************************************************************************** 2 **************************************************************************** 3 *** 4 *** This header was automatically generated from a Linux kernel header 5 *** of the same name, to make information necessary for userspace to 6 *** call into the kernel available to libc. It contains only constants, 7 *** structures, and macros generated from the original header, and thus, 8 *** contains no copyrightable information. 9 *** 10 *** To edit the content of this header, modify the corresponding 11 *** source file (e.g. under external/kernel-headers/original/) then 12 *** run bionic/libc/kernel/tools/update_all.py 13 *** 14 *** Any manual change here will be lost the next time this script will 15 *** be run. You've been warned! 16 *** 17 **************************************************************************** 18 ****************************************************************************/ 19 #ifndef __PSP_SEV_USER_H__ 20 #define __PSP_SEV_USER_H__ 21 #include <linux/types.h> 22 enum { 23 SEV_FACTORY_RESET = 0, 24 SEV_PLATFORM_STATUS, 25 SEV_PEK_GEN, 26 SEV_PEK_CSR, 27 SEV_PDH_GEN, 28 SEV_PDH_CERT_EXPORT, 29 SEV_PEK_CERT_IMPORT, 30 SEV_GET_ID, 31 SEV_GET_ID2, 32 SEV_MAX, 33 }; 34 typedef enum { 35 SEV_RET_SUCCESS = 0, 36 SEV_RET_INVALID_PLATFORM_STATE, 37 SEV_RET_INVALID_GUEST_STATE, 38 SEV_RET_INAVLID_CONFIG, 39 SEV_RET_INVALID_LEN, 40 SEV_RET_ALREADY_OWNED, 41 SEV_RET_INVALID_CERTIFICATE, 42 SEV_RET_POLICY_FAILURE, 43 SEV_RET_INACTIVE, 44 SEV_RET_INVALID_ADDRESS, 45 SEV_RET_BAD_SIGNATURE, 46 SEV_RET_BAD_MEASUREMENT, 47 SEV_RET_ASID_OWNED, 48 SEV_RET_INVALID_ASID, 49 SEV_RET_WBINVD_REQUIRED, 50 SEV_RET_DFFLUSH_REQUIRED, 51 SEV_RET_INVALID_GUEST, 52 SEV_RET_INVALID_COMMAND, 53 SEV_RET_ACTIVE, 54 SEV_RET_HWSEV_RET_PLATFORM, 55 SEV_RET_HWSEV_RET_UNSAFE, 56 SEV_RET_UNSUPPORTED, 57 SEV_RET_INVALID_PARAM, 58 SEV_RET_RESOURCE_LIMIT, 59 SEV_RET_SECURE_DATA_INVALID, 60 SEV_RET_MAX, 61 } sev_ret_code; 62 struct sev_user_data_status { 63 __u8 api_major; 64 __u8 api_minor; 65 __u8 state; 66 __u32 flags; 67 __u8 build; 68 __u32 guest_count; 69 } __packed; 70 #define SEV_STATUS_FLAGS_CONFIG_ES 0x0100 71 struct sev_user_data_pek_csr { 72 __u64 address; 73 __u32 length; 74 } __packed; 75 struct sev_user_data_pek_cert_import { 76 __u64 pek_cert_address; 77 __u32 pek_cert_len; 78 __u64 oca_cert_address; 79 __u32 oca_cert_len; 80 } __packed; 81 struct sev_user_data_pdh_cert_export { 82 __u64 pdh_cert_address; 83 __u32 pdh_cert_len; 84 __u64 cert_chain_address; 85 __u32 cert_chain_len; 86 } __packed; 87 struct sev_user_data_get_id { 88 __u8 socket1[64]; 89 __u8 socket2[64]; 90 } __packed; 91 struct sev_user_data_get_id2 { 92 __u64 address; 93 __u32 length; 94 } __packed; 95 struct sev_issue_cmd { 96 __u32 cmd; 97 __u64 data; 98 __u32 error; 99 } __packed; 100 #define SEV_IOC_TYPE 'S' 101 #define SEV_ISSUE_CMD _IOWR(SEV_IOC_TYPE, 0x0, struct sev_issue_cmd) 102 #endif 103