summaryrefslogtreecommitdiff
path: root/drivers/iommu
diff options
context:
space:
mode:
authorHiroshi Doyu <hdoyu@nvidia.com>2013-09-11 14:56:28 +0300
committerDan Willemsen <dwillemsen@nvidia.com>2013-09-16 17:42:21 -0700
commit441fdb7eecaa8befca2c60391fb2f0773612ed05 (patch)
treef6c5f29937a0486588fa032c0e51c915fe309626 /drivers/iommu
parent01650df9eec73d65750ab9074eb26f0a7f2a195e (diff)
iommu/tegra: smmu: Optimize alloc_ptbl
Without TEGRA_IOMMU_SMMU_LINEAR, zero initialized page table is enough. Optimize the way to zero initialize. Bug 1290869 Change-Id: Iaf71157c999663bc6216a9d086d2ccb093add1e6 Signed-off-by: Hiroshi Doyu <hdoyu@nvidia.com> Reviewed-on: http://git-master/r/273152 Reviewed-by: Krishna Reddy <vdumpa@nvidia.com>
Diffstat (limited to 'drivers/iommu')
-rw-r--r--drivers/iommu/tegra-smmu.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/drivers/iommu/tegra-smmu.c b/drivers/iommu/tegra-smmu.c
index 341f2b47a6ac..5e7deed8ec4e 100644
--- a/drivers/iommu/tegra-smmu.c
+++ b/drivers/iommu/tegra-smmu.c
@@ -825,6 +825,9 @@ static struct page *alloc_ptbl(struct smmu_as *as, dma_addr_t iova, bool flush)
if (IS_ENABLED(CONFIG_PREEMPT) && !in_atomic())
gfp = GFP_KERNEL;
+ if (!IS_ENABLED(CONFIG_TEGRA_IOMMU_SMMU_LINEAR))
+ gfp |= __GFP_ZERO;
+
/* Vacant - allocate a new page table */
dev_dbg(as->smmu->dev, "New PTBL pdn: %x\n", pdn);
@@ -834,9 +837,11 @@ static struct page *alloc_ptbl(struct smmu_as *as, dma_addr_t iova, bool flush)
SetPageReserved(page);
ptbl = (u32 *)page_address(page);
- for (i = 0; i < SMMU_PTBL_COUNT; i++) {
- ptbl[i] = _PTE_VACANT(addr);
- addr += SMMU_PAGE_SIZE;
+ if (IS_ENABLED(CONFIG_TEGRA_IOMMU_SMMU_LINEAR)) {
+ for (i = 0; i < SMMU_PTBL_COUNT; i++) {
+ ptbl[i] = _PTE_VACANT(addr);
+ addr += SMMU_PAGE_SIZE;
+ }
}
FLUSH_CPU_DCACHE(ptbl, page, SMMU_PTBL_SIZE);