Re: [PATCH v7 5/6] drm/panthor: Support sparse mappings

Boris Brezillon
2026-04-16T07:03:26Z

On Wed, 15 Apr 2026 23:09:17 +0100
Adrián Larumbe <adrian.larumbe@collabora.com> wrote:

> > > +static int
> > > +panthor_vm_exec_map_op(struct panthor_vm *vm, u32 flags,
> > > + const struct drm_gpuva_op_map *op)
> > > +{
> > > + struct panthor_gem_object *bo = to_panthor_bo(op->gem.obj);
> > > + int prot = flags_to_prot(flags);
> > > +
> > > + if (!op->va.range)
> > > + return 0;
> >
> > Do we really expect a range of zero here? If not, I'd either drop
> > the check, or at the very least, make it a drm_WARN_ON_ONCE().
>
> IIRC it can happen when panthor_vm_exec_map_op() is called from panthor_gpuva_sm_step_remap(),
> and the remap's unmap didn't have to be expanded to account for a THP.

Can't we just replace that by an extra size > 0 check before calling
panthor_vm_exec_map_op() in the remap() path? I mean, we already have
an !evicted check there.

if (!unmap_vma->evicted && size) {
ret = panthor_vm_exec_map_op()
...
}

> Although in that case,
> the check being done inside panthor_vm_map_pages() should be enough.