All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michael Grzeschik <m.grzeschik@pengutronix.de>
To: linux-media@vger.kernel.org
Cc: tfiga@chromium.org, m.szyprowski@samsung.com, kernel@pengutronix.de
Subject: [PATCH] media: videobuf2-dma-sg: use v{un,}map instead of vm_{un,}map_ram
Date: Mon, 21 Nov 2022 00:44:41 +0100	[thread overview]
Message-ID: <20221120234441.550908-1-m.grzeschik@pengutronix.de> (raw)

The comments before the vm_map_ram function state that it should be used
for up to 256 KB only, and video buffers are definitely much larger. It
recommends using vmap in that case.

Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
---
 drivers/media/common/videobuf2/videobuf2-dma-sg.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/media/common/videobuf2/videobuf2-dma-sg.c b/drivers/media/common/videobuf2/videobuf2-dma-sg.c
index dcb8de5ab3e84a..e86621fba350f3 100644
--- a/drivers/media/common/videobuf2/videobuf2-dma-sg.c
+++ b/drivers/media/common/videobuf2/videobuf2-dma-sg.c
@@ -188,7 +188,7 @@ static void vb2_dma_sg_put(void *buf_priv)
 		dma_unmap_sgtable(buf->dev, sgt, buf->dma_dir,
 				  DMA_ATTR_SKIP_CPU_SYNC);
 		if (buf->vaddr)
-			vm_unmap_ram(buf->vaddr, buf->num_pages);
+			vunmap(buf->vaddr);
 		sg_free_table(buf->dma_sgt);
 		while (--i >= 0)
 			__free_page(buf->pages[i]);
@@ -289,7 +289,7 @@ static void vb2_dma_sg_put_userptr(void *buf_priv)
 	       __func__, buf->num_pages);
 	dma_unmap_sgtable(buf->dev, sgt, buf->dma_dir, DMA_ATTR_SKIP_CPU_SYNC);
 	if (buf->vaddr)
-		vm_unmap_ram(buf->vaddr, buf->num_pages);
+		vunmap(buf->vaddr);
 	sg_free_table(buf->dma_sgt);
 	if (buf->dma_dir == DMA_FROM_DEVICE ||
 	    buf->dma_dir == DMA_BIDIRECTIONAL)
@@ -312,7 +312,8 @@ static void *vb2_dma_sg_vaddr(struct vb2_buffer *vb, void *buf_priv)
 			ret = dma_buf_vmap(buf->db_attach->dmabuf, &map);
 			buf->vaddr = ret ? NULL : map.vaddr;
 		} else {
-			buf->vaddr = vm_map_ram(buf->pages, buf->num_pages, -1);
+			buf->vaddr = vmap(buf->pages, buf->num_pages, VM_MAP,
+					  PAGE_KERNEL);
 		}
 	}
 
-- 
2.30.2


             reply	other threads:[~2022-11-20 23:45 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-20 23:44 Michael Grzeschik [this message]
2022-11-21 11:38 ` [PATCH] media: videobuf2-dma-sg: use v{un,}map instead of vm_{un,}map_ram Andrzej Pietrasiewicz
2022-11-24 13:35 ` Hans Verkuil
2022-12-02  9:01   ` Tomasz Figa
2023-05-10 14:25     ` Michael Grzeschik
2023-05-16 10:50       ` Tomasz Figa
2023-11-01  3:43         ` Tomasz Figa
2023-11-15 21:46           ` Michael Grzeschik
2023-11-20 10:50             ` Hans Verkuil

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221120234441.550908-1-m.grzeschik@pengutronix.de \
    --to=m.grzeschik@pengutronix.de \
    --cc=kernel@pengutronix.de \
    --cc=linux-media@vger.kernel.org \
    --cc=m.szyprowski@samsung.com \
    --cc=tfiga@chromium.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.