aboutsummaryrefslogtreecommitdiffstats
path: root/lib/dma-debug.c
diff options
context:
space:
mode:
authorKrzysztof Halasa <khc@pm.waw.pl>2010-01-08 17:42:36 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2010-01-11 12:34:04 -0500
commit42d53b4ff7d61487d18274ebdf1f70c1aef6f122 (patch)
tree55ef141c2c6e9ef52c724dd6aec03a8708d288b1 /lib/dma-debug.c
parente992cd9b72a18122bd5c958715623057f110793f (diff)
dma-debug: allow DMA_BIDIRECTIONAL mappings to be synced with DMA_FROM_DEVICE and
There is no need to perform full BIDIR sync (copying the buffers in case of swiotlb and similar schemes) if we know that the owner (CPU or device) hasn't altered the data. Addresses the false-positive reported at http://bugzilla.kernel.org/show_bug.cgi?id=14169 Signed-off-by: Krzysztof Halasa <khc@pm.waw.pl> Cc: David Miller <davem@davemloft.net> Cc: Joerg Roedel <joerg.roedel@amd.com> Cc: <stable@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'lib/dma-debug.c')
-rw-r--r--lib/dma-debug.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/dma-debug.c b/lib/dma-debug.c
index cf906201aecf..7d2f0b33e5a8 100644
--- a/lib/dma-debug.c
+++ b/lib/dma-debug.c
@@ -913,6 +913,9 @@ static void check_sync(struct device *dev,
913 ref->size); 913 ref->size);
914 } 914 }
915 915
916 if (entry->direction == DMA_BIDIRECTIONAL)
917 goto out;
918
916 if (ref->direction != entry->direction) { 919 if (ref->direction != entry->direction) {
917 err_printk(dev, entry, "DMA-API: device driver syncs " 920 err_printk(dev, entry, "DMA-API: device driver syncs "
918 "DMA memory with different direction " 921 "DMA memory with different direction "
@@ -923,9 +926,6 @@ static void check_sync(struct device *dev,
923 dir2name[ref->direction]); 926 dir2name[ref->direction]);
924 } 927 }
925 928
926 if (entry->direction == DMA_BIDIRECTIONAL)
927 goto out;
928
929 if (to_cpu && !(entry->direction == DMA_FROM_DEVICE) && 929 if (to_cpu && !(entry->direction == DMA_FROM_DEVICE) &&
930 !(ref->direction == DMA_TO_DEVICE)) 930 !(ref->direction == DMA_TO_DEVICE))
931 err_printk(dev, entry, "DMA-API: device driver syncs " 931 err_printk(dev, entry, "DMA-API: device driver syncs "
@@ -948,7 +948,6 @@ static void check_sync(struct device *dev,
948 948
949out: 949out:
950 put_hash_bucket(bucket, &flags); 950 put_hash_bucket(bucket, &flags);
951
952} 951}
953 952
954void debug_dma_map_page(struct device *dev, struct page *page, size_t offset, 953void debug_dma_map_page(struct device *dev, struct page *page, size_t offset,