From: "Sricharan" <sricharan@codeaurora.org>
To: 'Robin Murphy' <robin.murphy@arm.com>,
'Marek Szyprowski' <m.szyprowski@samsung.com>,
iommu@lists.linux-foundation.org,
linux-samsung-soc@vger.kernel.org
Cc: 'Krzysztof Kozlowski' <krzk@kernel.org>,
'Bartlomiej Zolnierkiewicz' <b.zolnierkie@samsung.com>
Subject: RE: [PATCH v2 3/4] iommu/exynos: Ensure that SYSMMU is added only once to its master device
Date: Tue, 10 Jan 2017 10:04:19 +0530 [thread overview]
Message-ID: <000c01d26afa$d2a6a2f0$77f3e8d0$@codeaurora.org> (raw)
In-Reply-To: <fc7e0a6e-e65b-2a58-4c19-5bc31e36363c@arm.com>
Hi,
>Hi Marek,
>
>On 09/01/17 12:03, Marek Szyprowski wrote:
>> This patch prepares Exynos IOMMU driver for deferred probing
>> support. Once it gets added, of_xlate() callback might be called
>> more than once for the same SYSMMU controller and master device
>> (for example it happens when masters device driver fails with
>> EPROBE_DEFER). This patch adds a check, which ensures that SYSMMU
>> controller is added to its master device (owner) only once.
>
>FWIW, I think it would be better to address that issue in the
>probe-deferral code itself, rather than fixing up individual IOMMU
>drivers. In fact, I *think* it's already covered in the latest version
>of the of_iommu_configure() changes[1], specifically this bit:
>
> ...
> if (fwspec) {
> if (fwspec->ops)
> return fwspec->ops;
> ...
>
>Which should ensure that a successful IOMMU configuration happens
>exactly once between device creation and destruction.
>
>That said, this patch would still add robustness against actual error
>conditions, e.g. an erroneous DT which managed to specify the same
>phandle twice, although making it "if (WARN_ON(entry == data))" might be
>a good idea.
>
Yes, the latest version has the above mentioned fix of just returning back
from of_iommu_configure, if already configured. But anyways since this
patch is doing the check in xlate, which still can be called multiple times
even without deferring, incase of say multiple sids as well. But i
remember that sometime back Marek mentioned that the exynos
iommu currently always has "#iommu-cells = <0>" , but this patch might
be required if that changes as well.
Regards,
Sricharan
>Robin.
>
>[1]:https://www.mail-archive.com/iommu@lists.linux-foundation.org/msg15333.html
>
>> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
>> ---
>> drivers/iommu/exynos-iommu.c | 6 +++++-
>> 1 file changed, 5 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/iommu/exynos-iommu.c b/drivers/iommu/exynos-iommu.c
>> index b0d537e6a445..8bf5a06a6c01 100644
>> --- a/drivers/iommu/exynos-iommu.c
>> +++ b/drivers/iommu/exynos-iommu.c
>> @@ -1253,7 +1253,7 @@ static int exynos_iommu_of_xlate(struct device *dev,
>> {
>> struct exynos_iommu_owner *owner = dev->archdata.iommu;
>> struct platform_device *sysmmu = of_find_device_by_node(spec->np);
>> - struct sysmmu_drvdata *data;
>> + struct sysmmu_drvdata *data, *entry;
>>
>> if (!sysmmu)
>> return -ENODEV;
>> @@ -1272,6 +1272,10 @@ static int exynos_iommu_of_xlate(struct device *dev,
>> dev->archdata.iommu = owner;
>> }
>>
>> + list_for_each_entry(entry, &owner->controllers, owner_node)
>> + if (entry == data)
>> + return 0;
>> +
>> list_add_tail(&data->owner_node, &owner->controllers);
>> data->master = dev;
>>
>>
>
>_______________________________________________
>iommu mailing list
>iommu@lists.linux-foundation.org
>https://lists.linuxfoundation.org/mailman/listinfo/iommu
next prev parent reply other threads:[~2017-01-10 4:34 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20170109120410eucas1p2caf69260dc125da0d9651321eadd03ca@eucas1p2.samsung.com>
2017-01-09 12:03 ` [PATCH v2 0/4] Fixes for Exynos IOMMU driver Marek Szyprowski
[not found] ` <CGME20170109120411eucas1p1fddd9c346093e918337dedf9a9a7739e@eucas1p1.samsung.com>
[not found] ` <1483963436-29803-1-git-send-email-m.szyprowski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2017-01-09 12:03 ` [PATCH v2 1/4] iommu/exynos: Improve page fault debug message Marek Szyprowski
2017-01-09 12:03 ` [PATCH v2 2/4] iommu/exynos: Fix warnings from DMA-debug Marek Szyprowski
2017-01-09 12:03 ` [PATCH v2 3/4] iommu/exynos: Ensure that SYSMMU is added only once to its master device Marek Szyprowski
[not found] ` <1483963436-29803-4-git-send-email-m.szyprowski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2017-01-09 14:30 ` Robin Murphy
2017-01-10 4:34 ` Sricharan [this message]
2017-01-09 12:03 ` [PATCH v2 4/4] iommu/exynos: Properly release device from the default domain in ->remove Marek Szyprowski
2017-01-10 14:01 ` [PATCH v2 0/4] Fixes for Exynos IOMMU driver Joerg Roedel
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='000c01d26afa$d2a6a2f0$77f3e8d0$@codeaurora.org' \
--to=sricharan@codeaurora.org \
--cc=b.zolnierkie@samsung.com \
--cc=iommu@lists.linux-foundation.org \
--cc=krzk@kernel.org \
--cc=linux-samsung-soc@vger.kernel.org \
--cc=m.szyprowski@samsung.com \
--cc=robin.murphy@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