1 /* 2 * This header was generated from the Linux kernel headers by update_headers.py, 3 * to provide necessary information from kernel to userspace, such as constants, 4 * structures, and macros, and thus, contains no copyrightable information. 5 */ 6 #ifndef __PSP_SEV_USER_H__ 7 #define __PSP_SEV_USER_H__ 8 #include <linux/types.h> 9 enum { 10 SEV_FACTORY_RESET = 0, 11 SEV_PLATFORM_STATUS, 12 SEV_PEK_GEN, 13 SEV_PEK_CSR, 14 SEV_PDH_GEN, 15 SEV_PDH_CERT_EXPORT, 16 SEV_PEK_CERT_IMPORT, 17 SEV_GET_ID, 18 SEV_MAX, 19 }; 20 typedef enum { 21 SEV_RET_SUCCESS = 0, 22 SEV_RET_INVALID_PLATFORM_STATE, 23 SEV_RET_INVALID_GUEST_STATE, 24 SEV_RET_INAVLID_CONFIG, 25 SEV_RET_INVALID_LEN, 26 SEV_RET_ALREADY_OWNED, 27 SEV_RET_INVALID_CERTIFICATE, 28 SEV_RET_POLICY_FAILURE, 29 SEV_RET_INACTIVE, 30 SEV_RET_INVALID_ADDRESS, 31 SEV_RET_BAD_SIGNATURE, 32 SEV_RET_BAD_MEASUREMENT, 33 SEV_RET_ASID_OWNED, 34 SEV_RET_INVALID_ASID, 35 SEV_RET_WBINVD_REQUIRED, 36 SEV_RET_DFFLUSH_REQUIRED, 37 SEV_RET_INVALID_GUEST, 38 SEV_RET_INVALID_COMMAND, 39 SEV_RET_ACTIVE, 40 SEV_RET_HWSEV_RET_PLATFORM, 41 SEV_RET_HWSEV_RET_UNSAFE, 42 SEV_RET_UNSUPPORTED, 43 SEV_RET_MAX, 44 } sev_ret_code; 45 struct sev_user_data_status { 46 __u8 api_major; 47 __u8 api_minor; 48 __u8 state; 49 __u32 flags; 50 __u8 build; 51 __u32 guest_count; 52 } __packed; 53 struct sev_user_data_pek_csr { 54 __u64 address; 55 __u32 length; 56 } __packed; 57 struct sev_user_data_pek_cert_import { 58 __u64 pek_cert_address; 59 __u32 pek_cert_len; 60 __u64 oca_cert_address; 61 __u32 oca_cert_len; 62 } __packed; 63 struct sev_user_data_pdh_cert_export { 64 __u64 pdh_cert_address; 65 __u32 pdh_cert_len; 66 __u64 cert_chain_address; 67 __u32 cert_chain_len; 68 } __packed; 69 struct sev_user_data_get_id { 70 __u8 socket1[64]; 71 __u8 socket2[64]; 72 } __packed; 73 struct sev_issue_cmd { 74 __u32 cmd; 75 __u64 data; 76 __u32 error; 77 } __packed; 78 #define SEV_IOC_TYPE 'S' 79 #define SEV_ISSUE_CMD _IOWR(SEV_IOC_TYPE, 0x0, struct sev_issue_cmd) 80 #endif 81