From: Julien Grall <julien.grall@arm.com>
To: Oleksandr <olekstysh@gmail.com>, xen-devel@lists.xenproject.org
Cc: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>,
sstabellini@kernel.org, volodymyr_babchuk@epam.com,
Jan Beulich <jbeulich@suse.com>
Subject: Re: [Xen-devel] [PATCH V5 7/8] iommu/arm: Introduce iommu_add_dt_device API
Date: Tue, 24 Sep 2019 18:21:20 +0100 [thread overview]
Message-ID: <f006d373-c759-938a-707a-33cfa0f0e338@arm.com> (raw)
In-Reply-To: <a16bf417-5e85-46e8-0ec4-167323384c8b@gmail.com>
Hi Oleksandr,
On 9/24/19 5:22 PM, Oleksandr wrote:
>
> On 24.09.19 18:57, Julien Grall wrote:
>> Hi,
>
> Hi Julien
>
>
>>
>> On 9/24/19 4:30 PM, Oleksandr Tyshchenko wrote:
>>> @@ -1263,15 +1264,22 @@ static int __init handle_device(struct domain
>>> *d, struct dt_device_node *dev,
>>> dt_dprintk("%s passthrough = %d nirq = %d naddr = %u\n",
>>> dt_node_full_name(dev), need_mapping, nirq, naddr);
>>> - if ( dt_device_is_protected(dev) && need_mapping )
>>> + if ( need_mapping )
>>> {
>>> - dt_dprintk("%s setup iommu\n", dt_node_full_name(dev));
>>> - res = iommu_assign_dt_device(d, dev);
>>> - if ( res )
>>> - {
>>> - printk(XENLOG_ERR "Failed to setup the IOMMU for %s\n",
>>> + dt_dprintk("Check if %s is behind the IOMMU and add it\n",
>>> dt_node_full_name(dev));
>>> - return res;
>>> +
>>> + iommu_add_dt_device(dev);
>>
>> Return value should always be checked or explain why this is not done.
>
> Yes, I will add a check. The positive result for us is non-negative
> (either "device is protected" or "device doesn't need to be protected").
>
>
>>
>>
>> [...]
>>
>>> int iommu_do_dt_domctl(struct xen_domctl *domctl, struct domain *d,
>>> XEN_GUEST_HANDLE_PARAM(xen_domctl_t) u_domctl)
>>> {
>>> @@ -177,6 +241,13 @@ int iommu_do_dt_domctl(struct xen_domctl
>>> *domctl, struct domain *d,
>>> break;
>>> }
>>> + iommu_add_dt_device(dev);
>>
>> Same here.
>
> Yes, I think, we don't need to check for return value, because the only
> one positive result "here" is the fact that "device is protected" (which
> is checked below).
>
> What is more, if we add a check for the return value to be strictly 0,
> we will get an error after guest's reboot (since iommu_add_dt_device()
> will return -EEXIST).
>
> So, I will add a comment explaining why we don't check. What do you think?
Why don't you do the following code?
if ( ret < 0 && ret != -EEXIST )
This would allow the code to return the corrrect error to the upper
layer. A suitable comment on top explaing the check would also be useful.
Cheers,
--
Julien Grall
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
next prev parent reply other threads:[~2019-09-24 17:21 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-24 15:30 [Xen-devel] [PATCH V5 0/8] iommu/arm: Add Renesas IPMMU-VMSA support + Linux's iommu_fwspec Oleksandr Tyshchenko
2019-09-24 15:30 ` [Xen-devel] [PATCH V5 1/8] iommu/arm: Add iommu_helpers.c file to keep common for IOMMUs stuff Oleksandr Tyshchenko
2019-09-24 15:30 ` [Xen-devel] [PATCH V5 2/8] iommu/arm: Add ability to handle deferred probing request Oleksandr Tyshchenko
2019-09-24 15:30 ` [Xen-devel] [PATCH V5 3/8] xen/common: Introduce _xrealloc function Oleksandr Tyshchenko
2019-09-24 15:51 ` Jan Beulich
2019-09-24 17:14 ` Oleksandr
2019-09-24 15:30 ` [Xen-devel] [PATCH V5 4/8] xen/common: Introduce xrealloc_flex_struct() helper macros Oleksandr Tyshchenko
2019-09-24 15:30 ` [Xen-devel] [PATCH V5 5/8] iommu/arm: Add lightweight iommu_fwspec support Oleksandr Tyshchenko
2019-09-24 15:42 ` Julien Grall
2019-09-24 15:30 ` [Xen-devel] [PATCH V5 6/8] iommu: Order the headers alphabetically in device_tree.c Oleksandr Tyshchenko
2019-09-24 15:43 ` Julien Grall
2019-09-24 15:30 ` [Xen-devel] [PATCH V5 7/8] iommu/arm: Introduce iommu_add_dt_device API Oleksandr Tyshchenko
2019-09-24 15:57 ` Julien Grall
2019-09-24 16:22 ` Oleksandr
2019-09-24 17:21 ` Julien Grall [this message]
2019-09-24 17:30 ` Oleksandr
2019-09-24 15:30 ` [Xen-devel] [PATCH V5 8/8] iommu/arm: Add Renesas IPMMU-VMSA support Oleksandr Tyshchenko
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=f006d373-c759-938a-707a-33cfa0f0e338@arm.com \
--to=julien.grall@arm.com \
--cc=jbeulich@suse.com \
--cc=oleksandr_tyshchenko@epam.com \
--cc=olekstysh@gmail.com \
--cc=sstabellini@kernel.org \
--cc=volodymyr_babchuk@epam.com \
--cc=xen-devel@lists.xenproject.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.