From: Liviu Dudau <liviu.dudau@arm.com>
To: "Adrián Larumbe" <adrian.larumbe@collabora.com>
Cc: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org,
Steven Price <steven.price@arm.com>,
Boris Brezillon <boris.brezillon@collabora.com>,
kernel@collabora.com,
Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
Maxime Ripard <mripard@kernel.org>,
Thomas Zimmermann <tzimmermann@suse.de>,
David Airlie <airlied@gmail.com>, Simona Vetter <simona@ffwll.ch>
Subject: Re: [PATCH v6 2/4] drm/panthor: Pass vm_bind_op to vm_prepare_map_op_ctx
Date: Tue, 7 Apr 2026 11:44:29 +0100 [thread overview]
Message-ID: <adTgDZyg3oJU4cHm@e142607> (raw)
In-Reply-To: <20260403192743.3572062-3-adrian.larumbe@collabora.com>
On Fri, Apr 03, 2026 at 08:27:27PM +0100, Adrián Larumbe wrote:
> Instead of passing its constituent elements, pass the whole struct to
> simplify the function prototype.
>
> Signed-off-by: Adrián Larumbe <adrian.larumbe@collabora.com>
> ---
> drivers/gpu/drm/panthor/panthor_mmu.c | 29 +++++++++++++++------------
> 1 file changed, 16 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/gpu/drm/panthor/panthor_mmu.c b/drivers/gpu/drm/panthor/panthor_mmu.c
> index 880c8c4cca17..10da2f021d9d 100644
> --- a/drivers/gpu/drm/panthor/panthor_mmu.c
> +++ b/drivers/gpu/drm/panthor/panthor_mmu.c
> @@ -1275,9 +1275,7 @@ static int panthor_vm_op_ctx_prealloc_pts(struct panthor_vm_op_ctx *op_ctx)
> static int panthor_vm_prepare_map_op_ctx(struct panthor_vm_op_ctx *op_ctx,
> struct panthor_vm *vm,
> struct panthor_gem_object *bo,
> - u64 offset,
> - u64 size, u64 va,
> - u32 flags)
> + const struct drm_panthor_vm_bind_op *op)
> {
> struct drm_gpuvm_bo *preallocated_vm_bo;
> struct sg_table *sgt = NULL;
> @@ -1286,12 +1284,12 @@ static int panthor_vm_prepare_map_op_ctx(struct panthor_vm_op_ctx *op_ctx,
> if (!bo)
> return -EINVAL;
>
> - if ((flags & ~PANTHOR_VM_BIND_OP_MAP_FLAGS) ||
> - (flags & DRM_PANTHOR_VM_BIND_OP_TYPE_MASK) != DRM_PANTHOR_VM_BIND_OP_TYPE_MAP)
> + if ((op->flags & ~PANTHOR_VM_BIND_OP_MAP_FLAGS) ||
> + (op->flags & DRM_PANTHOR_VM_BIND_OP_TYPE_MASK) != DRM_PANTHOR_VM_BIND_OP_TYPE_MAP)
> return -EINVAL;
>
> /* Make sure the VA and size are in-bounds. */
> - if (size > bo->base.size || offset > bo->base.size - size)
> + if (op->size > bo->base.size || op->bo_offset > bo->base.size - op->size)
> return -EINVAL;
>
> /* If the BO has an exclusive VM attached, it can't be mapped to other VMs. */
> @@ -1299,7 +1297,7 @@ static int panthor_vm_prepare_map_op_ctx(struct panthor_vm_op_ctx *op_ctx,
> bo->exclusive_vm_root_gem != panthor_vm_root_gem(vm))
> return -EINVAL;
>
> - panthor_vm_init_op_ctx(op_ctx, size, va, flags);
> + panthor_vm_init_op_ctx(op_ctx, op->size, op->va, op->flags);
>
> ret = panthor_vm_op_ctx_prealloc_vmas(op_ctx);
> if (ret)
> @@ -1328,7 +1326,7 @@ static int panthor_vm_prepare_map_op_ctx(struct panthor_vm_op_ctx *op_ctx,
> }
>
> op_ctx->map.vm_bo = drm_gpuvm_bo_obtain_prealloc(preallocated_vm_bo);
> - op_ctx->map.bo_offset = offset;
> + op_ctx->map.bo_offset = op->bo_offset;
>
> ret = panthor_vm_op_ctx_prealloc_pts(op_ctx);
> if (ret)
> @@ -2843,10 +2841,7 @@ panthor_vm_bind_prepare_op_ctx(struct drm_file *file,
> gem = drm_gem_object_lookup(file, op->bo_handle);
> ret = panthor_vm_prepare_map_op_ctx(op_ctx, vm,
> gem ? to_panthor_bo(gem) : NULL,
> - op->bo_offset,
> - op->size,
> - op->va,
> - op->flags);
> + op);
> drm_gem_object_put(gem);
> return ret;
>
> @@ -3042,10 +3037,18 @@ int panthor_vm_bind_exec_sync_op(struct drm_file *file,
> int panthor_vm_map_bo_range(struct panthor_vm *vm, struct panthor_gem_object *bo,
> u64 offset, u64 size, u64 va, u32 flags)
> {
> + struct drm_panthor_vm_bind_op op = {0};
> struct panthor_vm_op_ctx op_ctx;
> int ret;
>
> - ret = panthor_vm_prepare_map_op_ctx(&op_ctx, vm, bo, offset, size, va, flags);
> + op = (struct drm_panthor_vm_bind_op){
> + .bo_offset = offset,
> + .size = size,
> + .va = va,
> + .flags = flags,
> + };
You can merge the assignment with the declaration, at least GCC is OK with it.
Reviewed-by: Liviu Dudau <liviu.dudau@arm.com>
Best regards,
Liviu
> +
> + ret = panthor_vm_prepare_map_op_ctx(&op_ctx, vm, bo, &op);
> if (ret)
> return ret;
>
> --
> 2.53.0
>
--
====================
| I would like to |
| fix the world, |
| but they're not |
| giving me the |
\ source code! /
---------------
¯\_(ツ)_/¯
next prev parent reply other threads:[~2026-04-07 10:44 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-03 19:27 [PATCH v6 0/4] Support sparse mappings in Panthor Adrián Larumbe
2026-04-03 19:27 ` [PATCH v6 1/4] drm/panthor: Expose GPU page sizes to UM Adrián Larumbe
2026-04-03 19:27 ` [PATCH v6 2/4] drm/panthor: Pass vm_bind_op to vm_prepare_map_op_ctx Adrián Larumbe
2026-04-07 10:44 ` Liviu Dudau [this message]
2026-04-03 19:27 ` [PATCH v6 3/4] drm/panthor: Support sparse mappings Adrián Larumbe
2026-04-07 12:34 ` Boris Brezillon
2026-04-03 19:27 ` [PATCH v6 4/4] drm/panthor: Bump the driver version to 1.9 Adrián Larumbe
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=adTgDZyg3oJU4cHm@e142607 \
--to=liviu.dudau@arm.com \
--cc=adrian.larumbe@collabora.com \
--cc=airlied@gmail.com \
--cc=boris.brezillon@collabora.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=kernel@collabora.com \
--cc=linux-kernel@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mripard@kernel.org \
--cc=simona@ffwll.ch \
--cc=steven.price@arm.com \
--cc=tzimmermann@suse.de \
/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
all inboxes | Powered by JetHome®