powerpc: Handle SWIOTLB mapping error properly
authorFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Tue, 4 Aug 2009 19:08:27 +0000 (19:08 +0000)
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>
Fri, 28 Aug 2009 04:24:11 +0000 (14:24 +1000)
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
arch/powerpc/include/asm/dma-mapping.h
arch/powerpc/kernel/dma-swiotlb.c

index 91217e4a0bfc3b2abd0d19e00bffc4233bce7c6f..4bd41b4051e3c33505a5e772467851e79dfe8c64 100644 (file)
@@ -143,6 +143,11 @@ static inline void dma_free_coherent(struct device *dev, size_t size,
 
 static inline int dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
 {
+       struct dma_map_ops *dma_ops = get_dma_ops(dev);
+
+       if (dma_ops->mapping_error)
+               return dma_ops->mapping_error(dev, dma_addr);
+
 #ifdef CONFIG_PPC64
        return (dma_addr == DMA_ERROR_CODE);
 #else
index d1143a68d82a9b44987c4455dfb86a39f2dcdc9c..e96cbbd9b449874e09dc38288abead50c8db1673 100644 (file)
@@ -42,7 +42,8 @@ struct dma_map_ops swiotlb_dma_ops = {
        .sync_single_range_for_cpu = swiotlb_sync_single_range_for_cpu,
        .sync_single_range_for_device = swiotlb_sync_single_range_for_device,
        .sync_sg_for_cpu = swiotlb_sync_sg_for_cpu,
-       .sync_sg_for_device = swiotlb_sync_sg_for_device
+       .sync_sg_for_device = swiotlb_sync_sg_for_device,
+       .mapping_error = swiotlb_dma_mapping_error,
 };
 
 void pci_dma_dev_setup_swiotlb(struct pci_dev *pdev)