Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [Medium] drm/rockchip: rockchip_drm_collect_resv_regions() ignores IOMMU_RESV_RESERVED --
commit 7e781ea37d24b597e54bf98cdf417ce94c06861d Author: Francesco Saverio Pavone <[email protected]> drm/rockchip: Map the reserved regions 1:1 in the DRM IOMMU domain This commit collects direct-mapped IOMMU reserved regions from bound VOP devices, maps them 1:1 in the DRM IOMMU domain, and reserves their IOVA ranges in private->mm. > diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c > b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c > index ba417f7e9e474..aed22787c05e2 100644 > --- a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c > +++ b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c > @@ -88,6 +88,121 @@ void rockchip_drm_dma_detach_device(struct drm_device > *drm_dev, [ ... ] > +static void rockchip_drm_collect_resv_regions(struct drm_device *drm_dev, > + struct device *dev) > +{ > + struct rockchip_drm_private *private = drm_dev->dev_private; > + struct iommu_resv_region *region; > + struct rockchip_drm_resv *resv; > + LIST_HEAD(regions); > + > + iommu_get_resv_regions(dev, ®ions); > + > + list_for_each_entry(region, ®ions, list) { > + if (region->type != IOMMU_RESV_DIRECT && > + region->type != IOMMU_RESV_DIRECT_RELAXABLE) > + continue; [Severity: Medium] Should rockchip_drm_collect_resv_regions() also record IOMMU_RESV_RESERVED regions instead of skipping them? Commit "iommu/rockchip: Report the reserved regions from the devicetree" wires of_iommu_get_resv_regions() into rk_iommu_ops, which emits IOMMU_RESV_RESERVED for an iommu-addresses memory-region without a reg property. Dropping those regions leaves them unreserved in private->mm, so rockchip_gem_iommu_map() can allocate and map GEM buffer IOVAs inside ranges that the IOMMU API contract forbids mapping. Reserving IOMMU_RESV_RESERVED ranges in private->mm (and removing them on teardown) without calling iommu_map() or iommu_unmap() would avoid handing out those IOVAs. -- Sashiko AI review ยท https://sashiko.dev/#/patchset/[email protected]?part=3
