The SEV-SNP specification provides the guest a mechanism to communicate with the PSP without risk from a malicious hypervisor who wishes to read, alter, drop or replay the messages sent. The driver uses snp_issue_guest_request() to issue GHCB SNP_GUEST_REQUEST or SNP_EXT_GUEST_REQUEST NAE events to submit the request to PSP. The PSP requires that all communication should be encrypted using key specified through a struct snp_guest_platform_data descriptor. Userspace can use SNP_GET_REPORT ioctl() to query the guest attestation report. See SEV-SNP spec section Guest Messages for more details. [ bp: Remove the "what" from the commit message, massage. ]
Showing the changes to include/uapi (1 of 9 files). Show all
Unified · Split
| @@ -0,0 +1,50 @@ | ||
| 1 | +/* SPDX-License-Identifier: GPL-2.0-only WITH Linux-syscall-note */ | |
| 2 | +/* | |
| 3 | + * Userspace interface for AMD SEV and SNP guest driver. | |
| 4 | + * | |
| 5 | + * Copyright (C) 2021 Advanced Micro Devices, Inc. | |
| 6 | + * | |
| 7 | + * Author: Brijesh Singh <brijesh.singh@amd.com> | |
| 8 | + * | |
| 9 | + * SEV API specification is available at: https://developer.amd.com/sev/ | |
| 10 | + */ | |
| 11 | + | |
| 12 | +#ifndef __UAPI_LINUX_SEV_GUEST_H_ | |
| 13 | +#define __UAPI_LINUX_SEV_GUEST_H_ | |
| 14 | + | |
| 15 | +#include <linux/types.h> | |
| 16 | + | |
| 17 | +struct snp_report_req { | |
| 18 | + /* user data that should be included in the report */ | |
| 19 | + __u8 user_data[64]; | |
| 20 | + | |
| 21 | + /* The vmpl level to be included in the report */ | |
| 22 | + __u32 vmpl; | |
| 23 | + | |
| 24 | + /* Must be zero filled */ | |
| 25 | + __u8 rsvd[28]; | |
| 26 | +}; | |
| 27 | + | |
| 28 | +struct snp_report_resp { | |
| 29 | + /* response data, see SEV-SNP spec for the format */ | |
| 30 | + __u8 data[4000]; | |
| 31 | +}; | |
| 32 | + | |
| 33 | +struct snp_guest_request_ioctl { | |
| 34 | + /* message version number (must be non-zero) */ | |
| 35 | + __u8 msg_version; | |
| 36 | + | |
| 37 | + /* Request and response structure address */ | |
| 38 | + __u64 req_data; | |
| 39 | + __u64 resp_data; | |
| 40 | + | |
| 41 | + /* firmware error code on failure (see psp-sev.h) */ | |
| 42 | + __u64 fw_err; | |
| 43 | +}; | |
| 44 | + | |
| 45 | +#define SNP_GUEST_REQ_IOC_TYPE 'S' | |
| 46 | + | |
| 47 | +/* Get SNP attestation report */ | |
| 48 | +#define SNP_GET_REPORT _IOWR(SNP_GUEST_REQ_IOC_TYPE, 0x0, struct snp_guest_request_ioctl) | |
| 49 | + | |
| 50 | +#endif /* __UAPI_LINUX_SEV_GUEST_H_ */ | |