linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: robin.murphy@arm.com (Robin Murphy)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 4/9] iommu/arm-smmu-v3: Clean up DMA API usage
Date: Wed, 29 Jul 2015 19:46:07 +0100	[thread overview]
Message-ID: <c2cb4e3b6e7a30738e4d017e8640f08d930d5a82.1438195011.git.robin.murphy@arm.com> (raw)
In-Reply-To: <6999933bfa9b3d50853fd023d455c837a0d7ff23.1438195011.git.robin.murphy@arm.com>

With the correct DMA API calls now integrated into the io-pgtable code,
let that handle the flushing of non-coherent page table updates.

Signed-off-by: Robin Murphy <robin.murphy@arm.com>
---
 drivers/iommu/arm-smmu-v3.c | 18 +++---------------
 1 file changed, 3 insertions(+), 15 deletions(-)

diff --git a/drivers/iommu/arm-smmu-v3.c b/drivers/iommu/arm-smmu-v3.c
index 8e9ec81..ac29d24 100644
--- a/drivers/iommu/arm-smmu-v3.c
+++ b/drivers/iommu/arm-smmu-v3.c
@@ -1304,23 +1304,10 @@ static void arm_smmu_tlb_inv_range_nosync(unsigned long iova, size_t size,
 static void arm_smmu_flush_pgtable(void *addr, size_t size, void *cookie)
 {
 	struct arm_smmu_domain *smmu_domain = cookie;
-	struct arm_smmu_device *smmu = smmu_domain->smmu;
-	unsigned long offset = (unsigned long)addr & ~PAGE_MASK;
 
-	if (smmu->features & ARM_SMMU_FEAT_COHERENCY) {
+	/* The page table code handles flushing in the non-coherent case */
+	if (smmu_domain->smmu->features & ARM_SMMU_FEAT_COHERENCY)
 		dsb(ishst);
-	} else {
-		dma_addr_t dma_addr;
-		struct device *dev = smmu->dev;
-
-		dma_addr = dma_map_page(dev, virt_to_page(addr), offset, size,
-					DMA_TO_DEVICE);
-
-		if (dma_mapping_error(dev, dma_addr))
-			dev_err(dev, "failed to flush pgtable at %p\n", addr);
-		else
-			dma_unmap_page(dev, dma_addr, size, DMA_TO_DEVICE);
-	}
 }
 
 static struct iommu_gather_ops arm_smmu_gather_ops = {
@@ -1502,6 +1489,7 @@ static int arm_smmu_domain_finalise(struct iommu_domain *domain)
 		.ias		= ias,
 		.oas		= oas,
 		.tlb		= &arm_smmu_gather_ops,
+		.iommu_dev	= smmu->dev,
 	};
 
 	pgtbl_ops = alloc_io_pgtable_ops(fmt, &pgtbl_cfg, smmu_domain);
-- 
1.9.1

  parent reply	other threads:[~2015-07-29 18:46 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-29 18:46 [PATCH v2 1/9] iommu/io-pgtable-arm: Allow appropriate DMA API use Robin Murphy
2015-07-29 18:46 ` [PATCH v2 2/9] iommu/arm-smmu: Sort out coherency Robin Murphy
2015-07-29 18:46 ` [PATCH v2 3/9] iommu/arm-smmu: Clean up DMA API usage Robin Murphy
2015-07-29 18:46 ` Robin Murphy [this message]
2015-07-29 18:46 ` [PATCH v2 5/9] iommu/ipmmu-vmsa: " Robin Murphy
2015-07-29 18:46 ` [PATCH v2 6/9] iommu/io-pgtable-arm: Centralise sync points Robin Murphy
2015-07-29 18:46 ` [PATCH v2 7/9] iommu/arm-smmu: Remove arm_smmu_flush_pgtable() Robin Murphy
2015-07-29 18:46 ` [PATCH v2 8/9] iommu/arm-smmu-v3: " Robin Murphy
2015-07-29 18:46 ` [PATCH v2 9/9] iommu/io-pgtable: Remove flush_pgtable callback Robin Murphy
2015-07-31 11:22 ` [PATCH v2 1/9] iommu/io-pgtable-arm: Allow appropriate DMA API use Will Deacon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c2cb4e3b6e7a30738e4d017e8640f08d930d5a82.1438195011.git.robin.murphy@arm.com \
    --to=robin.murphy@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).