Hi,
On 25/02/2025 11:10, Jan Beulich wrote:
On 25.02.2025 12:08, Jan Beulich wrote:
On 25.02.2025 12:05, Mykyta Poturai wrote:
On 10.02.25 12:46, Jan Beulich wrote:
On 10.02.2025 11:30, Mykyta Poturai wrote:
--- a/xen/include/xen/iommu.h
+++ b/xen/include/xen/iommu.h
@@ -238,6 +238,14 @@ int iommu_do_dt_domctl(struct xen_domctl *domctl, struct
domain *d,
*/
int iommu_remove_dt_device(struct dt_device_node *np);
+/*
+ * Status code indicating that DT device cannot be added to the IOMMU
+ * or removed from it because the IOMMU is disabled or the device is not
+ * connected to it.
+ */
+
+#define DT_NO_IOMMU 1
While an improvement, it still isn't clear whose "status code" this is.
The #define is effectively hanging in the air, from all I can tell. And
from it not being a normal error code it is pretty clear that it better
would have only very narrow use.
Also can you please omit an interspersing blank line when the comment
is specifically tied to a definition or declaration?
What would you say about removing this status code entirely and
returning something like -ENODEV instead, with adding special handling
for this return to the callers where needed?
I'd be okay with that; Arm folks also need to be, though.
Oh, and: Of course it then needs to be pretty clear / obvious that -ENODEV
cannot come into play for other reasons / from other origins.
It would be difficult to guarantee that all the callbacks will never
return -ENODEV. So I am quite reluctant to use -ENODEV to indicate the
IOMMU is not available or the device is not behind an IOMMU.
Anyway, I can't fully remember the previous discussion. Can someone
remind me what we are trying to solve with introducing DT_NO_IOMMU? The
meaning of the value is already properly documented on each function
that can return the value:
* >0 : device doesn't need to be protected by an IOMMU
* (IOMMU is not enabled/present or device is not connected to it).
It seems to me it would be easier to open-code the value because there
is no question of how the define is going to be used.
Cheers,
--
Julien Grall