Skip to content

Commit f55f3c3

Browse files
mdrothbonzini
authored andcommitted
x86/sev: Move sev_guest.h into common SEV header
sev_guest.h currently contains various definitions relating to the format of SNP_GUEST_REQUEST commands to SNP firmware. Currently only the sev-guest driver makes use of them, but when the KVM side of this is implemented there's a need to parse the SNP_GUEST_REQUEST header to determine whether additional information needs to be provided to the guest. Prepare for this by moving those definitions to a common header that's shared by host/guest code so that KVM can also make use of them. Reviewed-by: Tom Lendacky <[email protected]> Reviewed-by: Liam Merwick <[email protected]> Signed-off-by: Michael Roth <[email protected]> Message-ID: <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]>
1 parent 88caf54 commit f55f3c3

File tree

3 files changed

+48
-65
lines changed

3 files changed

+48
-65
lines changed

arch/x86/include/asm/sev.h

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,54 @@ struct snp_req_data {
119119
unsigned int data_npages;
120120
};
121121

122+
#define MAX_AUTHTAG_LEN 32
123+
124+
/* See SNP spec SNP_GUEST_REQUEST section for the structure */
125+
enum msg_type {
126+
SNP_MSG_TYPE_INVALID = 0,
127+
SNP_MSG_CPUID_REQ,
128+
SNP_MSG_CPUID_RSP,
129+
SNP_MSG_KEY_REQ,
130+
SNP_MSG_KEY_RSP,
131+
SNP_MSG_REPORT_REQ,
132+
SNP_MSG_REPORT_RSP,
133+
SNP_MSG_EXPORT_REQ,
134+
SNP_MSG_EXPORT_RSP,
135+
SNP_MSG_IMPORT_REQ,
136+
SNP_MSG_IMPORT_RSP,
137+
SNP_MSG_ABSORB_REQ,
138+
SNP_MSG_ABSORB_RSP,
139+
SNP_MSG_VMRK_REQ,
140+
SNP_MSG_VMRK_RSP,
141+
142+
SNP_MSG_TYPE_MAX
143+
};
144+
145+
enum aead_algo {
146+
SNP_AEAD_INVALID,
147+
SNP_AEAD_AES_256_GCM,
148+
};
149+
150+
struct snp_guest_msg_hdr {
151+
u8 authtag[MAX_AUTHTAG_LEN];
152+
u64 msg_seqno;
153+
u8 rsvd1[8];
154+
u8 algo;
155+
u8 hdr_version;
156+
u16 hdr_sz;
157+
u8 msg_type;
158+
u8 msg_version;
159+
u16 msg_sz;
160+
u32 rsvd2;
161+
u8 msg_vmpck;
162+
u8 rsvd3[35];
163+
} __packed;
164+
165+
struct snp_guest_msg {
166+
struct snp_guest_msg_hdr hdr;
167+
u8 payload[4000];
168+
} __packed;
169+
122170
struct sev_guest_platform_data {
123171
u64 secrets_gpa;
124172
};

drivers/virt/coco/sev-guest/sev-guest.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@
2929
#include <asm/svm.h>
3030
#include <asm/sev.h>
3131

32-
#include "sev-guest.h"
33-
3432
#define DEVICE_NAME "sev-guest"
3533
#define AAD_LEN 48
3634
#define MSG_HDR_VER 1

drivers/virt/coco/sev-guest/sev-guest.h

Lines changed: 0 additions & 63 deletions
This file was deleted.

0 commit comments

Comments
 (0)