1*d63670d2STom Lendacky /* SPDX-License-Identifier: GPL-2.0-only */ 2*d63670d2STom Lendacky /* 3*d63670d2STom Lendacky * Copyright (C) 2021 Advanced Micro Devices, Inc. 4*d63670d2STom Lendacky * 5*d63670d2STom Lendacky * Author: Brijesh Singh <brijesh.singh@amd.com> 6*d63670d2STom Lendacky * 7*d63670d2STom Lendacky * SEV-SNP API spec is available at https://developer.amd.com/sev 8*d63670d2STom Lendacky */ 9*d63670d2STom Lendacky 10*d63670d2STom Lendacky #ifndef __VIRT_SEVGUEST_H__ 11*d63670d2STom Lendacky #define __VIRT_SEVGUEST_H__ 12*d63670d2STom Lendacky 13*d63670d2STom Lendacky #include <linux/types.h> 14*d63670d2STom Lendacky 15*d63670d2STom Lendacky #define MAX_AUTHTAG_LEN 32 16*d63670d2STom Lendacky 17*d63670d2STom Lendacky /* See SNP spec SNP_GUEST_REQUEST section for the structure */ 18*d63670d2STom Lendacky enum msg_type { 19*d63670d2STom Lendacky SNP_MSG_TYPE_INVALID = 0, 20*d63670d2STom Lendacky SNP_MSG_CPUID_REQ, 21*d63670d2STom Lendacky SNP_MSG_CPUID_RSP, 22*d63670d2STom Lendacky SNP_MSG_KEY_REQ, 23*d63670d2STom Lendacky SNP_MSG_KEY_RSP, 24*d63670d2STom Lendacky SNP_MSG_REPORT_REQ, 25*d63670d2STom Lendacky SNP_MSG_REPORT_RSP, 26*d63670d2STom Lendacky SNP_MSG_EXPORT_REQ, 27*d63670d2STom Lendacky SNP_MSG_EXPORT_RSP, 28*d63670d2STom Lendacky SNP_MSG_IMPORT_REQ, 29*d63670d2STom Lendacky SNP_MSG_IMPORT_RSP, 30*d63670d2STom Lendacky SNP_MSG_ABSORB_REQ, 31*d63670d2STom Lendacky SNP_MSG_ABSORB_RSP, 32*d63670d2STom Lendacky SNP_MSG_VMRK_REQ, 33*d63670d2STom Lendacky SNP_MSG_VMRK_RSP, 34*d63670d2STom Lendacky 35*d63670d2STom Lendacky SNP_MSG_TYPE_MAX 36*d63670d2STom Lendacky }; 37*d63670d2STom Lendacky 38*d63670d2STom Lendacky enum aead_algo { 39*d63670d2STom Lendacky SNP_AEAD_INVALID, 40*d63670d2STom Lendacky SNP_AEAD_AES_256_GCM, 41*d63670d2STom Lendacky }; 42*d63670d2STom Lendacky 43*d63670d2STom Lendacky struct snp_guest_msg_hdr { 44*d63670d2STom Lendacky u8 authtag[MAX_AUTHTAG_LEN]; 45*d63670d2STom Lendacky u64 msg_seqno; 46*d63670d2STom Lendacky u8 rsvd1[8]; 47*d63670d2STom Lendacky u8 algo; 48*d63670d2STom Lendacky u8 hdr_version; 49*d63670d2STom Lendacky u16 hdr_sz; 50*d63670d2STom Lendacky u8 msg_type; 51*d63670d2STom Lendacky u8 msg_version; 52*d63670d2STom Lendacky u16 msg_sz; 53*d63670d2STom Lendacky u32 rsvd2; 54*d63670d2STom Lendacky u8 msg_vmpck; 55*d63670d2STom Lendacky u8 rsvd3[35]; 56*d63670d2STom Lendacky } __packed; 57*d63670d2STom Lendacky 58*d63670d2STom Lendacky struct snp_guest_msg { 59*d63670d2STom Lendacky struct snp_guest_msg_hdr hdr; 60*d63670d2STom Lendacky u8 payload[4000]; 61*d63670d2STom Lendacky } __packed; 62*d63670d2STom Lendacky 63*d63670d2STom Lendacky #endif /* __VIRT_SEVGUEST_H__ */ 64