Skip to content

Commit 2fc0ac1

Browse files
digetxjoergroedel
authored andcommitted
iommu/tegra: gart: Optimize mapping / unmapping performance
Currently GART writes one page entry at a time. More optimal would be to aggregate the writes and flush BUS buffer in the end, this gives map/unmap 10-40% performance boost (depending on size of mapping) in comparison to flushing after each page entry update. Signed-off-by: Dmitry Osipenko <digetx@gmail.com> Acked-by: Thierry Reding <treding@nvidia.com> Signed-off-by: Joerg Roedel <jroedel@suse.de>
1 parent 1d7ae53 commit 2fc0ac1

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

drivers/iommu/tegra-gart.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,6 @@ static int gart_iommu_map(struct iommu_domain *domain, unsigned long iova,
290290
}
291291
}
292292
gart_set_pte(gart, iova, GART_PTE(pfn));
293-
FLUSH_GART_REGS(gart);
294293
spin_unlock_irqrestore(&gart->pte_lock, flags);
295294
return 0;
296295
}
@@ -307,7 +306,6 @@ static size_t gart_iommu_unmap(struct iommu_domain *domain, unsigned long iova,
307306

308307
spin_lock_irqsave(&gart->pte_lock, flags);
309308
gart_set_pte(gart, iova, 0);
310-
FLUSH_GART_REGS(gart);
311309
spin_unlock_irqrestore(&gart->pte_lock, flags);
312310
return bytes;
313311
}
@@ -373,6 +371,14 @@ static int gart_iommu_of_xlate(struct device *dev,
373371
return 0;
374372
}
375373

374+
static void gart_iommu_sync(struct iommu_domain *domain)
375+
{
376+
struct gart_domain *gart_domain = to_gart_domain(domain);
377+
struct gart_device *gart = gart_domain->gart;
378+
379+
FLUSH_GART_REGS(gart);
380+
}
381+
376382
static const struct iommu_ops gart_iommu_ops = {
377383
.capable = gart_iommu_capable,
378384
.domain_alloc = gart_iommu_domain_alloc,
@@ -387,6 +393,8 @@ static const struct iommu_ops gart_iommu_ops = {
387393
.iova_to_phys = gart_iommu_iova_to_phys,
388394
.pgsize_bitmap = GART_IOMMU_PGSIZES,
389395
.of_xlate = gart_iommu_of_xlate,
396+
.iotlb_sync_map = gart_iommu_sync,
397+
.iotlb_sync = gart_iommu_sync,
390398
};
391399

392400
static int tegra_gart_suspend(struct device *dev)

0 commit comments

Comments
 (0)