linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm/exynos: Drop local dma_parms
@ 2020-09-03 20:51 ` Robin Murphy
  2020-09-04  7:28   ` Marek Szyprowski
  2020-09-22  4:52   ` Inki Dae
  0 siblings, 2 replies; 4+ messages in thread
From: Robin Murphy @ 2020-09-03 20:51 UTC (permalink / raw)
  To: inki.dae, jy0922.shim, sw0312.kim, kyungmin.park
  Cc: linux-samsung-soc, linux-arm-kernel, dri-devel

Since commit 9495b7e92f71 ("driver core: platform: Initialize dma_parms
for platform devices"), struct platform_device already provides a
dma_parms structure, so we can save allocating another one.

Also the DMA segment size is simply a size, not a bitmask.

Signed-off-by: Robin Murphy <robin.murphy@arm.com>
---
 drivers/gpu/drm/exynos/exynos_drm_dma.c | 26 +------------------------
 1 file changed, 1 insertion(+), 25 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_dma.c b/drivers/gpu/drm/exynos/exynos_drm_dma.c
index 58b89ec11b0e..9f25a5ebbf7d 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_dma.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_dma.c
@@ -31,23 +31,6 @@
 #define EXYNOS_DEV_ADDR_START	0x20000000
 #define EXYNOS_DEV_ADDR_SIZE	0x40000000
 
-static inline int configure_dma_max_seg_size(struct device *dev)
-{
-	if (!dev->dma_parms)
-		dev->dma_parms = kzalloc(sizeof(*dev->dma_parms), GFP_KERNEL);
-	if (!dev->dma_parms)
-		return -ENOMEM;
-
-	dma_set_max_seg_size(dev, DMA_BIT_MASK(32));
-	return 0;
-}
-
-static inline void clear_dma_max_seg_size(struct device *dev)
-{
-	kfree(dev->dma_parms);
-	dev->dma_parms = NULL;
-}
-
 /*
  * drm_iommu_attach_device- attach device to iommu mapping
  *
@@ -69,9 +52,7 @@ static int drm_iommu_attach_device(struct drm_device *drm_dev,
 		return -EINVAL;
 	}
 
-	ret = configure_dma_max_seg_size(subdrv_dev);
-	if (ret)
-		return ret;
+	dma_set_max_seg_size(subdrv_dev, UINT_MAX);
 
 	if (IS_ENABLED(CONFIG_ARM_DMA_USE_IOMMU)) {
 		/*
@@ -89,9 +70,6 @@ static int drm_iommu_attach_device(struct drm_device *drm_dev,
 		ret = iommu_attach_device(priv->mapping, subdrv_dev);
 	}
 
-	if (ret)
-		clear_dma_max_seg_size(subdrv_dev);
-
 	return ret;
 }
 
@@ -114,8 +92,6 @@ static void drm_iommu_detach_device(struct drm_device *drm_dev,
 		arm_iommu_attach_device(subdrv_dev, *dma_priv);
 	} else if (IS_ENABLED(CONFIG_IOMMU_DMA))
 		iommu_detach_device(priv->mapping, subdrv_dev);
-
-	clear_dma_max_seg_size(subdrv_dev);
 }
 
 int exynos_drm_register_dma(struct drm_device *drm, struct device *dev,
-- 
2.28.0.dirty


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] drm/exynos: Drop local dma_parms
  2020-09-03 20:51 ` [PATCH] drm/exynos: Drop local dma_parms Robin Murphy
