mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-08-24 21:13:24 +00:00
x86/sev: Document requirement for linear mapping of guest request buffers
The Guest Request supports 3 types of messages now, the largest is the
extended variant of MSG_REPORT_REQ: sizeof(snp_ext_report_req)==112. These
used to be allocated on stack and then moved to the SNP guest platform device
(snp_guest_dev) for the reason explained in
db10cb9b57
("virt: sevguest: Fix passing a stack buffer as a scatterlist target"):
aesgcm_encrypt() and aesgcm_decrypt() are used for guest messages and might
potentially use a crypto accelerator which requires DMA buffers to be in the
linear mapping.
Add a comment, warn and return an error when the buffers are not in linear
mapping.
Signed-off-by: Alexey Kardashevskiy <aik@amd.com>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Reviewed-by: Tom Lendacky <thomas.lendacky@amd.com>
Reviewed-by: Dionna Glaze <dionnaglaze@google.com>
Link: https://lore.kernel.org/20250611040842.2667262-4-aik@amd.com
This commit is contained in:
parent
d100016eac
commit
7ffeb2fc26
@ -2008,6 +2008,15 @@ int snp_send_guest_request(struct snp_msg_desc *mdesc, struct snp_guest_req *req
|
||||
u64 seqno;
|
||||
int rc;
|
||||
|
||||
/*
|
||||
* enc_payload() calls aesgcm_encrypt(), which can potentially offload to HW.
|
||||
* The offload's DMA SG list of data to encrypt has to be in linear mapping.
|
||||
*/
|
||||
if (!virt_addr_valid(req->req_buf) || !virt_addr_valid(req->resp_buf)) {
|
||||
pr_warn("AES-GSM buffers must be in linear mapping");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
guard(mutex)(&snp_cmd_mutex);
|
||||
|
||||
/* Check if the VMPCK is not empty */
|
||||
|
Loading…
Reference in New Issue
Block a user