Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-only WITH Linux-syscall-note */
0002 /*
0003  * Userspace interface for AMD SEV and SNP guest driver.
0004  *
0005  * Copyright (C) 2021 Advanced Micro Devices, Inc.
0006  *
0007  * Author: Brijesh Singh <brijesh.singh@amd.com>
0008  *
0009  * SEV API specification is available at: https://developer.amd.com/sev/
0010  */
0011 
0012 #ifndef __UAPI_LINUX_SEV_GUEST_H_
0013 #define __UAPI_LINUX_SEV_GUEST_H_
0014 
0015 #include <linux/types.h>
0016 
0017 struct snp_report_req {
0018     /* user data that should be included in the report */
0019     __u8 user_data[64];
0020 
0021     /* The vmpl level to be included in the report */
0022     __u32 vmpl;
0023 
0024     /* Must be zero filled */
0025     __u8 rsvd[28];
0026 };
0027 
0028 struct snp_report_resp {
0029     /* response data, see SEV-SNP spec for the format */
0030     __u8 data[4000];
0031 };
0032 
0033 struct snp_derived_key_req {
0034     __u32 root_key_select;
0035     __u32 rsvd;
0036     __u64 guest_field_select;
0037     __u32 vmpl;
0038     __u32 guest_svn;
0039     __u64 tcb_version;
0040 };
0041 
0042 struct snp_derived_key_resp {
0043     /* response data, see SEV-SNP spec for the format */
0044     __u8 data[64];
0045 };
0046 
0047 struct snp_guest_request_ioctl {
0048     /* message version number (must be non-zero) */
0049     __u8 msg_version;
0050 
0051     /* Request and response structure address */
0052     __u64 req_data;
0053     __u64 resp_data;
0054 
0055     /* firmware error code on failure (see psp-sev.h) */
0056     __u64 fw_err;
0057 };
0058 
0059 struct snp_ext_report_req {
0060     struct snp_report_req data;
0061 
0062     /* where to copy the certificate blob */
0063     __u64 certs_address;
0064 
0065     /* length of the certificate blob */
0066     __u32 certs_len;
0067 };
0068 
0069 #define SNP_GUEST_REQ_IOC_TYPE  'S'
0070 
0071 /* Get SNP attestation report */
0072 #define SNP_GET_REPORT _IOWR(SNP_GUEST_REQ_IOC_TYPE, 0x0, struct snp_guest_request_ioctl)
0073 
0074 /* Get a derived key from the root */
0075 #define SNP_GET_DERIVED_KEY _IOWR(SNP_GUEST_REQ_IOC_TYPE, 0x1, struct snp_guest_request_ioctl)
0076 
0077 /* Get SNP extended report as defined in the GHCB specification version 2. */
0078 #define SNP_GET_EXT_REPORT _IOWR(SNP_GUEST_REQ_IOC_TYPE, 0x2, struct snp_guest_request_ioctl)
0079 
0080 #endif /* __UAPI_LINUX_SEV_GUEST_H_ */