@ 2020-09-04  7:28   ` Marek Szyprowski
  2020-09-21  1:17     ` Inki Dae
  2020-09-22  4:52   ` Inki Dae
  1 sibling, 1 reply; 4+ messages in thread
From: Marek Szyprowski @ 2020-09-04  7:28 UTC (permalink / raw)
  To: Robin Murphy, inki.dae, jy0922.shim, sw0312.kim, kyungmin.park
  Cc: linux-samsung-soc, dri-devel, linux-arm-kernel

Hi Robin,

On 03.09.2020 22:51, Robin Murphy wrote:
> Since commit 9495b7e92f71 ("driver core: platform: Initialize dma_parms
> for platform devices"), struct platform_device already provides a
> dma_parms structure, so we can save allocating another one.
>
> Also the DMA segment size is simply a size, not a bitmask.
>
> Signed-off-by: Robin Murphy <robin.murphy@arm.com>

I've sent a similar patch over 2 months ago, but it looks it got lost:

https://lore.kernel.org/dri-devel/20200707110827.3760-1-m.szyprowski@samsung.com/

Inki, could You queue it for merge?

> ---
>   drivers/gpu/drm/exynos/exynos_drm_dma.c | 26 +------------------------
>   1 file changed, 1 insertion(+), 25 deletions(-)
>
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_dma.c b/drivers/gpu/drm/exynos/exynos_drm_dma.c
> index 58b89ec11b0e..9f25a5ebbf7d 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_dma.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_dma.c
> @@ -31,23 +31,6 @@
>   #define EXYNOS_DEV_ADDR_START	0x20000000
>   #define EXYNOS_DEV_ADDR_SIZE	0x40000000
>   
> -static inline int configure_dma_max_seg_size(struct device *dev)
> -{
> -	if (!dev->dma_parms)
> -		dev->dma_parms = kzalloc(sizeof(*dev->dma_parms), GFP_KERNEL);
> -	if (!dev->dma_parms)
> -		return -ENOMEM;
> -
> -	dma_set_max_seg_size(dev, DMA_BIT_MASK(32));
> -	return 0;
> -}
> -
> -static inline void clear_dma_max_seg_size(struct device *dev)
> -{
> -	kfree(dev->dma_parms);
> -	dev->dma_parms = NULL;
> -}
> -
>   /*
>    * drm_iommu_attach_device- attach device to iommu mapping
>    *
> @@ -69,9 +52,7 @@ static int drm_iommu_attach_device(struct drm_device *drm_dev,
>   		return -EINVAL;
>   	}
>   
> -	ret = configure_dma_max_seg_size(subdrv_dev);
> -	if (ret)
> -		return ret;
> +	dma_set_max_seg_size(subdrv_dev, UINT_MAX);
>   
>   	if (IS_ENABLED(CONFIG_ARM_DMA_USE_IOMMU)) {
>   		/*
> @@ -89,9 +70,6 @@ static int drm_iommu_attach_device(struct drm_device *drm_dev,
>   		ret = iommu_attach_device(priv->mapping, subdrv_dev);
>   	}
>   
> -	if (ret)
> -		clear_dma_max_seg_size(subdrv_dev);
> -
>   	return ret;
>   }
>   
> @@ -114,8 +92,6 @@ static void drm_iommu_detach_device(struct drm_device *drm_dev,
>   		arm_iommu_attach_device(subdrv_dev, *dma_priv);
>   	} else if (IS_ENABLED(CONFIG_IOMMU_DMA))
>   		iommu_detach_device(priv->mapping, subdrv_dev);
> -
> -	clear_dma_max_seg_size(subdrv_dev);
>   }
>   
>   int exynos_drm_register_dma(struct drm_device *drm, struct device *dev,

Best regards
-- 
Marek Szyprowski, PhD
Samsung R&D Institute Poland


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] drm/exynos: Drop local dma_parms
  2020-09-04  7:28   ` Marek Szyprowski
