[COMMON] g2d: add System MMU fault handler
authorCho KyongHo <pullip.cho@samsung.com>
Mon, 8 May 2017 04:36:09 +0000 (13:36 +0900)
committerSeungchul Kim <sc377.kim@samsung.com>
Mon, 28 May 2018 05:27:17 +0000 (14:27 +0900)
System MMU fault handler is registers to show the status of H/W and
the driver when unexpected fault is occurred in System MMU for
debugging purpose..

Change-Id: Ibe58a3a8f1b7e90c1a41875be20a18708075c5ad
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
drivers/gpu/exynos/g2d/g2d_drv.c

index 9a5261f8c0ad6131ab6d4961e829a5a18c3f26f9..cceafb50ede9e155587b8d7babf7c65b303db492 100644 (file)
@@ -150,6 +150,20 @@ static irqreturn_t g2d_irq_handler(int irq, void *priv)
        return IRQ_HANDLED;
 }
 
+#ifdef CONFIG_EXYNOS_IOVMM
+static int g2d_iommu_fault_handler(struct iommu_domain *domain,
+                               struct device *dev, unsigned long fault_addr,
+                               int fault_flags, void *token)
+{
+       struct g2d_device *g2d_dev = token;
+       int job_id = g2d_hw_get_current_task(g2d_dev);
+
+       g2d_dump_task(g2d_dev, job_id);
+
+       return 0;
+}
+#endif
+
 static __u32 get_hw_version(struct g2d_device *g2d_dev, __u32 *version)
 {
        int ret;
@@ -320,6 +334,8 @@ static int g2d_probe(struct platform_device *pdev)
                return PTR_ERR(g2d_dev->clock);
        }
 
+       iovmm_set_fault_handler(&pdev->dev, g2d_iommu_fault_handler, g2d_dev);
+
        ret = iovmm_activate(&pdev->dev);
        if (ret < 0) {
                dev_err(&pdev->dev, "Failed to activate iommu\n");