[PATCH] iommu: debug tegra-smmu

From: Nicolin Chen
Date: Fri Feb 05 2021 - 04:41:07 EST


Signed-off-by: Nicolin Chen <nicoleotsuka@xxxxxxxxx>
---
drivers/iommu/tegra-smmu.c | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/drivers/iommu/tegra-smmu.c b/drivers/iommu/tegra-smmu.c
index 4a3f095a1c26..796b7df54b8f 100644
--- a/drivers/iommu/tegra-smmu.c
+++ b/drivers/iommu/tegra-smmu.c
@@ -363,6 +363,7 @@ static void tegra_smmu_enable(struct tegra_smmu *smmu, unsigned int swgroup,
value |= SMMU_ASID_VALUE(asid);
value |= SMMU_ASID_ENABLE;
smmu_writel(smmu, value, group->reg);
+ pr_alert("--------%s, swgroup %d: writing %x to reg1 %x\n", __func__, swgroup, value, group->reg);
} else {
pr_warn("%s group from swgroup %u not found\n", __func__,
swgroup);
@@ -379,6 +380,7 @@ static void tegra_smmu_enable(struct tegra_smmu *smmu, unsigned int swgroup,
value = smmu_readl(smmu, client->smmu.reg);
value |= BIT(client->smmu.bit);
smmu_writel(smmu, value, client->smmu.reg);
+ pr_alert("--------%s, swgroup %d: writing %x to reg2 %x\n", __func__, swgroup, value, client->smmu.reg);
}
}

@@ -491,13 +493,19 @@ static int tegra_smmu_attach_dev(struct iommu_domain *domain,
unsigned int index;
int err;

+ dev_alert(dev, "-------%s: smmu %s\n", __func__, smmu ? "valid" : "NULL");
+ dump_stack();
if (!fwspec)
return -ENOENT;

+ dev_alert(dev, "-------%s: fwspec->num_ids %d\n", __func__, fwspec->num_ids);
for (index = 0; index < fwspec->num_ids; index++) {
err = tegra_smmu_as_prepare(smmu, as);
- if (err)
+ if (err) {
+ dev_err(dev, "failed to prepare as(%d) for fwspec %d",
+ as->id, fwspec->ids[index]);
goto disable;
+ }

tegra_smmu_enable(smmu, fwspec->ids[index], as->id);
}
@@ -805,6 +813,8 @@ static struct iommu_device *tegra_smmu_probe_device(struct device *dev)
if (!smmu)
return ERR_PTR(-ENODEV);

+ dev_alert(dev, "--------%s, %d\n", __func__, __LINE__);
+ dump_stack();
return &smmu->iommu;
}

@@ -904,6 +914,8 @@ static int tegra_smmu_of_xlate(struct device *dev,

dev_iommu_priv_set(dev, mc->smmu);

+ dev_alert(dev, "-------%s: id %d", __func__, id);
+ dump_stack();
return iommu_fwspec_add_ids(dev, &id, 1);
}

--
2.17.1


--EVF5PPMfhYS0aIcm--