Christopher Ferris | 80ae69d | 2022-08-02 16:32:21 -0700 | [diff] [blame] | 1 | /**************************************************************************** |
| 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 __UAPI_LINUX_SEV_GUEST_H_ |
| 20 | #define __UAPI_LINUX_SEV_GUEST_H_ |
| 21 | #include <linux/types.h> |
| 22 | struct snp_report_req { |
| 23 | __u8 user_data[64]; |
| 24 | __u32 vmpl; |
| 25 | __u8 rsvd[28]; |
| 26 | }; |
| 27 | struct snp_report_resp { |
| 28 | __u8 data[4000]; |
| 29 | }; |
| 30 | struct snp_derived_key_req { |
| 31 | __u32 root_key_select; |
| 32 | __u32 rsvd; |
| 33 | __u64 guest_field_select; |
| 34 | __u32 vmpl; |
| 35 | __u32 guest_svn; |
| 36 | __u64 tcb_version; |
| 37 | }; |
| 38 | struct snp_derived_key_resp { |
| 39 | __u8 data[64]; |
| 40 | }; |
| 41 | struct snp_guest_request_ioctl { |
| 42 | __u8 msg_version; |
| 43 | __u64 req_data; |
| 44 | __u64 resp_data; |
Christopher Ferris | 37c3f3c | 2023-07-10 10:59:05 -0700 | [diff] [blame] | 45 | union { |
| 46 | __u64 exitinfo2; |
| 47 | struct { |
| 48 | __u32 fw_error; |
| 49 | __u32 vmm_error; |
| 50 | }; |
| 51 | }; |
Christopher Ferris | 80ae69d | 2022-08-02 16:32:21 -0700 | [diff] [blame] | 52 | }; |
| 53 | struct snp_ext_report_req { |
| 54 | struct snp_report_req data; |
| 55 | __u64 certs_address; |
| 56 | __u32 certs_len; |
| 57 | }; |
| 58 | #define SNP_GUEST_REQ_IOC_TYPE 'S' |
| 59 | #define SNP_GET_REPORT _IOWR(SNP_GUEST_REQ_IOC_TYPE, 0x0, struct snp_guest_request_ioctl) |
| 60 | #define SNP_GET_DERIVED_KEY _IOWR(SNP_GUEST_REQ_IOC_TYPE, 0x1, struct snp_guest_request_ioctl) |
| 61 | #define SNP_GET_EXT_REPORT _IOWR(SNP_GUEST_REQ_IOC_TYPE, 0x2, struct snp_guest_request_ioctl) |
Christopher Ferris | 37c3f3c | 2023-07-10 10:59:05 -0700 | [diff] [blame] | 62 | #define SNP_GUEST_FW_ERR_MASK GENMASK_ULL(31, 0) |
| 63 | #define SNP_GUEST_VMM_ERR_SHIFT 32 |
| 64 | #define SNP_GUEST_VMM_ERR(x) (((u64) x) << SNP_GUEST_VMM_ERR_SHIFT) |
| 65 | #define SNP_GUEST_VMM_ERR_INVALID_LEN 1 |
| 66 | #define SNP_GUEST_VMM_ERR_BUSY 2 |
Christopher Ferris | 80ae69d | 2022-08-02 16:32:21 -0700 | [diff] [blame] | 67 | #endif |