From: Nicolin Chen Date: Fri, 11 Sep 2020 07:16:42 +0000 (-0700) Subject: iommu/tegra-smmu: Fix iova->phys translation X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=4fba98859b819961d8e1fe862b79052ff4b687b8;p=linux.git iommu/tegra-smmu: Fix iova->phys translation IOVA might not be always 4KB aligned. So tegra_smmu_iova_to_phys function needs to add on the lower 12-bit offset from input iova. Signed-off-by: Nicolin Chen Acked-by: Thierry Reding Link: https://lore.kernel.org/r/20200911071643.17212-3-nicoleotsuka@gmail.com Signed-off-by: Joerg Roedel --- diff --git a/drivers/iommu/tegra-smmu.c b/drivers/iommu/tegra-smmu.c index bd473e085aac9..e6d1424589506 100644 --- a/drivers/iommu/tegra-smmu.c +++ b/drivers/iommu/tegra-smmu.c @@ -795,7 +795,7 @@ static phys_addr_t tegra_smmu_iova_to_phys(struct iommu_domain *domain, pfn = *pte & as->smmu->pfn_mask; - return SMMU_PFN_PHYS(pfn); + return SMMU_PFN_PHYS(pfn) + SMMU_OFFSET_IN_PAGE(iova); } static struct tegra_smmu *tegra_smmu_find(struct device_node *np)