Skip to content

Commit

Permalink
dma-debug: allow DMA_BIDIRECTIONAL mappings to be synced with DMA_FRO…
Browse files Browse the repository at this point in the history
…M_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 <[email protected]>
Cc: David Miller <[email protected]>
Cc: Joerg Roedel <[email protected]>
Cc: <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Krzysztof Halasa authored and torvalds committed Jan 11, 2010
1 parent e992cd9 commit 42d53b4
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions lib/dma-debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -913,6 +913,9 @@ static void check_sync(struct device *dev,
ref->size);
}

if (entry->direction == DMA_BIDIRECTIONAL)
goto out;

if (ref->direction != entry->direction) {
err_printk(dev, entry, "DMA-API: device driver syncs "
"DMA memory with different direction "
Expand All @@ -923,9 +926,6 @@ static void check_sync(struct device *dev,
dir2name[ref->direction]);
}

if (entry->direction == DMA_BIDIRECTIONAL)
goto out;

if (to_cpu && !(entry->direction == DMA_FROM_DEVICE) &&
!(ref->direction == DMA_TO_DEVICE))
err_printk(dev, entry, "DMA-API: device driver syncs "
Expand All @@ -948,7 +948,6 @@ static void check_sync(struct device *dev,

out:
put_hash_bucket(bucket, &flags);

}

void debug_dma_map_page(struct device *dev, struct page *page, size_t offset,
Expand Down

0 comments on commit 42d53b4

Please sign in to comment.