[PATCH] drm/panthor: Set FMODE_UNSIGNED_OFFSET in fop_flags

Emmanuel Gil Peyrot posted 1 patch 1 month, 4 weeks ago
drivers/gpu/drm/panthor/panthor_drv.c | 1 +
1 file changed, 1 insertion(+)
[PATCH] drm/panthor: Set FMODE_UNSIGNED_OFFSET in fop_flags
Posted by Emmanuel Gil Peyrot 1 month, 4 weeks ago
This fixes a regression introduced in commit
641bb4394f405cba498b100b44541ffc0aed5be1.  No panthor device, card or
render node, could be open() since this commit, returning EINVAL
instead.  This prevented Mesa from working on SoCs such as the rk3588
which contains a Mali-G610 GPU.

The commit mentions which drivers must be changed to set that flag, but
panthor seemingly got forgotten, triggering the WARN_ON_ONCE() added
in drm_open_helper().
---
 drivers/gpu/drm/panthor/panthor_drv.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/drm/panthor/panthor_drv.c b/drivers/gpu/drm/panthor/panthor_drv.c
index 34182f67136c..c520f156e2d7 100644
--- a/drivers/gpu/drm/panthor/panthor_drv.c
+++ b/drivers/gpu/drm/panthor/panthor_drv.c
@@ -1383,6 +1383,7 @@ static const struct file_operations panthor_drm_driver_fops = {
 	.read = drm_read,
 	.llseek = noop_llseek,
 	.mmap = panthor_mmap,
+	.fop_flags = FOP_UNSIGNED_OFFSET,
 };
 
 #ifdef CONFIG_DEBUG_FS
-- 
2.46.2
Re: [PATCH] drm/panthor: Set FMODE_UNSIGNED_OFFSET in fop_flags
Posted by Steven Price 1 month, 4 weeks ago
On 29/09/2024 23:10, Emmanuel Gil Peyrot wrote:
> This fixes a regression introduced in commit
> 641bb4394f405cba498b100b44541ffc0aed5be1.  No panthor device, card or
> render node, could be open() since this commit, returning EINVAL
> instead.  This prevented Mesa from working on SoCs such as the rk3588
> which contains a Mali-G610 GPU.
> 
> The commit mentions which drivers must be changed to set that flag, but
> panthor seemingly got forgotten, triggering the WARN_ON_ONCE() added
> in drm_open_helper().

Hi Emmanuel,

Liviu posted an identical patch earlier:

https://lore.kernel.org/r/20240920102802.2483367-1-liviu.dudau%40arm.com

The problem is because 641bb4394f40 isn't yet back-merged into any DRM
tree we can't merge it yet (as that commit added the definition of
FOP_UNSIGNED_OFFSET).

Liviu was going to ask the DRM maintainers for advice - I'm not sure
what the outcome way. But anyway we should get -rc1 back-merged soon and
then can apply this to drm-misc-fixes.

Thanks,
Steve

> ---
>  drivers/gpu/drm/panthor/panthor_drv.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/gpu/drm/panthor/panthor_drv.c b/drivers/gpu/drm/panthor/panthor_drv.c
> index 34182f67136c..c520f156e2d7 100644
> --- a/drivers/gpu/drm/panthor/panthor_drv.c
> +++ b/drivers/gpu/drm/panthor/panthor_drv.c
> @@ -1383,6 +1383,7 @@ static const struct file_operations panthor_drm_driver_fops = {
>  	.read = drm_read,
>  	.llseek = noop_llseek,
>  	.mmap = panthor_mmap,
> +	.fop_flags = FOP_UNSIGNED_OFFSET,
>  };
>  
>  #ifdef CONFIG_DEBUG_FS