All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] drm/sun4i: Add DMA mask and segment size
@ 2022-06-20 18:13 ` Jernej Skrabec
  0 siblings, 0 replies; 15+ messages in thread
From: Jernej Skrabec @ 2022-06-20 18:13 UTC (permalink / raw)
  To: mripard, wens
  Cc: airlied, daniel, samuel, dri-devel, linux-arm-kernel,
	linux-sunxi, linux-kernel, Jernej Skrabec

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>
---
Changes from v1:
- added comment
- updated commit message with kernel report

 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 275f7e4a03ae..f135a6b3cadb 100644
--- a/drivers/gpu/drm/sun4i/sun4i_drv.c
+++ b/drivers/gpu/drm/sun4i/sun4i_drv.c
@@ -7,6 +7,7 @@
  */
 
 #include <linux/component.h>
+#include <linux/dma-mapping.h>
 #include <linux/kfifo.h>
 #include <linux/module.h>
 #include <linux/of_graph.h>
@@ -367,6 +368,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, DMA_BIT_MASK(32));
+
 	for (i = 0;; i++) {
 		struct device_node *pipeline = of_parse_phandle(np,
 								"allwinner,pipelines",
-- 
2.36.1


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

* [PATCH v2] drm/sun4i: Add DMA mask and segment size
@ 2022-06-20 18:13 ` Jernej Skrabec
  0 siblings, 0 replies; 15+ messages in thread
From: Jernej Skrabec @ 2022-06-20 18:13 UTC (permalink / raw)
  To: mripard, wens
  Cc: samuel, airlied, linux-kernel, dri-devel, Jernej Skrabec,
	linux-sunxi, linux-arm-kernel

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>
---
Changes from v1:
- added comment
- updated commit message with kernel report

 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 275f7e4a03ae..f135a6b3cadb 100644
--- a/drivers/gpu/drm/sun4i/sun4i_drv.c
+++ b/drivers/gpu/drm/sun4i/sun4i_drv.c
@@ -7,6 +7,7 @@
  */
 
 #include <linux/component.h>
+#include <linux/dma-mapping.h>
 #include <linux/kfifo.h>
 #include <linux/module.h>
 #include <linux/of_graph.h>
@@ -367,6 +368,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, DMA_BIT_MASK(32));
+
 	for (i = 0;; i++) {
 		struct device_node *pipeline = of_parse_phandle(np,
 								"allwinner,pipelines",
-- 
2.36.1


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

* [PATCH v2] drm/sun4i: Add DMA mask and segment size
@ 2022-06-20 18:13 ` Jernej Skrabec
  0 siblings, 0 replies; 15+ messages in thread
From: Jernej Skrabec @ 2022-06-20 18:13 UTC (permalink / raw)
  To: mripard, wens
  Cc: airlied, daniel, samuel, dri-devel, linux-arm-kernel,
	linux-sunxi, linux-kernel, Jernej Skrabec

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>
---
Changes from v1:
- added comment
- updated commit message with kernel report

 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 275f7e4a03ae..f135a6b3cadb 100644
--- a/drivers/gpu/drm/sun4i/sun4i_drv.c
+++ b/drivers/gpu/drm/sun4i/sun4i_drv.c
@@ -7,6 +7,7 @@
  */
 
 #include <linux/component.h>
+#include <linux/dma-mapping.h>
 #include <linux/kfifo.h>
 #include <linux/module.h>
 #include <linux/of_graph.h>
@@ -367,6 +368,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, DMA_BIT_MASK(32));
+
 	for (i = 0;; i++) {
 		struct device_node *pipeline = of_parse_phandle(np,
 								"allwinner,pipelines",
-- 
2.36.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v2] drm/sun4i: Add DMA mask and segment size
  2022-06-20 18:13 ` Jernej Skrabec
  (?)
@ 2022-06-21  3:17   ` Samuel Holland
  -1 siblings, 0 replies; 15+ messages in thread
From: Samuel Holland @ 2022-06-21  3:17 UTC (permalink / raw)
  To: Jernej Skrabec, mripard, wens
  Cc: airlied, daniel, dri-devel, linux-arm-kernel, linux-sunxi, linux-kernel

On 6/20/22 1:13 PM, Jernej Skrabec wrote:
> 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>

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

* Re: [PATCH v2] drm/sun4i: Add DMA mask and segment size
@ 2022-06-21  3:17   ` Samuel Holland
  0 siblings, 0 replies; 15+ messages in thread
From: Samuel Holland @ 2022-06-21  3:17 UTC (permalink / raw)
  To: Jernej Skrabec, mripard, wens
  Cc: airlied, linux-kernel, dri-devel, linux-sunxi, linux-arm-kernel

On 6/20/22 1:13 PM, Jernej Skrabec wrote:
> 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>

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

* Re: [PATCH v2] drm/sun4i: Add DMA mask and segment size
@ 2022-06-21  3:17   ` Samuel Holland
  0 siblings, 0 replies; 15+ messages in thread
From: Samuel Holland @ 2022-06-21  3:17 UTC (permalink / raw)
  To: Jernej Skrabec, mripard, wens
  Cc: airlied, daniel, dri-devel, linux-arm-kernel, linux-sunxi, linux-kernel

On 6/20/22 1:13 PM, Jernej Skrabec wrote:
> 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>

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v2] drm/sun4i: Add DMA mask and segment size
  2022-06-20 18:13 ` Jernej Skrabec
  (?)
@ 2022-06-21 12:44   ` Robin Murphy
  -1 siblings, 0 replies; 15+ messages in thread
From: Robin Murphy @ 2022-06-21 12:44 UTC (permalink / raw)
  To: Jernej Skrabec, mripard, wens
  Cc: airlied, daniel, samuel, dri-devel, linux-arm-kernel,
	linux-sunxi, linux-kernel

On 2022-06-20 19:13, Jernej Skrabec wrote:
> 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>
> ---
> Changes from v1:
> - added comment
> - updated commit message with kernel report
> 
>   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 275f7e4a03ae..f135a6b3cadb 100644
> --- a/drivers/gpu/drm/sun4i/sun4i_drv.c
> +++ b/drivers/gpu/drm/sun4i/sun4i_drv.c
> @@ -7,6 +7,7 @@
>    */
>   
>   #include <linux/component.h>
> +#include <linux/dma-mapping.h>
>   #include <linux/kfifo.h>
>   #include <linux/module.h>
>   #include <linux/of_graph.h>
> @@ -367,6 +368,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, DMA_BIT_MASK(32));

Nit: this one is a number, not a bitmask, so UINT_MAX would be more 
appropriate semantically.

Thanks,
Robin.

> +
>   	for (i = 0;; i++) {
>   		struct device_node *pipeline = of_parse_phandle(np,
>   								"allwinner,pipelines",

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

* Re: [PATCH v2] drm/sun4i: Add DMA mask and segment size
@ 2022-06-21 12:44   ` Robin Murphy
  0 siblings, 0 replies; 15+ messages in thread
From: Robin Murphy @ 2022-06-21 12:44 UTC (permalink / raw)
  To: Jernej Skrabec, mripard, wens
  Cc: samuel, airlied, linux-kernel, dri-devel, linux-sunxi, linux-arm-kernel

On 2022-06-20 19:13, Jernej Skrabec wrote:
> 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>
> ---
> Changes from v1:
> - added comment
> - updated commit message with kernel report
> 
>   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 275f7e4a03ae..f135a6b3cadb 100644
> --- a/drivers/gpu/drm/sun4i/sun4i_drv.c
> +++ b/drivers/gpu/drm/sun4i/sun4i_drv.c
> @@ -7,6 +7,7 @@
>    */
>   
>   #include <linux/component.h>
> +#include <linux/dma-mapping.h>
>   #include <linux/kfifo.h>
>   #include <linux/module.h>
>   #include <linux/of_graph.h>
> @@ -367,6 +368,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, DMA_BIT_MASK(32));

Nit: this one is a number, not a bitmask, so UINT_MAX would be more 
appropriate semantically.

Thanks,
Robin.

> +
>   	for (i = 0;; i++) {
>   		struct device_node *pipeline = of_parse_phandle(np,
>   								"allwinner,pipelines",

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

* Re: [PATCH v2] drm/sun4i: Add DMA mask and segment size
@ 2022-06-21 12:44   ` Robin Murphy
  0 siblings, 0 replies; 15+ messages in thread
From: Robin Murphy @ 2022-06-21 12:44 UTC (permalink / raw)
  To: Jernej Skrabec, mripard, wens
  Cc: airlied, daniel, samuel, dri-devel, linux-arm-kernel,
	linux-sunxi, linux-kernel

On 2022-06-20 19:13, Jernej Skrabec wrote:
> 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>
> ---
> Changes from v1:
> - added comment
> - updated commit message with kernel report
> 
>   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 275f7e4a03ae..f135a6b3cadb 100644
> --- a/drivers/gpu/drm/sun4i/sun4i_drv.c
> +++ b/drivers/gpu/drm/sun4i/sun4i_drv.c
> @@ -7,6 +7,7 @@
>    */
>   
>   #include <linux/component.h>
> +#include <linux/dma-mapping.h>
>   #include <linux/kfifo.h>
>   #include <linux/module.h>
>   #include <linux/of_graph.h>
> @@ -367,6 +368,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, DMA_BIT_MASK(32));

Nit: this one is a number, not a bitmask, so UINT_MAX would be more 
appropriate semantically.

Thanks,
Robin.

> +
>   	for (i = 0;; i++) {
>   		struct device_node *pipeline = of_parse_phandle(np,
>   								"allwinner,pipelines",

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: (subset) [PATCH v2] drm/sun4i: Add DMA mask and segment size
  2022-06-20 18:13 ` Jernej Skrabec
  (?)
@ 2022-06-22  7:37   ` Maxime Ripard
  -1 siblings, 0 replies; 15+ messages in thread
From: Maxime Ripard @ 2022-06-22  7:37 UTC (permalink / raw)
  To: mripard, jernej.skrabec, wens
  Cc: Maxime Ripard, samuel, dri-devel, airlied, linux-sunxi,
	linux-kernel, linux-arm-kernel, daniel

On Mon, 20 Jun 2022 20:13:33 +0200, Jernej Skrabec wrote:
> 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 ]---
> 
> [...]

Applied to drm/drm-misc (drm-misc-fixes).

Thanks!
Maxime

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

* Re: (subset) [PATCH v2] drm/sun4i: Add DMA mask and segment size
@ 2022-06-22  7:37   ` Maxime Ripard
  0 siblings, 0 replies; 15+ messages in thread
From: Maxime Ripard @ 2022-06-22  7:37 UTC (permalink / raw)
  To: mripard, jernej.skrabec, wens
  Cc: samuel, airlied, linux-kernel, dri-devel, Maxime Ripard,
	linux-sunxi, linux-arm-kernel

On Mon, 20 Jun 2022 20:13:33 +0200, Jernej Skrabec wrote:
> 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 ]---
> 
> [...]

Applied to drm/drm-misc (drm-misc-fixes).

Thanks!
Maxime

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

* Re: (subset) [PATCH v2] drm/sun4i: Add DMA mask and segment size
@ 2022-06-22  7:37   ` Maxime Ripard
  0 siblings, 0 replies; 15+ messages in thread
From: Maxime Ripard @ 2022-06-22  7:37 UTC (permalink / raw)
  To: mripard, jernej.skrabec, wens
  Cc: Maxime Ripard, samuel, dri-devel, airlied, linux-sunxi,
	linux-kernel, linux-arm-kernel, daniel

On Mon, 20 Jun 2022 20:13:33 +0200, Jernej Skrabec wrote:
> 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 ]---
> 
> [...]

Applied to drm/drm-misc (drm-misc-fixes).

Thanks!
Maxime

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v2] drm/sun4i: Add DMA mask and segment size
  2022-06-21 12:44   ` Robin Murphy
  (?)
@ 2022-06-22  7:38     ` Maxime Ripard
  -1 siblings, 0 replies; 15+ messages in thread
From: Maxime Ripard @ 2022-06-22  7:38 UTC (permalink / raw)
  To: Robin Murphy
  Cc: samuel, airlied, linux-kernel, dri-devel, wens, Jernej Skrabec,
	linux-sunxi, linux-arm-kernel

[-- Attachment #1: Type: text/plain, Size: 4146 bytes --]

Hi Robin,

On Tue, Jun 21, 2022 at 01:44:44PM +0100, Robin Murphy wrote:
> On 2022-06-20 19:13, Jernej Skrabec wrote:
> > 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>
> > ---
> > Changes from v1:
> > - added comment
> > - updated commit message with kernel report
> > 
> >   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 275f7e4a03ae..f135a6b3cadb 100644
> > --- a/drivers/gpu/drm/sun4i/sun4i_drv.c
> > +++ b/drivers/gpu/drm/sun4i/sun4i_drv.c
> > @@ -7,6 +7,7 @@
> >    */
> >   #include <linux/component.h>
> > +#include <linux/dma-mapping.h>
> >   #include <linux/kfifo.h>
> >   #include <linux/module.h>
> >   #include <linux/of_graph.h>
> > @@ -367,6 +368,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, DMA_BIT_MASK(32));
> 
> Nit: this one is a number, not a bitmask, so UINT_MAX would be more
> appropriate semantically.

Thanks for the suggestion, I've fixed it while applying

Maxime

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

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

* Re: [PATCH v2] drm/sun4i: Add DMA mask and segment size
@ 2022-06-22  7:38     ` Maxime Ripard
  0 siblings, 0 replies; 15+ messages in thread
From: Maxime Ripard @ 2022-06-22  7:38 UTC (permalink / raw)
  To: Robin Murphy
  Cc: Jernej Skrabec, wens, airlied, daniel, samuel, dri-devel,
	linux-arm-kernel, linux-sunxi, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 4146 bytes --]

Hi Robin,

On Tue, Jun 21, 2022 at 01:44:44PM +0100, Robin Murphy wrote:
> On 2022-06-20 19:13, Jernej Skrabec wrote:
> > 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>
> > ---
> > Changes from v1:
> > - added comment
> > - updated commit message with kernel report
> > 
> >   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 275f7e4a03ae..f135a6b3cadb 100644
> > --- a/drivers/gpu/drm/sun4i/sun4i_drv.c
> > +++ b/drivers/gpu/drm/sun4i/sun4i_drv.c
> > @@ -7,6 +7,7 @@
> >    */
> >   #include <linux/component.h>
> > +#include <linux/dma-mapping.h>
> >   #include <linux/kfifo.h>
> >   #include <linux/module.h>
> >   #include <linux/of_graph.h>
> > @@ -367,6 +368,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, DMA_BIT_MASK(32));
> 
> Nit: this one is a number, not a bitmask, so UINT_MAX would be more
> appropriate semantically.

