Commit 8e36baf9 authored by Eric Auger's avatar Eric Auger Committed by Christoph Hellwig

dma-remap: align the size in dma_common_*_remap()

Running a guest with a virtio-iommu protecting virtio devices
is broken since commit 515e5b6d ("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: 515e5b6d ("dma-mapping: use vmap insted of reimplementing it")
Signed-off-by: default avatarEric Auger <eric.auger@redhat.com>
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
parent d07ae4c4
...@@ -24,7 +24,8 @@ void *dma_common_pages_remap(struct page **pages, size_t size, ...@@ -24,7 +24,8 @@ void *dma_common_pages_remap(struct page **pages, size_t size,
{ {
void *vaddr; 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) if (vaddr)
find_vm_area(vaddr)->pages = pages; find_vm_area(vaddr)->pages = pages;
return vaddr; return vaddr;
...@@ -37,7 +38,7 @@ void *dma_common_pages_remap(struct page **pages, size_t size, ...@@ -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, void *dma_common_contiguous_remap(struct page *page, size_t size,
pgprot_t prot, const void *caller) pgprot_t prot, const void *caller)
{ {
int count = size >> PAGE_SHIFT; int count = PAGE_ALIGN(size) >> PAGE_SHIFT;
struct page **pages; struct page **pages;
void *vaddr; void *vaddr;
int i; int i;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment