Skip to content

Commit d33ddc9

Browse files
kelleymhbp3tk0v
authored andcommitted
Drivers: hv: Explicitly request decrypted in vmap_pfn() calls
Update vmap_pfn() calls to explicitly request that the mapping be for decrypted access to the memory. There's no change in functionality since the PFNs passed to vmap_pfn() are above the shared_gpa_boundary, implicitly producing a decrypted mapping. But explicitly requesting "decrypted" allows the code to work before and after changes that cause vmap_pfn() to mask the PFNs to being below the shared_gpa_boundary. Signed-off-by: Michael Kelley <mikelley@microsoft.com> Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de> Reviewed-by: Tianyu Lan <Tianyu.Lan@microsoft.com> Link: https://lore.kernel.org/r/1679838727-87310-4-git-send-email-mikelley@microsoft.com
1 parent 71290be commit d33ddc9

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

arch/x86/hyperv/ivm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ void *hv_map_memory(void *addr, unsigned long size)
343343
pfns[i] = vmalloc_to_pfn(addr + i * PAGE_SIZE) +
344344
(ms_hyperv.shared_gpa_boundary >> PAGE_SHIFT);
345345

346-
vaddr = vmap_pfn(pfns, size / PAGE_SIZE, PAGE_KERNEL_IO);
346+
vaddr = vmap_pfn(pfns, size / PAGE_SIZE, pgprot_decrypted(PAGE_KERNEL));
347347
kfree(pfns);
348348

349349
return vaddr;

drivers/hv/ring_buffer.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ int hv_ringbuffer_init(struct hv_ring_buffer_info *ring_info,
211211

212212
ring_info->ring_buffer = (struct hv_ring_buffer *)
213213
vmap_pfn(pfns_wraparound, page_cnt * 2 - 1,
214-
PAGE_KERNEL);
214+
pgprot_decrypted(PAGE_KERNEL));
215215
kfree(pfns_wraparound);
216216

217217
if (!ring_info->ring_buffer)

0 commit comments

Comments
 (0)