|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [xen staging] iommu/arm: Add iommu_dt_xlate()
commit b8f43b71dad07a4878d0ee3061fd963429a04727
Author: Oleksandr Tyshchenko <oleksandr_tyshchenko@xxxxxxxx>
AuthorDate: Fri Mar 14 13:34:50 2025 +0000
Commit: Stefano Stabellini <stefano.stabellini@xxxxxxx>
CommitDate: Mon Apr 21 17:37:41 2025 -0700
iommu/arm: Add iommu_dt_xlate()
Move code for processing DT IOMMU specifier to a separate helper.
This helper will be re-used for adding PCI devices by the subsequent
patches as we will need exact the same actions for processing
DT PCI-IOMMU specifier.
Signed-off-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@xxxxxxxx>
Signed-off-by: Stewart Hildebrand <stewart.hildebrand@xxxxxxx>
Signed-off-by: Mykyta Poturai <mykyta_poturai@xxxxxxxx>
Reviewed-by: Julien Grall <jgrall@xxxxxxxxxx>
---
xen/drivers/passthrough/device_tree.c | 42 ++++++++++++++++++++++-------------
1 file changed, 27 insertions(+), 15 deletions(-)
diff --git a/xen/drivers/passthrough/device_tree.c
b/xen/drivers/passthrough/device_tree.c
index 075fb25a37..4a1971c3fc 100644
--- a/xen/drivers/passthrough/device_tree.c
+++ b/xen/drivers/passthrough/device_tree.c
@@ -137,6 +137,30 @@ int iommu_release_dt_devices(struct domain *d)
return 0;
}
+static int iommu_dt_xlate(struct device *dev,
+ const struct dt_phandle_args *iommu_spec,
+ const struct iommu_ops *ops)
+{
+ int rc;
+
+ if ( !ops->dt_xlate )
+ return -EINVAL;
+
+ if ( !dt_device_is_available(iommu_spec->np) )
+ return 1;
+
+ rc = iommu_fwspec_init(dev, &iommu_spec->np->dev);
+ if ( rc )
+ return rc;
+
+ /*
+ * Provide DT IOMMU specifier which describes the IOMMU master
+ * interfaces of that device (device IDs, etc) to the driver.
+ * The driver is responsible to decide how to interpret them.
+ */
+ return ops->dt_xlate(dev, iommu_spec);
+}
+
int iommu_remove_dt_device(struct dt_device_node *np)
{
const struct iommu_ops *ops = iommu_get_ops();
@@ -215,27 +239,15 @@ int iommu_add_dt_device(struct dt_device_node *np)
{
/*
* The driver which supports generic IOMMU DT bindings must have
- * these callback implemented.
+ * this callback implemented.
*/
- if ( !ops->add_device || !ops->dt_xlate )
+ if ( !ops->add_device )
{
rc = -EINVAL;
goto fail;
}
- if ( !dt_device_is_available(iommu_spec.np) )
- break;
-
- rc = iommu_fwspec_init(dev, &iommu_spec.np->dev);
- if ( rc )
- break;
-
- /*
- * Provide DT IOMMU specifier which describes the IOMMU master
- * interfaces of that device (device IDs, etc) to the driver.
- * The driver is responsible to decide how to interpret them.
- */
- rc = ops->dt_xlate(dev, &iommu_spec);
+ rc = iommu_dt_xlate(dev, &iommu_spec, ops);
if ( rc )
break;
--
generated by git-patchbot for /home/xen/git/xen.git#staging
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |