sparc64: Enable 64-bit DMA
authorTushar Dave <tushar.n.dave@oracle.com>
Fri, 28 Oct 2016 17:12:45 +0000 (10:12 -0700)
committerDavid S. Miller <davem@davemloft.net>
Fri, 18 Nov 2016 19:17:00 +0000 (11:17 -0800)
ATU 64bit addressing allows PCIe devices with 64bit DMA capabilities
to use ATU for 64bit DMA.

Signed-off-by: Tushar Dave <tushar.n.dave@oracle.com>
Reviewed-by: chris hyser <chris.hyser@oracle.com>
Acked-by: Sowmini Varadhan <sowmini.varadhan@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
arch/sparc/Kconfig
arch/sparc/kernel/iommu.c

index 5202eb4ba2db758dfb65978176212f96c55967ab..60145c9b9f84a9aa1ab2f7954a6f9e3b4565b4e6 100644 (file)
@@ -93,6 +93,10 @@ config ARCH_ATU
        bool
        default y if SPARC64
 
+config ARCH_DMA_ADDR_T_64BIT
+       bool
+       default y if ARCH_ATU
+
 config IOMMU_HELPER
        bool
        default y if SPARC64
index 5c615abff030fdb6c26a7c68c86d5c3fa0544b94..852a3291db968986a0f77d240ccf7b58c3f9070a 100644 (file)
@@ -760,8 +760,12 @@ int dma_supported(struct device *dev, u64 device_mask)
        struct iommu *iommu = dev->archdata.iommu;
        u64 dma_addr_mask = iommu->dma_addr_mask;
 
-       if (device_mask >= (1UL << 32UL))
-               return 0;
+       if (device_mask > DMA_BIT_MASK(32)) {
+               if (iommu->atu)
+                       dma_addr_mask = iommu->atu->dma_addr_mask;
+               else
+                       return 0;
+       }
 
        if ((device_mask & dma_addr_mask) == dma_addr_mask)
                return 1;