mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 1/2] udmabuf: fix vmap_udmabuf error page set
@ 2024-07-31  9:02 Huan Yang
  2024-07-31  9:02 ` [PATCH 2/2] udmabuf: make udmabuf folios and offsets set more readable Huan Yang
  0 siblings, 1 reply; 2+ messages in thread
From: Huan Yang @ 2024-07-31  9:02 UTC (permalink / raw)
  To: Gerd Hoffmann, Sumit Semwal, Christian König, dri-devel,
	linux-media, linaro-mm-sig, linux-kernel
  Cc: opensource.kernel, Huan Yang

Currently vmap_udmabuf set page's array by each folio.
But, ubuf->folios is only contain's the folio's head page.

That mean we repeatedly mapped the folio head page to the vmalloc area.

This patch fix it, set each folio's page correct, so that pages array
contains right page, and then map into vmalloc area

Signed-off-by: Huan Yang <link@vivo.com>
---
 drivers/dma-buf/udmabuf.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/dma-buf/udmabuf.c b/drivers/dma-buf/udmabuf.c
index 047c3cd2ceff..6604d91e7072 100644
--- a/drivers/dma-buf/udmabuf.c
+++ b/drivers/dma-buf/udmabuf.c
@@ -85,7 +85,8 @@ static int vmap_udmabuf(struct dma_buf *buf, struct iosys_map *map)
 		return -ENOMEM;
 
 	for (pg = 0; pg < ubuf->pagecount; pg++)
-		pages[pg] = &ubuf->folios[pg]->page;
+		pages[pg] = folio_page(ubuf->folios[pg],
+				       ubuf->offsets[pg] >> PAGE_SHIFT);
 
 	vaddr = vm_map_ram(pages, ubuf->pagecount, -1);
 	kfree(pages);

base-commit: cd19ac2f903276b820f5d0d89de0c896c27036ed
-- 
2.45.2


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-07-31  9:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-07-31  9:02 [PATCH 1/2] udmabuf: fix vmap_udmabuf error page set Huan Yang
2024-07-31  9:02 ` [PATCH 2/2] udmabuf: make udmabuf folios and offsets set more readable Huan Yang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®