On 07/03/2025 09:20, Luca Fancellu wrote:
On 7 Mar 2025, at 09:09, Julien Grall <jul...@xen.org> wrote:
/*
* The following flags are passed to map (applicable ones also to unmap)
* operations, while some are passed back by lookup operations.
@@ -209,6 +233,8 @@ struct msi_msg;
#ifdef CONFIG_HAS_DEVICE_TREE
#include <xen/device_tree.h>
+#ifdef CONFIG_HAS_PASSTHROUGH
+
int iommu_assign_dt_device(struct domain *d, struct dt_device_node *dev);
int iommu_deassign_dt_device(struct domain *d, struct dt_device_node *dev);
int iommu_dt_domain_init(struct domain *d);
@@ -238,6 +264,26 @@ int iommu_do_dt_domctl(struct xen_domctl *domctl, struct
domain *d,
*/
int iommu_remove_dt_device(struct dt_device_node *np);
+#else
+
+static inline int iommu_assign_dt_device(struct domain *d,
+ struct dt_device_node *dev)
+{
+ return -EINVAL;
+}
+
+static inline int iommu_add_dt_device(struct dt_device_node *np)
+{
+ return 1;
I would suggest to add a comment explain what 1 means. IIRC, this means "no
iommu" present.
Would it be ok something like in iommu_domain_init:
/*
* Returns as the real iommu_add_dt_device() would: Error “no iommu" because
* !iommu_enabled due to the fact that !HAS_PASSTHROUGH
*/
That's fine with me. The iommu code is technically maintained by Jan, so
I will wait for him to confirm he is fine with the patch before committing.
Cheers,
--
Julien Grall