On 24/09/2026 12:04, Boris Brezillon wrote: > op->remap.next->gem.offset is adjusted twice in > panthor_gpuva_sm_step_remap() (once on the remap.next object, and once on > the local map_op). Let's do it only once, and move this adjusment closer > to the place it matters. > > Reported-by: Akash Goel <[email protected]> > Closes: > https://lore.kernel.org/dri-devel/[email protected]/ > Signed-off-by: Boris Brezillon <[email protected]>
Reviewed-by: Steven Price <[email protected]> > --- > drivers/gpu/drm/panthor/panthor_mmu.c | 12 ++++++------ > 1 file changed, 6 insertions(+), 6 deletions(-) > > diff --git a/drivers/gpu/drm/panthor/panthor_mmu.c > b/drivers/gpu/drm/panthor/panthor_mmu.c > index 01564d250adf..d8fb29ace5c4 100644 > --- a/drivers/gpu/drm/panthor/panthor_mmu.c > +++ b/drivers/gpu/drm/panthor/panthor_mmu.c > @@ -2397,11 +2397,6 @@ static int panthor_gpuva_sm_step_remap(struct > drm_gpuva_op *op, > > drm_gpuva_op_remap_to_unmap_range(&op->remap, &unmap_start, > &unmap_range); > > - /* op->remap.prev's BO offset is always the same as the unmap va's, but > - * that of op->remap.next must be adjusted so as to remain < SZ_2M > - */ > - panthor_fix_sparse_map_offset(op->remap.next, unmap_vma->flags); > - > if (!unmap_vma->evicted) { > /* > * ARM IOMMU page table management code disallows partial > unmaps of huge pages, > @@ -2447,6 +2442,12 @@ static int panthor_gpuva_sm_step_remap(struct > drm_gpuva_op *op, > u64 addr = op->remap.next->va.addr; > u64 size = unmap_start + unmap_range - op->remap.next->va.addr; > > + /* op->remap.prev's BO offset is always the same as the unmap > + * va's, but that of op->remap.next must be adjusted so as to > + * remain < SZ_2M > + */ > + panthor_fix_sparse_map_offset(op->remap.next, unmap_vma->flags); > + > if (!unmap_vma->evicted && size > 0) { > struct drm_gpuva_op_map map_op = { > .va.addr = addr, > @@ -2454,7 +2455,6 @@ static int panthor_gpuva_sm_step_remap(struct > drm_gpuva_op *op, > .gem.obj = op->remap.next->gem.obj, > .gem.offset = op->remap.next->gem.offset, > }; > - panthor_fix_sparse_map_offset(&map_op, > unmap_vma->flags); > > ret = panthor_vm_exec_map_op(vm, unmap_vma->flags, > &map_op); > if (ret) >
