From: Volodymyr Babchuk <Volodymyr_Babchuk@epam.com>
To: Julien Grall <julien@xen.org>
Cc: Stefano Stabellini <sstabellini@kernel.org>,
Anthony PERARD <anthony.perard@citrix.com>,
Oleksii Moisieiev <Oleksii_Moisieiev@epam.com>,
Oleksandr <olekstysh@gmail.com>,
"xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>,
Wei Liu <wl@xen.org>, Juergen Gross <jgross@suse.com>,
Andrew Cooper <andrew.cooper3@citrix.com>,
George Dunlap <george.dunlap@citrix.com>,
Jan Beulich <jbeulich@suse.com>,
Bertrand Marquis <bertrand.marquis@arm.com>
Subject: Re: [RFC v1 5/5] xen/arm: add SCI mediator support for DomUs
Date: Wed, 22 Dec 2021 11:17:45 +0000 [thread overview]
Message-ID: <87lf0cx50o.fsf@epam.com> (raw)
In-Reply-To: <bc6d7529-337d-a4e1-664a-dddd68ecf5cb@xen.org>
Hi Julien,
Julien Grall <julien@xen.org> writes:
> Hi Stefano,
>
> On 21/12/2021 22:39, Stefano Stabellini wrote:
>> On Tue, 21 Dec 2021, Anthony PERARD wrote:
>>> On Fri, Dec 17, 2021 at 12:15:25PM +0000, Oleksii Moisieiev wrote:
>>>>> On 14.12.21 11:34, Oleksii Moisieiev wrote:
>>>>>> @@ -1817,17 +1858,24 @@ static void libxl__add_dtdevs(libxl__egc *egc, libxl__ao *ao, uint32_t domid,
>>>>>> {
>>>>>> AO_GC;
>>>>>> libxl__ao_device *aodev = libxl__multidev_prepare(multidev);
>>>>>> - int i, rc = 0;
>>>>>> + int i, rc = 0, rc_sci = 0;
>>>>>> for (i = 0; i < d_config->num_dtdevs; i++) {
>>>>>> const libxl_device_dtdev *dtdev = &d_config->dtdevs[i];
>>>>>> LOGD(DEBUG, domid, "Assign device \"%s\" to domain", dtdev->path);
>>>>>> rc = xc_assign_dt_device(CTX->xch, domid, dtdev->path);
>>>>>> - if (rc < 0) {
>>>>>> - LOGD(ERROR, domid, "xc_assign_dtdevice failed: %d", rc);
>>>>>> + rc_sci = xc_domain_add_sci_device(CTX->xch, domid, dtdev->path);
>>>>>> +
>>>>>> + if ((rc < 0) && (rc_sci < 0)) {
>>>>>> + LOGD(ERROR, domid, "xc_assign_dt_device failed: %d; "
>>>>>> + "xc_domain_add_sci_device failed: %d",
>>>>>> + rc, rc_sci);
>>>>>> goto out;
>>>>>> }
>>>>>> +
>>>>>> + if (rc)
>>>>>> + rc = rc_sci;
>>>>>
>>>>>
>>>>> If I get this code right, it sounds like the dom.cfg's dtdev property is
>>>>> reused to describe sci devices as well, but the libxl__add_dtdevs() does not
>>>>> (and can not) differentiate them. So it has no option but to send two
>>>>> domctls for each device in dtdevs[] hoping to at least one domctl to
>>>>> succeeded. Or I really missed something?
>>>>>
>>>>> It feels to me that:
>>>>> - either new dom.cfg's property could be introduced (scidev?) to describe
>>>>> sci devices together with new parsing logic/management code, so you will end
>>>>> up having new libxl__add_scidevs() to invoke XEN_DOMCTL_add_sci_device,
>>>>> so no mixing things.
>>>>> - or indeed dtdev logic could be *completely* reused including extending
>>>>> XEN_DOMCTL_assign_device to cover your use-case, although sounds generic, it
>>>>> is used to describe devices for the passthrough (to configure an IOMMU for
>>>>> the device), in that case you wouldn't need an extra
>>>>> XEN_DOMCTL_add_sci_device introduced by current patch.
>> I realize I did my review before reading Oleksandr's comments. I
>> fully
>> agree with his feedback. Having seen how difficult is for users to setup
>> a domU configuration correctly today, I would advise to try to reuse the
>> existing dtdev property instead of adding yet one new property to make
>> the life of our users easier.
>>
>>
>>>>> Personally I would use the first option as I am not sure that second option
>>>>> is conceptually correct && possible. I would leave this for the maintainers
>>>>> to clarify.
>>>>>
>>>>
>>>> Thank you for the point. I agree that reusing XEN_DOMCTL_assign_device
>>>> seems not to be conceptually correct. Introducing new dom.cfg property
>>>> seems to be the only way to avoid extra Domctl calls.
>>>> I will handle this in v2 if there will be no complains from Maintainers.
>>>
>>> I don't know if there will be a complains in v2 or not :-), but using
>>> something different from dtdev sound good.
>>>
>>> If I understand correctly, dtdev seems to be about passing through an
>>> existing device to a guest, and this new sci device seems to be about having Xen
>>> "emulating" an sci device which the guest will use. So introducing
>>> something new (scidev or other name) sounds good.
>> Users already have to provide 4 properties (dtdev, iomem, irqs,
>> device_tree) to setup device assignment. I think that making it 5
>> properties would not be a step forward :-)
>
> IIRC, in the past, we discussed to fetch the information directly from
> the partial device-tree. Maybe this discussion needs to be revived?
>
> Although, this is a separate topic from this series.
>
>> To me dtdev and XEN_DOMCTL_assign_device are appropriate because
>> they
>> signify device assignment of one or more devices. We are not adding any
>> additional "meaning" to them. It is just that we'll automatically detect
>> and generate any SCMI configurations based on the list of assigned
>> devices. Because if SCMI is enabled and a device is assigned to the
>> guest, then I think we want to add the device to the SCMI list of
>> devices automatically.
>
> I am OK with re-using dtdev/XEN_DOMCTL_assign_device however there is
> a pitfall with that approach.
>
> At the moment, they are only used for device protected by the
> IOMMU. If the device is not protected by the IOMMU then it will return
> an error.
IIRC there was a change, that allowed to assign device without a IOMMU. At
least we discussed this internally.
>
> Now, with your approach we may have a device that is not protected by
> the IOMMU but require to a SCMI configuration.
You need to protect only DMA-capable devices.
> I don't think it would be sensible to just return "succeed" here
> because technically you are asking to assign a non-protected
> device. But at the same time, it would prevent a user to assign a
> non-DMA capable device.
>
> So how do you suggest to approach this?
Well, in my head assign_device ideally should do the following:
1. Assign IOMMU if it is configured for the device
2. Assign SCMI access rights
(Not related to this patch series, but...)
3. Assign IRQs
4. Assign IO memory ranges.
Points 3. and 4. would allow us to not provide additional irq=[] and
iomem=[] entries in a guest config.
--
Volodymyr Babchuk at EPAM
next prev parent reply other threads:[~2021-12-22 11:18 UTC|newest]
Thread overview: 95+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-14 9:34 [RFC v1 0/5] Introduce SCI-mediator feature Oleksii Moisieiev
2021-12-14 9:34 ` [RFC v1 1/5] xen/arm: add support for Renesas R-Car Gen3 platform Oleksii Moisieiev
2021-12-15 6:38 ` Oleksandr Andrushchenko
2021-12-15 20:08 ` Oleksii Moisieiev
2021-12-15 9:39 ` Julien Grall
2021-12-17 10:48 ` Oleksii Moisieiev
2021-12-15 9:57 ` Oleksandr Tyshchenko
2021-12-17 10:52 ` Oleksii Moisieiev
2021-12-14 9:34 ` [RFC v1 2/5] xen/arm: add generic SCI mediator framework Oleksii Moisieiev
2021-12-17 2:45 ` Stefano Stabellini
2021-12-17 12:50 ` Oleksii Moisieiev
2021-12-14 9:34 ` [RFC v1 3/5] xen/arm: introduce SCMI-SMC mediator driver Oleksii Moisieiev
2021-12-17 11:35 ` Oleksandr
2021-12-17 13:23 ` Oleksii Moisieiev
2021-12-17 13:37 ` Julien Grall
2021-12-17 13:58 ` Oleksii Moisieiev
2021-12-17 16:38 ` Julien Grall
2021-12-20 15:41 ` Oleksii Moisieiev
2021-12-24 14:42 ` Julien Grall
2021-12-24 17:02 ` Oleksii Moisieiev
2022-01-03 13:14 ` Julien Grall
2022-01-06 13:53 ` Oleksii Moisieiev
2022-01-06 14:02 ` Julien Grall
2022-01-06 15:43 ` Oleksii Moisieiev
2022-01-06 16:04 ` Julien Grall
2022-01-06 16:28 ` Oleksii Moisieiev
2022-01-19 10:37 ` Oleksii Moisieiev
2022-01-20 2:10 ` Stefano Stabellini
2022-01-20 10:25 ` Oleksii Moisieiev
2021-12-18 2:14 ` Stefano Stabellini
2021-12-20 18:12 ` Oleksii Moisieiev
2021-12-21 0:52 ` Stefano Stabellini
2021-12-21 20:03 ` Oleksii Moisieiev
2021-12-21 21:22 ` Stefano Stabellini
2021-12-22 11:04 ` Oleksii Moisieiev
2021-12-23 2:23 ` Stefano Stabellini
2021-12-23 18:45 ` Volodymyr Babchuk
2021-12-23 19:06 ` Oleksii Moisieiev
2021-12-24 0:16 ` Stefano Stabellini
2021-12-24 13:29 ` Julien Grall
2021-12-24 13:59 ` Oleksii Moisieiev
2021-12-24 14:28 ` Julien Grall
2021-12-24 16:49 ` Oleksii Moisieiev
2022-01-03 14:23 ` Julien Grall
2022-01-06 15:19 ` Oleksii Moisieiev
2021-12-24 14:07 ` Oleksii Moisieiev
2022-01-19 12:04 ` Oleksii Moisieiev
2022-01-20 1:28 ` Stefano Stabellini
2022-01-20 10:21 ` Oleksii Moisieiev
2022-01-20 22:29 ` Stefano Stabellini
2022-01-21 15:07 ` Oleksii Moisieiev
2022-01-21 20:49 ` Stefano Stabellini
2022-01-24 18:22 ` Oleksii Moisieiev
2022-01-24 19:06 ` Stefano Stabellini
2022-01-24 19:26 ` Julien Grall
2022-01-24 22:14 ` Stefano Stabellini
2022-01-25 14:35 ` Oleksii Moisieiev
2022-01-25 21:19 ` Stefano Stabellini
2022-01-27 18:11 ` Oleksii Moisieiev
2022-01-27 21:18 ` Stefano Stabellini
2021-12-14 9:34 ` [RFC v1 4/5] tools/arm: add "scmi_smc" option to xl.cfg Oleksii Moisieiev
2021-12-15 21:51 ` Oleksandr
2021-12-17 11:00 ` Oleksii Moisieiev
2021-12-21 0:54 ` Stefano Stabellini
2021-12-22 10:24 ` Oleksii Moisieiev
2021-12-23 2:23 ` Stefano Stabellini
2021-12-23 19:13 ` Oleksii Moisieiev
2021-12-21 13:27 ` Anthony PERARD
2021-12-22 12:20 ` Oleksii Moisieiev
2021-12-14 9:34 ` [RFC v1 5/5] xen/arm: add SCI mediator support for DomUs Oleksii Moisieiev
2021-12-14 9:41 ` Jan Beulich
2021-12-16 17:36 ` Oleksii Moisieiev
2021-12-17 7:12 ` Jan Beulich
2021-12-17 7:16 ` Jan Beulich
2021-12-17 13:40 ` Oleksii Moisieiev
2021-12-16 0:04 ` Oleksandr
2021-12-17 12:15 ` Oleksii Moisieiev
2021-12-21 14:45 ` Anthony PERARD
2021-12-21 21:39 ` Stefano Stabellini
2021-12-22 9:24 ` Julien Grall
2021-12-22 11:17 ` Volodymyr Babchuk [this message]
2021-12-22 11:30 ` Julien Grall
2021-12-22 12:34 ` Volodymyr Babchuk
2021-12-22 13:49 ` Julien Grall
2021-12-23 2:23 ` Stefano Stabellini
2021-12-23 19:06 ` Stefano Stabellini
2021-12-24 13:30 ` Julien Grall
2022-01-19 9:40 ` Oleksii Moisieiev
2022-01-20 1:53 ` Stefano Stabellini
2022-01-20 10:27 ` Oleksii Moisieiev
2021-12-23 19:11 ` Oleksii Moisieiev
2021-12-21 1:37 ` Stefano Stabellini
2021-12-22 13:41 ` Oleksii Moisieiev
2021-12-16 0:33 ` [RFC v1 0/5] Introduce SCI-mediator feature Oleksandr
2021-12-17 12:24 ` Oleksii Moisieiev
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=87lf0cx50o.fsf@epam.com \
--to=volodymyr_babchuk@epam.com \
--cc=Oleksii_Moisieiev@epam.com \
--cc=andrew.cooper3@citrix.com \
--cc=anthony.perard@citrix.com \
--cc=bertrand.marquis@arm.com \
--cc=george.dunlap@citrix.com \
--cc=jbeulich@suse.com \
--cc=jgross@suse.com \
--cc=julien@xen.org \
--cc=olekstysh@gmail.com \
--cc=sstabellini@kernel.org \
--cc=wl@xen.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.