]> Gentwo Git Trees - linux/.git/commitdiff
drm/panthor: Improve IOMMU map/unmap debugging logs
authorLoïc Molinari <loic.molinari@collabora.com>
Fri, 14 Nov 2025 17:03:00 +0000 (18:03 +0100)
committerBoris Brezillon <boris.brezillon@collabora.com>
Wed, 26 Nov 2025 10:07:56 +0000 (11:07 +0100)
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 <loic.molinari@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Link: https://patch.msgid.link/20251114170303.2800-10-loic.molinari@collabora.com
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
drivers/gpu/drm/panthor/panthor_mmu.c

index 6a41dfd7aaf339a32c2b6feef77dc0445c5c00c1..8818d6a8d93e272b729687395f3977ebed98e7a9 100644 (file)
@@ -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;