Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-only */
0002 /*
0003  * Copyright (C) 2021 Advanced Micro Devices, Inc.
0004  *
0005  * Author: Brijesh Singh <brijesh.singh@amd.com>
0006  *
0007  * SEV-SNP API spec is available at https://developer.amd.com/sev
0008  */
0009 
0010 #ifndef __VIRT_SEVGUEST_H__
0011 #define __VIRT_SEVGUEST_H__
0012 
0013 #include <linux/types.h>
0014 
0015 #define MAX_AUTHTAG_LEN     32
0016 
0017 /* See SNP spec SNP_GUEST_REQUEST section for the structure */
0018 enum msg_type {
0019     SNP_MSG_TYPE_INVALID = 0,
0020     SNP_MSG_CPUID_REQ,
0021     SNP_MSG_CPUID_RSP,
0022     SNP_MSG_KEY_REQ,
0023     SNP_MSG_KEY_RSP,
0024     SNP_MSG_REPORT_REQ,
0025     SNP_MSG_REPORT_RSP,
0026     SNP_MSG_EXPORT_REQ,
0027     SNP_MSG_EXPORT_RSP,
0028     SNP_MSG_IMPORT_REQ,
0029     SNP_MSG_IMPORT_RSP,
0030     SNP_MSG_ABSORB_REQ,
0031     SNP_MSG_ABSORB_RSP,
0032     SNP_MSG_VMRK_REQ,
0033     SNP_MSG_VMRK_RSP,
0034 
0035     SNP_MSG_TYPE_MAX
0036 };
0037 
0038 enum aead_algo {
0039     SNP_AEAD_INVALID,
0040     SNP_AEAD_AES_256_GCM,
0041 };
0042 
0043 struct snp_guest_msg_hdr {
0044     u8 authtag[MAX_AUTHTAG_LEN];
0045     u64 msg_seqno;
0046     u8 rsvd1[8];
0047     u8 algo;
0048     u8 hdr_version;
0049     u16 hdr_sz;
0050     u8 msg_type;
0051     u8 msg_version;
0052     u16 msg_sz;
0053     u32 rsvd2;
0054     u8 msg_vmpck;
0055     u8 rsvd3[35];
0056 } __packed;
0057 
0058 struct snp_guest_msg {
0059     struct snp_guest_msg_hdr hdr;
0060     u8 payload[4000];
0061 } __packed;
0062 
0063 #endif /* __VIRT_SEVGUEST_H__ */