[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1569854031-237636-3-git-send-email-john.garry@huawei.com>
Date: Mon, 30 Sep 2019 22:33:47 +0800
From: John Garry <john.garry@...wei.com>
To: <lorenzo.pieralisi@....com>, <guohanjun@...wei.com>,
<sudeep.holla@....com>, <robin.murphy@....com>,
<mark.rutland@....com>, <will@...nel.org>
CC: <shameerali.kolothum.thodi@...wei.com>,
<linux-arm-kernel@...ts.infradead.org>,
<linux-kernel@...r.kernel.org>, <iommu@...ts.linux-foundation.org>,
<rjw@...ysocki.net>, <lenb@...nel.org>, <nleeder@...eaurora.org>,
<linuxarm@...wei.com>, John Garry <john.garry@...wei.com>
Subject: [RFC PATCH 2/6] iommu/arm-smmu-v3: Record IIDR in arm_smmu_device structure
To allow other devices know the SMMU HW IIDR, record the IIDR contents as
the first member of the arm_smmu_device structure.
In storing as the first member, it saves exposing SMMU APIs, which are
nicely self-contained today.
Signed-off-by: John Garry <john.garry@...wei.com>
---
drivers/iommu/arm-smmu-v3.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/iommu/arm-smmu-v3.c b/drivers/iommu/arm-smmu-v3.c
index 40f4757096c3..1ed3ef0f1ec3 100644
--- a/drivers/iommu/arm-smmu-v3.c
+++ b/drivers/iommu/arm-smmu-v3.c
@@ -70,6 +70,8 @@
#define IDR1_SSIDSIZE GENMASK(10, 6)
#define IDR1_SIDSIZE GENMASK(5, 0)
+#define ARM_SMMU_IIDR 0x18
+
#define ARM_SMMU_IDR5 0x14
#define IDR5_STALL_MAX GENMASK(31, 16)
#define IDR5_GRAN64K (1 << 6)
@@ -546,6 +548,7 @@ struct arm_smmu_strtab_cfg {
/* An SMMUv3 instance */
struct arm_smmu_device {
+ u32 iidr; /* must be first member */
struct device *dev;
void __iomem *base;
@@ -3153,6 +3156,8 @@ static int arm_smmu_device_probe(struct platform_device *pdev)
iommu_device_set_ops(&smmu->iommu, &arm_smmu_ops);
iommu_device_set_fwnode(&smmu->iommu, dev->fwnode);
+ smmu->iidr = readl(smmu->base + ARM_SMMU_IIDR);
+
ret = iommu_device_register(&smmu->iommu);
if (ret) {
dev_err(dev, "Failed to register iommu\n");
--
2.17.1
Powered by blists - more mailing lists