Skip to content

Commit d210919

Browse files
digetxthierryreding
authored andcommitted
drm/tegra: Add back arm_iommu_detach_device()
DMA buffers of 2D/3D engines aren't mapped properly when CONFIG_ARM_DMA_USE_IOMMU=y. The memory management code of Tegra DRM driver has a longstanding overhaul overdue and it's not obvious where the problem is in this case. Hence let's add back the old workaround which we already had sometime before. It explicitly detaches DRM devices from the offending implicit IOMMU domain. This fixes a completely broken 2d/3d drivers in case of ARM32 multiplatform kernel config. Cc: [email protected] Fixes: fa6661b ("drm/tegra: Optionally attach clients to the IOMMU") Signed-off-by: Dmitry Osipenko <[email protected]> Signed-off-by: Thierry Reding <[email protected]>
1 parent d518596 commit d210919

File tree

1 file changed

+15
-0
lines changed
  • drivers/gpu/drm/tegra

1 file changed

+15
-0
lines changed

drivers/gpu/drm/tegra/drm.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@
2222
#include <drm/drm_prime.h>
2323
#include <drm/drm_vblank.h>
2424

25+
#if IS_ENABLED(CONFIG_ARM_DMA_USE_IOMMU)
26+
#include <asm/dma-iommu.h>
27+
#endif
28+
2529
#include "dc.h"
2630
#include "drm.h"
2731
#include "gem.h"
@@ -945,6 +949,17 @@ int host1x_client_iommu_attach(struct host1x_client *client)
945949
struct iommu_group *group = NULL;
946950
int err;
947951

952+
#if IS_ENABLED(CONFIG_ARM_DMA_USE_IOMMU)
953+
if (client->dev->archdata.mapping) {
954+
struct dma_iommu_mapping *mapping =
955+
to_dma_iommu_mapping(client->dev);
956+
arm_iommu_detach_device(client->dev);
957+
arm_iommu_release_mapping(mapping);
958+
959+
domain = iommu_get_domain_for_dev(client->dev);
960+
}
961+
#endif
962+
948963
/*
949964
* If the host1x client is already attached to an IOMMU domain that is
950965
* not the shared IOMMU domain, don't try to attach it to a different

0 commit comments

Comments
 (0)