diff options
author | Casey Dahlin <cdahlin@redhat.com> | 2009-08-20 19:27:56 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-08-21 04:36:03 -0400 |
commit | c7084b35eb1a4d3353a501508baf9d3d82822c93 (patch) | |
tree | cbb16e4f78f3195c71ade12918977fae9f96d520 | |
parent | 451d7400a34cb679369e337d67f0238ed410f484 (diff) |
lib/swiotlb.c: Fix strange panic message selection logic when swiotlb fills up
swiotlb_full() in lib/swiotlb.c throws one of two panic messages
based on whether the direction of transfer is from the device
or to the device. The logic around this is somewhat weird in
the case of bidirectional transfers. It appears to want to
throw both in succession, but since its a panic only the first
makes it.
This patch adds a third, separate error for DMA_BIDIRECTIONAL
to make things a bit clearer.
Signed-off-by: Casey Dahlin <cdahlin@redhat.com>
Cc: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Cc: Becky Bruce <beckyb@kernel.crashing.org>
[ further fixed the error message ]
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
LKML-Reference: <200908202327.n7KNRuqK001504@imap1.linux-foundation.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
-rw-r--r-- | lib/swiotlb.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/lib/swiotlb.c b/lib/swiotlb.c index 9e2fe3e1804c..ac25cd28e807 100644 --- a/lib/swiotlb.c +++ b/lib/swiotlb.c | |||
@@ -581,12 +581,15 @@ swiotlb_full(struct device *dev, size_t size, int dir, int do_panic) | |||
581 | printk(KERN_ERR "DMA: Out of SW-IOMMU space for %zu bytes at " | 581 | printk(KERN_ERR "DMA: Out of SW-IOMMU space for %zu bytes at " |
582 | "device %s\n", size, dev ? dev_name(dev) : "?"); | 582 | "device %s\n", size, dev ? dev_name(dev) : "?"); |
583 | 583 | ||
584 | if (size > io_tlb_overflow && do_panic) { | 584 | if (size <= io_tlb_overflow || !do_panic) |
585 | if (dir == DMA_FROM_DEVICE || dir == DMA_BIDIRECTIONAL) | 585 | return; |
586 | panic("DMA: Memory would be corrupted\n"); | 586 | |
587 | if (dir == DMA_TO_DEVICE || dir == DMA_BIDIRECTIONAL) | 587 | if (dir == DMA_BIDIRECTIONAL) |
588 | panic("DMA: Random memory would be DMAed\n"); | 588 | panic("DMA: Random memory could be DMA accessed\n"); |
589 | } | 589 | if (dir == DMA_FROM_DEVICE) |
590 | panic("DMA: Random memory could be DMA written\n"); | ||
591 | if (dir == DMA_TO_DEVICE) | ||
592 | panic("DMA: Random memory could be DMA read\n"); | ||
590 | } | 593 | } |
591 | 594 | ||
592 | /* | 595 | /* |