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