Skip to content

Commit

Permalink
Drivers: hv: Explicitly request decrypted in vmap_pfn() calls
Browse files Browse the repository at this point in the history
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
  • Loading branch information
kelleymh authored and bp3tk0v committed Mar 27, 2023
1 parent 71290be commit d33ddc9
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion arch/x86/hyperv/ivm.c
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ void *hv_map_memory(void *addr, unsigned long size)
pfns[i] = vmalloc_to_pfn(addr + i * PAGE_SIZE) +
(ms_hyperv.shared_gpa_boundary >> PAGE_SHIFT);

vaddr = vmap_pfn(pfns, size / PAGE_SIZE, PAGE_KERNEL_IO);
vaddr = vmap_pfn(pfns, size / PAGE_SIZE, pgprot_decrypted(PAGE_KERNEL));
kfree(pfns);

return vaddr;
Expand Down
2 changes: 1 addition & 1 deletion drivers/hv/ring_buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ int hv_ringbuffer_init(struct hv_ring_buffer_info *ring_info,

ring_info->ring_buffer = (struct hv_ring_buffer *)
vmap_pfn(pfns_wraparound, page_cnt * 2 - 1,
PAGE_KERNEL);
pgprot_decrypted(PAGE_KERNEL));
kfree(pfns_wraparound);

if (!ring_info->ring_buffer)
Expand Down

0 comments on commit d33ddc9

Please sign in to comment.