From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Jernej Skrabec <jernej.skrabec@gmail.com>,
Samuel Holland <samuel@sholland.org>,
Maxime Ripard <maxime@cerno.tech>,
Sasha Levin <sashal@kernel.org>,
mripard@kernel.org, wens@csie.org, airlied@linux.ie,
daniel@ffwll.ch, dri-devel@lists.freedesktop.org,
linux-arm-kernel@lists.infradead.org,
linux-sunxi@lists.linux.dev
Subject: [PATCH AUTOSEL 4.19 20/22] drm/sun4i: Add DMA mask and segment size
Date: Mon, 27 Jun 2022 22:25:15 -0400 [thread overview]
Message-ID: <20220628022518.596687-20-sashal@kernel.org> (raw)
In-Reply-To: <20220628022518.596687-1-sashal@kernel.org>
From: Jernej Skrabec <jernej.skrabec@gmail.com>
[ Upstream commit f5aa16807aa4f99293044944590dde81364f434f ]
Kernel occasionally complains that there is mismatch in segment size
when trying to render HW decoded videos and rendering them directly with
sun4i DRM driver. Following message can be observed on H6 SoC:
[ 184.298308] ------------[ cut here ]------------
[ 184.298326] DMA-API: sun4i-drm display-engine: mapping sg segment longer than device claims to support [len=6144000] [max=65536]
[ 184.298364] WARNING: CPU: 1 PID: 382 at kernel/dma/debug.c:1162 debug_dma_map_sg+0x2b0/0x350
[ 184.322997] CPU: 1 PID: 382 Comm: ffmpeg Not tainted 5.19.0-rc1+ #1331
[ 184.329533] Hardware name: Tanix TX6 (DT)
[ 184.333544] pstate: 60000005 (nZCv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--)
[ 184.340512] pc : debug_dma_map_sg+0x2b0/0x350
[ 184.344882] lr : debug_dma_map_sg+0x2b0/0x350
[ 184.349250] sp : ffff800009f33a50
[ 184.352567] x29: ffff800009f33a50 x28: 0000000000010000 x27: ffff000001b86c00
[ 184.359725] x26: ffffffffffffffff x25: ffff000005d8cc80 x24: 0000000000000000
[ 184.366879] x23: ffff80000939ab18 x22: 0000000000000001 x21: 0000000000000001
[ 184.374031] x20: 0000000000000000 x19: ffff0000018a7410 x18: ffffffffffffffff
[ 184.381186] x17: 0000000000000000 x16: 0000000000000000 x15: ffffffffffffffff
[ 184.388338] x14: 0000000000000001 x13: ffff800009534e86 x12: 6f70707573206f74
[ 184.395493] x11: 20736d69616c6320 x10: 000000000000000a x9 : 0000000000010000
[ 184.402647] x8 : ffff8000093b6d40 x7 : ffff800009f33850 x6 : 000000000000000c
[ 184.409800] x5 : ffff0000bf997940 x4 : 0000000000000000 x3 : 0000000000000027
[ 184.416953] x2 : 0000000000000000 x1 : 0000000000000000 x0 : ffff000003960e80
[ 184.424106] Call trace:
[ 184.426556] debug_dma_map_sg+0x2b0/0x350
[ 184.430580] __dma_map_sg_attrs+0xa0/0x110
[ 184.434687] dma_map_sgtable+0x28/0x4c
[ 184.438447] vb2_dc_dmabuf_ops_map+0x60/0xcc
[ 184.442729] __map_dma_buf+0x2c/0xd4
[ 184.446321] dma_buf_map_attachment+0xa0/0x130
[ 184.450777] drm_gem_prime_import_dev+0x7c/0x18c
[ 184.455410] drm_gem_prime_fd_to_handle+0x1b8/0x214
[ 184.460300] drm_prime_fd_to_handle_ioctl+0x2c/0x40
[ 184.465190] drm_ioctl_kernel+0xc4/0x174
[ 184.469123] drm_ioctl+0x204/0x420
[ 184.472534] __arm64_sys_ioctl+0xac/0xf0
[ 184.476474] invoke_syscall+0x48/0x114
[ 184.480240] el0_svc_common.constprop.0+0x44/0xec
[ 184.484956] do_el0_svc+0x2c/0xc0
[ 184.488283] el0_svc+0x2c/0x84
[ 184.491354] el0t_64_sync_handler+0x11c/0x150
[ 184.495723] el0t_64_sync+0x18c/0x190
[ 184.499397] ---[ end trace 0000000000000000 ]---
Fix that by setting DMA mask and segment size.
Signed-off-by: Jernej Skrabec <jernej.skrabec@gmail.com>
Reviewed-by: Samuel Holland <samuel@sholland.org>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Link: https://patchwork.freedesktop.org/patch/msgid/20220620181333.650301-1-jernej.skrabec@gmail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/gpu/drm/sun4i/sun4i_drv.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/drivers/gpu/drm/sun4i/sun4i_drv.c b/drivers/gpu/drm/sun4i/sun4i_drv.c
index 57f61ec4bc6b..2fdc83f7fb05 100644
--- a/drivers/gpu/drm/sun4i/sun4i_drv.c
+++ b/drivers/gpu/drm/sun4i/sun4i_drv.c
@@ -11,6 +11,7 @@
*/
#include <linux/component.h>
+#include <linux/dma-mapping.h>
#include <linux/kfifo.h>
#include <linux/of_graph.h>
#include <linux/of_reserved_mem.h>
@@ -378,6 +379,13 @@ static int sun4i_drv_probe(struct platform_device *pdev)
INIT_KFIFO(list.fifo);
+ /*
+ * DE2 and DE3 cores actually supports 40-bit addresses, but
+ * driver does not.
+ */
+ dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
+ dma_set_max_seg_size(&pdev->dev, UINT_MAX);
+
for (i = 0;; i++) {
struct device_node *pipeline = of_parse_phandle(np,
"allwinner,pipelines",
--
2.35.1
next prev parent reply other threads:[~2022-06-28 2:33 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-28 2:24 [PATCH AUTOSEL 4.19 01/22] spi: spi-cadence: Fix SPI CS gets toggling sporadically Sasha Levin
2022-06-28 2:24 ` [PATCH AUTOSEL 4.19 02/22] spi: cadence: Detect transmit FIFO depth Sasha Levin
2022-06-28 2:24 ` [PATCH AUTOSEL 4.19 03/22] ALSA: usb-audio: US16x08: Move overflow check before array access Sasha Levin
2022-06-28 2:24 ` [PATCH AUTOSEL 4.19 04/22] drm/vc4: crtc: Use an union to store the page flip callback Sasha Levin
2022-06-29 13:10 ` Pavel Machek
2022-06-28 2:25 ` [PATCH AUTOSEL 4.19 05/22] drm/vc4: crtc: Move the BO handling out of common page-flip callback Sasha Levin
2022-06-28 2:25 ` [PATCH AUTOSEL 4.19 06/22] ALSA: x86: intel_hdmi_audio: enable pm_runtime and set autosuspend delay Sasha Levin
2022-06-28 2:25 ` [PATCH AUTOSEL 4.19 07/22] hamradio: 6pack: fix array-index-out-of-bounds in decode_std_command() Sasha Levin
2022-06-28 2:25 ` [PATCH AUTOSEL 4.19 08/22] drivers/net/ethernet/neterion/vxge: Fix a use-after-free bug in vxge-main.c Sasha Levin
2022-06-28 2:25 ` [PATCH AUTOSEL 4.19 09/22] video: fbdev: skeletonfb: Fix syntax errors in comments Sasha Levin
2022-06-28 2:25 ` [PATCH AUTOSEL 4.19 10/22] video: fbdev: intelfb: Use aperture size from pci_resource_len Sasha Levin
2022-06-28 2:25 ` [PATCH AUTOSEL 4.19 11/22] video: fbdev: pxa3xx-gcu: Fix integer overflow in pxa3xx_gcu_write Sasha Levin
2022-06-28 2:25 ` [PATCH AUTOSEL 4.19 12/22] video: fbdev: simplefb: Check before clk_put() not needed Sasha Levin
2022-06-28 2:25 ` [PATCH AUTOSEL 4.19 13/22] arch: mips: generic: Add missing of_node_put() in board-ranchu.c Sasha Levin
2022-06-28 2:25 ` [PATCH AUTOSEL 4.19 14/22] mips: mti-malta: Fix refcount leak in malta-time.c Sasha Levin
2022-06-28 2:25 ` [PATCH AUTOSEL 4.19 15/22] mips: ralink: Fix refcount leak in of.c Sasha Levin
2022-06-28 2:25 ` [PATCH AUTOSEL 4.19 16/22] mips: lantiq: falcon: Fix refcount leak bug in sysctrl Sasha Levin
2022-06-28 2:25 ` [PATCH AUTOSEL 4.19 17/22] mips: lantiq: xway: " Sasha Levin
2022-06-28 2:25 ` [PATCH AUTOSEL 4.19 18/22] mips/pic32/pic32mzda: Fix refcount leak bugs Sasha Levin
2022-06-28 2:25 ` [PATCH AUTOSEL 4.19 19/22] mips: lantiq: Add missing of_node_put() in irq.c Sasha Levin
2022-06-28 2:25 ` Sasha Levin [this message]
2022-06-28 2:25 ` [PATCH AUTOSEL 4.19 21/22] drm/amdgpu: Adjust logic around GTT size (v3) Sasha Levin
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=20220628022518.596687-20-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=airlied@linux.ie \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=jernej.skrabec@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sunxi@lists.linux.dev \
--cc=maxime@cerno.tech \
--cc=mripard@kernel.org \
--cc=samuel@sholland.org \
--cc=stable@vger.kernel.org \
--cc=wens@csie.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