Skip to contentSkip to conversation

iommu/sun50i: Change the readl timeout to the atomic variant

PATCH Applied Maxime Ripard 2 participants 3 messages Jun 28, 2020 – Jun 30, 2020

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

PATCH 1/2 iommu/sun50i: Change the readl timeout to the atomic variant

The flush_all_tlb call back can be called from an atomic context, so using readl_poll_timeout that embeds a udelay doesn't work.

Fixes 4100b8c229b3 ("iommu: Add Allwinner H6 IOMMU driver")
---
 drivers/iommu/sun50i-iommu.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/iommu/sun50i-iommu.c +3 -3
index fce605e96aa2..a1563b54c743 100644
@@ -313,9 +313,9 @@ static int sun50i_iommu_flush_all_tlb(struct sun50i_iommu *iommu)
 		    IOMMU_TLB_FLUSH_MICRO_TLB(1) |
 		    IOMMU_TLB_FLUSH_MICRO_TLB(0));
 
-	ret = readl_poll_timeout(iommu->base + IOMMU_TLB_FLUSH_REG,
-				 reg, !reg,
-				 1, 2000);
+	ret = readl_poll_timeout_atomic(iommu->base + IOMMU_TLB_FLUSH_REG,
+					reg, !reg,
+					1, 2000);
 	if (ret)
 		dev_warn(iommu->dev, "TLB Flush timed out!\n");
 
Signature · 7 lines
2.26.2


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
#1 lore raw

PATCH 2/2 iommu/sun50i: Remove unused variable

The pte_dma variable in the unmap callback is set but never used. Remove it.

Fixes 4100b8c229b3 ("iommu: Add Allwinner H6 IOMMU driver")
---
 drivers/iommu/sun50i-iommu.c | 2 --
 1 file changed, 2 deletions(-)
drivers/iommu/sun50i-iommu.c +0 -2
index a1563b54c743..3b1bf2fb94f5 100644
@@ -556,7 +556,6 @@ static size_t sun50i_iommu_unmap(struct iommu_domain *domain, unsigned long iova
 {
 	struct sun50i_iommu_domain *sun50i_domain = to_sun50i_domain(domain);
 	phys_addr_t pt_phys;
-	dma_addr_t pte_dma;
 	u32 *pte_addr;
 	u32 dte;
 
@@ -566,7 +565,6 @@ static size_t sun50i_iommu_unmap(struct iommu_domain *domain, unsigned long iova
 
 	pt_phys = sun50i_dte_get_pt_address(dte);
 	pte_addr = (u32 *)phys_to_virt(pt_phys) + sun50i_iova_get_pte_index(iova);
-	pte_dma = pt_phys + sun50i_iova_get_pte_index(iova) * PT_ENTRY_SIZE;
 
 	if (!sun50i_pte_is_page_valid(*pte_addr))
 		return 0;
Signature · 7 lines
2.26.2


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
maintainer Applied
#2 lore raw
In reply to Maxime Ripard
Quoted 5 lines · Maxime Ripard

The flush_all_tlb call back can be called from an atomic context, so using readl_poll_timeout that embeds a udelay doesn't work.

Fixes 4100b8c229b3 ("iommu: Add Allwinner H6 IOMMU driver")

Applied both for v5.8, thanks.

_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu