mirror of
https://github.com/torvalds/linux.git
synced 2025-12-07 20:06:24 +00:00
drm/panthor: Improve IOMMU map/unmap debugging logs
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>
This commit is contained in:
committed by
Boris Brezillon
parent
ab3490493c
commit
e20c626047
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user