iommu/arm: Introduce iommu_add_dt_device API
authorOleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
Thu, 26 Sep 2019 11:20:33 +0000 (14:20 +0300)
committerJulien Grall <julien.grall@arm.com>
Thu, 26 Sep 2019 14:51:52 +0000 (15:51 +0100)
commit3e27f7d4cf434fd2cee6ecb5aeebf117e1e9572c
tree565cc771b4dcc400f438be65bc24c51113e4682d
parente386739529b71bbc29ae829eb57cadf5feb92169
iommu/arm: Introduce iommu_add_dt_device API

The main puprose of this patch is to add a way to register DT device
(which is behind the IOMMU) using the generic IOMMU DT bindings [1]
before assigning that device to a domain.

So, this patch adds new "iommu_add_dt_device" API for adding DT device
to the IOMMU using generic IOMMU DT bindings and previously added
"iommu_fwspec" support. As devices can be assigned to the hardware domain
and other domains this function is called from two places: handle_device()
and iommu_do_dt_domctl().

Besides that, this patch adds new "dt_xlate" callback (borrowed from
Linux "of_xlate") for providing the driver with DT IOMMU specifier
which describes the IOMMU master interfaces of that device (device IDs, etc).
According to the generic IOMMU DT bindings the context of required
properties for IOMMU device/master node (#iommu-cells, iommus) depends
on many factors and is really driver depended thing.

Please note, all IOMMU drivers which support generic IOMMU DT bindings
should use "dt_xlate" and "add_device" callbacks.

[1] https://www.kernel.org/doc/Documentation/devicetree/bindings/iommu/iommu.txt

Signed-off-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
Acked-by: Julien Grall <julien.grall@arm.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
xen/arch/arm/domain_build.c
xen/drivers/passthrough/device_tree.c
xen/include/xen/iommu.h