@ 2020-09-21  1:17     ` Inki Dae
  0 siblings, 0 replies; 4+ messages in thread
From: Inki Dae @ 2020-09-21  1:17 UTC (permalink / raw)
  To: Marek Szyprowski, Robin Murphy, jy0922.shim, sw0312.kim, kyungmin.park
  Cc: linux-samsung-soc, dri-devel, linux-arm-kernel

Hi Marek,

20. 9. 4. 오후 4:28에 Marek Szyprowski 이(가) 쓴 글:
> Hi Robin,
> 
> On 03.09.2020 22:51, Robin Murphy wrote:
>> Since commit 9495b7e92f71 ("driver core: platform: Initialize dma_parms
>> for platform devices"), struct platform_device already provides a
>> dma_parms structure, so we can save allocating another one.
>>
>> Also the DMA segment size is simply a size, not a bitmask.
>>
>> Signed-off-by: Robin Murphy <robin.murphy@arm.com>
> 
> I've sent a similar patch over 2 months ago, but it looks it got lost:
> 
> https://lore.kernel.org/dri-devel/20200707110827.3760-1-m.szyprowski@samsung.com/
> 
> Inki, could You queue it for merge?

Oops, sorry. Reviewed already but forgot to merge.

Thanks,
Inki Dae

> 
>> ---
>>   drivers/gpu/drm/exynos/exynos_drm_dma.c | 26 +------------------------
>>   1 file changed, 1 insertion(+), 25 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/exynos/exynos_drm_dma.c b/drivers/gpu/drm/exynos/exynos_drm_dma.c
>> index 58b89ec11b0e..9f25a5ebbf7d 100644
>> --- a/drivers/gpu/drm/exynos/exynos_drm_dma.c
>> +++ b/drivers/gpu/drm/exynos/exynos_drm_dma.c
>> @@ -31,23 +31,6 @@
>>   #define EXYNOS_DEV_ADDR_START	0x20000000
>>   #define EXYNOS_DEV_ADDR_SIZE	0x40000000
>>   
>> -static inline int configure_dma_max_seg_size(struct device *dev)
>> -{
>> -	if (!dev->dma_parms)
>> -		dev->dma_parms = kzalloc(sizeof(*dev->dma_parms), GFP_KERNEL);
>> -	if (!dev->dma_parms)
>> -		return -ENOMEM;
>> -
>> -	dma_set_max_seg_size(dev, DMA_BIT_MASK(32));
>> -	return 0;
>> -}
>> -
>> -static inline void clear_dma_max_seg_size(struct device *dev)
>> -{
>> -	kfree(dev->dma_parms);
>> -	dev->dma_parms = NULL;
>> -}
>> -
>>   /*
>>    * drm_iommu_attach_device- attach device to iommu mapping
>>    *
>> @@ -69,9 +52,7 @@ static int drm_iommu_attach_device(struct drm_device *drm_dev,
>>   		return -EINVAL;
>>   	}
>>   
>> -	ret = configure_dma_max_seg_size(subdrv_dev);
>> -	if (ret)
>> -		return ret;
>> +	dma_set_max_seg_size(subdrv_dev, UINT_MAX);
>>   
>>   	if (IS_ENABLED(CONFIG_ARM_DMA_USE_IOMMU)) {
>>   		/*
>> @@ -89,9 +70,6 @@ static int drm_iommu_attach_device(struct drm_device *drm_dev,
>>   		ret = iommu_attach_device(priv->mapping, subdrv_dev);
>>   	}
>>   
>> -	if (ret)
>> -		clear_dma_max_seg_size(subdrv_dev);
>> -
>>   	return ret;
>>   }
>>   
>> @@ -114,8 +92,6 @@ static void drm_iommu_detach_device(struct drm_device *drm_dev,
>>   		arm_iommu_attach_device(subdrv_dev, *dma_priv);
>>   	} else if (IS_ENABLED(CONFIG_IOMMU_DMA))
>>   		iommu_detach_device(priv->mapping, subdrv_dev);
>> -
>> -	clear_dma_max_seg_size(subdrv_dev);
>>   }
>>   
>>   int exynos_drm_register_dma(struct drm_device *drm, struct device *dev,
> 
> Best regards
> 

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] drm/exynos: Drop local dma_parms
  2020-09-03 20:51 ` [PATCH] drm/exynos: Drop local dma_parms Robin Murphy
  2020-09-04  7:28   ` Marek Szyprowski
@ 2020-09-22  4:52   ` Inki Dae
  1 sibling, 0 replies; 4+ messages in thread
