blob: f73a397eb5489865010da244c411dcddc10b3de2 [file] [log] [blame]
Elliott Hughes180edef2023-11-02 00:08:05 +00001/*
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 Ferris76a1d452018-06-27 14:12:29 -07007#ifndef __PSP_SEV_USER_H__
8#define __PSP_SEV_USER_H__
9#include <linux/types.h>
10enum {
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 Ferris9ce28842018-10-25 12:11:39 -070018 SEV_GET_ID,
Christopher Ferrisaeddbcf2019-07-08 12:45:46 -070019 SEV_GET_ID2,
Christopher Ferris76a1d452018-06-27 14:12:29 -070020 SEV_MAX,
21};
22typedef enum {
Christopher Ferris37c3f3c2023-07-10 10:59:05 -070023 SEV_RET_NO_FW_CALL = - 1,
Christopher Ferris76a1d452018-06-27 14:12:29 -070024 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 Ferrisd32ca142020-02-04 16:16:51 -080046 SEV_RET_INVALID_PARAM,
47 SEV_RET_RESOURCE_LIMIT,
48 SEV_RET_SECURE_DATA_INVALID,
Christopher Ferris76a1d452018-06-27 14:12:29 -070049 SEV_RET_MAX,
50} sev_ret_code;
51struct 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 Cross4ac33222022-12-15 15:45:35 -080058} __attribute__((__packed__));
Christopher Ferris8177cdf2020-08-03 11:53:55 -070059#define SEV_STATUS_FLAGS_CONFIG_ES 0x0100
Christopher Ferris76a1d452018-06-27 14:12:29 -070060struct sev_user_data_pek_csr {
61 __u64 address;
62 __u32 length;
Colin Cross4ac33222022-12-15 15:45:35 -080063} __attribute__((__packed__));
Christopher Ferris76a1d452018-06-27 14:12:29 -070064struct 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 Cross4ac33222022-12-15 15:45:35 -080069} __attribute__((__packed__));
Christopher Ferris76a1d452018-06-27 14:12:29 -070070struct 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 Cross4ac33222022-12-15 15:45:35 -080075} __attribute__((__packed__));
Christopher Ferris9ce28842018-10-25 12:11:39 -070076struct sev_user_data_get_id {
77 __u8 socket1[64];
78 __u8 socket2[64];
Colin Cross4ac33222022-12-15 15:45:35 -080079} __attribute__((__packed__));
Christopher Ferrisaeddbcf2019-07-08 12:45:46 -070080struct sev_user_data_get_id2 {
81 __u64 address;
82 __u32 length;
Colin Cross4ac33222022-12-15 15:45:35 -080083} __attribute__((__packed__));
Christopher Ferris76a1d452018-06-27 14:12:29 -070084struct sev_issue_cmd {
85 __u32 cmd;
86 __u64 data;
87 __u32 error;
Colin Cross4ac33222022-12-15 15:45:35 -080088} __attribute__((__packed__));
Christopher Ferris76a1d452018-06-27 14:12:29 -070089#define SEV_IOC_TYPE 'S'
90#define SEV_ISSUE_CMD _IOWR(SEV_IOC_TYPE, 0x0, struct sev_issue_cmd)
91#endif