]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
iommu: Add calls for IOMMU_DEBUG_PAGEALLOC
authorMostafa Saleh <smostafa@google.com>
Fri, 9 Jan 2026 17:18:03 +0000 (17:18 +0000)
committerJoerg Roedel <joerg.roedel@amd.com>
Sat, 10 Jan 2026 09:52:26 +0000 (10:52 +0100)
commitccc21213f013834b484cdcc738e282f963fcfc97
treeb78671940295f76aa1d3ea7c8338f46da17a54be
parent466ae6978a5b8c6022bd4537fbfd00e94bb07219
iommu: Add calls for IOMMU_DEBUG_PAGEALLOC

Add calls for the new iommu debug config IOMMU_DEBUG_PAGEALLOC:
- iommu_debug_init: Enable the debug mode if configured by the user.
- iommu_debug_map: Track iommu pages mapped, using physical address.
- iommu_debug_unmap_begin: Track start of iommu unmap operation, with
  IOVA and size.
- iommu_debug_unmap_end: Track the end of unmap operation, passing the
  actual unmapped size versus the tracked one at unmap_begin.

We have to do the unmap_begin/end as once pages are unmapped we lose
the information of the physical address.
This is racy, but the API is racy by construction as it uses refcounts
and doesn't attempt to lock/synchronize with the IOMMU API as that will
be costly, meaning that possibility of false negative exists.

Reviewed-by: Samiullah Khawaja <skhawaja@google.com>
Reviewed-by: Lu Baolu <baolu.lu@linux.intel.com>
Reviewed-by: Pranjal Shrivastava <praan@google.com>
Signed-off-by: Mostafa Saleh <smostafa@google.com>
Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
drivers/iommu/iommu-debug-pagealloc.c
drivers/iommu/iommu-priv.h
drivers/iommu/iommu.c
include/linux/iommu-debug-pagealloc.h