Skip to contentSkip to conversation

gpu: host1x: Detach Host1x from IOMMU DMA domain on arm32

PATCH Applied Dmitry Osipenko 3 participants 4 messages Aug 30, 2018 – Sep 28, 2018

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 gpu: host1x: Detach Host1x from IOMMU DMA domain on arm32

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.

---

Changelog:

v2: Correctly placed the detachment code, now Host1x is detached regardless
of the firewall state.

v3: Compiles now.

 drivers/gpu/host1x/dev.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)
drivers/gpu/host1x/dev.c +12 -1
index d88073e7d22d..de6bc4e7fa23 100644
@@ -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"
@@ -217,7 +221,14 @@ static int host1x_probe(struct platform_device *pdev)
 		dev_err(&pdev->dev, "failed to get reset: %d\n", err);
 		return err;
 	}
-
+#if IS_ENABLED(CONFIG_ARM_DMA_USE_IOMMU)
+	if (host->dev->archdata.mapping) {
+		struct dma_iommu_mapping *mapping =
+				to_dma_iommu_mapping(host->dev);
+		arm_iommu_detach_device(host->dev);
+		arm_iommu_release_mapping(mapping);
+	}
+#endif
 	if (IS_ENABLED(CONFIG_TEGRA_HOST1X_FIREWALL))
 		goto skip_iommu;
 
Signature · 6 lines
2.18.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#1 lore raw
Quoted 10 lines · Dmitry Osipenko

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.

---

Changelog:

Quoted 7 lines

v2: Correctly placed the detachment code, now Host1x is detached regardless
of the firewall state.

v3: Compiles now.

 drivers/gpu/host1x/dev.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

Applied, thanks.

Thierry

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Reviewed-by on v3 1/1
#2 lore raw
In reply to Dmitry Osipenko
Quoted 40 lines · Dmitry Osipenko

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.

---

Changelog:

v2: Correctly placed the detachment code, now Host1x is detached regardless
of the firewall state.

v3: Compiles now.

  drivers/gpu/host1x/dev.c | 13 ++++++++++++-
  1 file changed, 12 insertions(+), 1 deletion(-)
drivers/gpu/host1x/dev.c +5 -1
index d88073e7d22d..de6bc4e7fa23 100644
@@ -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"
@@ -217,7 +221,14 @@ static int host1x_probe(struct platform_device *pdev)
  		dev_err(&pdev->dev, "failed to get reset: %d\n", err);
  		return err;
  	}
-
+#if IS_ENABLED(CONFIG_ARM_DMA_USE_IOMMU)

drivers/gpu/host1x/dev.c static int host1x_probe(struct platform_device *pdev) · line 234

Quoted 10 lines
drivers/gpu/host1x/dev.c +7 -0
+	if (host->dev->archdata.mapping) {
+		struct dma_iommu_mapping *mapping =
+				to_dma_iommu_mapping(host->dev);
+		arm_iommu_detach_device(host->dev);
+		arm_iommu_release_mapping(mapping);
+	}
+#endif
  	if (IS_ENABLED(CONFIG_TEGRA_HOST1X_FIREWALL))
  		goto skip_iommu;
 

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#3 lore raw

Hmm, I guess that was a bit late. Damn inbox filters ..

Mikko

Quoted 48 lines · Mikko Perttunen
Quoted 45 lines · Dmitry Osipenko

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.

---

Changelog:

v2: Correctly placed the detachment code, now Host1x is detached regardless of the firewall state.

v3: Compiles now.

  drivers/gpu/host1x/dev.c | 13 ++++++++++++-

  1 file changed, 12 insertions(+), 1 deletion(-)
drivers/gpu/host1x/dev.c +11 -1
index d88073e7d22d..de6bc4e7fa23 100644
@@ -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"
@@ -217,7 +221,14 @@ static int host1x_probe(struct platform_device 
 *pdev)
           dev_err(&pdev->dev, "failed to get reset: %d\n", err);
           return err;
       }
-
+#if IS_ENABLED(CONFIG_ARM_DMA_USE_IOMMU)
+    if (host->dev->archdata.mapping) {
+        struct dma_iommu_mapping *mapping =
+                to_dma_iommu_mapping(host->dev);
+        arm_iommu_detach_device(host->dev);
+        arm_iommu_release_mapping(mapping);
+    }
Quoted 8 lines

drivers/gpu/host1x/dev.c static int host1x_probe(struct platform_device *pdev) · line 233

Quoted 4 lines
drivers/gpu/host1x/dev.c +1 -0
+#endif
       if (IS_ENABLED(CONFIG_TEGRA_HOST1X_FIREWALL))
           goto skip_iommu;

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel