From: Hui Tang <tanghui20@huawei.com>
To: <daniel.vetter@ffwll.ch>, <grandmaster@al2klimov.de>,
<dri-devel@lists.freedesktop.org>
Cc: <linux-fbdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: [PATCH] video: fbdev: fix use of 'dma_map_single'
Date: Mon, 1 Mar 2021 12:05:09 +0800 [thread overview]
Message-ID: <1614571509-40078-1-git-send-email-tanghui20@huawei.com> (raw)
DMA_TO_DEVICE synchronisation must be done after the last modification
of the memory region by the software and before it is handed off to
the device.
Signed-off-by: Hui Tang <tanghui20@huawei.com>
---
drivers/video/fbdev/grvga.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/video/fbdev/grvga.c b/drivers/video/fbdev/grvga.c
index 24818b2..25ae9ef 100644
--- a/drivers/video/fbdev/grvga.c
+++ b/drivers/video/fbdev/grvga.c
@@ -435,6 +435,8 @@ static int grvga_probe(struct platform_device *dev)
retval = -ENOMEM;
goto dealloc_cmap;
}
+
+ memset((unsigned long *) virtual_start, 0, grvga_mem_size);
} else { /* Allocate frambuffer memory */
unsigned long page;
@@ -449,6 +451,7 @@ static int grvga_probe(struct platform_device *dev)
goto dealloc_cmap;
}
+ memset((unsigned long *) virtual_start, 0, grvga_mem_size);
physical_start = dma_map_single(&dev->dev, (void *)virtual_start, grvga_mem_size, DMA_TO_DEVICE);
/* Set page reserved so that mmap will work. This is necessary
@@ -463,8 +466,6 @@ static int grvga_probe(struct platform_device *dev)
par->fb_alloced = 1;
}
- memset((unsigned long *) virtual_start, 0, grvga_mem_size);
-
info->screen_base = (char __iomem *) virtual_start;
info->fix.smem_start = physical_start;
info->fix.smem_len = grvga_mem_size;
--
2.8.1
reply other threads:[~2021-03-01 4:08 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=1614571509-40078-1-git-send-email-tanghui20@huawei.com \
--to=tanghui20@huawei.com \
--cc=daniel.vetter@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=grandmaster@al2klimov.de \
--cc=linux-fbdev@vger.kernel.org \
--cc=linux-kernel@vger.kernel.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 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).