[RAMEN9610-12969][COMMON] iommu/exynos: retry when PTW fault occur
authorJanghyuck Kim <janghyuck.kim@samsung.com>
Tue, 5 Mar 2019 06:53:32 +0000 (15:53 +0900)
committerCosmin Tanislav <demonsingur@gmail.com>
Mon, 22 Apr 2024 17:23:19 +0000 (20:23 +0300)
Change-Id: I3e425c2e611d65c6b619b3e21c46fce7de7fde18
Signed-off-by: Janghyuck Kim <janghyuck.kim@samsung.com>
drivers/iommu/exynos-iommu-reg.h

index 24fbac3d1ce8b318a05cd5db8a75ef5b974cbafa..63fc315b2e08d4473e8a01e5f57fa9259f5730d1 100644 (file)
@@ -372,13 +372,14 @@ finish:
        pr_crit("----------------------------------------------------------\n");
 }
 
-static inline void show_fault_information(struct sysmmu_drvdata *drvdata,
+static inline int show_fault_information(struct sysmmu_drvdata *drvdata,
                                   int flags, unsigned long fault_addr)
 {
        unsigned int info;
        phys_addr_t pgtable;
        int fault_id = SYSMMU_FAULT_ID(flags);
        const char *port_name = NULL;
+       static int ptw_count = 0;
 
        pgtable = __raw_readl(drvdata->sfrbase + REG_PT_BASE_PPN);
        pgtable <<= PAGE_SHIFT;
@@ -421,14 +422,24 @@ static inline void show_fault_information(struct sysmmu_drvdata *drvdata,
        }
 
        if (fault_id == SYSMMU_FAULT_PTW_ACCESS) {
-               pr_crit("System MMU has failed to access page table\n");
+               ptw_count++;
+               pr_crit("System MMU has failed to access page table, %d\n", ptw_count);
                pgtable = 0;
+
+               if (ptw_count > 3)
+                       panic("Unrecoverable System MMU PTW fault");
+
+               writel(0x1, drvdata->sfrbase + REG_INT_CLEAR);
+
+               return IRQ_HANDLED;
        }
 
        dump_sysmmu_status(drvdata, pgtable);
 
 finish:
        pr_crit("----------------------------------------------------------\n");
+
+       return 0;
 }
 
 static inline void __sysmmu_disable_nocount(struct sysmmu_drvdata *drvdata)