blob: 5aefc1c8da9142fe038e73cf4c039ddbdb750bc1 [file] [log] [blame]
Christopher Ferris76a1d452018-06-27 14:12:29 -07001/****************************************************************************
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>
22enum {
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,
Christopher Ferris9ce28842018-10-25 12:11:39 -070030 SEV_GET_ID,
Christopher Ferrisaeddbcf2019-07-08 12:45:46 -070031 SEV_GET_ID2,
Christopher Ferris76a1d452018-06-27 14:12:29 -070032 SEV_MAX,
33};
34typedef enum {
Christopher Ferris37c3f3c2023-07-10 10:59:05 -070035 SEV_RET_NO_FW_CALL = - 1,
Christopher Ferris76a1d452018-06-27 14:12:29 -070036 SEV_RET_SUCCESS = 0,
37 SEV_RET_INVALID_PLATFORM_STATE,
38 SEV_RET_INVALID_GUEST_STATE,
39 SEV_RET_INAVLID_CONFIG,
40 SEV_RET_INVALID_LEN,
41 SEV_RET_ALREADY_OWNED,
42 SEV_RET_INVALID_CERTIFICATE,
43 SEV_RET_POLICY_FAILURE,
44 SEV_RET_INACTIVE,
45 SEV_RET_INVALID_ADDRESS,
46 SEV_RET_BAD_SIGNATURE,
47 SEV_RET_BAD_MEASUREMENT,
48 SEV_RET_ASID_OWNED,
49 SEV_RET_INVALID_ASID,
50 SEV_RET_WBINVD_REQUIRED,
51 SEV_RET_DFFLUSH_REQUIRED,
52 SEV_RET_INVALID_GUEST,
53 SEV_RET_INVALID_COMMAND,
54 SEV_RET_ACTIVE,
55 SEV_RET_HWSEV_RET_PLATFORM,
56 SEV_RET_HWSEV_RET_UNSAFE,
57 SEV_RET_UNSUPPORTED,
Christopher Ferrisd32ca142020-02-04 16:16:51 -080058 SEV_RET_INVALID_PARAM,
59 SEV_RET_RESOURCE_LIMIT,
60 SEV_RET_SECURE_DATA_INVALID,
Christopher Ferris76a1d452018-06-27 14:12:29 -070061 SEV_RET_MAX,
62} sev_ret_code;
63struct sev_user_data_status {
64 __u8 api_major;
65 __u8 api_minor;
66 __u8 state;
67 __u32 flags;
68 __u8 build;
69 __u32 guest_count;
Colin Cross4ac33222022-12-15 15:45:35 -080070} __attribute__((__packed__));
Christopher Ferris8177cdf2020-08-03 11:53:55 -070071#define SEV_STATUS_FLAGS_CONFIG_ES 0x0100
Christopher Ferris76a1d452018-06-27 14:12:29 -070072struct sev_user_data_pek_csr {
73 __u64 address;
74 __u32 length;
Colin Cross4ac33222022-12-15 15:45:35 -080075} __attribute__((__packed__));
Christopher Ferris76a1d452018-06-27 14:12:29 -070076struct sev_user_data_pek_cert_import {
77 __u64 pek_cert_address;
78 __u32 pek_cert_len;
79 __u64 oca_cert_address;
80 __u32 oca_cert_len;
Colin Cross4ac33222022-12-15 15:45:35 -080081} __attribute__((__packed__));
Christopher Ferris76a1d452018-06-27 14:12:29 -070082struct sev_user_data_pdh_cert_export {
83 __u64 pdh_cert_address;
84 __u32 pdh_cert_len;
85 __u64 cert_chain_address;
86 __u32 cert_chain_len;
Colin Cross4ac33222022-12-15 15:45:35 -080087} __attribute__((__packed__));
Christopher Ferris9ce28842018-10-25 12:11:39 -070088struct sev_user_data_get_id {
89 __u8 socket1[64];
90 __u8 socket2[64];
Colin Cross4ac33222022-12-15 15:45:35 -080091} __attribute__((__packed__));
Christopher Ferrisaeddbcf2019-07-08 12:45:46 -070092struct sev_user_data_get_id2 {
93 __u64 address;
94 __u32 length;
Colin Cross4ac33222022-12-15 15:45:35 -080095} __attribute__((__packed__));
Christopher Ferris76a1d452018-06-27 14:12:29 -070096struct sev_issue_cmd {
97 __u32 cmd;
98 __u64 data;
99 __u32 error;
Colin Cross4ac33222022-12-15 15:45:35 -0800100} __attribute__((__packed__));
Christopher Ferris76a1d452018-06-27 14:12:29 -0700101#define SEV_IOC_TYPE 'S'
102#define SEV_ISSUE_CMD _IOWR(SEV_IOC_TYPE, 0x0, struct sev_issue_cmd)
103#endif