Skip to content

Commit 0a895c0

Browse files
nikunjadbp3tk0v
authored andcommitted
virt: sev-guest: Carve out SNP message context structure
Currently, the sev-guest driver is the only user of SNP guest messaging. The snp_guest_dev structure holds all the allocated buffers, secrets page and VMPCK details. In preparation for adding messaging allocation and initialization APIs, decouple snp_guest_dev from messaging-related information by carving out the guest message context structure(snp_msg_desc). Incorporate this newly added context into snp_send_guest_request() and all related functions, replacing the use of the snp_guest_dev. No functional change. Signed-off-by: Nikunj A Dadhania <[email protected]> Signed-off-by: Borislav Petkov (AMD) <[email protected]> Reviewed-by: Tom Lendacky <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent ae59661 commit 0a895c0

File tree

2 files changed

+108
-91
lines changed

2 files changed

+108
-91
lines changed

arch/x86/include/asm/sev.h

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,27 @@ struct snp_secrets_page {
234234
u8 rsvd4[3744];
235235
} __packed;
236236

237+
struct snp_msg_desc {
238+
/* request and response are in unencrypted memory */
239+
struct snp_guest_msg *request, *response;
240+
241+
/*
242+
* Avoid information leakage by double-buffering shared messages
243+
* in fields that are in regular encrypted memory.
244+
*/
245+
struct snp_guest_msg secret_request, secret_response;
246+
247+
struct snp_secrets_page *secrets;
248+
struct snp_req_data input;
249+
250+
void *certs_data;
251+
252+
struct aesgcm_ctx *ctx;
253+
254+
u32 *os_area_msg_seqno;
255+
u8 *vmpck;
256+
};
257+
237258
/*
238259
* The SVSM Calling Area (CA) related structures.
239260
*/

0 commit comments

Comments
 (0)