From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932922AbdAIILg (ORCPT ); Mon, 9 Jan 2017 03:11:36 -0500 Received: from mailout1.w1.samsung.com ([210.118.77.11]:62714 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932227AbdAIILf (ORCPT ); Mon, 9 Jan 2017 03:11:35 -0500 X-AuditID: cbfec7f2-f790f6d000002555-71-587345b35dd9 Subject: Re: [PATCH] iommu: Drop the of_iommu_{set/get}_ops() interface To: Lorenzo Pieralisi , iommu@lists.linux-foundation.org Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Matthias Brugger , Will Deacon , Robin Murphy , Joerg Roedel From: Marek Szyprowski Message-id: Date: Mon, 09 Jan 2017 09:11:28 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.6.0 MIME-version: 1.0 In-reply-to: <20170103173456.18154-1-lorenzo.pieralisi@arm.com> Content-type: text/plain; charset=utf-8; format=flowed Content-transfer-encoding: 7bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprCKsWRmVeSWpSXmKPExsWy7djP87qbXYsjDM708Vgs2G9t0Tl7A7vF psfXWC0u75rDZvHm9wt2i6YWY4uDH56wWrz8eILFgcPjycF5TB5r5q1h9Ng56y67x+Yl9R6T byxn9Pi8SS6ALYrLJiU1J7MstUjfLoErY822PUwFy1Ur2ju5Ghh3yHUxcnJICJhIrNp3lgXC FpO4cG89WxcjF4eQwFJGiTP3j7BAOJ8ZJSac288M07F80TZ2EFtIYBmjxMX3GhBFz4GKOl4C FXFwCAu4S3zalAhSIyIQKrG05woTSA2zwH1GiaNHe5hAEmwChhJdb7vYQGxeATuJww+nsILY LAKqEqfa34ItEBWIkWg49ZMdokZQ4sfkeywg8zkF7CXa7lqChJkFrCSe/WtlhbDlJTaveQt1 5yZ2iTM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UfYhTgYFTi4Z3gVRQhxJpYVlyZe4hRgoNZ SYS32Lo4Qog3JbGyKrUoP76oNCe1+BCjKdAPE5mlRJPzgUkgryTe0MTQ3NLQyNjCwtzISEmc d+qHK+FCAumJJanZqakFqUUwfUwcnFINjIefMTAdLm7e8jcpqPgso8s3cVXxpjbOI6UVVY7X evb5mmX+5GR/sHz+5Z85j574fIjc/cPyfueR9xevXvMwSBNft2pi6bLrc47vW+Smf3PJwti+ jA6m7QxJdnr3FJwsanuSWe78+q62lbNBY5fJ8UsxTfNexLjpl53uNZabt7aRc+5JZa4dl5RY ijMSDbWYi4oTAVBg6NnKAgAA X-MTR: 20000000000000000@CPGS X-CMS-MailID: 20170109081130eucas1p1f728fda323de8d1cc59aa3455ac2570a X-Msg-Generator: CA X-Sender-IP: 182.198.249.180 X-Local-Sender: =?UTF-8?B?TWFyZWsgU3p5cHJvd3NraRtTUlBPTC1LZXJuZWwgKFRQKRs=?= =?UTF-8?B?7IK87ISx7KCE7J6QG1NlbmlvciBTb2Z0d2FyZSBFbmdpbmVlcg==?= X-Global-Sender: =?UTF-8?B?TWFyZWsgU3p5cHJvd3NraRtTUlBPTC1LZXJuZWwgKFRQKRtT?= =?UTF-8?B?YW1zdW5nIEVsZWN0cm9uaWNzG1NlbmlvciBTb2Z0d2FyZSBFbmdpbmVlcg==?= X-Sender-Code: =?UTF-8?B?QzEwG0VIURtDMTBDRDAyQ0QwMjczOTI=?= CMS-TYPE: 201P X-HopCount: 7 X-CMS-RootMailID: 20170103173514epcas4p42d343054cc7117c7299ca7bfad0015af X-RootMTR: 20170103173514epcas4p42d343054cc7117c7299ca7bfad0015af References: <20170103173456.18154-1-lorenzo.pieralisi@arm.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Lorenzo, On 2017-01-03 18:34, Lorenzo Pieralisi wrote: > With the introduction of the new iommu_{register/get}_instance() > interface in commit e4f10ffe4c9b ("iommu: Make of_iommu_set/get_ops() DT > agnostic") (based on struct fwnode_handle as look-up token, so firmware > agnostic) to register IOMMU instances with the core IOMMU layer there is > no reason to keep the old OF based interface around any longer. > > Convert all the IOMMU drivers (and OF IOMMU core code) that rely on the > of_iommu_{set/get}_ops() to the new kernel interface to register/retrieve > IOMMU instances and remove the of_iommu_{set/get}_ops() remaining glue > code in order to complete the interface rework. > > Signed-off-by: Lorenzo Pieralisi > Cc: Matthias Brugger > Cc: Will Deacon > Cc: Robin Murphy > Cc: Joerg Roedel > Cc: Marek Szyprowski > --- > Exynos, msm and mtk code compile tested only owing to lack of > test platforms, I would appreciate some help in testing this > patch on those platforms before merging it even if it is just > a simple interface conversion. Tested-by: Marek Szyprowski > > Thanks, > Lorenzo > > drivers/iommu/exynos-iommu.c | 2 +- > drivers/iommu/msm_iommu.c | 2 +- > drivers/iommu/mtk_iommu.c | 2 +- > drivers/iommu/of_iommu.c | 4 ++-- > include/linux/of_iommu.h | 11 ----------- > 5 files changed, 5 insertions(+), 16 deletions(-) > > diff --git a/drivers/iommu/exynos-iommu.c b/drivers/iommu/exynos-iommu.c > index 57ba0d3..b79e4c4 100644 > --- a/drivers/iommu/exynos-iommu.c > +++ b/drivers/iommu/exynos-iommu.c > @@ -628,7 +628,7 @@ static int __init exynos_sysmmu_probe(struct platform_device *pdev) > > pm_runtime_enable(dev); > > - of_iommu_set_ops(dev->of_node, &exynos_iommu_ops); > + iommu_register_instance(dev->fwnode, &exynos_iommu_ops); > > return 0; > } > diff --git a/drivers/iommu/msm_iommu.c b/drivers/iommu/msm_iommu.c > index b09692b..9cd3cee 100644 > --- a/drivers/iommu/msm_iommu.c > +++ b/drivers/iommu/msm_iommu.c > @@ -737,7 +737,7 @@ static int msm_iommu_probe(struct platform_device *pdev) > } > > list_add(&iommu->dev_node, &qcom_iommu_devices); > - of_iommu_set_ops(pdev->dev.of_node, &msm_iommu_ops); > + iommu_register_instance(pdev->dev.fwnode, &msm_iommu_ops); > > pr_info("device mapped at %p, irq %d with %d ctx banks\n", > iommu->base, iommu->irq, iommu->ncb); > diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c > index 1479c76..0596ab2 100644 > --- a/drivers/iommu/mtk_iommu.c > +++ b/drivers/iommu/mtk_iommu.c > @@ -655,7 +655,7 @@ static int mtk_iommu_init_fn(struct device_node *np) > return ret; > } > > - of_iommu_set_ops(np, &mtk_iommu_ops); > + iommu_register_instance(&np->fwnode, &mtk_iommu_ops); > return 0; > } > > diff --git a/drivers/iommu/of_iommu.c b/drivers/iommu/of_iommu.c > index 0f57ddc..d7f480a 100644 > --- a/drivers/iommu/of_iommu.c > +++ b/drivers/iommu/of_iommu.c > @@ -127,7 +127,7 @@ static const struct iommu_ops > "iommu-map-mask", &iommu_spec.np, iommu_spec.args)) > return NULL; > > - ops = of_iommu_get_ops(iommu_spec.np); > + ops = iommu_get_instance(&iommu_spec.np->fwnode); > if (!ops || !ops->of_xlate || > iommu_fwspec_init(&pdev->dev, &iommu_spec.np->fwnode, ops) || > ops->of_xlate(&pdev->dev, &iommu_spec)) > @@ -157,7 +157,7 @@ const struct iommu_ops *of_iommu_configure(struct device *dev, > "#iommu-cells", idx, > &iommu_spec)) { > np = iommu_spec.np; > - ops = of_iommu_get_ops(np); > + ops = iommu_get_instance(&np->fwnode); > > if (!ops || !ops->of_xlate || > iommu_fwspec_init(dev, &np->fwnode, ops) || > diff --git a/include/linux/of_iommu.h b/include/linux/of_iommu.h > index 6a7fc50..13394ac 100644 > --- a/include/linux/of_iommu.h > +++ b/include/linux/of_iommu.h > @@ -31,17 +31,6 @@ static inline const struct iommu_ops *of_iommu_configure(struct device *dev, > > #endif /* CONFIG_OF_IOMMU */ > > -static inline void of_iommu_set_ops(struct device_node *np, > - const struct iommu_ops *ops) > -{ > - iommu_register_instance(&np->fwnode, ops); > -} > - > -static inline const struct iommu_ops *of_iommu_get_ops(struct device_node *np) > -{ > - return iommu_get_instance(&np->fwnode); > -} > - > extern struct of_device_id __iommu_of_table; > > typedef int (*of_iommu_init_fn)(struct device_node *); Best regards -- Marek Szyprowski, PhD Samsung R&D Institute Poland