powerpc/dma: Fix check for direct DMA support
authorNishanth Aravamudan <nacc@us.ibm.com>
Wed, 15 Sep 2010 08:05:46 +0000 (08:05 +0000)
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>
Wed, 13 Oct 2010 05:19:21 +0000 (16:19 +1100)
The current check is wrong because it does not take the DMA offset intot
account, and in the case of a driver which doesn't actually support
64bits would falsely report that device as working.

Signed-off-by: Milton Miller <miltonm@bga.com>
Signed-off-by: Nishanth Aravamudan <nacc@us.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
arch/powerpc/kernel/dma.c

index f368c07..cf02cad 100644 (file)
@@ -90,7 +90,7 @@ static int dma_direct_dma_supported(struct device *dev, u64 mask)
        /* Could be improved so platforms can set the limit in case
         * they have limited DMA windows
         */
-       return mask >= (memblock_end_of_DRAM() - 1);
+       return mask >= get_dma_offset(dev) + (memblock_end_of_DRAM() - 1);
 #else
        return 1;
 #endif