summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/tegra
diff options
context:
space:
mode:
authorDmitry Osipenko <digetx@gmail.com>2018-08-19 17:24:20 +0300
committerThierry Reding <treding@nvidia.com>2018-09-26 17:24:02 +0200
commit5ac93f81096a2065adb99defdb8f04ae2c19cc11 (patch)
tree2ae10b0b43c288a1690f050416249e4e0f4c9f89 /drivers/gpu/drm/tegra
parente31c8ea5aff8670275e4e451fdc3bca5fbc8a528 (diff)
downloadlinux-5ac93f81096a2065adb99defdb8f04ae2c19cc11.tar.gz
linux-5ac93f81096a2065adb99defdb8f04ae2c19cc11.tar.bz2
linux-5ac93f81096a2065adb99defdb8f04ae2c19cc11.zip
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>
Diffstat (limited to 'drivers/gpu/drm/tegra')
-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 @@
#include <drm/drm_atomic.h>
#include <drm/drm_atomic_helper.h>
+#if IS_ENABLED(CONFIG_ARM_DMA_USE_IOMMU)
+#include <asm/dma-iommu.h>
+#endif
+
#include "drm.h"
#include "gem.h"
@@ -1068,6 +1072,14 @@ struct iommu_group *host1x_client_iommu_attach(struct host1x_client *client,
}
if (!shared || (shared && (group != tegra->group))) {
+#if IS_ENABLED(CONFIG_ARM_DMA_USE_IOMMU)
+ if (client->dev->archdata.mapping) {
+ struct dma_iommu_mapping *mapping =
+ to_dma_iommu_mapping(client->dev);
+ arm_iommu_detach_device(client->dev);
+ arm_iommu_release_mapping(mapping);
+ }
+#endif
err = iommu_attach_group(tegra->domain, group);
if (err < 0) {
iommu_group_put(group);