Thanks for the suggestion, I've fixed it while applying

Maxime

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

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

* Re: [PATCH v2] drm/sun4i: Add DMA mask and segment size
@ 2022-06-22  7:38     ` Maxime Ripard
  0 siblings, 0 replies; 15+ messages in thread
From: Maxime Ripard @ 2022-06-22  7:38 UTC (permalink / raw)
  To: Robin Murphy
  Cc: Jernej Skrabec, wens, airlied, daniel, samuel, dri-devel,
	linux-arm-kernel, linux-sunxi, linux-kernel


[-- Attachment #1.1: Type: text/plain, Size: 4146 bytes --]

Hi Robin,

On Tue, Jun 21, 2022 at 01:44:44PM +0100, Robin Murphy wrote:
> On 2022-06-20 19:13, Jernej Skrabec wrote:
> > 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>
> > ---
> > Changes from v1:
> > - added comment
> > - updated commit message with kernel report
> > 
> >   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 275f7e4a03ae..f135a6b3cadb 100644
> > --- a/drivers/gpu/drm/sun4i/sun4i_drv.c
> > +++ b/drivers/gpu/drm/sun4i/sun4i_drv.c
> > @@ -7,6 +7,7 @@
> >    */
> >   #include <linux/component.h>
> > +#include <linux/dma-mapping.h>
> >   #include <linux/kfifo.h>
> >   #include <linux/module.h>
> >   #include <linux/of_graph.h>
> > @@ -367,6 +368,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, DMA_BIT_MASK(32));
> 
> Nit: this one is a number, not a bitmask, so UINT_MAX would be more
> appropriate semantically.

Thanks for the suggestion, I've fixed it while applying

Maxime

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

end of thread, other threads:[~2022-06-22  7:39 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-20 18:13 [PATCH v2] drm/sun4i: Add DMA mask and segment size Jernej Skrabec
2022-06-20 18:13 ` Jernej Skrabec
2022-06-20 18:13 ` Jernej Skrabec
2022-06-21  3:17 ` Samuel Holland
2022-06-21  3:17   ` Samuel Holland
2022-06-21  3:17   ` Samuel Holland
2022-06-21 12:44 ` Robin Murphy
2022-06-21 12:44   ` Robin Murphy
2022-06-21 12:44   ` Robin Murphy
2022-06-22  7:38   ` Maxime Ripard
2022-06-22  7:38     ` Maxime Ripard
2022-06-22  7:38     ` Maxime Ripard
2022-06-22  7:37 ` (subset) " Maxime Ripard
2022-06-22  7:37   ` Maxime Ripard
2022-06-22  7:37   ` Maxime Ripard

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.