The driver has no .get_resv_regions callback, so a reserved-memory node that lists a device in "iommu-addresses" is ignored: the region is neither kept out of the IOVA allocator nor mapped 1:1 in the default domain.
This matters for the VOP when the bootloader leaves a window scanning out of its own framebuffer. On RK3588 the default DMA domain is installed on the VOP MMU as soon as the MMU is resumed, with an empty page table, and the running scanout faults. On a ROCK 5B+ started from EDK2 this shows as rk_iommu fdd97e00.iommu: Enable stall request timed out, status: 0x00001d rk_iommu fdd97e00.iommu: Enable stall request timed out, status: 0x00030b Use of_iommu_get_resv_regions() as the callback, so that the core maps such a region before the MMU is enabled: the probe does not touch the hardware, and the page table is first loaded from the runtime resume. The driver is devicetree only, and calling the OF helper directly, instead of going through iommu_dma_get_resv_regions(), lets a consumer read the regions on 32-bit ARM too, where IOMMU_DMA is not available. The default domain is not a DMA domain there, so the core maps nothing and this patch alone changes nothing on 32-bit ARM. The IOVA space of the driver is 32 bits wide, so a region above 4 GiB cannot be mapped 1:1. Nothing checks for that here. Signed-off-by: Francesco Saverio Pavone <[email protected]> --- drivers/iommu/rockchip-iommu.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/iommu/rockchip-iommu.c b/drivers/iommu/rockchip-iommu.c index 1fa3110b142ad..757532a86975c 100644 --- a/drivers/iommu/rockchip-iommu.c +++ b/drivers/iommu/rockchip-iommu.c @@ -20,6 +20,7 @@ #include <linux/mm.h> #include <linux/init.h> #include <linux/of.h> +#include <linux/of_iommu.h> #include <linux/of_platform.h> #include <linux/platform_device.h> #include <linux/pm_runtime.h> @@ -1204,6 +1205,7 @@ static const struct iommu_ops rk_iommu_ops = { .probe_device = rk_iommu_probe_device, .release_device = rk_iommu_release_device, .device_group = generic_single_device_group, + .get_resv_regions = of_iommu_get_resv_regions, .of_xlate = rk_iommu_of_xlate, .default_domain_ops = &(const struct iommu_domain_ops) { .attach_dev = rk_iommu_attach_device, -- 2.54.0
