On Fri, 14 Nov 2025 18:03:00 +0100 Loïc Molinari <[email protected]> wrote:
> Log the number of pages and their sizes actually mapped/unmapped by > the IOMMU page table driver. Since a map/unmap op is often split in > several ops depending on the underlying scatter/gather table, add the > start address and the total size to the debugging logs in order to > help understand which batch an op is part of. > > Signed-off-by: Loïc Molinari <[email protected]> > Reviewed-by: Boris Brezillon <[email protected]> Just queued this specific patch to drm-misc-next since it had no external deps. Make sure you rebase before preparing your v10. > --- > drivers/gpu/drm/panthor/panthor_mmu.c | 19 ++++++++++++++----- > 1 file changed, 14 insertions(+), 5 deletions(-) > > diff --git a/drivers/gpu/drm/panthor/panthor_mmu.c > b/drivers/gpu/drm/panthor/panthor_mmu.c > index 58fead90533a..32410713c61c 100644 > --- a/drivers/gpu/drm/panthor/panthor_mmu.c > +++ b/drivers/gpu/drm/panthor/panthor_mmu.c > @@ -918,10 +918,9 @@ static int panthor_vm_unmap_pages(struct panthor_vm *vm, > u64 iova, u64 size) > { > struct panthor_device *ptdev = vm->ptdev; > struct io_pgtable_ops *ops = vm->pgtbl_ops; > + u64 start_iova = iova; > u64 offset = 0; > > - drm_dbg(&ptdev->base, "unmap: as=%d, iova=%llx, len=%llx", vm->as.id, > iova, size); > - > while (offset < size) { > size_t unmapped_sz = 0, pgcount; > size_t pgsize = get_pgsize(iova + offset, size - offset, > &pgcount); > @@ -936,6 +935,12 @@ static int panthor_vm_unmap_pages(struct panthor_vm *vm, > u64 iova, u64 size) > panthor_vm_flush_range(vm, iova, offset + unmapped_sz); > return -EINVAL; > } > + > + drm_dbg(&ptdev->base, > + "unmap: as=%d, iova=0x%llx, sz=%llu, va=0x%llx, > pgcnt=%zu, pgsz=%zu", > + vm->as.id, start_iova, size, iova + offset, > + unmapped_sz / pgsize, pgsize); > + > offset += unmapped_sz; > } > > @@ -951,6 +956,7 @@ panthor_vm_map_pages(struct panthor_vm *vm, u64 iova, int > prot, > struct scatterlist *sgl; > struct io_pgtable_ops *ops = vm->pgtbl_ops; > u64 start_iova = iova; > + u64 start_size = size; > int ret; > > if (!size) > @@ -970,15 +976,18 @@ panthor_vm_map_pages(struct panthor_vm *vm, u64 iova, > int prot, > len = min_t(size_t, len, size); > size -= len; > > - drm_dbg(&ptdev->base, "map: as=%d, iova=%llx, paddr=%pad, > len=%zx", > - vm->as.id, iova, &paddr, len); > - > while (len) { > size_t pgcount, mapped = 0; > size_t pgsize = get_pgsize(iova | paddr, len, &pgcount); > > ret = ops->map_pages(ops, iova, paddr, pgsize, pgcount, > prot, > GFP_KERNEL, &mapped); > + > + drm_dbg(&ptdev->base, > + "map: as=%d, iova=0x%llx, sz=%llu, va=0x%llx, > pa=%pad, pgcnt=%zu, pgsz=%zu", > + vm->as.id, start_iova, start_size, iova, &paddr, > + mapped / pgsize, pgsize); > + > iova += mapped; > paddr += mapped; > len -= mapped;
