From patchwork Mon Apr 25 15:58:14 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sricharan Ramabadhran X-Patchwork-Id: 8930341 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 95610BF29F for ; Mon, 25 Apr 2016 16:02:45 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id BE193201C7 for ; Mon, 25 Apr 2016 16:02:44 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E345120165 for ; Mon, 25 Apr 2016 16:02:43 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1auiwm-0001P5-Ep; Mon, 25 Apr 2016 16:01:16 +0000 Received: from smtp.codeaurora.org ([198.145.29.96]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1auiuk-0005G5-Jr for linux-arm-kernel@lists.infradead.org; Mon, 25 Apr 2016 15:59:11 +0000 Received: from smtp.codeaurora.org (localhost [127.0.0.1]) by smtp.codeaurora.org (Postfix) with ESMTP id 27C336120A; Mon, 25 Apr 2016 15:58:52 +0000 (UTC) Received: by smtp.codeaurora.org (Postfix, from userid 1000) id EFC5861305; Mon, 25 Apr 2016 15:58:51 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from blr-ubuntu-32.ap.qualcomm.com (unknown [202.46.23.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: sricharan@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id BF9C8612F0; Mon, 25 Apr 2016 15:58:48 +0000 (UTC) From: Sricharan R To: will.deacon@arm.com, robin.murphy@arm.com, joro@8bytes.org, iommu@lists.linux-foundation.org, linux-arm-kernel@lists.infradead.org, laurent.pinchart@ideasonboard.com Subject: [RFC 9/9] drivers: iommu: arm-smmu: Set iommu_ops in probe Date: Mon, 25 Apr 2016 21:28:14 +0530 Message-Id: <1461599894-1969-10-git-send-email-sricharan@codeaurora.org> X-Mailer: git-send-email 1.8.2.1 In-Reply-To: <1461599894-1969-1-git-send-email-sricharan@codeaurora.org> References: <1461599894-1969-1-git-send-email-sricharan@codeaurora.org> X-Virus-Scanned: ClamAV using ClamSMTP X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160425_085910_794156_224D2338 X-CRM114-Status: GOOD ( 15.06 ) X-Spam-Score: -2.9 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: sricharan@codeaurora.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP iommu_ops should be set after the iommu is probed. This ensures that the iommu is really ready when master's iommu ops are set during their probe or else deferred. Signed-off-by: Sricharan R --- drivers/iommu/arm-smmu.c | 34 ++-------------------------------- 1 file changed, 2 insertions(+), 32 deletions(-) diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c index 2d65de4..f103d35 100644 --- a/drivers/iommu/arm-smmu.c +++ b/drivers/iommu/arm-smmu.c @@ -1919,6 +1919,7 @@ static int arm_smmu_device_dt_probe(struct platform_device *pdev) if (of_property_read_bool(dev->of_node, "mmu-masters")) arm_smmu_probe_mmu_masters(smmu); arm_smmu_device_reset(smmu); + of_iommu_set_ops(dev->of_node, &arm_smmu_ops); return 0; out_free_irqs: @@ -1957,24 +1958,13 @@ static struct platform_driver arm_smmu_driver = { .remove = arm_smmu_device_remove, }; -static int __init arm_smmu_init(void) +static int __init arm_smmu_of_init(struct device_node *np) { - struct device_node *np; static bool done; int ret; if (done) return 0; - /* - * Play nice with systems that don't have an ARM SMMU by checking that - * an ARM SMMU exists in the system before proceeding with the driver - * and IOMMU bus operation registration. - */ - np = of_find_matching_node(NULL, arm_smmu_of_match); - if (!np) - return 0; - - of_node_put(np); ret = platform_driver_register(&arm_smmu_driver); if (ret) @@ -2002,28 +1992,8 @@ static void __exit arm_smmu_exit(void) { return platform_driver_unregister(&arm_smmu_driver); } - -subsys_initcall(arm_smmu_init); module_exit(arm_smmu_exit); -static int __init arm_smmu_of_init(struct device_node *np) -{ - struct arm_smmu_device *smmu; - struct platform_device *pdev; - int ret = arm_smmu_init(); - - if (ret) - return ret; - - pdev = of_platform_device_create(np, NULL, platform_bus_type.dev_root); - if (!pdev) - return -ENODEV; - - smmu = platform_get_drvdata(pdev); - of_iommu_set_ops(np, &arm_smmu_ops); - - return 0; -} IOMMU_OF_DECLARE(arm_smmuv1, "arm,smmu-v1", arm_smmu_of_init); IOMMU_OF_DECLARE(arm_smmuv2, "arm,smmu-v2", arm_smmu_of_init); IOMMU_OF_DECLARE(arm_mmu400, "arm,mmu-400", arm_smmu_of_init);