[PATCH v1] gpu: host1x: Detach Host1x from IOMMU DMA domain on arm32

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Host1x is getting attached to an implicit IOMMU DMA domain if
CONFIG_ARM_DMA_USE_IOMMU=y. Since Host1x driver manages IOMMU by
itself, Host1x device 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@xxxxxxxxx>
---
 drivers/gpu/host1x/dev.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/drivers/gpu/host1x/dev.c b/drivers/gpu/host1x/dev.c
index d88073e7d22d..47624f20718d 100644
--- a/drivers/gpu/host1x/dev.c
+++ b/drivers/gpu/host1x/dev.c
@@ -29,6 +29,10 @@
 #include <trace/events/host1x.h>
 #undef CREATE_TRACE_POINTS
 
+#if IS_ENABLED(CONFIG_ARM_DMA_USE_IOMMU)
+#include <asm/dma-iommu.h>
+#endif
+
 #include "bus.h"
 #include "channel.h"
 #include "debug.h"
@@ -236,6 +240,14 @@ static int host1x_probe(struct platform_device *pdev)
 			goto put_cache;
 		}
 
+#if IS_ENABLED(CONFIG_ARM_DMA_USE_IOMMU)
+		if (pdev->dev->archdata.mapping) {
+			struct dma_iommu_mapping *mapping =
+					to_dma_iommu_mapping(pdev->dev);
+			arm_iommu_detach_device(pdev->dev);
+			arm_iommu_release_mapping(mapping);
+		}
+#endif
 		err = iommu_attach_group(host->domain, host->group);
 		if (err) {
 			if (err == -ENODEV) {
-- 
2.18.0




[Index of Archives]     [ARM Kernel]     [Linux ARM]     [Linux ARM MSM]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux