From: Jan Beulich <jbeulich@suse.com>
To: Oleksii Moisieiev <Oleksii_Moisieiev@epam.com>
Cc: "xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>,
"Andrew Cooper" <andrew.cooper3@citrix.com>,
"Anthony PERARD" <anthony.perard@vates.tech>,
"Bertrand Marquis" <bertrand.marquis@arm.com>,
"Juergen Gross" <jgross@suse.com>,
"Julien Grall" <julien@xen.org>,
"Michal Orzel" <michal.orzel@amd.com>,
"Roger Pau Monné" <roger.pau@citrix.com>,
"Volodymyr Babchuk" <Volodymyr_Babchuk@epam.com>,
"Grygorii Strashko" <grygorii_strashko@epam.com>,
"Stefano Stabellini" <sstabellini@kernel.org>
Subject: Re: [RFC PATCH v4 5/8] xen/domctl: extend XEN_DOMCTL_assign_device to handle not only iommu
Date: Thu, 26 Jun 2025 08:10:16 +0200 [thread overview]
Message-ID: <8bb4e188-eb3b-4ee3-88cc-93c826b04ef8@suse.com> (raw)
In-Reply-To: <3e190e60-74a4-4565-acae-3b8602a4c46e@epam.com>
On 25.06.2025 21:56, Oleksii Moisieiev wrote:
>
> On 23/06/2025 10:15, Jan Beulich wrote:
>> On 19.06.2025 18:15, Oleksii Moisieiev wrote:
>>> On 18/06/2025 03:04, Stefano Stabellini wrote:
>>>> On Thu, 12 Jun 2025, Oleksii Moisieiev wrote:
>>>>>>> diff --git a/xen/arch/arm/firmware/sci.c b/xen/arch/arm/firmware/sci.c
>>>>>>> index e1522e10e2..8efd541c4f 100644
>>>>>>> --- a/xen/arch/arm/firmware/sci.c
>>>>>>> +++ b/xen/arch/arm/firmware/sci.c
>>>>>>> @@ -126,6 +126,43 @@ int sci_assign_dt_device(struct domain *d, struct dt_device_node *dev)
>>>>>>> return 0;
>>>>>>> }
>>>>>>>
>>>>>>> +int sci_do_domctl(struct xen_domctl *domctl, struct domain *d,
>>>>>>> + XEN_GUEST_HANDLE_PARAM(xen_domctl_t) u_domctl)
>>>>>>> +{
>>>>>>> + struct dt_device_node *dev;
>>>>>>> + int ret = 0;
>>>>>>> +
>>>>>>> + switch ( domctl->cmd )
>>>>>>> + {
>>>>>>> + case XEN_DOMCTL_assign_device:
>>>>>>> + ret = -EOPNOTSUPP;
>>>>>> Are you sure -EOPNOTSUPP is the right error code for the 3 checks below?
>>>>> The -EOPNOTSUPP code is used because this is part of a chained call after
>>>>> iommu_do_domctl, as stated in xen/common/domctl.c:859. The
>>>>> XEN_DOMCTL_assign_device
>>>>> call is expected to handle any DT device, regardless of whether the DT
>>>>> device is
>>>>> protected by an IOMMU or if the IOMMU is disabled.
>>>>> The following cases are considered:
>>>>>
>>>>> 1. IOMMU Protected Device (Success)
>>>>>
>>>>> If the device is protected by the IOMMU and iommu_do_domctl returns 0,
>>>>> we continue
>>>>> processing the DT device by calling sci_do_domctl.
>>>>>
>>>>> 2. IOMMU Disabled (-EOPNOTSUPP from iommu_do_domctl)
>>>>>
>>>>> If iommu_do_domctl returns -EOPNOTSUPP, indicating that the IOMMU is
>>>>> disabled,
>>>>> we still proceed to call sci_do_domctl.
>>>> OK this makes sense. I think it is OK to have a special error code to
>>>> say "the IOMMU is disabled" but I don't know if it is a good idea to try
>>>> to use -EOPNOTSUPP for that. -EOPNOTSUPP could mean a hypervisor
>>>> configuration with domctl disabled, for instance.
>>>>
>>>> It might be wiser to use a different error code. Maybe ENOENT?
>>>>
>>> I see that in the following commit:
>>>
>>> 71e617a6b8 (use is_iommu_enabled() where appropriate..., 2019-09-17)
>>>
>>> -ENOSYS return code was changed to -EOPNOTSUPP in iommu_do_domctl.
>>>
>>> It's not clear to me why this was done from the commit description.
>> This has been discussed many times elsewhere. Many of our ENOSYS uses are
>> simply wrong. ENOSYS has very limited applicability: Unavailability of a
>> top-level hypercall (originally: syscall).
>>
> What is your opinion about changing it to -ENOENT to say "the IOMMU is
> disabled" as Stefano suggested in [0]?
>
> [0]: https://lists.xen.org/archives/html/xen-devel/2025-06/msg01233.html
To me, ENOENT is closer to ENODEV, and hence not overly applicable here.
If you want to avoid EOPNOTSUPP for whatever reason, how about ENXIO or
EIO? (EPERM might also be an option, but we assign that a different
meaning generally.)
Jan
next prev parent reply other threads:[~2025-06-26 6:11 UTC|newest]
Thread overview: 67+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-19 15:50 [RFC PATCH v4 0/8] xen/arm: scmi: introduce SCI SCMI SMC multi-agent support Oleksii Moisieiev
2025-05-19 15:50 ` [RFC PATCH v4 2/8] xen/arm: scmi-smc: update to be used under sci subsystem Oleksii Moisieiev
2025-05-19 23:29 ` Stefano Stabellini
2025-05-19 15:50 ` [RFC PATCH v4 3/8] xen/arm: scmi-smc: passthrough SCMI SMC to domain, single agent Oleksii Moisieiev
2025-05-20 0:18 ` Stefano Stabellini
2025-05-19 15:50 ` [RFC PATCH v4 1/8] xen/arm: add generic SCI subsystem Oleksii Moisieiev
2025-05-19 23:45 ` Stefano Stabellini
2025-05-19 15:50 ` [RFC PATCH v4 7/8] docs: arm: add SCI SCMI SMC multi-agent driver docs Oleksii Moisieiev
2025-05-19 15:50 ` [RFC PATCH v4 4/8] docs: arm: add docs for SCMI over SMC calls forwarding driver Oleksii Moisieiev
2025-05-19 15:50 ` [RFC PATCH v4 5/8] xen/domctl: extend XEN_DOMCTL_assign_device to handle not only iommu Oleksii Moisieiev
2025-05-19 18:54 ` Jan Beulich
2025-05-22 0:25 ` Stefano Stabellini
2025-05-22 6:18 ` Jan Beulich
2025-06-12 11:42 ` Oleksii Moisieiev
2025-06-12 13:10 ` Grygorii Strashko
2025-06-18 0:04 ` Stefano Stabellini
2025-06-19 16:15 ` Oleksii Moisieiev
2025-06-22 21:30 ` Stefano Stabellini
2025-06-24 8:42 ` Oleksii Moisieiev
2025-06-24 8:47 ` Jan Beulich
2025-06-24 8:48 ` Oleksii Moisieiev
2025-06-23 7:15 ` Jan Beulich
2025-06-23 7:28 ` Oleksii Moisieiev
2025-06-25 19:56 ` Oleksii Moisieiev
2025-06-26 6:10 ` Jan Beulich [this message]
2025-06-26 13:07 ` Oleksii Moisieiev
2025-06-26 14:41 ` Jan Beulich
2025-06-26 15:01 ` Oleksii Moisieiev
2025-05-19 15:50 ` [RFC PATCH v4 6/8] xen/arm: scmi: introduce SCI SCMI SMC multi-agent driver Oleksii Moisieiev
2025-05-23 20:06 ` Stefano Stabellini
2025-06-02 7:17 ` Bertrand Marquis
2025-06-12 12:03 ` Oleksii Moisieiev
2025-06-12 12:10 ` Grygorii Strashko
2025-06-17 23:38 ` Stefano Stabellini
2025-06-18 7:22 ` Julien Grall
2025-06-19 16:15 ` Oleksii Moisieiev
2025-06-22 21:50 ` Stefano Stabellini
2025-06-19 16:15 ` Oleksii Moisieiev
2025-06-05 22:44 ` Julien Grall
2025-06-12 12:03 ` Oleksii Moisieiev
2025-06-17 23:22 ` Stefano Stabellini
2025-06-17 23:56 ` Stefano Stabellini
2025-06-19 16:15 ` Oleksii Moisieiev
2025-06-22 22:15 ` Stefano Stabellini
2025-06-23 8:06 ` Julien Grall
2025-06-23 19:27 ` Stefano Stabellini
2025-06-23 20:38 ` Julien Grall
2025-06-23 20:42 ` Stefano Stabellini
2025-06-23 21:58 ` Julien Grall
2025-06-25 19:47 ` Oleksii Moisieiev
2025-06-18 7:28 ` Julien Grall
2025-06-19 16:15 ` Oleksii Moisieiev
2025-05-19 15:50 ` [RFC PATCH v4 8/8] docs: arm: proposal to add separate SCMI node for Xen agent Oleksii Moisieiev
2025-05-23 20:19 ` Stefano Stabellini
2025-06-12 12:03 ` Oleksii Moisieiev
2025-06-18 0:35 ` Stefano Stabellini
2025-06-19 16:15 ` [RFC PATCH v4 8/8] docs: armproposa: l " Oleksii Moisieiev
2025-06-22 21:57 ` Stefano Stabellini
2025-06-23 8:02 ` Julien Grall
2025-06-25 19:47 ` Oleksii Moisieiev
2025-06-25 20:32 ` Julien Grall
2025-06-29 15:41 ` Oleksii Moisieiev
2025-06-29 18:34 ` Julien Grall
2025-06-30 11:57 ` Oleksii Moisieiev
2025-06-30 12:13 ` Julien Grall
2025-06-30 22:33 ` Stefano Stabellini
2025-06-05 22:40 ` [RFC PATCH v4 0/8] xen/arm: scmi: introduce SCI SCMI SMC multi-agent support Julien Grall
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=8bb4e188-eb3b-4ee3-88cc-93c826b04ef8@suse.com \
--to=jbeulich@suse.com \
--cc=Oleksii_Moisieiev@epam.com \
--cc=Volodymyr_Babchuk@epam.com \
--cc=andrew.cooper3@citrix.com \
--cc=anthony.perard@vates.tech \
--cc=bertrand.marquis@arm.com \
--cc=grygorii_strashko@epam.com \
--cc=jgross@suse.com \
--cc=julien@xen.org \
--cc=michal.orzel@amd.com \
--cc=roger.pau@citrix.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.