diff options
author | Joerg Roedel <joerg.roedel@amd.com> | 2009-01-09 14:14:49 +0100 |
---|---|---|
committer | Joerg Roedel <joerg.roedel@amd.com> | 2009-03-05 20:35:18 +0100 |
commit | f62bc980e6fd26434012c0d5676ecb17179d9ee4 (patch) | |
tree | 515d946a1739eb9a6bbcce215d8be62ae5695b09 /lib/dma-debug.c | |
parent | 2d62ece14fe04168a7d16688ddd2d17ac472268c (diff) | |
download | lwn-f62bc980e6fd26434012c0d5676ecb17179d9ee4.tar.gz lwn-f62bc980e6fd26434012c0d5676ecb17179d9ee4.zip |
dma-debug: add checking for map/unmap_page/single
Impact: add debug callbacks for dma_{un}map_[page|single]
Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Diffstat (limited to 'lib/dma-debug.c')
-rw-r--r-- | lib/dma-debug.c | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/lib/dma-debug.c b/lib/dma-debug.c index d0cb47a4211e..a2ed2b769685 100644 --- a/lib/dma-debug.c +++ b/lib/dma-debug.c @@ -566,3 +566,56 @@ out: } +void debug_dma_map_page(struct device *dev, struct page *page, size_t offset, + size_t size, int direction, dma_addr_t dma_addr, + bool map_single) +{ + struct dma_debug_entry *entry; + + if (unlikely(global_disable)) + return; + + if (unlikely(dma_mapping_error(dev, dma_addr))) + return; + + entry = dma_entry_alloc(); + if (!entry) + return; + + entry->dev = dev; + entry->type = dma_debug_page; + entry->paddr = page_to_phys(page) + offset; + entry->dev_addr = dma_addr; + entry->size = size; + entry->direction = direction; + + if (map_single) { + entry->type = dma_debug_single; + check_for_stack(dev, page_address(page) + offset); + } + + add_dma_entry(entry); +} +EXPORT_SYMBOL(debug_dma_map_page); + +void debug_dma_unmap_page(struct device *dev, dma_addr_t addr, + size_t size, int direction, bool map_single) +{ + struct dma_debug_entry ref = { + .type = dma_debug_page, + .dev = dev, + .dev_addr = addr, + .size = size, + .direction = direction, + }; + + if (unlikely(global_disable)) + return; + + if (map_single) + ref.type = dma_debug_single; + + check_unmap(&ref); +} +EXPORT_SYMBOL(debug_dma_unmap_page); + |