Skip to content

Commit 8e36baf

Browse files
eaugerChristoph Hellwig
authored andcommitted
dma-remap: align the size in dma_common_*_remap()
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]>
1 parent d07ae4c commit 8e36baf

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

kernel/dma/remap.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ void *dma_common_pages_remap(struct page **pages, size_t size,
2424
{
2525
void *vaddr;
2626

27-
vaddr = vmap(pages, size >> PAGE_SHIFT, VM_DMA_COHERENT, prot);
27+
vaddr = vmap(pages, PAGE_ALIGN(size) >> PAGE_SHIFT,
28+
VM_DMA_COHERENT, prot);
2829
if (vaddr)
2930
find_vm_area(vaddr)->pages = pages;
3031
return vaddr;
@@ -37,7 +38,7 @@ void *dma_common_pages_remap(struct page **pages, size_t size,
3738
void *dma_common_contiguous_remap(struct page *page, size_t size,
3839
pgprot_t prot, const void *caller)
3940
{
40-
int count = size >> PAGE_SHIFT;
41+
int count = PAGE_ALIGN(size) >> PAGE_SHIFT;
4142
struct page **pages;
4243
void *vaddr;
4344
int i;

0 commit comments

Comments
 (0)