[PATCH v2 2/2] dma-debug: Remove obsolete mapping dump helper

From: Avi Weiss

Date: Thu Nov 19 2026 - 08:13:55 EST


debug_dma_dump_mappings() is only called by the legacy AMD GART IOMMU
leak diagnostic. The helper traverses DMA-debug hash buckets even when
DMA debugging was never initialized.

Remove the helper, its declarations and the GART call. Keep the GART
stack trace for diagnosing IOMMU exhaustion.

Signed-off-by: Avi Weiss <thnkslprpt@xxxxxxxxx>
---
arch/x86/kernel/amd_gart_64.c | 1 -
include/linux/dma-map-ops.h | 4 ----
kernel/dma/debug.c | 33 ---------------------------------
3 files changed, 38 deletions(-)

diff --git a/arch/x86/kernel/amd_gart_64.c b/arch/x86/kernel/amd_gart_64.c
index b5f1f031d45b..965844299a1b 100644
--- a/arch/x86/kernel/amd_gart_64.c
+++ b/arch/x86/kernel/amd_gart_64.c
@@ -157,7 +157,6 @@ static void dump_leak(void)
dump = 1;

show_stack(NULL, NULL, KERN_ERR);
- debug_dma_dump_mappings(NULL);
}
#endif

diff --git a/include/linux/dma-map-ops.h b/include/linux/dma-map-ops.h
index afaf2c12189b..eb32ed923455 100644
--- a/include/linux/dma-map-ops.h
+++ b/include/linux/dma-map-ops.h
@@ -418,14 +418,10 @@ static inline void arch_teardown_dma_ops(struct device *dev)

#ifdef CONFIG_DMA_API_DEBUG
void dma_debug_add_bus(const struct bus_type *bus);
-void debug_dma_dump_mappings(struct device *dev);
#else
static inline void dma_debug_add_bus(const struct bus_type *bus)
{
}
-static inline void debug_dma_dump_mappings(struct device *dev)
-{
-}
#endif /* CONFIG_DMA_API_DEBUG */

extern const struct dma_map_ops dma_dummy_ops;
diff --git a/kernel/dma/debug.c b/kernel/dma/debug.c
index 6e554dcfc9b9..f1b6f7b9aa14 100644
--- a/kernel/dma/debug.c
+++ b/kernel/dma/debug.c
@@ -535,39 +535,6 @@ static void active_cacheline_remove(struct dma_debug_entry *entry)
spin_unlock_irqrestore(&radix_lock, flags);
}

-/*
- * Dump mappings entries on kernel space for debugging purposes
- */
-void debug_dma_dump_mappings(struct device *dev)
-{
- int idx;
- phys_addr_t cln;
-
- for (idx = 0; idx < HASH_SIZE; idx++) {
- struct hash_bucket *bucket = &dma_entry_hash[idx];
- struct dma_debug_entry *entry;
- unsigned long flags;
-
- spin_lock_irqsave(&bucket->lock, flags);
- list_for_each_entry(entry, &bucket->list, list) {
- if (!dev || dev == entry->dev) {
- cln = to_cacheline_number(entry);
- dev_info(entry->dev,
- "%s idx %d P=%pa D=%llx L=%llx cln=%pa %s %s attrs=0x%lx\n",
- type2name[entry->type], idx,
- &entry->paddr, entry->dev_addr,
- entry->size, &cln,
- dir2name[entry->direction],
- maperr2str[entry->map_err_type],
- entry->attrs);
- }
- }
- spin_unlock_irqrestore(&bucket->lock, flags);
-
- cond_resched();
- }
-}
-
/*
* Dump mappings entries on user space via debugfs
*/
--
2.43.0