public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/v3d: set the V3D GPU sg segment limitation
@ 2025-11-13  9:25 Xiaolei Wang
  2025-11-23  7:18 ` xiaolei wang
  2025-12-01 13:35 ` Maíra Canal
  0 siblings, 2 replies; 4+ messages in thread
From: Xiaolei Wang @ 2025-11-13  9:25 UTC (permalink / raw)
  To: mwen, mcanal, maarten.lankhorst, mripard, tzimmermann, airlied,
	simona, xiaolei.wang
  Cc: dri-devel, linux-kernel

When using V3D rendering, the kernel occasionally reports a
segment size mismatch. This is because 'max_seg_size' is not
set. The kernel defaults to 64K. Based on V3D's addressing
capabilities, setting 'max_seg_size' to the maximum will
prevent 'debug_dma_map_sg()' from complaining about the
over-mapping of the V3D segment length.

DMA-API: v3d 1002000000.v3d: mapping sg segment longer than device
 claims to support [len=8290304] [max=65536]
WARNING: CPU: 0 PID: 493 at kernel/dma/debug.c:1179 debug_dma_map_sg+0x330/0x388
CPU: 0 UID: 0 PID: 493 Comm: Xorg Not tainted 6.12.53-yocto-standard #1
Hardware name: Raspberry Pi 5 Model B Rev 1.0 (DT)
pstate: 60400009 (nZCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
pc : debug_dma_map_sg+0x330/0x388
lr : debug_dma_map_sg+0x330/0x388
sp : ffff8000829a3ac0
x29: ffff8000829a3ac0 x28: 0000000000000001 x27: ffff8000813fe000
x26: ffffc1ffc0000000 x25: ffff00010fdeb760 x24: 0000000000000000
x23: ffff8000816a9bf0 x22: 0000000000000001 x21: 0000000000000002
x20: 0000000000000002 x19: ffff00010185e810 x18: ffffffffffffffff
x17: 69766564206e6168 x16: 74207265676e6f6c x15: 20746e656d676573
x14: 20677320676e6970 x13: 5d34303334393134 x12: 0000000000000000
x11: 00000000000000c0 x10: 00000000000009c0 x9 : ffff8000800e0b7c
x8 : ffff00010a315ca0 x7 : ffff8000816a5110 x6 : 0000000000000001
x5 : 000000000000002b x4 : 0000000000000002 x3 : 0000000000000008
x2 : 0000000000000000 x1 : 0000000000000000 x0 : ffff00010a315280
Call trace:
 debug_dma_map_sg+0x330/0x388
 __dma_map_sg_attrs+0xc0/0x278
 dma_map_sgtable+0x30/0x58
 drm_gem_shmem_get_pages_sgt+0xb4/0x140
 v3d_bo_create_finish+0x28/0x130 [v3d]
 v3d_create_bo_ioctl+0x54/0x180 [v3d]
 drm_ioctl_kernel+0xc8/0x140
 drm_ioctl+0x2d4/0x4d8

Signed-off-by: Xiaolei Wang <xiaolei.wang@windriver.com>
---
 drivers/gpu/drm/v3d/v3d_drv.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/gpu/drm/v3d/v3d_drv.c b/drivers/gpu/drm/v3d/v3d_drv.c
index c5a3bbbc74c5..f4da7a94e401 100644
--- a/drivers/gpu/drm/v3d/v3d_drv.c
+++ b/drivers/gpu/drm/v3d/v3d_drv.c
@@ -377,6 +377,8 @@ static int v3d_platform_drm_probe(struct platform_device *pdev)
 	if (ret)
 		goto clk_disable;
 
+	dma_set_max_seg_size(&pdev->dev, UINT_MAX);
+
 	v3d->va_width = 30 + V3D_GET_FIELD(mmu_debug, V3D_MMU_VA_WIDTH);
 
 	ident1 = V3D_READ(V3D_HUB_IDENT1);
-- 
2.43.0


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

* Re: [PATCH] drm/v3d: set the V3D GPU sg segment limitation
  2025-11-13  9:25 [PATCH] drm/v3d: set the V3D GPU sg segment limitation Xiaolei Wang
@ 2025-11-23  7:18 ` xiaolei wang
  2025-12-01 13:35 ` Maíra Canal
  1 sibling, 0 replies; 4+ messages in thread
From: xiaolei wang @ 2025-11-23  7:18 UTC (permalink / raw)
  To: mwen, mcanal, maarten.lankhorst, mripard, tzimmermann, airlied,
	simona
  Cc: dri-devel, linux-kernel

Humble ping...

thanks

xiaolei

On 11/13/25 17:25, Xiaolei Wang wrote:
> When using V3D rendering, the kernel occasionally reports a
> segment size mismatch. This is because 'max_seg_size' is not
> set. The kernel defaults to 64K. Based on V3D's addressing
> capabilities, setting 'max_seg_size' to the maximum will
> prevent 'debug_dma_map_sg()' from complaining about the
> over-mapping of the V3D segment length.
>
> DMA-API: v3d 1002000000.v3d: mapping sg segment longer than device
>   claims to support [len=8290304] [max=65536]
> WARNING: CPU: 0 PID: 493 at kernel/dma/debug.c:1179 debug_dma_map_sg+0x330/0x388
> CPU: 0 UID: 0 PID: 493 Comm: Xorg Not tainted 6.12.53-yocto-standard #1
> Hardware name: Raspberry Pi 5 Model B Rev 1.0 (DT)
> pstate: 60400009 (nZCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
> pc : debug_dma_map_sg+0x330/0x388
> lr : debug_dma_map_sg+0x330/0x388
> sp : ffff8000829a3ac0
> x29: ffff8000829a3ac0 x28: 0000000000000001 x27: ffff8000813fe000
> x26: ffffc1ffc0000000 x25: ffff00010fdeb760 x24: 0000000000000000
> x23: ffff8000816a9bf0 x22: 0000000000000001 x21: 0000000000000002
> x20: 0000000000000002 x19: ffff00010185e810 x18: ffffffffffffffff
> x17: 69766564206e6168 x16: 74207265676e6f6c x15: 20746e656d676573
> x14: 20677320676e6970 x13: 5d34303334393134 x12: 0000000000000000
> x11: 00000000000000c0 x10: 00000000000009c0 x9 : ffff8000800e0b7c
> x8 : ffff00010a315ca0 x7 : ffff8000816a5110 x6 : 0000000000000001
> x5 : 000000000000002b x4 : 0000000000000002 x3 : 0000000000000008
> x2 : 0000000000000000 x1 : 0000000000000000 x0 : ffff00010a315280
> Call trace:
>   debug_dma_map_sg+0x330/0x388
>   __dma_map_sg_attrs+0xc0/0x278
>   dma_map_sgtable+0x30/0x58
>   drm_gem_shmem_get_pages_sgt+0xb4/0x140
>   v3d_bo_create_finish+0x28/0x130 [v3d]
>   v3d_create_bo_ioctl+0x54/0x180 [v3d]
>   drm_ioctl_kernel+0xc8/0x140
>   drm_ioctl+0x2d4/0x4d8
>
> Signed-off-by: Xiaolei Wang <xiaolei.wang@windriver.com>
> ---
>   drivers/gpu/drm/v3d/v3d_drv.c | 2 ++
>   1 file changed, 2 insertions(+)
>
> diff --git a/drivers/gpu/drm/v3d/v3d_drv.c b/drivers/gpu/drm/v3d/v3d_drv.c
> index c5a3bbbc74c5..f4da7a94e401 100644
> --- a/drivers/gpu/drm/v3d/v3d_drv.c
> +++ b/drivers/gpu/drm/v3d/v3d_drv.c
> @@ -377,6 +377,8 @@ static int v3d_platform_drm_probe(struct platform_device *pdev)
>   	if (ret)
>   		goto clk_disable;
>   
> +	dma_set_max_seg_size(&pdev->dev, UINT_MAX);
> +
>   	v3d->va_width = 30 + V3D_GET_FIELD(mmu_debug, V3D_MMU_VA_WIDTH);
>   
>   	ident1 = V3D_READ(V3D_HUB_IDENT1);

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

* Re: [PATCH] drm/v3d: set the V3D GPU sg segment limitation
  2025-11-13  9:25 [PATCH] drm/v3d: set the V3D GPU sg segment limitation Xiaolei Wang
  2025-11-23  7:18 ` xiaolei wang
@ 2025-12-01 13:35 ` Maíra Canal
  2025-12-01 13:56   ` xiaolei wang
  1 sibling, 1 reply; 4+ messages in thread
From: Maíra Canal @ 2025-12-01 13:35 UTC (permalink / raw)
  To: Xiaolei Wang, mwen, maarten.lankhorst, mripard, tzimmermann,
	airlied, simona
  Cc: dri-devel, linux-kernel

Hi Xiaolei,

On 13/11/25 06:25, Xiaolei Wang wrote:
> When using V3D rendering, the kernel occasionally reports a
> segment size mismatch. This is because 'max_seg_size' is not

Could you mention that this only happens when CONFIG_DMA_API_DEBUG is
enabled?

Best Regards,
- Maíra

> set. The kernel defaults to 64K. Based on V3D's addressing
> capabilities, setting 'max_seg_size' to the maximum will
> prevent 'debug_dma_map_sg()' from complaining about the
> over-mapping of the V3D segment length.
> 
> DMA-API: v3d 1002000000.v3d: mapping sg segment longer than device
>   claims to support [len=8290304] [max=65536]
> WARNING: CPU: 0 PID: 493 at kernel/dma/debug.c:1179 debug_dma_map_sg+0x330/0x388
> CPU: 0 UID: 0 PID: 493 Comm: Xorg Not tainted 6.12.53-yocto-standard #1
> Hardware name: Raspberry Pi 5 Model B Rev 1.0 (DT)
> pstate: 60400009 (nZCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
> pc : debug_dma_map_sg+0x330/0x388
> lr : debug_dma_map_sg+0x330/0x388
> sp : ffff8000829a3ac0
> x29: ffff8000829a3ac0 x28: 0000000000000001 x27: ffff8000813fe000
> x26: ffffc1ffc0000000 x25: ffff00010fdeb760 x24: 0000000000000000
> x23: ffff8000816a9bf0 x22: 0000000000000001 x21: 0000000000000002
> x20: 0000000000000002 x19: ffff00010185e810 x18: ffffffffffffffff
> x17: 69766564206e6168 x16: 74207265676e6f6c x15: 20746e656d676573
> x14: 20677320676e6970 x13: 5d34303334393134 x12: 0000000000000000
> x11: 00000000000000c0 x10: 00000000000009c0 x9 : ffff8000800e0b7c
> x8 : ffff00010a315ca0 x7 : ffff8000816a5110 x6 : 0000000000000001
> x5 : 000000000000002b x4 : 0000000000000002 x3 : 0000000000000008
> x2 : 0000000000000000 x1 : 0000000000000000 x0 : ffff00010a315280
> Call trace:
>   debug_dma_map_sg+0x330/0x388
>   __dma_map_sg_attrs+0xc0/0x278
>   dma_map_sgtable+0x30/0x58
>   drm_gem_shmem_get_pages_sgt+0xb4/0x140
>   v3d_bo_create_finish+0x28/0x130 [v3d]
>   v3d_create_bo_ioctl+0x54/0x180 [v3d]
>   drm_ioctl_kernel+0xc8/0x140
>   drm_ioctl+0x2d4/0x4d8
> 
> Signed-off-by: Xiaolei Wang <xiaolei.wang@windriver.com>
> ---
>   drivers/gpu/drm/v3d/v3d_drv.c | 2 ++
>   1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/gpu/drm/v3d/v3d_drv.c b/drivers/gpu/drm/v3d/v3d_drv.c
> index c5a3bbbc74c5..f4da7a94e401 100644
> --- a/drivers/gpu/drm/v3d/v3d_drv.c
> +++ b/drivers/gpu/drm/v3d/v3d_drv.c
> @@ -377,6 +377,8 @@ static int v3d_platform_drm_probe(struct platform_device *pdev)
>   	if (ret)
>   		goto clk_disable;
>   
> +	dma_set_max_seg_size(&pdev->dev, UINT_MAX);

I believe I'd

> +
>   	v3d->va_width = 30 + V3D_GET_FIELD(mmu_debug, V3D_MMU_VA_WIDTH);
>   
>   	ident1 = V3D_READ(V3D_HUB_IDENT1);


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

* Re: [PATCH] drm/v3d: set the V3D GPU sg segment limitation
  2025-12-01 13:35 ` Maíra Canal
@ 2025-12-01 13:56   ` xiaolei wang
  0 siblings, 0 replies; 4+ messages in thread
From: xiaolei wang @ 2025-12-01 13:56 UTC (permalink / raw)
  To: Maíra Canal, mwen, maarten.lankhorst, mripard, tzimmermann,
	airlied, simona
  Cc: dri-devel, linux-kernel


On 12/1/25 21:35, Maíra Canal wrote:
> CAUTION: This email comes from a non Wind River email account!
> Do not click links or open attachments unless you recognize the sender 
> and know the content is safe.
>
> Hi Xiaolei,
>
> On 13/11/25 06:25, Xiaolei Wang wrote:
>> When using V3D rendering, the kernel occasionally reports a
>> segment size mismatch. This is because 'max_seg_size' is not
>
> Could you mention that this only happens when CONFIG_DMA_API_DEBUG is
> enabled?

Yes, I only found that when CONFIG_DMA_API_DEBUG was enabled

thanks

xiaolei

>
> Best Regards,
> - Maíra
>
>> set. The kernel defaults to 64K. Based on V3D's addressing
>> capabilities, setting 'max_seg_size' to the maximum will
>> prevent 'debug_dma_map_sg()' from complaining about the
>> over-mapping of the V3D segment length.
>>
>> DMA-API: v3d 1002000000.v3d: mapping sg segment longer than device
>>   claims to support [len=8290304] [max=65536]
>> WARNING: CPU: 0 PID: 493 at kernel/dma/debug.c:1179 
>> debug_dma_map_sg+0x330/0x388
>> CPU: 0 UID: 0 PID: 493 Comm: Xorg Not tainted 6.12.53-yocto-standard #1
>> Hardware name: Raspberry Pi 5 Model B Rev 1.0 (DT)
>> pstate: 60400009 (nZCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
>> pc : debug_dma_map_sg+0x330/0x388
>> lr : debug_dma_map_sg+0x330/0x388
>> sp : ffff8000829a3ac0
>> x29: ffff8000829a3ac0 x28: 0000000000000001 x27: ffff8000813fe000
>> x26: ffffc1ffc0000000 x25: ffff00010fdeb760 x24: 0000000000000000
>> x23: ffff8000816a9bf0 x22: 0000000000000001 x21: 0000000000000002
>> x20: 0000000000000002 x19: ffff00010185e810 x18: ffffffffffffffff
>> x17: 69766564206e6168 x16: 74207265676e6f6c x15: 20746e656d676573
>> x14: 20677320676e6970 x13: 5d34303334393134 x12: 0000000000000000
>> x11: 00000000000000c0 x10: 00000000000009c0 x9 : ffff8000800e0b7c
>> x8 : ffff00010a315ca0 x7 : ffff8000816a5110 x6 : 0000000000000001
>> x5 : 000000000000002b x4 : 0000000000000002 x3 : 0000000000000008
>> x2 : 0000000000000000 x1 : 0000000000000000 x0 : ffff00010a315280
>> Call trace:
>>   debug_dma_map_sg+0x330/0x388
>>   __dma_map_sg_attrs+0xc0/0x278
>>   dma_map_sgtable+0x30/0x58
>>   drm_gem_shmem_get_pages_sgt+0xb4/0x140
>>   v3d_bo_create_finish+0x28/0x130 [v3d]
>>   v3d_create_bo_ioctl+0x54/0x180 [v3d]
>>   drm_ioctl_kernel+0xc8/0x140
>>   drm_ioctl+0x2d4/0x4d8
>>
>> Signed-off-by: Xiaolei Wang <xiaolei.wang@windriver.com>
>> ---
>>   drivers/gpu/drm/v3d/v3d_drv.c | 2 ++
>>   1 file changed, 2 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/v3d/v3d_drv.c 
>> b/drivers/gpu/drm/v3d/v3d_drv.c
>> index c5a3bbbc74c5..f4da7a94e401 100644
>> --- a/drivers/gpu/drm/v3d/v3d_drv.c
>> +++ b/drivers/gpu/drm/v3d/v3d_drv.c
>> @@ -377,6 +377,8 @@ static int v3d_platform_drm_probe(struct 
>> platform_device *pdev)
>>       if (ret)
>>               goto clk_disable;
>>
>> +     dma_set_max_seg_size(&pdev->dev, UINT_MAX);
>
> I believe I'd
>
>> +
>>       v3d->va_width = 30 + V3D_GET_FIELD(mmu_debug, V3D_MMU_VA_WIDTH);
>>
>>       ident1 = V3D_READ(V3D_HUB_IDENT1);
>

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

end of thread, other threads:[~2025-12-01 13:57 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-13  9:25 [PATCH] drm/v3d: set the V3D GPU sg segment limitation Xiaolei Wang
2025-11-23  7:18 ` xiaolei wang
2025-12-01 13:35 ` Maíra Canal
2025-12-01 13:56   ` xiaolei wang

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