Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1496923

[RFC PATCH 6/6] sparc64: Enable 64-bit DMA

From Tushar Dave <tushar.n.dave@oracle.com>
Newsgroups linux.kernel
Subject [RFC PATCH 6/6] sparc64: Enable 64-bit DMA
Date 2016-10-07 01:40 +0200
Message-ID <spqqB-7YC-21@gated-at.bofh.it> (permalink)
References <spqqB-7YC-11@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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>
---
 arch/sparc/Kconfig        | 4 ++++
 arch/sparc/kernel/iommu.c | 8 ++++++--
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig
index 338282d..78e7556 100644
--- a/arch/sparc/Kconfig
+++ b/arch/sparc/Kconfig
@@ -95,6 +95,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
diff --git a/arch/sparc/kernel/iommu.c b/arch/sparc/kernel/iommu.c
index 5c615ab..852a329 100644
--- a/arch/sparc/kernel/iommu.c
+++ b/arch/sparc/kernel/iommu.c
@@ -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;
-- 
1.9.1

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[RFC PATCH 0/6] sparc: Enable sun4v hypervisor PCI IOMMU v2 APIs and ATU Tushar Dave <tushar.n.dave@oracle.com> - 2016-10-07 01:40 +0200
  [RFC PATCH 6/6] sparc64: Enable 64-bit DMA Tushar Dave <tushar.n.dave@oracle.com> - 2016-10-07 01:40 +0200
    Re: [RFC PATCH 6/6] sparc64: Enable 64-bit DMA Christoph Hellwig <hch@infradead.org> - 2016-10-07 09:40 +0200
      Re: [RFC PATCH 6/6] sparc64: Enable 64-bit DMA tndave <tushar.n.dave@oracle.com> - 2016-10-07 10:20 +0200
        Re: [RFC PATCH 6/6] sparc64: Enable 64-bit DMA Christoph Hellwig <hch@infradead.org> - 2016-10-11 19:10 +0200
          Re: [RFC PATCH 6/6] sparc64: Enable 64-bit DMA tndave <tushar.n.dave@oracle.com> - 2016-10-11 21:50 +0200
  [RFC PATCH 5/6] sparc64: Enable sun4v dma ops to use IOMMU v2 APIs Tushar Dave <tushar.n.dave@oracle.com> - 2016-10-07 01:40 +0200
  [RFC PATCH 2/6] sparc64: Add ATU (new IOMMU) support Tushar Dave <tushar.n.dave@oracle.com> - 2016-10-07 01:40 +0200
  [RFC PATCH 3/6] sparc64: Initialize iommu_map_table and iommu_pool Tushar Dave <tushar.n.dave@oracle.com> - 2016-10-07 01:40 +0200
  [RFC PATCH 4/6] sparc64: Bind PCIe devices to use IOMMU v2 service Tushar Dave <tushar.n.dave@oracle.com> - 2016-10-07 01:40 +0200

csiph-web