Skip to contentSkip to conversation

iommu/rockchip: fix zap cache during device attach

PATCH Superseded John Keeping 2 participants 3 messages May 10, 2016 – May 15, 2016

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 iommu/rockchip: fix zap cache during device attach

rk_iommu_command() takes a struct rk_iommu and iterates over the slave MMUs, so this is doubly wrong in that we're passing in the wrong pointer and talking to MMUs that we shouldn't be.

Fixes cd6438c5f844 ("iommu/rockchip: Reconstruct to support multi slaves")
---
 drivers/iommu/rockchip-iommu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iommu/rockchip-iommu.c +1 -1
index 5710a06c3049..0ea8d9a24de0 100644
@@ -815,7 +815,7 @@ static int rk_iommu_attach_device(struct iommu_domain *domain,
 	dte_addr = virt_to_phys(rk_domain->dt);
 	for (i = 0; i < iommu->num_mmu; i++) {
 		rk_iommu_write(iommu->bases[i], RK_MMU_DTE_ADDR, dte_addr);
-		rk_iommu_command(iommu->bases[i], RK_MMU_CMD_ZAP_CACHE);
+		rk_iommu_base_command(iommu->bases[i], RK_MMU_CMD_ZAP_CACHE);
 		rk_iommu_write(iommu->bases[i], RK_MMU_INT_MASK, RK_MMU_IRQ_MASK);
 	}
 
Signature · 1 line
2.8.2.565.gdb84f68.dirty
maintainer Tested-by Reviewed-by on v1 1/1
#1 lore raw

Am Dienstag, 10. Mai 2016, 16:50:46 schrieb John Keeping:

Quoted 6 lines

rk_iommu_command() takes a struct rk_iommu and iterates over the slave MMUs, so this is doubly wrong in that we're passing in the wrong pointer and talking to MMUs that we shouldn't be.

Fixes cd6438c5f844 ("iommu/rockchip: Reconstruct to support multi

slaves") Signed-off-by: John Keeping <[email protected]>

on a rk3288-veyron

I was wondering for a short time why this didn't spew warnings until I realized that the iommu->bases[i] is of course a void* .

Heiko

#2 lore raw
Quoted 8 lines · Heiko Stuebner

Am Dienstag, 10. Mai 2016, 16:50:46 schrieb John Keeping:

Quoted 6 lines

rk_iommu_command() takes a struct rk_iommu and iterates over the slave MMUs, so this is doubly wrong in that we're passing in the wrong pointer and talking to MMUs that we shouldn't be.

Fixes cd6438c5f844 ("iommu/rockchip: Reconstruct to support multi

slaves") Signed-off-by: John Keeping <[email protected]>

Quoted 6 lines

on a rk3288-veyron

I was wondering for a short time why this didn't spew warnings until I realized that the iommu->bases[i] is of course a void* .

Yes, although sparse catches it because iommu->bases[i] is __iomem so it shows up as a namespace warning.