]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
iommu: Fix up map/unmap debugging for iommupt domains
authorJason Gunthorpe <jgg@nvidia.com>
Tue, 12 May 2026 16:46:14 +0000 (13:46 -0300)
committerJoerg Roedel <joerg.roedel@amd.com>
Fri, 15 May 2026 05:29:15 +0000 (07:29 +0200)
commitb948a87228482235afbaf5f4d8037860b5c470fd
tree4d47d3dd296cbf6000b2c35336d05ec0ae12b5a1
parent6fc7e8a3b8115294f60f5c89de27330bf1b9c98e
iommu: Fix up map/unmap debugging for iommupt domains

Sashiko noticed a few issues in this path, and a few more were
found on review. Tidy them up further. These are intertwined
because the debug code depends on some of the WARN_ONs to function
right:

Lift into iommu_map_nosync():
- The might_sleep_if()
- 0 pgsize_bitmap WARN_ON
- Promote the illegal domain->type to a WARN_ON
- WARN_ON for illegal gfp flags

Then remove the return 0 since it is now safe to call
iommu_debug_map().

Lift into __iommu_unmap():
- 0 pgsize_bitmap WARN_ON
- Promote the illegal domain->type to a WARN_ON
- iommu_debug_unmap_begin()

This now pairs with the unconditional iommu_debug_map() on the
mapping side. Thus iommu debugging now works for iommupt along
with some of the other debugging features.

Fixes: 99fb8afa16ad ("iommupt: Directly call iommupt's unmap_range()")
Fixes: d6c65b0fd621 ("iommupt: Avoid rewalking during map")
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Reviewed-by: Pranjal Shrivastava <praan@google.com>
Reviewed-by: Samiullah Khawaja <skhawaja@google.com>
Reviewed-by: Mostafa Saleh <smostafa@google.com>
Tested-by: Josua Mayer <josua@solid-run.com>
Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
drivers/iommu/iommu.c