From: Inki Dae @ 2020-09-22  4:52 UTC (permalink / raw)
  To: Robin Murphy, jy0922.shim, sw0312.kim, kyungmin.park
  Cc: linux-samsung-soc, linux-arm-kernel, dri-devel

Hi Robin,

As Marek said, he posted same patch[1] before so I merged it instead of you.
I totally forgot to merge it. :( Sorry for confusing.

[1] https://lore.kernel.org/dri-devel/20200707110827.3760-1-m.szyprowski@samsung.com/

Thanks,
Inki Dae

20. 9. 4. 오전 5:51에 Robin Murphy 이(가) 쓴 글:
> Since commit 9495b7e92f71 ("driver core: platform: Initialize dma_parms
> for platform devices"), struct platform_device already provides a
> dma_parms structure, so we can save allocating another one.
> 
> Also the DMA segment size is simply a size, not a bitmask.
> 
> Signed-off-by: Robin Murphy <robin.murphy@arm.com>
> ---
>  drivers/gpu/drm/exynos/exynos_drm_dma.c | 26 +------------------------
>  1 file changed, 1 insertion(+), 25 deletions(-)
> 
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_dma.c b/drivers/gpu/drm/exynos/exynos_drm_dma.c
> index 58b89ec11b0e..9f25a5ebbf7d 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_dma.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_dma.c
> @@ -31,23 +31,6 @@
>  #define EXYNOS_DEV_ADDR_START	0x20000000
>  #define EXYNOS_DEV_ADDR_SIZE	0x40000000
>  
> -static inline int configure_dma_max_seg_size(struct device *dev)
> -{
> -	if (!dev->dma_parms)
> -		dev->dma_parms = kzalloc(sizeof(*dev->dma_parms), GFP_KERNEL);
> -	if (!dev->dma_parms)
> -		return -ENOMEM;
> -
> -	dma_set_max_seg_size(dev, DMA_BIT_MASK(32));
> -	return 0;
> -}
> -
> -static inline void clear_dma_max_seg_size(struct device *dev)
> -{
> -	kfree(dev->dma_parms);
> -	dev->dma_parms = NULL;
> -}
> -
>  /*
>   * drm_iommu_attach_device- attach device to iommu mapping
>   *
> @@ -69,9 +52,7 @@ static int drm_iommu_attach_device(struct drm_device *drm_dev,
>  		return -EINVAL;
>  	}
>  
> -	ret = configure_dma_max_seg_size(subdrv_dev);
> -	if (ret)
> -		return ret;
> +	dma_set_max_seg_size(subdrv_dev, UINT_MAX);
>  
>  	if (IS_ENABLED(CONFIG_ARM_DMA_USE_IOMMU)) {
>  		/*
> @@ -89,9 +70,6 @@ static int drm_iommu_attach_device(struct drm_device *drm_dev,
>  		ret = iommu_attach_device(priv->mapping, subdrv_dev);
>  	}
>  
> -	if (ret)
> -		clear_dma_max_seg_size(subdrv_dev);
> -
>  	return ret;
>  }
>  
> @@ -114,8 +92,6 @@ static void drm_iommu_detach_device(struct drm_device *drm_dev,
>  		arm_iommu_attach_device(subdrv_dev, *dma_priv);
>  	} else if (IS_ENABLED(CONFIG_IOMMU_DMA))
>  		iommu_detach_device(priv->mapping, subdrv_dev);
> -
> -	clear_dma_max_seg_size(subdrv_dev);
>  }
>  
>  int exynos_drm_register_dma(struct drm_device *drm, struct device *dev,
> 

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

end of thread, other threads:[~2020-09-22  4:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CGME20200903205201eucas1p124161a3310b7a0a3ba077a8369daa45b@eucas1p1.samsung.com>
2020-09-03 20:51 ` [PATCH] drm/exynos: Drop local dma_parms Robin Murphy
2020-09-04  7:28   ` Marek Szyprowski
2020-09-21  1:17     ` Inki Dae
2020-09-22  4:52   ` Inki Dae

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).