Commit b9d2317e0c4aed02afd20022083b2a485289605d
1 parent
6bfd449876
Exists in
master
and in
4 other branches
dma-debug: add checks for sync_single_*
Impact: add debug callbacks for dma_sync_single_for_* functions Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Showing 2 changed files with 41 additions and 0 deletions Side-by-side Diff
include/linux/dma-debug.h
... | ... | @@ -49,6 +49,14 @@ |
49 | 49 | extern void debug_dma_free_coherent(struct device *dev, size_t size, |
50 | 50 | void *virt, dma_addr_t addr); |
51 | 51 | |
52 | +extern void debug_dma_sync_single_for_cpu(struct device *dev, | |
53 | + dma_addr_t dma_handle, size_t size, | |
54 | + int direction); | |
55 | + | |
56 | +extern void debug_dma_sync_single_for_device(struct device *dev, | |
57 | + dma_addr_t dma_handle, | |
58 | + size_t size, int direction); | |
59 | + | |
52 | 60 | #else /* CONFIG_DMA_API_DEBUG */ |
53 | 61 | |
54 | 62 | static inline void dma_debug_init(u32 num_entries) |
... | ... | @@ -86,6 +94,18 @@ |
86 | 94 | |
87 | 95 | static inline void debug_dma_free_coherent(struct device *dev, size_t size, |
88 | 96 | void *virt, dma_addr_t addr) |
97 | +{ | |
98 | +} | |
99 | + | |
100 | +static inline void debug_dma_sync_single_for_cpu(struct device *dev, | |
101 | + dma_addr_t dma_handle, | |
102 | + size_t size, int direction) | |
103 | +{ | |
104 | +} | |
105 | + | |
106 | +static inline void debug_dma_sync_single_for_device(struct device *dev, | |
107 | + dma_addr_t dma_handle, | |
108 | + size_t size, int direction) | |
89 | 109 | { |
90 | 110 | } |
91 | 111 |
lib/dma-debug.c
... | ... | @@ -736,4 +736,25 @@ |
736 | 736 | check_unmap(&ref); |
737 | 737 | } |
738 | 738 | EXPORT_SYMBOL(debug_dma_free_coherent); |
739 | + | |
740 | +void debug_dma_sync_single_for_cpu(struct device *dev, dma_addr_t dma_handle, | |
741 | + size_t size, int direction) | |
742 | +{ | |
743 | + if (unlikely(global_disable)) | |
744 | + return; | |
745 | + | |
746 | + check_sync(dev, dma_handle, size, 0, direction, true); | |
747 | +} | |
748 | +EXPORT_SYMBOL(debug_dma_sync_single_for_cpu); | |
749 | + | |
750 | +void debug_dma_sync_single_for_device(struct device *dev, | |
751 | + dma_addr_t dma_handle, size_t size, | |
752 | + int direction) | |
753 | +{ | |
754 | + if (unlikely(global_disable)) | |
755 | + return; | |
756 | + | |
757 | + check_sync(dev, dma_handle, size, 0, direction, false); | |
758 | +} | |
759 | +EXPORT_SYMBOL(debug_dma_sync_single_for_device); |