[COMMON] iommu/exynos: implement API to show status
authorJanghyuck Kim <janghyuck.kim@samsung.com>
Thu, 8 Dec 2016 02:23:31 +0000 (11:23 +0900)
committerSangwook Ju <sw.ju@samsung.com>
Mon, 14 May 2018 10:45:20 +0000 (19:45 +0900)
exynos_sysmmu_show_status() provides information of sysmmu status.

Change-Id: Ia448f085acd3b7d605941481f7799899940420f3
Signed-off-by: Janghyuck Kim <janghyuck.kim@samsung.com>
drivers/iommu/exynos-iommu.c

index b4cabf54492be4b377cd1fe4bd95c5254abe1be1..230d2a9630cd48453a075a9e453fbb1ece21c853 100644 (file)
@@ -1547,10 +1547,37 @@ static struct iommu_ops exynos_iommu_ops = {
        .of_xlate = exynos_iommu_of_xlate,
 };
 
-void exynos_sysmmu_show_status(struct device *dev)
+void exynos_sysmmu_show_status(struct device *master)
 {
-       /* DUMMY */
-       dev_info(dev, "Called sysmmu show status\n");
+       struct exynos_iommu_owner *owner;
+       struct sysmmu_list_data *list;
+
+       if (!has_sysmmu(master)) {
+               dev_err(master, "has no sysmmu!\n");
+               return;
+       }
+
+       owner = master->archdata.iommu;
+       list_for_each_entry(list, &owner->sysmmu_list, node) {
+               unsigned long flags;
+               struct sysmmu_drvdata *drvdata;
+
+               drvdata = dev_get_drvdata(list->sysmmu);
+
+               spin_lock_irqsave(&drvdata->lock, flags);
+               if (!is_sysmmu_active(drvdata) ||
+                               !is_sysmmu_runtime_active(drvdata)) {
+                       dev_info(drvdata->sysmmu,
+                               "%s: SysMMU is not active\n", __func__);
+                       spin_unlock_irqrestore(&drvdata->lock, flags);
+                       continue;
+               }
+
+               dev_info(drvdata->sysmmu, "Dumping status.\n");
+               dump_sysmmu_status(drvdata->sfrbase);
+
+               spin_unlock_irqrestore(&drvdata->lock, flags);
+       }
 }
 
 static int sysmmu_fault_notifier(struct notifier_block *nb,