All of lore.kernel.org
 help / color / mirror / Atom feed
From: Oleksandr <olekstysh@gmail.com>
To: Julien Grall <julien.grall@arm.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 V4 7/8] iommu/arm: Introduce iommu_add_dt_device API
Date: Fri, 20 Sep 2019 16:24:49 +0300	[thread overview]
Message-ID: <b4faaef5-c99e-8ba2-49fb-2279d40edef3@gmail.com> (raw)
In-Reply-To: <5d306b6f-b657-4668-4c79-f624ca9350a5@arm.com>



Hi Julien


>
>>
>>>
>>>>>> +
>>>>>> +int __init iommu_add_dt_device(struct dt_device_node *np)
>>>>>
>>>>> Sorry to only realise it now. Would it make sense to have this 
>>>>> function implemented in xen/passthrough/device_tree.c? 
>>>>
>>>> Not entirely sure. device_tree.c is a common code. The iommu_fwspec 
>>>> stuff (widely used in this function) is ARM code.
>>>
>>> Some of the device_tree.c already contains Arm specific code (such 
>>> as device.h).
>>>
>>> DT has been only used by Arm so far, so it is sadly fairly tie to 
>>> the architecture. But it should be easy to make it generic if needs 
>>> be (such as for RISCv).
>>>
>>> While iommu_fwspec is been implemented in Arm headers, this could 
>>> potentially be made common. So I would still prefer this that 
>>> function is moved in device_tree.c
>>
>> Well, will move. Also I will remove __init as it can be called at 
>> runtime...
>>
>>
>> As for runtime:
>>
>> The current implementation allows us to fail at early stage if 
>> something is wrong with the device which is behind an IOMMU (and 
>> needs to be protected). As we scan for all present devices, but not 
>> only for "passthrough".
>> The "splitting" into handle_device() for hwdom and 
>> iommu_do_dt_domctl() for other guests will postpone an error 
>> recognition to the guest domain creation time. So, we would have non 
>> function system anyway. Wouldn't be better to fail early instead of 
>> continue and fail anyway?
>
> Yes your implementation allows us to fail at early stage but then you 
> are abusing the function handle_device(). There are actually no 
> promise this will be called for every device going forward. Think 
> about dom0less where the goal is to have no dom0 at all.
>
> You are also tying the order of the domains creation as dom0 would 
> have to be always created before any other domains are created.
>
> Similar (ab)use of handle_device() does not exist, so I would rather 
> not start to introduce them because this will become quickly 
> unmaintainable as we are mixing dom0 creation and Xen initialization.
>
> Even without this series, assigning a device to the guest may not be a 
> success because the IOMMU may not have enough context bank (used for 
> configuring the IOMMU stage-2) or there are not enough memory. Not 
> been able to add the device to the IOMMU driver is only another 
> example where it may fail.
>
> But I would not consider this as not functional. The rest of your 
> system may work perfectly even if this particular device is not 
> usable. There are no security risk as the IOMMU should block any 
> transaction by default.
>
> I am also not in favor of parsing again the Device-Tree (we have 
> enough of them), so this is the best solution I can come up. Feel free 
> to suggest something different.

I am happy with the explanation, sounds reasonable. Will modify patch as 
you suggested.


-- 
Regards,

Oleksandr Tyshchenko


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

  reply	other threads:[~2019-09-20 13:25 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-13 15:35 [Xen-devel] [PATCH V4 0/8] iommu/arm: Add Renesas IPMMU-VMSA support + Linux's iommu_fwspec Oleksandr Tyshchenko
2019-09-13 15:35 ` [Xen-devel] [PATCH V4 1/8] iommu/arm: Add iommu_helpers.c file to keep common for IOMMUs stuff Oleksandr Tyshchenko
2019-09-13 15:35 ` [Xen-devel] [PATCH V4 2/8] iommu/arm: Add ability to handle deferred probing request Oleksandr Tyshchenko
2019-09-19  9:44   ` Julien Grall
2019-09-19  9:57     ` Oleksandr
2019-09-13 15:35 ` [Xen-devel] [PATCH V4 3/8] iommu/arm: Order the headers alphabetically in iommu.c Oleksandr Tyshchenko
2019-09-19  9:48   ` Julien Grall
2019-09-13 15:35 ` [Xen-devel] [PATCH V4 4/8] xen/common: Introduce _xrealloc function Oleksandr Tyshchenko
2019-09-16 10:13   ` Jan Beulich
2019-09-16 15:03     ` Oleksandr
2019-09-16 15:24       ` Jan Beulich
2019-09-23 12:50         ` Oleksandr
2019-09-23 13:31           ` Jan Beulich
2019-09-23 13:41             ` Oleksandr
2019-09-13 15:35 ` [Xen-devel] [PATCH V4 5/8] xen/common: Introduce xrealloc_flex_struct() helper macros Oleksandr Tyshchenko
2019-09-16 10:37   ` Jan Beulich
2019-09-16 18:11     ` Oleksandr
2019-09-20  9:51       ` Oleksandr
2019-09-20 10:25         ` Jan Beulich
2019-09-13 15:35 ` [Xen-devel] [PATCH V4 6/8] iommu/arm: Add lightweight iommu_fwspec support Oleksandr Tyshchenko
2019-09-16 10:40   ` Jan Beulich
2019-09-16 18:08     ` Oleksandr
2019-09-17  6:12       ` Jan Beulich
2019-09-17 18:18         ` Oleksandr
2019-09-19 10:12           ` Julien Grall
2019-09-19 10:15             ` Jan Beulich
2019-09-19 10:57               ` Oleksandr
2019-09-19 11:36                 ` Julien Grall
2019-09-19 12:07                   ` Oleksandr
2019-09-13 15:35 ` [Xen-devel] [PATCH V4 7/8] iommu/arm: Introduce iommu_add_dt_device API Oleksandr Tyshchenko
2019-09-16  9:53   ` Jan Beulich
2019-09-16 11:07     ` Oleksandr
2019-09-19 11:35   ` Julien Grall
2019-09-19 12:25     ` Oleksandr
2019-09-19 12:29       ` Julien Grall
2019-09-19 13:26         ` Oleksandr
2019-09-20 13:18           ` Julien Grall
2019-09-20 13:24             ` Oleksandr [this message]
2019-09-13 15:35 ` [Xen-devel] [PATCH V4 8/8] iommu/arm: Add Renesas IPMMU-VMSA support Oleksandr Tyshchenko
2019-09-19 11:45   ` Julien Grall
2019-09-19 11:58     ` Oleksandr
2019-09-19 12:05       ` Julien Grall
2019-09-19 12:08         ` Oleksandr
2019-09-20  0:25   ` Yoshihiro Shimoda
2019-09-20 12:57     ` Oleksandr

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=b4faaef5-c99e-8ba2-49fb-2279d40edef3@gmail.com \
    --to=olekstysh@gmail.com \
    --cc=Volodymyr_Babchuk@epam.com \
    --cc=jbeulich@suse.com \
    --cc=julien.grall@arm.com \
    --cc=oleksandr_tyshchenko@epam.com \
    --cc=sstabellini@kernel.org \
    --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.