1 /* SPDX-License-Identifier: GPL-2.0-only WITH 1 2 /* 3 * Userspace interface for AMD SEV and SNP gue 4 * 5 * Copyright (C) 2021 Advanced Micro Devices, 6 * 7 * Author: Brijesh Singh <brijesh.singh@amd.co 8 * 9 * SEV API specification is available at: http 10 */ 11 12 #ifndef __UAPI_LINUX_SEV_GUEST_H_ 13 #define __UAPI_LINUX_SEV_GUEST_H_ 14 15 #include <linux/types.h> 16 17 #define SNP_REPORT_USER_DATA_SIZE 64 18 19 struct snp_report_req { 20 /* user data that should be included i 21 __u8 user_data[SNP_REPORT_USER_DATA_SI 22 23 /* The vmpl level to be included in th 24 __u32 vmpl; 25 26 /* Must be zero filled */ 27 __u8 rsvd[28]; 28 }; 29 30 struct snp_report_resp { 31 /* response data, see SEV-SNP spec for 32 __u8 data[4000]; 33 }; 34 35 struct snp_derived_key_req { 36 __u32 root_key_select; 37 __u32 rsvd; 38 __u64 guest_field_select; 39 __u32 vmpl; 40 __u32 guest_svn; 41 __u64 tcb_version; 42 }; 43 44 struct snp_derived_key_resp { 45 /* response data, see SEV-SNP spec for 46 __u8 data[64]; 47 }; 48 49 struct snp_guest_request_ioctl { 50 /* message version number (must be non 51 __u8 msg_version; 52 53 /* Request and response structure addr 54 __u64 req_data; 55 __u64 resp_data; 56 57 /* bits[63:32]: VMM error code, bits[3 58 union { 59 __u64 exitinfo2; 60 struct { 61 __u32 fw_error; 62 __u32 vmm_error; 63 }; 64 }; 65 }; 66 67 struct snp_ext_report_req { 68 struct snp_report_req data; 69 70 /* where to copy the certificate blob 71 __u64 certs_address; 72 73 /* length of the certificate blob */ 74 __u32 certs_len; 75 }; 76 77 #define SNP_GUEST_REQ_IOC_TYPE 'S' 78 79 /* Get SNP attestation report */ 80 #define SNP_GET_REPORT _IOWR(SNP_GUEST_REQ_IOC 81 82 /* Get a derived key from the root */ 83 #define SNP_GET_DERIVED_KEY _IOWR(SNP_GUEST_RE 84 85 /* Get SNP extended report as defined in the G 86 #define SNP_GET_EXT_REPORT _IOWR(SNP_GUEST_REQ 87 88 /* Guest message request EXIT_INFO_2 constants 89 #define SNP_GUEST_FW_ERR_MASK GENMAS 90 #define SNP_GUEST_VMM_ERR_SHIFT 32 91 #define SNP_GUEST_VMM_ERR(x) (((u64 92 #define SNP_GUEST_FW_ERR(x) ((x) & 93 #define SNP_GUEST_ERR(vmm_err, fw_err) (SNP_G 94 SNP_G 95 96 #define SNP_GUEST_VMM_ERR_INVALID_LEN 1 97 #define SNP_GUEST_VMM_ERR_BUSY 2 98 99 #endif /* __UAPI_LINUX_SEV_GUEST_H_ */ 100
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.