aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/iommu/arm-smmu.c
diff options
context:
space:
mode:
authorRobin Murphy <Robin.Murphy@arm.com>2015-07-29 14:46:06 -0400
committerWill Deacon <will.deacon@arm.com>2015-08-06 09:35:38 -0400
commit2df7a25ce4a79092946330ac4b7a2fbb5944d1d6 (patch)
treef201791d178bf10f67305cfda853cc0327329855 /drivers/iommu/arm-smmu.c
parentf8d5496131554f61b0fd931fa046f0233fe2aac2 (diff)
iommu/arm-smmu: Clean up DMA API usage
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> Signed-off-by: Will Deacon <will.deacon@arm.com>
Diffstat (limited to 'drivers/iommu/arm-smmu.c')
-rw-r--r--drivers/iommu/arm-smmu.c22
1 files changed, 6 insertions, 16 deletions
diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c
index 0583ed2f33c0..5770ab98fa38 100644
--- a/drivers/iommu/arm-smmu.c
+++ b/drivers/iommu/arm-smmu.c
@@ -611,24 +611,13 @@ static void arm_smmu_tlb_inv_range_nosync(unsigned long iova, size_t size,
611static void arm_smmu_flush_pgtable(void *addr, size_t size, void *cookie) 611static void arm_smmu_flush_pgtable(void *addr, size_t size, void *cookie)
612{ 612{
613 struct arm_smmu_domain *smmu_domain = cookie; 613 struct arm_smmu_domain *smmu_domain = cookie;
614 struct arm_smmu_device *smmu = smmu_domain->smmu;
615 unsigned long offset = (unsigned long)addr & ~PAGE_MASK;
616
617 614
618 /* Ensure new page tables are visible to the hardware walker */ 615 /*
619 if (smmu->features & ARM_SMMU_FEAT_COHERENT_WALK) { 616 * Ensure new page tables are visible to a coherent hardware walker.
617 * The page table code deals with flushing for the non-coherent case.
618 */
619 if (smmu_domain->smmu->features & ARM_SMMU_FEAT_COHERENT_WALK)
620 dsb(ishst); 620 dsb(ishst);
621 } else {
622 /*
623 * If the SMMU can't walk tables in the CPU caches, treat them
624 * like non-coherent DMA since we need to flush the new entries
625 * all the way out to memory. There's no possibility of
626 * recursion here as the SMMU table walker will not be wired
627 * through another SMMU.
628 */
629 dma_map_page(smmu->dev, virt_to_page(addr), offset, size,
630 DMA_TO_DEVICE);
631 }
632} 621}
633 622
634static struct iommu_gather_ops arm_smmu_gather_ops = { 623static struct iommu_gather_ops arm_smmu_gather_ops = {
@@ -899,6 +888,7 @@ static int arm_smmu_init_domain_context(struct iommu_domain *domain,
899 .ias = ias, 888 .ias = ias,
900 .oas = oas, 889 .oas = oas,
901 .tlb = &arm_smmu_gather_ops, 890 .tlb = &arm_smmu_gather_ops,
891 .iommu_dev = smmu->dev,
902 }; 892 };
903 893
904 smmu_domain->smmu = smmu; 894 smmu_domain->smmu = smmu;