Some Device Trees may expose both legacy SMMU and generic IOMMU bindings
together. However, the SMMU driver in Xen is only supporting the legacy
SMMU bindings, leading to fatal initialization errors at boot time.
This patch fixes the booting problem by adding a check to
iommu_add_dt_device: if the Xen driver doesn't support the new generic
bindings, and the device is behind an IOMMU, do not return error. The
following iommu_assign_dt_device should succeed.
This check will become superfluous, hence removable, once the Xen SMMU
driver gets support for the generic IOMMU bindings.
Signed-off-by: Stefano Stabellini <stefano.stabellini@xilinx.com>
Reviewed-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
Acked-by: Julien Grall <julien.grall@arm.com>
Release-acked-by: Juergen Gross <jgross@suse.com>
* these callback implemented.
*/
if ( !ops->add_device || !ops->dt_xlate )
- return -EINVAL;
+ {
+ /*
+ * Some Device Trees may expose both legacy SMMU and generic
+ * IOMMU bindings together. However, the SMMU driver is only
+ * supporting the former and will protect them during the
+ * initialization. So we need to skip them and not return
+ * error here.
+ *
+ * XXX: This can be dropped when the SMMU is able to deal
+ * with generic bindings.
+ */
+ if ( dt_device_is_protected(np) )
+ return 0;
+ else
+ return -EINVAL;
+ }
if ( !dt_device_is_available(iommu_spec.np) )
break;