All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3] gpu: host1x: Detach Host1x from IOMMU DMA domain on arm32
@ 2018-08-30  0:12 Dmitry Osipenko
  2018-09-26 15:12 ` Thierry Reding
  2018-09-28  2:58 ` Mikko Perttunen
  0 siblings, 2 replies; 4+ messages in thread
From: Dmitry Osipenko @ 2018-08-30  0:12 UTC (permalink / raw)
  To: Thierry Reding, Mikko Perttunen; +Cc: linux-tegra, dri-devel

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.

Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
---

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(-)

diff --git a/drivers/gpu/host1x/dev.c b/drivers/gpu/host1x/dev.c
index d88073e7d22d..de6bc4e7fa23 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"
@@ -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;
 
-- 
2.18.0

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v3] gpu: host1x: Detach Host1x from IOMMU DMA domain on arm32
  2018-08-30  0:12 [PATCH v3] gpu: host1x: Detach Host1x from IOMMU DMA domain on arm32 Dmitry Osipenko
@ 2018-09-26 15:12 ` Thierry Reding
  2018-09-28  2:58 ` Mikko Perttunen
  1 sibling, 0 replies; 4+ messages in thread
From: Thierry Reding @ 2018-09-26 15:12 UTC (permalink / raw)
  To: Dmitry Osipenko; +Cc: linux-tegra, Mikko Perttunen, dri-devel


[-- Attachment #1.1: Type: text/plain, Size: 655 bytes --]

On Thu, Aug 30, 2018 at 03:12:47AM +0300, Dmitry Osipenko wrote:
> 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.
> 
> Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
> ---
> 
> 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(-)

Applied, thanks.

Thierry

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

[-- Attachment #2: Type: text/plain, Size: 160 bytes --]

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v3] gpu: host1x: Detach Host1x from IOMMU DMA domain on arm32
  2018-08-30  0:12 [PATCH v3] gpu: host1x: Detach Host1x from IOMMU DMA domain on arm32 Dmitry Osipenko
  2018-09-26 15:12 ` Thierry Reding
@ 2018-09-28  2:58 ` Mikko Perttunen
  2018-09-28  3:00   ` Mikko Perttunen
  1 sibling, 1 reply; 4+ messages in thread
From: Mikko Perttunen @ 2018-09-28  2:58 UTC (permalink / raw)
  To: Dmitry Osipenko, Thierry Reding; +Cc: linux-tegra, dri-devel

Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>

On 30/08/2018 9.12, Dmitry Osipenko wrote:
> 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.
> 
> Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
> ---
> 
> 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(-)
> 
> diff --git a/drivers/gpu/host1x/dev.c b/drivers/gpu/host1x/dev.c
> index d88073e7d22d..de6bc4e7fa23 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"
> @@ -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;
>   
> 
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v3] gpu: host1x: Detach Host1x from IOMMU DMA domain on arm32
  2018-09-28  2:58 ` Mikko Perttunen
@ 2018-09-28  3:00   ` Mikko Perttunen
  0 siblings, 0 replies; 4+ messages in thread
From: Mikko Perttunen @ 2018-09-28  3:00 UTC (permalink / raw)
  To: Dmitry Osipenko, Thierry Reding; +Cc: linux-tegra, dri-devel

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

Mikko

On 28/09/2018 11.58, Mikko Perttunen wrote:
> Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
> 
> On 30/08/2018 9.12, Dmitry Osipenko wrote:
>> 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.
>>
>> Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
>> ---
>>
>> 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(-)
>>
>> diff --git a/drivers/gpu/host1x/dev.c b/drivers/gpu/host1x/dev.c
>> index d88073e7d22d..de6bc4e7fa23 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"
>> @@ -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;
>>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-09-28  3:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-30  0:12 [PATCH v3] gpu: host1x: Detach Host1x from IOMMU DMA domain on arm32 Dmitry Osipenko
2018-09-26 15:12 ` Thierry Reding
2018-09-28  2:58 ` Mikko Perttunen
2018-09-28  3:00   ` Mikko Perttunen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.