From: Boris Brezillon <boris.brezillon@collabora.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>,
kernel@collabora.com, Liviu Dudau <liviu.dudau@arm.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 v7 2/6] drm/panthor: Pass vm_bind_op to vm_prepare_map_op_ctx
Date: Wed, 15 Apr 2026 15:11:53 +0200 [thread overview]
Message-ID: <20260415151153.36c6b125@fedora> (raw)
In-Reply-To: <20260415112900.681834-3-adrian.larumbe@collabora.com>
On Wed, 15 Apr 2026 12:28:46 +0100
Adrián Larumbe <adrian.larumbe@collabora.com> 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>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
> ---
> drivers/gpu/drm/panthor/panthor_mmu.c | 27 ++++++++++++++-------------
> 1 file changed, 14 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/gpu/drm/panthor/panthor_mmu.c b/drivers/gpu/drm/panthor/panthor_mmu.c
> index 01577be88933..d9e2f8afb8fb 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)
> @@ -2849,10 +2847,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;
>
> @@ -3048,10 +3043,16 @@ 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 = {
You could even make it const here, but I think you're adjusting some
fields after the initialization in one of the following patches.
> + .bo_offset = offset,
> + .size = size,
> + .va = va,
> + .flags = flags,
> + };
> struct panthor_vm_op_ctx op_ctx;
> int ret;
>
> - ret = panthor_vm_prepare_map_op_ctx(&op_ctx, vm, bo, offset, size, va, flags);
> + ret = panthor_vm_prepare_map_op_ctx(&op_ctx, vm, bo, &op);
> if (ret)
> return ret;
>
next prev parent reply other threads:[~2026-04-15 13:12 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-15 11:28 [PATCH v7 0/6] Support sparse mappings in Panthor Adrián Larumbe
2026-04-15 11:28 ` [PATCH v7 1/6] drm/panthor: Expose GPU page sizes to UM Adrián Larumbe
2026-04-15 13:10 ` Boris Brezillon
2026-04-15 15:19 ` Steven Price
2026-04-15 11:28 ` [PATCH v7 2/6] drm/panthor: Pass vm_bind_op to vm_prepare_map_op_ctx Adrián Larumbe
2026-04-15 13:11 ` Boris Brezillon [this message]
2026-04-15 15:19 ` Steven Price
2026-04-15 11:28 ` [PATCH v7 3/6] drm/panthor: Delete spurious whitespace from uAPI header Adrián Larumbe
2026-04-15 13:41 ` Boris Brezillon
2026-04-15 15:19 ` Steven Price
2026-04-15 11:28 ` [PATCH v7 4/6] drm/panthor: Remove unused operation context field Adrián Larumbe
2026-04-15 13:41 ` Boris Brezillon
2026-04-15 15:20 ` Steven Price
2026-04-15 11:28 ` [PATCH v7 5/6] drm/panthor: Support sparse mappings Adrián Larumbe
2026-04-15 15:12 ` Boris Brezillon
2026-04-15 22:09 ` Adrián Larumbe
2026-04-16 6:55 ` Boris Brezillon
2026-04-16 7:03 ` Boris Brezillon
2026-04-15 23:15 ` Adrián Larumbe
2026-04-16 18:25 ` Adrián Larumbe
2026-04-17 8:19 ` Boris Brezillon
2026-04-15 11:28 ` [PATCH v7 6/6] drm/panthor: Bump the driver version to 1.9 Adrián Larumbe
2026-04-15 13:54 ` Jani Nikula
2026-04-15 14:01 ` Adrián Larumbe
2026-04-15 16:20 ` Jani Nikula
2026-04-15 15:26 ` Boris Brezillon
2026-04-15 15:22 ` Boris Brezillon
2026-04-15 15:27 ` Boris Brezillon
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=20260415151153.36c6b125@fedora \
--to=boris.brezillon@collabora.com \
--cc=adrian.larumbe@collabora.com \
--cc=airlied@gmail.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=kernel@collabora.com \
--cc=linux-kernel@vger.kernel.org \
--cc=liviu.dudau@arm.com \
--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 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.