All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] drm/exynos: gem: Drop NONCONTIG flag for buffers allocated without IOMMU
       [not found] <CGME20171122131501eucas1p1557c57b70990b11084228e64d54726c2@eucas1p1.samsung.com>
@ 2017-11-22 13:14 ` Marek Szyprowski
  2017-11-22 17:33     ` Tobias Jakobi
  2017-11-23  5:38   ` Inki Dae
  0 siblings, 2 replies; 5+ messages in thread
From: Marek Szyprowski @ 2017-11-22 13:14 UTC (permalink / raw)
  To: dri-devel, linux-samsung-soc
  Cc: Marek Szyprowski, Inki Dae, Seung-Woo Kim,
	Bartlomiej Zolnierkiewicz, Krzysztof Kozlowski,
	Marian Mihailescu, stable

When no IOMMU is available, all GEM buffers allocated by Exynos DRM driver
are contiguous, because of the underlying dma_alloc_attrs() function
provides only such buffers. In such case it makes no sense to keep
BO_NONCONTIG flag for the allocated GEM buffers. This allows to avoid
failures for buffer contiguity checks in the subsequent operations on GEM
objects.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
CC: stable@vger.kernel.org # v4.4+
---
This issue is there since commit 0519f9a12d011 ("drm/exynos: add iommu
support for exynos drm framework"), but this patch applies cleanly
only to v4.4+ kernel releases due changes in the surrounding code.

Changelog:
v2:
- added warning message when buffer flags are updadated (requested by Inki)

v1: https://patchwork.kernel.org/patch/10034919/
- initial version
---
 drivers/gpu/drm/exynos/exynos_drm_gem.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_gem.c b/drivers/gpu/drm/exynos/exynos_drm_gem.c
index 077de014d610..4400efe3974a 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_gem.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_gem.c
@@ -247,6 +247,15 @@ struct exynos_drm_gem *exynos_drm_gem_create(struct drm_device *dev,
 	if (IS_ERR(exynos_gem))
 		return exynos_gem;
 
+	if (!is_drm_iommu_supported(dev) && (flags & EXYNOS_BO_NONCONTIG)) {
+		/*
+		 * when no IOMMU is available, all allocated buffers are
+		 * contiguous anyway, so drop EXYNOS_BO_NONCONTIG flag
+		 */
+		flags &= ~EXYNOS_BO_NONCONTIG;
+		DRM_WARN("Non-contiguous allocation is not supported without IOMMU, falling back to contiguous buffer\n");
+	}
+
 	/* set memory type and cache attribute from user side. */
 	exynos_gem->flags = flags;
 
-- 
2.14.2

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

* Re: [PATCH v2] drm/exynos: gem: Drop NONCONTIG flag for buffers allocated without IOMMU
  2017-11-22 13:14 ` [PATCH v2] drm/exynos: gem: Drop NONCONTIG flag for buffers allocated without IOMMU Marek Szyprowski
@ 2017-11-22 17:33     ` Tobias Jakobi
  2017-11-23  5:38   ` Inki Dae
  1 sibling, 0 replies; 5+ messages in thread
From: Tobias Jakobi @ 2017-11-22 17:33 UTC (permalink / raw)
  To: Marek Szyprowski, dri-devel, linux-samsung-soc
  Cc: Inki Dae, Seung-Woo Kim, Bartlomiej Zolnierkiewicz,
	Krzysztof Kozlowski, Marian Mihailescu, stable

Marek Szyprowski wrote:
> When no IOMMU is available, all GEM buffers allocated by Exynos DRM driver
> are contiguous, because of the underlying dma_alloc_attrs() function
> provides only such buffers. In such case it makes no sense to keep
> BO_NONCONTIG flag for the allocated GEM buffers. This allows to avoid
> failures for buffer contiguity checks in the subsequent operations on GEM
> objects.

Reviewed-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>

- Tobias

> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
> CC: stable@vger.kernel.org # v4.4+
> ---
> This issue is there since commit 0519f9a12d011 ("drm/exynos: add iommu
> support for exynos drm framework"), but this patch applies cleanly
> only to v4.4+ kernel releases due changes in the surrounding code.
> 
> Changelog:
> v2:
> - added warning message when buffer flags are updadated (requested by Inki)
> 
> v1: https://patchwork.kernel.org/patch/10034919/
> - initial version
> ---
>  drivers/gpu/drm/exynos/exynos_drm_gem.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_gem.c b/drivers/gpu/drm/exynos/exynos_drm_gem.c
> index 077de014d610..4400efe3974a 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_gem.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_gem.c
> @@ -247,6 +247,15 @@ struct exynos_drm_gem *exynos_drm_gem_create(struct drm_device *dev,
>  	if (IS_ERR(exynos_gem))
>  		return exynos_gem;
>  
> +	if (!is_drm_iommu_supported(dev) && (flags & EXYNOS_BO_NONCONTIG)) {
> +		/*
> +		 * when no IOMMU is available, all allocated buffers are
> +		 * contiguous anyway, so drop EXYNOS_BO_NONCONTIG flag
> +		 */
> +		flags &= ~EXYNOS_BO_NONCONTIG;
> +		DRM_WARN("Non-contiguous allocation is not supported without IOMMU, falling back to contiguous buffer\n");
> +	}
> +
>  	/* set memory type and cache attribute from user side. */
>  	exynos_gem->flags = flags;
>  
> 

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

* Re: [PATCH v2] drm/exynos: gem: Drop NONCONTIG flag for buffers allocated without IOMMU
@ 2017-11-22 17:33     ` Tobias Jakobi
  0 siblings, 0 replies; 5+ messages in thread
From: Tobias Jakobi @ 2017-11-22 17:33 UTC (permalink / raw)
  To: Marek Szyprowski, dri-devel, linux-samsung-soc
  Cc: Bartlomiej Zolnierkiewicz, Seung-Woo Kim, stable,
	Krzysztof Kozlowski, Marian Mihailescu

Marek Szyprowski wrote:
> When no IOMMU is available, all GEM buffers allocated by Exynos DRM driver
> are contiguous, because of the underlying dma_alloc_attrs() function
> provides only such buffers. In such case it makes no sense to keep
> BO_NONCONTIG flag for the allocated GEM buffers. This allows to avoid
> failures for buffer contiguity checks in the subsequent operations on GEM
> objects.

Reviewed-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>

- Tobias

> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
> CC: stable@vger.kernel.org # v4.4+
> ---
> This issue is there since commit 0519f9a12d011 ("drm/exynos: add iommu
> support for exynos drm framework"), but this patch applies cleanly
> only to v4.4+ kernel releases due changes in the surrounding code.
> 
> Changelog:
> v2:
> - added warning message when buffer flags are updadated (requested by Inki)
> 
> v1: https://patchwork.kernel.org/patch/10034919/
> - initial version
> ---
>  drivers/gpu/drm/exynos/exynos_drm_gem.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_gem.c b/drivers/gpu/drm/exynos/exynos_drm_gem.c
> index 077de014d610..4400efe3974a 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_gem.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_gem.c
> @@ -247,6 +247,15 @@ struct exynos_drm_gem *exynos_drm_gem_create(struct drm_device *dev,
>  	if (IS_ERR(exynos_gem))
>  		return exynos_gem;
>  
> +	if (!is_drm_iommu_supported(dev) && (flags & EXYNOS_BO_NONCONTIG)) {
> +		/*
> +		 * when no IOMMU is available, all allocated buffers are
> +		 * contiguous anyway, so drop EXYNOS_BO_NONCONTIG flag
> +		 */
> +		flags &= ~EXYNOS_BO_NONCONTIG;
> +		DRM_WARN("Non-contiguous allocation is not supported without IOMMU, falling back to contiguous buffer\n");
> +	}
> +
>  	/* set memory type and cache attribute from user side. */
>  	exynos_gem->flags = flags;
>  
> 

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

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

* Re: [PATCH v2] drm/exynos: gem: Drop NONCONTIG flag for buffers allocated without IOMMU
  2017-11-22 13:14 ` [PATCH v2] drm/exynos: gem: Drop NONCONTIG flag for buffers allocated without IOMMU Marek Szyprowski
  2017-11-22 17:33     ` Tobias Jakobi
@ 2017-11-23  5:38   ` Inki Dae
  2017-11-23 12:21     ` Tobias Jakobi
  1 sibling, 1 reply; 5+ messages in thread
From: Inki Dae @ 2017-11-23  5:38 UTC (permalink / raw)
  To: Marek Szyprowski, dri-devel, linux-samsung-soc
  Cc: Seung-Woo Kim, Bartlomiej Zolnierkiewicz, Krzysztof Kozlowski,
	Marian Mihailescu, stable



2017년 11월 22일 22:14에 Marek Szyprowski 이(가) 쓴 글:
> When no IOMMU is available, all GEM buffers allocated by Exynos DRM driver
> are contiguous, because of the underlying dma_alloc_attrs() function
> provides only such buffers. In such case it makes no sense to keep
> BO_NONCONTIG flag for the allocated GEM buffers. This allows to avoid
> failures for buffer contiguity checks in the subsequent operations on GEM
> objects.
> 
> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
> CC: stable@vger.kernel.org # v4.4+
> ---
> This issue is there since commit 0519f9a12d011 ("drm/exynos: add iommu
> support for exynos drm framework"), but this patch applies cleanly
> only to v4.4+ kernel releases due changes in the surrounding code.
> 
> Changelog:
> v2:
> - added warning message when buffer flags are updadated (requested by Inki)
> 
> v1: https://patchwork.kernel.org/patch/10034919/
> - initial version
> ---
>  drivers/gpu/drm/exynos/exynos_drm_gem.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_gem.c b/drivers/gpu/drm/exynos/exynos_drm_gem.c
> index 077de014d610..4400efe3974a 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_gem.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_gem.c
> @@ -247,6 +247,15 @@ struct exynos_drm_gem *exynos_drm_gem_create(struct drm_device *dev,
>  	if (IS_ERR(exynos_gem))
>  		return exynos_gem;
>  
> +	if (!is_drm_iommu_supported(dev) && (flags & EXYNOS_BO_NONCONTIG)) {
> +		/*
> +		 * when no IOMMU is available, all allocated buffers are
> +		 * contiguous anyway, so drop EXYNOS_BO_NONCONTIG flag
> +		 */
> +		flags &= ~EXYNOS_BO_NONCONTIG;
> +		DRM_WARN("Non-contiguous allocation is not supported without IOMMU, falling back to contiguous buffer\n");

WARNING: line over 80 characters

I wil change above a warning like below if you are ok,
	DRM_WARN("Changed to CONTIG buffer due to no IOMMU support.\n");


Thanks,
Inki Dae

> +	}
> +
>  	/* set memory type and cache attribute from user side. */
>  	exynos_gem->flags = flags;
>  
> 

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

* Re: [PATCH v2] drm/exynos: gem: Drop NONCONTIG flag for buffers allocated without IOMMU
  2017-11-23  5:38   ` Inki Dae
@ 2017-11-23 12:21     ` Tobias Jakobi
  0 siblings, 0 replies; 5+ messages in thread
From: Tobias Jakobi @ 2017-11-23 12:21 UTC (permalink / raw)
  To: Inki Dae, Marek Szyprowski, dri-devel, linux-samsung-soc
  Cc: Seung-Woo Kim, Bartlomiej Zolnierkiewicz, Krzysztof Kozlowski,
	Marian Mihailescu, stable

Inki Dae wrote:
> 
> 
> 2017년 11월 22일 22:14에 Marek Szyprowski 이(가) 쓴 글:
>> When no IOMMU is available, all GEM buffers allocated by Exynos DRM driver
>> are contiguous, because of the underlying dma_alloc_attrs() function
>> provides only such buffers. In such case it makes no sense to keep
>> BO_NONCONTIG flag for the allocated GEM buffers. This allows to avoid
>> failures for buffer contiguity checks in the subsequent operations on GEM
>> objects.
>>
>> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
>> CC: stable@vger.kernel.org # v4.4+
>> ---
>> This issue is there since commit 0519f9a12d011 ("drm/exynos: add iommu
>> support for exynos drm framework"), but this patch applies cleanly
>> only to v4.4+ kernel releases due changes in the surrounding code.
>>
>> Changelog:
>> v2:
>> - added warning message when buffer flags are updadated (requested by Inki)
>>
>> v1: https://patchwork.kernel.org/patch/10034919/
>> - initial version
>> ---
>>  drivers/gpu/drm/exynos/exynos_drm_gem.c | 9 +++++++++
>>  1 file changed, 9 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/exynos/exynos_drm_gem.c b/drivers/gpu/drm/exynos/exynos_drm_gem.c
>> index 077de014d610..4400efe3974a 100644
>> --- a/drivers/gpu/drm/exynos/exynos_drm_gem.c
>> +++ b/drivers/gpu/drm/exynos/exynos_drm_gem.c
>> @@ -247,6 +247,15 @@ struct exynos_drm_gem *exynos_drm_gem_create(struct drm_device *dev,
>>  	if (IS_ERR(exynos_gem))
>>  		return exynos_gem;
>>  
>> +	if (!is_drm_iommu_supported(dev) && (flags & EXYNOS_BO_NONCONTIG)) {
>> +		/*
>> +		 * when no IOMMU is available, all allocated buffers are
>> +		 * contiguous anyway, so drop EXYNOS_BO_NONCONTIG flag
>> +		 */
>> +		flags &= ~EXYNOS_BO_NONCONTIG;
>> +		DRM_WARN("Non-contiguous allocation is not supported without IOMMU, falling back to contiguous buffer\n");
> 
> WARNING: line over 80 characters
That warning is bogus. Message strings are not supposed to be split.


> I wil change above a warning like below if you are ok,
> 	DRM_WARN("Changed to CONTIG buffer due to no IOMMU support.\n");
I think Marek's message is more descriptive.

- Tobias

> 
> 
> Thanks,
> Inki Dae
> 
>> +	}
>> +
>>  	/* set memory type and cache attribute from user side. */
>>  	exynos_gem->flags = flags;
>>  
>>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

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

end of thread, other threads:[~2017-11-23 12:21 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CGME20171122131501eucas1p1557c57b70990b11084228e64d54726c2@eucas1p1.samsung.com>
2017-11-22 13:14 ` [PATCH v2] drm/exynos: gem: Drop NONCONTIG flag for buffers allocated without IOMMU Marek Szyprowski
2017-11-22 17:33   ` Tobias Jakobi
2017-11-22 17:33     ` Tobias Jakobi
2017-11-23  5:38   ` Inki Dae
2017-11-23 12:21     ` Tobias Jakobi

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.