From: Tomasz Figa Date: Tue, 16 Aug 2016 03:41:16 +0000 (+0900) Subject: CHROMIUM: iommu/rockchip: Fix TLB flush of secondary IOMMUs X-Git-Tag: firefly_0821_release~1194 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=e1b2457124c65cc66b132a3727dfebc53e359924;p=firefly-linux-kernel-4.4.55.git CHROMIUM: iommu/rockchip: Fix TLB flush of secondary IOMMUs Due to the bug in current code, only first IOMMU has the TLB lines flushed in rk_iommu_zap_lines. This patch fixes the inner loop to execute for all IOMMUs and properly flush the TLB. BUG=chrome-os-partner:55135 TEST=compile Change-Id: Ica2d4b0cc3d3cbc88c70ad541dc00883f1b4e90c Signed-off-by: Tomasz Figa Reviewed-on: https://chromium-review.googlesource.com/371098 Reviewed-by: Guenter Roeck Signed-off-by: Randy Li --- diff --git a/drivers/iommu/rockchip-iommu.c b/drivers/iommu/rockchip-iommu.c index d980e8658918..4f856a1a9492 100644 --- a/drivers/iommu/rockchip-iommu.c +++ b/drivers/iommu/rockchip-iommu.c @@ -292,19 +292,21 @@ static void rk_iommu_base_command(void __iomem *base, u32 command) { writel(command, base + RK_MMU_COMMAND); } -static void rk_iommu_zap_lines(struct rk_iommu *iommu, dma_addr_t iova, +static void rk_iommu_zap_lines(struct rk_iommu *iommu, dma_addr_t iova_start, size_t size) { int i; - - dma_addr_t iova_end = iova + size; + dma_addr_t iova_end = iova_start + size; /* * TODO(djkurtz): Figure out when it is more efficient to shootdown the * entire iotlb rather than iterate over individual iovas. */ - for (i = 0; i < iommu->num_mmu; i++) - for (; iova < iova_end; iova += SPAGE_SIZE) + for (i = 0; i < iommu->num_mmu; i++) { + dma_addr_t iova; + + for (iova = iova_start; iova < iova_end; iova += SPAGE_SIZE) rk_iommu_write(iommu->bases[i], RK_MMU_ZAP_ONE_LINE, iova); + } } static bool rk_iommu_is_stall_active(struct rk_iommu *iommu)