aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitry Osipenko <digetx@gmail.com>2018-08-19 10:24:20 -0400
committerThierry Reding <treding@nvidia.com>2018-09-26 11:24:02 -0400
commit5ac93f81096a2065adb99defdb8f04ae2c19cc11 (patch)
tree2ae10b0b43c288a1690f050416249e4e0f4c9f89
parente31c8ea5aff8670275e4e451fdc3bca5fbc8a528 (diff)
drm/tegra: Detach devices from IOMMU DMA domain on arm32
All Tegra DRM devices are getting attached to an implicit IOMMU DMA domain if CONFIG_ARM_DMA_USE_IOMMU=y. Since Tegra DRM driver manages IOMMU by itself, the devices must be detached from the implicit domain using arch-specific IOMMU-API. Note that this works only for arm32 and not for arm64, which will remain broken if CONFIG_IOMMU_DMA is enabled. Signed-off-by: Dmitry Osipenko <digetx@gmail.com> Signed-off-by: Thierry Reding <treding@nvidia.com>
-rw-r--r--drivers/gpu/drm/tegra/drm.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/drivers/gpu/drm/tegra/drm.c b/drivers/gpu/drm/tegra/drm.c
index 0ee924e3d0a1..552046062ec8 100644
--- a/drivers/gpu/drm/tegra/drm.c
+++ b/drivers/gpu/drm/tegra/drm.c
@@ -15,6 +15,10 @@
15#include <drm/drm_atomic.h> 15#include <drm/drm_atomic.h>
16#include <drm/drm_atomic_helper.h> 16#include <drm/drm_atomic_helper.h>
17 17
18#if IS_ENABLED(CONFIG_ARM_DMA_USE_IOMMU)
19#include <asm/dma-iommu.h>
20#endif
21
18#include "drm.h" 22#include "drm.h"
19#include "gem.h" 23#include "gem.h"
20 24
@@ -1068,6 +1072,14 @@ struct iommu_group *host1x_client_iommu_attach(struct host1x_client *client,
1068 } 1072 }
1069 1073
1070 if (!shared || (shared && (group != tegra->group))) { 1074 if (!shared || (shared && (group != tegra->group))) {
1075#if IS_ENABLED(CONFIG_ARM_DMA_USE_IOMMU)
1076 if (client->dev->archdata.mapping) {
1077 struct dma_iommu_mapping *mapping =
1078 to_dma_iommu_mapping(client->dev);
1079 arm_iommu_detach_device(client->dev);
1080 arm_iommu_release_mapping(mapping);
1081 }
1082#endif
1071 err = iommu_attach_group(tegra->domain, group); 1083 err = iommu_attach_group(tegra->domain, group);
1072 if (err < 0) { 1084 if (err < 0) {
1073 iommu_group_put(group); 1085 iommu_group_put(group);