arm,smmu: add support for generic DT bindings. Implement add_device and dt_xlate.
authorBrian Woods <brian.woods@xilinx.com>
Tue, 3 Aug 2021 00:24:09 +0000 (17:24 -0700)
committerJulien Grall <jgrall@amazon.com>
Tue, 3 Aug 2021 09:38:55 +0000 (10:38 +0100)
commit2278d2cbb0b7c1b48b298c6c4c6a7de2271ac928
tree4748f6a3044fb0d29d87d4a5d64e4254a3bf3caa
parent029760630a9023b2b49833a00a4768b541ff50d4
arm,smmu: add support for generic DT bindings. Implement add_device and dt_xlate.

For the legacy path, arm_smmu_dt_add_device_legacy is called by
register_smmu_master scanning mmu-masters (a fwspec entry is also
created.) For the generic path, arm_smmu_dt_add_device_generic gets
called instead. Then, arm_smmu_dt_add_device_generic calls
arm_smmu_dt_add_device_legacy afterwards, shared with the legacy path.
This way most of the low level implementation is shared between the two
paths.

If both legacy bindings and generic bindings are present in device tree,
the legacy bindings are the ones that are used. That's because
mmu-masters is parsed by
xen/drivers/passthrough/arm/smmu.c:arm_smmu_device_dt_probe which is
called by arm_smmu_dt_init. It happens very early. iommus is parsed by
xen/drivers/passthrough/device_tree.c:iommu_add_dt_device which is
called by xen/arch/arm/domain_build.c:handle_device and happens
afterwards.

arm_smmu_dt_xlate_generic is a verbatim copy from Linux
(drivers/iommu/arm/arm-smmu/arm-smmu.c:arm_smmu_of_xlate, version
v5.10).

A workaround was introduced by cf4af9d6d6c (xen/arm: boot with device
trees with "mmu-masters" and "iommus") because the SMMU driver only
supported the legacy bindings. Remove it now.

Signed-off-by: Brian Woods <brian.woods@xilinx.com>
Signed-off-by: Stefano Stabellini <stefano.stabellini@xilinx.com>
Reviewed-by: Rahul Singh <rahul.singh@arm.com>
Acked-by: Julien Grall <jgrall@amazon.com>
xen/drivers/passthrough/arm/smmu.c
xen/drivers/passthrough/device_tree.c