From: Zhen Lei <thunder.leizhen@huawei.com>
To: Catalin Marinas <catalin.marinas@arm.com>,
Will Deacon <will.deacon@arm.com>, Joerg Roedel <joro@8bytes.org>,
linux-arm-kernel <linux-arm-kernel@lists.infradead.org>,
iommu <iommu@lists.linux-foundation.org>,
Robin Murphy <robin.murphy@arm.com>,
Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
linux-kernel <linux-kernel@vger.kernel.org>
Cc: Zefan Li <lizefan@huawei.com>, Xinwei Hu <huxinwei@huawei.com>,
"Tianhong Ding" <dingtianhong@huawei.com>,
Hanjun Guo <guohanjun@huawei.com>,
Zhen Lei <thunder.leizhen@huawei.com>
Subject: [PATCH v4 4/5] iommu/arm-smmu: to backward compatible with probe non-deferral
Date: Thu, 15 Oct 2015 16:30:46 +0800 [thread overview]
Message-ID: <1444897847-18040-5-git-send-email-thunder.leizhen@huawei.com> (raw)
In-Reply-To: <1444897847-18040-1-git-send-email-thunder.leizhen@huawei.com>
This patch eliminate the strong dependence on Laurent's series(to support
probe deferral). That means, no matter whether Laurent's series upstreamed
or not, the smmu-v3 driver will always work well.
Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
---
drivers/iommu/arm-smmu-v3.c | 20 ++++++++++++++++++--
1 file changed, 18 insertions(+), 2 deletions(-)
diff --git a/drivers/iommu/arm-smmu-v3.c b/drivers/iommu/arm-smmu-v3.c
index 021a846..66052e9 100644
--- a/drivers/iommu/arm-smmu-v3.c
+++ b/drivers/iommu/arm-smmu-v3.c
@@ -1857,6 +1857,12 @@ static int arm_smmu_add_device(struct device *dev)
struct pci_dev *pdev;
struct device *root;
+ if (dev->archdata.iommu == ERR_PTR(-EPROBE_DEFER)) {
+ dev->archdata.iommu = NULL;
+
+ return of_iommu_configure(dev, dev->of_node) ? 0 : -ENODEV;
+ }
+
/* only support pci devices hotplug */
if (!dev_is_pci(dev))
return -ENODEV;
@@ -1930,6 +1936,11 @@ static int arm_smmu_of_xlate(struct device *dev, struct of_phandle_args *args)
return -EINVAL;
smmu = platform_get_drvdata(pdev);
+ if (!smmu) {
+ dev->archdata.iommu = ERR_PTR(-EPROBE_DEFER);
+
+ return -EPROBE_DEFER;
+ }
if (!dev->archdata.iommu)
dev->archdata.iommu = smmu;
@@ -2768,7 +2779,6 @@ static int arm_smmu_device_dt_probe(struct platform_device *pdev)
/* Record our private device structure */
platform_set_drvdata(pdev, smmu);
- of_iommu_set_ops(smmu->dev->of_node, &arm_smmu_ops);
/* Reset the device */
ret = arm_smmu_device_reset(smmu);
@@ -2840,7 +2850,13 @@ static void __exit arm_smmu_exit(void)
subsys_initcall(arm_smmu_init);
module_exit(arm_smmu_exit);
-IOMMU_OF_DECLARE(arm_smmu_v3, "arm,smmu-v3", NULL);
+static int arm_smmu_of_iommu_init(struct device_node *np)
+{
+ of_iommu_set_ops(np, &arm_smmu_ops);
+
+ return 0;
+}
+IOMMU_OF_DECLARE(arm_smmu_v3, "arm,smmu-v3", arm_smmu_of_iommu_init);
MODULE_DESCRIPTION("IOMMU API for ARM architected SMMUv3 implementations");
MODULE_AUTHOR("Will Deacon <will.deacon@arm.com>");
--
2.5.0
next prev parent reply other threads:[~2015-10-15 8:36 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-15 8:30 [PATCH v4 0/5] iommu/arm-smmu: add support for non-pci devices Zhen Lei
2015-10-15 8:30 ` [PATCH v4 1/5] iommu/arm-smmu: to support probe deferral Zhen Lei
2015-10-15 8:30 ` [PATCH v4 2/5] iommu/arm-smmu: rename __arm_smmu_get_pci_sid Zhen Lei
2015-10-15 8:30 ` [PATCH v4 3/5] iommu/arm-smmu: add support for non-pci devices Zhen Lei
2015-10-15 8:30 ` Zhen Lei [this message]
2015-10-15 8:30 ` [PATCH v4 5/5] iommu/arm-smmu: describe the limitation of #iommu-cells Zhen Lei
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1444897847-18040-5-git-send-email-thunder.leizhen@huawei.com \
--to=thunder.leizhen@huawei.com \
--cc=catalin.marinas@arm.com \
--cc=dingtianhong@huawei.com \
--cc=guohanjun@huawei.com \
--cc=huxinwei@huawei.com \
--cc=iommu@lists.linux-foundation.org \
--cc=joro@8bytes.org \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lizefan@huawei.com \
--cc=robin.murphy@arm.com \
--cc=will.deacon@arm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®