iommu/tegra: smmu: Fix smmu_iommu_unmap() return value
Subsystems (3)
PATCH 1/2 iommu/tegra: smmu: Fix smmu_iommu_unmap() return value
From: Hiroshi DOYU <[email protected]>
Fix to return 0 if fails.
Signed-off-by Hiroshi DOYU <[email protected]>
--- drivers/iommu/tegra-smmu.c | 15 +++++++++------ 1 files changed, 9 insertions(+), 6 deletions(-)
drivers/iommu/tegra-smmu.c +9 -6
@@ -680,7 +680,7 @@ err_out:return err; } -static void __smmu_iommu_unmap (struct smmu_as *as,dma_addr_t iova) +static int __smmu_iommu_unmap (struct smmu_as *as,dma_addr_t iova) {unsigned long *pte;struct page *page;
@@ -688,10 +688,10 @@ static void __smmu_iommu_unmap(struct smmu_as *as, dma_addr_t iova) pte =locate_pte (as, iova, false, &page, &count);if (WARN_ON (!pte)) -return ; +return -EINVAL ; -if (WARN_ON (*pte ==_PTE_VACANT (iova))) -return ; +if (*pte ==_PTE_VACANT (iova)) +return -EINVAL ; *pte =_PTE_VACANT (iova);FLUSH_CPU_DCACHE (pte, page,sizeof (*pte));
@@ -700,6 +700,8 @@ static void __smmu_iommu_unmap(struct smmu_as *as, dma_addr_t iova)free_ptbl (as, iova);smmu_flush_regs (as->smmu,0 ); } + +return 0 ; } static void __smmu_iommu_map_pfn(struct smmu_as *as, dma_addr_t iova,
@@ -747,13 +749,14 @@ static size_t smmu_iommu_unmap(struct iommu_domain *domain, unsigned long iova, {struct smmu_as *as = domain->priv;unsigned long flags; +int err;dev_dbg (as->smmu->dev,"[%d] %08lx\n" , as->asid, iova);spin_lock_irqsave (&as->lock, flags); -__smmu_iommu_unmap (as, iova); + err =__smmu_iommu_unmap (as, iova);spin_unlock_irqrestore (&as->lock, flags); -return SMMU_PAGE_SIZE ; +return err ?0 :SMMU_PAGE_SIZE ; } static phys_addr_t smmu_iommu_iova_to_phys(struct iommu_domain *domain,
Signature · 1 line
1.7.5.4
A message that is not in the archive (sent off-list or not yet received): 1349079560-31133-1-git-send-email-hdoyu-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org
PATCH 2/2 iommu/tegra: smmu: Don't allocate pte at iova_to_phys
From: Hiroshi DOYU <[email protected]>
No need to allocate new pte if it doesn't exsit just for translation.
Signed-off-by Hiroshi DOYU <[email protected]>
--- drivers/iommu/tegra-smmu.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-)
drivers/iommu/tegra-smmu.c +4 -4
@@ -766,14 +766,14 @@ static phys_addr_t smmu_iommu_iova_to_phys(struct iommu_domain *domain,unsigned long *pte;unsigned int *count;struct page *page; -unsigned long pfn; +unsigned long pfn =0 ;unsigned long flags;spin_lock_irqsave (&as->lock, flags); - pte =locate_pte (as, iova, true, &page, &count); - pfn = *pte &SMMU_PFN_MASK ; -WARN_ON (!pfn_valid (pfn)); + pte =locate_pte (as, iova, false, &page, &count); +if (pte) + pfn = *pte &SMMU_PFN_MASK ;dev_dbg (as->smmu->dev,"iova:%08lx pfn:%08lx asid:%d\n" , iova, pfn, as->asid);
Signature · 1 line
1.7.5.4