mm-commits.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* + dma-remap-align-the-size-in-dma_common__remap.patch added to -mm tree
@ 2020-06-24 22:30 akpm
  0 siblings, 0 replies; only message in thread
From: akpm @ 2020-06-24 22:30 UTC (permalink / raw)
  To: mm-commits, robin.murphy, peterz, m.szyprowski, jean-philippe,
	hch, bbhushan2, eric.auger


The patch titled
     Subject: kernel/dma/remap.c: align the size in dma_common_*_remap()
has been added to the -mm tree.  Its filename is
     dma-remap-align-the-size-in-dma_common__remap.patch

This patch should soon appear at
    http://ozlabs.org/~akpm/mmots/broken-out/dma-remap-align-the-size-in-dma_common__remap.patch
and later at
    http://ozlabs.org/~akpm/mmotm/broken-out/dma-remap-align-the-size-in-dma_common__remap.patch

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***

The -mm tree is included into linux-next and is updated
there every 3-4 working days

------------------------------------------------------
From: Eric Auger <eric.auger@redhat.com>
Subject: kernel/dma/remap.c: align the size in dma_common_*_remap()

Running a guest with a virtio-iommu protecting virtio devices is broken
since commit 515e5b6d90d4 ("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.

Link: http://lkml.kernel.org/r/20200622202320.1331-1-eric.auger@redhat.com
Fixes: 515e5b6d90d4 ("dma-mapping: use vmap insted of reimplementing it")
Signed-off-by: Eric Auger <eric.auger@redhat.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Marek Szyprowski <m.szyprowski@samsung.com>
Cc: Robin Murphy <robin.murphy@arm.com>
Cc: Jean-Philippe Brucker <jean-philippe@linaro.org>
Cc: Bharat Bhushan <bbhushan2@marvell.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 kernel/dma/remap.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/kernel/dma/remap.c~dma-remap-align-the-size-in-dma_common__remap
+++ a/kernel/dma/remap.c
@@ -24,7 +24,7 @@ void *dma_common_pages_remap(struct page
 {
 	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;
@@ -37,7 +37,7 @@ void *dma_common_pages_remap(struct page
 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;
_

Patches currently in -mm which might be from eric.auger@redhat.com are

dma-remap-align-the-size-in-dma_common__remap.patch

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-06-24 22:30 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-24 22:30 + dma-remap-align-the-size-in-dma_common__remap.patch added to -mm tree akpm

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).