<div dir="ltr"><div class="gmail_default" style="font-family:monospace,monospace">Thanks, this fixes the DRM driver on 5.19-rc2 on the <span>rk3288-veyron-jaq.</span></div><div class="gmail_default" style="font-family:monospace,monospace"><span><br></span></div><div class="gmail_default" style="font-family:monospace,monospace"><span>Tested-by: Tomeu Vizoso <<a href="mailto:tomeu.vizoso@collabora.com">tomeu.vizoso@collabora.com</a>></span></div><div class="gmail_default" style="font-family:monospace,monospace"><span><br></span></div><div class="gmail_default" style="font-family:monospace,monospace"><span>Cheers,</span></div><div class="gmail_default" style="font-family:monospace,monospace"><span><br></span></div><div class="gmail_default" style="font-family:monospace,monospace"><span>Tomeu<br></span></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Jun 15, 2022 at 5:52 PM Steven Price <<a href="mailto:steven.price@arm.com">steven.price@arm.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Since commit 1ea2a07a532b ("iommu: Add DMA ownership management<br>
interfaces") the Rockchip display driver on the Firefly RK3288 fails to<br>
initialise properly. This is because ARM DMA domain is still attached.<br>
<br>
Let's follow the lead of exynos and tegra and add code to explicitly<br>
remove the ARM domain before attaching a new one.<br>
<br>
Suggested-by: Robin Murphy <<a href="mailto:robin.murphy@arm.com" target="_blank">robin.murphy@arm.com</a>><br>
Signed-off-by: Steven Price <<a href="mailto:steven.price@arm.com" target="_blank">steven.price@arm.com</a>><br>
---<br>
See also the thread[1] where I reported the regression.<br>
<br>
[1] <a href="https://lore.kernel.org/linux-kernel/da9cca0a-ec5b-2e73-9de0-a930f7d947b2%40arm.com" rel="noreferrer" target="_blank">https://lore.kernel.org/linux-kernel/da9cca0a-ec5b-2e73-9de0-a930f7d947b2%40arm.com</a><br>
---<br>
drivers/gpu/drm/rockchip/rockchip_drm_drv.c | 17 +++++++++++++++++<br>
1 file changed, 17 insertions(+)<br>
<br>
diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c<br>
index 67d38f53d3e5..13ed33e74457 100644<br>
--- a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c<br>
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c<br>
@@ -23,6 +23,14 @@<br>
#include <drm/drm_probe_helper.h><br>
#include <drm/drm_vblank.h><br>
<br>
+#if defined(CONFIG_ARM_DMA_USE_IOMMU)<br>
+#include <asm/dma-iommu.h><br>
+#else<br>
+#define arm_iommu_detach_device(...) ({ })<br>
+#define arm_iommu_release_mapping(...) ({ })<br>
+#define to_dma_iommu_mapping(dev) NULL<br>
+#endif<br>
+<br>
#include "rockchip_drm_drv.h"<br>
#include "rockchip_drm_fb.h"<br>
#include "rockchip_drm_gem.h"<br>
@@ -49,6 +57,15 @@ int rockchip_drm_dma_attach_device(struct drm_device *drm_dev,<br>
if (!private->domain)<br>
return 0;<br>
<br>
+ if (IS_ENABLED(CONFIG_ARM_DMA_USE_IOMMU)) {<br>
+ struct dma_iommu_mapping *mapping = to_dma_iommu_mapping(dev);<br>
+<br>
+ if (mapping) {<br>
+ arm_iommu_detach_device(dev);<br>
+ arm_iommu_release_mapping(mapping);<br>
+ }<br>
+ }<br>
+<br>
ret = iommu_attach_device(private->domain, dev);<br>
if (ret) {<br>
DRM_DEV_ERROR(dev, "Failed to attach iommu device\n");<br>
-- <br>
2.25.1<br>
<br>
</blockquote></div>