From: Marek Szyprowski <m.szyprowski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
To: Joerg Roedel <joro-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>
Cc: Krzysztof Kozlowski
<k.kozlowski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>,
linux-samsung-soc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
Shaik Ameer Basha
<shaik.ameer-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>,
Inki Dae <inki.dae-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>,
iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org,
Javier Martinez Canillas
<javier-0uQlZySMnqxg9hUCZPvPmw@public.gmane.org>,
Cho KyongHo <pullip.cho-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
Subject: Re: [PATCH] iommu: Ignore -ENODEV errors from add_device call-back returning -ENODEV
Date: Mon, 29 Jun 2015 10:53:43 +0200 [thread overview]
Message-ID: <55910797.7090709@samsung.com> (raw)
In-Reply-To: <20150629083534.GG18569-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>
Hello,
On 2015-06-29 10:35, Joerg Roedel wrote:
> Hi Marek,
>
> On Thu, Jun 25, 2015 at 03:10:44PM +0200, Marek Szyprowski wrote:
>> + /* skip devices which doesn't have sysmmu controller */
>> if (!has_sysmmu(dev))
>> - return -ENODEV;
>> + return 0;
> Thanks for reporting this! But I think that the -ENODEV return value
> could be of use for the iommu core in the future. Can you please try the
> attached patch, which just ignores -ENODEV as a return value from
> add_device?
>
> >From 3c9e7507e93ff6c6e05e6ee2cb123b5d35d8c412 Mon Sep 17 00:00:00 2001
> From: Joerg Roedel <jroedel-l3A5Bk7waGM@public.gmane.org>
> Date: Mon, 29 Jun 2015 10:16:08 +0200
> Subject: [PATCH] iommu: Ignore -ENODEV errors from add_device call-back
>
> The -ENODEV error just means that the device is not
> translated by an IOMMU. We shouldn't bail out of iommu
> driver initialization when that happens, as this is a common
> scenario on ARM.
>
> No returning -ENODEV in the drivers would be a bad idea, as
> the IOMMU core would have no indication whether a device is
> translated or not. This information is not used at the
> moment, but will probably be in the future.
>
> Signed-off-by: Joerg Roedel <jroedel-l3A5Bk7waGM@public.gmane.org>
Works fine!
Tested-by: Marek Szyprowski <m.szyprowski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
> ---
> drivers/iommu/iommu.c | 13 ++++++++++++-
> 1 file changed, 12 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
> index 49e7542..f286090 100644
> --- a/drivers/iommu/iommu.c
> +++ b/drivers/iommu/iommu.c
> @@ -847,13 +847,24 @@ static int add_iommu_group(struct device *dev, void *data)
> {
> struct iommu_callback_data *cb = data;
> const struct iommu_ops *ops = cb->ops;
> + int ret;
>
> if (!ops->add_device)
> return 0;
>
> WARN_ON(dev->iommu_group);
>
> - return ops->add_device(dev);
> + ret = ops->add_device(dev);
> +
> + /*
> + * We ignore -ENODEV errors for now, as they just mean that the
> + * device is not translated by an IOMMU. We still care about
> + * other errors and fail to initialize when they happen.
> + */
> + if (ret == -ENODEV)
> + ret = 0;
> +
> + return ret;
> }
>
> static int remove_iommu_group(struct device *dev, void *data)
Best regards
--
Marek Szyprowski, PhD
Samsung R&D Institute Poland
next prev parent reply other threads:[~2015-06-29 8:53 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-25 13:10 [PATCH] iommu/exynos: Skip unsupported devices instead of returning -ENODEV Marek Szyprowski
2015-06-29 8:35 ` [PATCH] iommu: Ignore -ENODEV errors from add_device call-back " Joerg Roedel
[not found] ` <20150629083534.GG18569-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>
2015-06-29 8:53 ` Marek Szyprowski [this message]
2015-06-29 13:43 ` 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=55910797.7090709@samsung.com \
--to=m.szyprowski-sze3o3uu22jbdgjk7y7tuq@public.gmane.org \
--cc=inki.dae-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org \
--cc=iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
--cc=javier-0uQlZySMnqxg9hUCZPvPmw@public.gmane.org \
--cc=joro-zLv9SwRftAIdnm+yROfE0A@public.gmane.org \
--cc=k.kozlowski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org \
--cc=linux-samsung-soc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=pullip.cho-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org \
--cc=shaik.ameer-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org \
/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