From patchwork Fri Nov 4 11:55:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 621660 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DFC9EC4332F for ; Fri, 4 Nov 2022 11:56:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230510AbiKDL4D (ORCPT ); Fri, 4 Nov 2022 07:56:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34492 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230035AbiKDLzb (ORCPT ); Fri, 4 Nov 2022 07:55:31 -0400 Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9A2FE23EB2 for ; Fri, 4 Nov 2022 04:55:27 -0700 (PDT) Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20221104115522euoutp028957dc20df2449a164021166115a711c~kX6SDtaMX0645406454euoutp02g for ; Fri, 4 Nov 2022 11:55:22 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20221104115522euoutp028957dc20df2449a164021166115a711c~kX6SDtaMX0645406454euoutp02g DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1667562922; bh=0bjJJ72NgE7HBes5ZZXZXgX6KwAQSmQyte75G2LW2ao=; h=From:To:Cc:Subject:Date:References:From; b=V1Os/pm3Y+9AIiBd8BHTD1gNuSRg4Nuth01nxWtVDDb7tI6IaMN0igoS5xpHFxXVC VWrMdtdmUeInTJzM51A0KYxk90oPmHYBgKA10/khxw4jG2rqEEySzYSBjQPKZGHe3k AWgM9nXJS/6/xIdRFSUZf1DXOT3VG42IV59S4zeM= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20221104115521eucas1p25ff86f7c12bec265f0e303a18bd36c10~kX6RmG-nk2214922149eucas1p2G; Fri, 4 Nov 2022 11:55:21 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id 0C.17.19378.9ADF4636; Fri, 4 Nov 2022 11:55:21 +0000 (GMT) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20221104115521eucas1p2ef149555574e8f6cbd1bb3df0bdbbb20~kX6RHZnjq2320023200eucas1p2D; Fri, 4 Nov 2022 11:55:21 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20221104115521eusmtrp11dc9d1562fae828dd5ce7f176c062310~kX6RGs-Aa0229402294eusmtrp1O; Fri, 4 Nov 2022 11:55:21 +0000 (GMT) X-AuditID: cbfec7f5-a4dff70000014bb2-0e-6364fda9091c Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id CB.D1.10862.9ADF4636; Fri, 4 Nov 2022 11:55:21 +0000 (GMT) Received: from AMDC2765.digital.local (unknown [106.120.51.73]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20221104115520eusmtip11fc5ba64fce5fac39d4bb74cd5217eee~kX6QlP4Sq2304223042eusmtip1Z; Fri, 4 Nov 2022 11:55:20 +0000 (GMT) From: Marek Szyprowski To: iommu@lists.linux.dev, linux-samsung-soc@vger.kernel.org Cc: Marek Szyprowski , Joerg Roedel , Will Deacon , Krzysztof Kozlowski , Alim Akhtar , Sam Protsenko Subject: [PATCH] iommu/exynos: Fix driver initialization sequence Date: Fri, 4 Nov 2022 12:55:11 +0100 Message-Id: <20221104115511.28256-1-m.szyprowski@samsung.com> X-Mailer: git-send-email 2.17.1 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrJIsWRmVeSWpSXmKPExsWy7djP87or/6YkGxy5oWnxYN42NotfXyws OmdvYLfY+3oru8WM8/uYLNYeuctu8bwPyGq5Y+rA4fHk4Dwmj02rOtk87lzbw+bxYvNMRo++ LasYPT5vkgtgi+KySUnNySxLLdK3S+DKePT4MHPBMp6KFR8nMTcwruXqYuTkkBAwkTg5rZGt i5GLQ0hgBaPEsuVrmCGcL4wSDw8cg8p8ZpRobFrABNPycdkHRojEckaJLduesIAkwFo+XlQA sdkEDCW63naxgdgiAjYSV04tAZvELPCXUeLapTmsIAlhAUeJi/P+s4PYLAKqEsumzmYGsXkF bCU+/t/EDrFNXmL1hgPMEHYvh8T+u6ldjBxAtovEq4eJEGFhiVfHt0CVy0icntzDArJLQqCd UWLB7/tMEM4ERomG57cYIaqsJe6c+8UGMohZQFNi/S59iLCjRMe8vewQ8/kkbrwVBAkzA5mT tk1nhgjzSnS0CUFUq0nMOr4Obu3BC5egrvSQaO48yAoJkliJf00H2Scwys1C2LWAkXEVo3hq aXFuemqxcV5quV5xYm5xaV66XnJ+7iZGYGo4/e/41x2MK1591DvEyMTBeIhRgoNZSYT307bk ZCHelMTKqtSi/Pii0pzU4kOM0hwsSuK8bDO0koUE0hNLUrNTUwtSi2CyTBycUg1MXOtifr1K dZhtln29/nHcsecxzZuEW6LPPOdd9WbFOw1v9ehv2Rd73RWqbPwv/2rNjFN48Unz6qLFj1UU V8T/vKLy7ORF+zCpY8IneeawVbNcl7r0Su9E1frvnd8jpMy0zfqnmwkcOZs27Xdyqu9vrRL2 aUcPrVhoHfpQJjul8/uMbhEl1Sk8ZVxmxV/tdKwXzXktvDY5aP1z33C22VF6Hv5mZzn+Lend purc/+O/utDF0CkLNEJNpknxxVSdlbshXfM66GxF9uHZA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xINtZiLihMB7q0w8tQCAAA= X-CMS-MailID: 20221104115521eucas1p2ef149555574e8f6cbd1bb3df0bdbbb20 X-Msg-Generator: CA X-RootMTR: 20221104115521eucas1p2ef149555574e8f6cbd1bb3df0bdbbb20 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20221104115521eucas1p2ef149555574e8f6cbd1bb3df0bdbbb20 References: Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org Registering SYSMMU platform driver might directly trigger initializing IOMMU domains and performing initial mappings. That time all common resources for the SYSMMU driver must be already allocated, so move platform driver registration to the end of exynos_iommu_init() function. Signed-off-by: Marek Szyprowski Acked-by: Krzysztof Kozlowski --- drivers/iommu/exynos-iommu.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/iommu/exynos-iommu.c b/drivers/iommu/exynos-iommu.c index 45fd4850bacb..85a6a775aea5 100644 --- a/drivers/iommu/exynos-iommu.c +++ b/drivers/iommu/exynos-iommu.c @@ -1432,12 +1432,6 @@ static int __init exynos_iommu_init(void) return -ENOMEM; } - ret = platform_driver_register(&exynos_sysmmu_driver); - if (ret) { - pr_err("%s: Failed to register driver\n", __func__); - goto err_reg_driver; - } - zero_lv2_table = kmem_cache_zalloc(lv2table_kmem_cache, GFP_KERNEL); if (zero_lv2_table == NULL) { pr_err("%s: Failed to allocate zero level2 page table\n", @@ -1446,10 +1440,16 @@ static int __init exynos_iommu_init(void) goto err_zero_lv2; } + ret = platform_driver_register(&exynos_sysmmu_driver); + if (ret) { + pr_err("%s: Failed to register driver\n", __func__); + goto err_reg_driver; + } + return 0; -err_zero_lv2: - platform_driver_unregister(&exynos_sysmmu_driver); err_reg_driver: + platform_driver_unregister(&exynos_sysmmu_driver); +err_zero_lv2: kmem_cache_destroy(lv2table_kmem_cache); return ret; }