iommu/arm: Add lightweight iommu_fwspec support
authorOleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
Thu, 26 Sep 2019 11:20:31 +0000 (14:20 +0300)
committerJulien Grall <julien.grall@arm.com>
Thu, 26 Sep 2019 13:35:32 +0000 (14:35 +0100)
commit292189a56c0c4f3d88ed622f699018702962d91e
tree72a75a9c50b9744b5c079f6969584a6825bed990
parentefc882ffb762a0b2eeadb60ea05a1093b5a48de8
iommu/arm: Add lightweight iommu_fwspec support

We need to have some abstract way to add new device to the IOMMU
based on the generic IOMMU DT bindings [1] which can be used for
both DT (right now) and ACPI (in future).

For that reason we can borrow the idea used in Linux these days
called "iommu_fwspec". Having this in, it will be possible
to configure IOMMU master interfaces of the device (device IDs)
from a single common place and avoid keeping almost identical look-up
implementations in each IOMMU driver.

There is no need to port the whole implementation of "iommu_fwspec"
to Xen, we could, probably, end up with a much simpler solution,
some "stripped down" version which fits our requirements.

So, this patch adds the following:
1. A common structure "iommu_fwspec" to hold the the per-device
   firmware data
2. New member "iommu_fwspec" of struct device
3. Functions/helpers to deal with "dev->iommu_fwspec"

It should be noted that in comparison of the original "iommu_fwspec"
Xen's variant doesn't contain some fields, which are not really
needed at the moment (ops, flag) and "iommu_fwnode" field was replaced
by "iommu_dev" to avoid porting a lot of code (to support "fwnode_handle")
with little benefit.

The "iommu_fwspec" support is based on the Linux's commit:
f74c2bb98776e2de508f4d607cd519873065118e "Linux 5.3-rc8"

Subsequent patches will use of that support.

[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>
xen/drivers/passthrough/arm/Makefile
xen/drivers/passthrough/arm/iommu_fwspec.c [new file with mode: 0644]
xen/include/asm-arm/device.h
xen/include/asm-arm/iommu_fwspec.h [new file with mode: 0644]