Skip to content

Commit

Permalink
dma-remap: align the size in dma_common_*_remap()
Browse files Browse the repository at this point in the history
Running a guest with a virtio-iommu protecting virtio devices
is broken since commit 515e5b6 ("dma-mapping: use vmap insted
of reimplementing it"). Before the conversion, the size was
page aligned in __get_vm_area_node(). Doing so fixes the
regression.

Fixes: 515e5b6 ("dma-mapping: use vmap insted of reimplementing it")
Signed-off-by: Eric Auger <[email protected]>
Signed-off-by: Christoph Hellwig <[email protected]>
  • Loading branch information
eauger authored and Christoph Hellwig committed Jun 23, 2020
1 parent d07ae4c commit 8e36baf
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions kernel/dma/remap.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ void *dma_common_pages_remap(struct page **pages, size_t size,
{
void *vaddr;

vaddr = vmap(pages, size >> PAGE_SHIFT, VM_DMA_COHERENT, prot);
vaddr = vmap(pages, PAGE_ALIGN(size) >> PAGE_SHIFT,
VM_DMA_COHERENT, prot);
if (vaddr)
find_vm_area(vaddr)->pages = pages;
return vaddr;
Expand All @@ -37,7 +38,7 @@ void *dma_common_pages_remap(struct page **pages, size_t size,
void *dma_common_contiguous_remap(struct page *page, size_t size,
pgprot_t prot, const void *caller)
{
int count = size >> PAGE_SHIFT;
int count = PAGE_ALIGN(size) >> PAGE_SHIFT;
struct page **pages;
void *vaddr;
int i;
Expand Down

0 comments on commit 8e36baf

Please sign in to comment.