blob: ffbcf8222282321567314b98b8ed546fb4c68a2d [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 Ferris0f795212024-01-17 14:17:28 -080049 SEV_RET_INVALID_KEY = 0x27,
Christopher Ferris76a1d452018-06-27 14:12:29 -070050 SEV_RET_MAX,
51} sev_ret_code;
52struct sev_user_data_status {
53 __u8 api_major;
54 __u8 api_minor;
55 __u8 state;
56 __u32 flags;
57 __u8 build;
58 __u32 guest_count;
Colin Cross4ac33222022-12-15 15:45:35 -080059} __attribute__((__packed__));
Christopher Ferris8177cdf2020-08-03 11:53:55 -070060#define SEV_STATUS_FLAGS_CONFIG_ES 0x0100
Christopher Ferris76a1d452018-06-27 14:12:29 -070061struct sev_user_data_pek_csr {
62 __u64 address;
63 __u32 length;
Colin Cross4ac33222022-12-15 15:45:35 -080064} __attribute__((__packed__));
Christopher Ferris76a1d452018-06-27 14:12:29 -070065struct sev_user_data_pek_cert_import {
66 __u64 pek_cert_address;
67 __u32 pek_cert_len;
68 __u64 oca_cert_address;
69 __u32 oca_cert_len;
Colin Cross4ac33222022-12-15 15:45:35 -080070} __attribute__((__packed__));
Christopher Ferris76a1d452018-06-27 14:12:29 -070071struct sev_user_data_pdh_cert_export {
72 __u64 pdh_cert_address;
73 __u32 pdh_cert_len;
74 __u64 cert_chain_address;
75 __u32 cert_chain_len;
Colin Cross4ac33222022-12-15 15:45:35 -080076} __attribute__((__packed__));
Christopher Ferris9ce28842018-10-25 12:11:39 -070077struct sev_user_data_get_id {
78 __u8 socket1[64];
79 __u8 socket2[64];
Colin Cross4ac33222022-12-15 15:45:35 -080080} __attribute__((__packed__));
Christopher Ferrisaeddbcf2019-07-08 12:45:46 -070081struct sev_user_data_get_id2 {
82 __u64 address;
83 __u32 length;
Colin Cross4ac33222022-12-15 15:45:35 -080084} __attribute__((__packed__));
Christopher Ferris76a1d452018-06-27 14:12:29 -070085struct sev_issue_cmd {
86 __u32 cmd;
87 __u64 data;
88 __u32 error;
Colin Cross4ac33222022-12-15 15:45:35 -080089} __attribute__((__packed__));
Christopher Ferris76a1d452018-06-27 14:12:29 -070090#define SEV_IOC_TYPE 'S'
91#define SEV_ISSUE_CMD _IOWR(SEV_IOC_TYPE, 0x0, struct sev_issue_cmd)
92#endif