Skip to content

Commit 8490cad

Browse files
Steven Pricemmind
authored andcommitted
drm/rockchip: Detach from ARM DMA domain in attach_device
Since commit 1ea2a07 ("iommu: Add DMA ownership management interfaces") the Rockchip display driver on the Firefly RK3288 fails to initialise properly. This is because ARM DMA domain is still attached. Let's follow the lead of exynos and tegra and add code to explicitly remove the ARM domain before attaching a new one. Fixes: 1ea2a07 ("iommu: Add DMA ownership management interfaces") Suggested-by: Robin Murphy <robin.murphy@arm.com> Signed-off-by: Steven Price <steven.price@arm.com> Signed-off-by: Heiko Stuebner <heiko@sntech.de> Link: https://patchwork.freedesktop.org/patch/msgid/20220615154830.555422-1-steven.price@arm.com
1 parent 1dbc790 commit 8490cad

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

drivers/gpu/drm/rockchip/rockchip_drm_drv.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,14 @@
2323
#include <drm/drm_probe_helper.h>
2424
#include <drm/drm_vblank.h>
2525

26+
#if defined(CONFIG_ARM_DMA_USE_IOMMU)
27+
#include <asm/dma-iommu.h>
28+
#else
29+
#define arm_iommu_detach_device(...) ({ })
30+
#define arm_iommu_release_mapping(...) ({ })
31+
#define to_dma_iommu_mapping(dev) NULL
32+
#endif
33+
2634
#include "rockchip_drm_drv.h"
2735
#include "rockchip_drm_fb.h"
2836
#include "rockchip_drm_gem.h"
@@ -49,6 +57,15 @@ int rockchip_drm_dma_attach_device(struct drm_device *drm_dev,
4957
if (!private->domain)
5058
return 0;
5159

60+
if (IS_ENABLED(CONFIG_ARM_DMA_USE_IOMMU)) {
61+
struct dma_iommu_mapping *mapping = to_dma_iommu_mapping(dev);
62+
63+
if (mapping) {
64+
arm_iommu_detach_device(dev);
65+
arm_iommu_release_mapping(mapping);
66+
}
67+
}
68+
5269
ret = iommu_attach_device(private->domain, dev);
5370
if (ret) {
5471
DRM_DEV_ERROR(dev, "Failed to attach iommu device\n");

0 commit comments

Comments
 (0)