All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/etnaviv: init DMA ops for virtual master device
@ 2018-03-09 11:20 Lucas Stach
  2018-03-09 11:34 ` Russell King - ARM Linux
  0 siblings, 1 reply; 4+ messages in thread
From: Lucas Stach @ 2018-03-09 11:20 UTC (permalink / raw)
  To: dri-devel, etnaviv; +Cc: patchwork-lst, kernel, Russell King

All the DRM GEM dma-buf import/export operations are done through the
virtual DRM master device. As this isn't instanciated from DT anymore
we need to make sure the DMA ops are set up correctly.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
---
 drivers/gpu/drm/etnaviv/etnaviv_drv.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/etnaviv/etnaviv_drv.c b/drivers/gpu/drm/etnaviv/etnaviv_drv.c
index ab50090d066c..d7666aed943b 100644
--- a/drivers/gpu/drm/etnaviv/etnaviv_drv.c
+++ b/drivers/gpu/drm/etnaviv/etnaviv_drv.c
@@ -655,7 +655,8 @@ static int etnaviv_pdev_probe(struct platform_device *pdev)
 	struct device *dev = &pdev->dev;
 	struct component_match *match = NULL;
 
-	dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32));
+	arch_setup_dma_ops(dev, 0, 0x100000000, NULL, false);
+	dma_coerce_mask_and_coherent(dev, DMA_BIT_MASK(32));
 
 	if (!dev->platform_data) {
 		struct device_node *core_node;
-- 
2.16.1

_______________________________________________
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] drm/etnaviv: init DMA ops for virtual master device
  2018-03-09 11:20 [PATCH] drm/etnaviv: init DMA ops for virtual master device Lucas Stach
@ 2018-03-09 11:34 ` Russell King - ARM Linux
  2018-03-09 14:12   ` Fabio Estevam
  0 siblings, 1 reply; 4+ messages in thread
From: Russell King - ARM Linux @ 2018-03-09 11:34 UTC (permalink / raw)
  To: Lucas Stach; +Cc: kernel, etnaviv, dri-devel, patchwork-lst

On Fri, Mar 09, 2018 at 12:20:59PM +0100, Lucas Stach wrote:
> All the DRM GEM dma-buf import/export operations are done through the
> virtual DRM master device. As this isn't instanciated from DT anymore
> we need to make sure the DMA ops are set up correctly.
> 
> Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
> ---
>  drivers/gpu/drm/etnaviv/etnaviv_drv.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/etnaviv/etnaviv_drv.c b/drivers/gpu/drm/etnaviv/etnaviv_drv.c
> index ab50090d066c..d7666aed943b 100644
> --- a/drivers/gpu/drm/etnaviv/etnaviv_drv.c
> +++ b/drivers/gpu/drm/etnaviv/etnaviv_drv.c
> @@ -655,7 +655,8 @@ static int etnaviv_pdev_probe(struct platform_device *pdev)
>  	struct device *dev = &pdev->dev;
>  	struct component_match *match = NULL;
>  
> -	dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32));
> +	arch_setup_dma_ops(dev, 0, 0x100000000, NULL, false);
> +	dma_coerce_mask_and_coherent(dev, DMA_BIT_MASK(32));

NAK.  dma_coerce_mask_and_coherent() exists for broken devices.  Please
instead ensure that the device is created with the proper default DMA
mask.

-- 
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line in suburbia: sync at 8.8Mbps down 630kbps up
According to speedtest.net: 8.21Mbps down 510kbps up
_______________________________________________
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] drm/etnaviv: init DMA ops for virtual master device
  2018-03-09 11:34 ` Russell King - ARM Linux
@ 2018-03-09 14:12   ` Fabio Estevam
  2018-03-09 14:29     ` Russell King - ARM Linux
  0 siblings, 1 reply; 4+ messages in thread
From: Fabio Estevam @ 2018-03-09 14:12 UTC (permalink / raw)
  To: Russell King - ARM Linux
  Cc: The etnaviv authors, DRI mailing list, patchwork-lst, Sascha Hauer

Hi Russell,

On Fri, Mar 9, 2018 at 8:34 AM, Russell King - ARM Linux
<linux@armlinux.org.uk> wrote:
> On Fri, Mar 09, 2018 at 12:20:59PM +0100, Lucas Stach wrote:
>> All the DRM GEM dma-buf import/export operations are done through the
>> virtual DRM master device. As this isn't instanciated from DT anymore
>> we need to make sure the DMA ops are set up correctly.
>>
>> Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
>> ---
>>  drivers/gpu/drm/etnaviv/etnaviv_drv.c | 3 ++-
>>  1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/etnaviv/etnaviv_drv.c b/drivers/gpu/drm/etnaviv/etnaviv_drv.c
>> index ab50090d066c..d7666aed943b 100644
>> --- a/drivers/gpu/drm/etnaviv/etnaviv_drv.c
>> +++ b/drivers/gpu/drm/etnaviv/etnaviv_drv.c
>> @@ -655,7 +655,8 @@ static int etnaviv_pdev_probe(struct platform_device *pdev)
>>       struct device *dev = &pdev->dev;
>>       struct component_match *match = NULL;
>>
>> -     dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32));
>> +     arch_setup_dma_ops(dev, 0, 0x100000000, NULL, false);
>> +     dma_coerce_mask_and_coherent(dev, DMA_BIT_MASK(32));
>
> NAK.  dma_coerce_mask_and_coherent() exists for broken devices.  Please
> instead ensure that the device is created with the proper default DMA
> mask.

Should it be like this (like vc4_drv.c) ?

--- a/drivers/gpu/drm/etnaviv/etnaviv_drv.c
+++ b/drivers/gpu/drm/etnaviv/etnaviv_drv.c
@@ -578,6 +578,8 @@ static int etnaviv_bind(struct device *dev)
        struct drm_device *drm;
        int ret;

+       dev->coherent_dma_mask = DMA_BIT_MASK(32);
+
        drm = drm_dev_alloc(&etnaviv_drm_driver, dev);
        if (IS_ERR(drm))
                return PTR_ERR(drm);
@@ -655,8 +657,6 @@ static int etnaviv_pdev_probe(struct platform_device *pdev)
        struct device *dev = &pdev->dev;
        struct component_match *match = NULL;

-       dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32));
-
        if (!dev->platform_data) {
                struct device_node *core_node;
_______________________________________________
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] drm/etnaviv: init DMA ops for virtual master device
  2018-03-09 14:12   ` Fabio Estevam
@ 2018-03-09 14:29     ` Russell King - ARM Linux
  0 siblings, 0 replies; 4+ messages in thread
From: Russell King - ARM Linux @ 2018-03-09 14:29 UTC (permalink / raw)
  To: Fabio Estevam
  Cc: The etnaviv authors, DRI mailing list, patchwork-lst, Sascha Hauer

On Fri, Mar 09, 2018 at 11:12:37AM -0300, Fabio Estevam wrote:
> Hi Russell,
> 
> On Fri, Mar 9, 2018 at 8:34 AM, Russell King - ARM Linux
> <linux@armlinux.org.uk> wrote:
> > On Fri, Mar 09, 2018 at 12:20:59PM +0100, Lucas Stach wrote:
> >> All the DRM GEM dma-buf import/export operations are done through the
> >> virtual DRM master device. As this isn't instanciated from DT anymore
> >> we need to make sure the DMA ops are set up correctly.
> >>
> >> Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
> >> ---
> >>  drivers/gpu/drm/etnaviv/etnaviv_drv.c | 3 ++-
> >>  1 file changed, 2 insertions(+), 1 deletion(-)
> >>
> >> diff --git a/drivers/gpu/drm/etnaviv/etnaviv_drv.c b/drivers/gpu/drm/etnaviv/etnaviv_drv.c
> >> index ab50090d066c..d7666aed943b 100644
> >> --- a/drivers/gpu/drm/etnaviv/etnaviv_drv.c
> >> +++ b/drivers/gpu/drm/etnaviv/etnaviv_drv.c
> >> @@ -655,7 +655,8 @@ static int etnaviv_pdev_probe(struct platform_device *pdev)
> >>       struct device *dev = &pdev->dev;
> >>       struct component_match *match = NULL;
> >>
> >> -     dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32));
> >> +     arch_setup_dma_ops(dev, 0, 0x100000000, NULL, false);
> >> +     dma_coerce_mask_and_coherent(dev, DMA_BIT_MASK(32));
> >
> > NAK.  dma_coerce_mask_and_coherent() exists for broken devices.  Please
> > instead ensure that the device is created with the proper default DMA
> > mask.
> 
> Should it be like this (like vc4_drv.c) ?
> 
> --- a/drivers/gpu/drm/etnaviv/etnaviv_drv.c
> +++ b/drivers/gpu/drm/etnaviv/etnaviv_drv.c
> @@ -578,6 +578,8 @@ static int etnaviv_bind(struct device *dev)
>         struct drm_device *drm;
>         int ret;
> 
> +       dev->coherent_dma_mask = DMA_BIT_MASK(32);
> +

No.  Drivers should be using dma_set_coherent_mask().

Whoever is creating this struct device has the responsibility to
initialise the DMA mask to something sensible.

-- 
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line in suburbia: sync at 8.8Mbps down 630kbps up
According to speedtest.net: 8.21Mbps down 510kbps up
_______________________________________________
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-03-09 14:29 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-09 11:20 [PATCH] drm/etnaviv: init DMA ops for virtual master device Lucas Stach
2018-03-09 11:34 ` Russell King - ARM Linux
2018-03-09 14:12   ` Fabio Estevam
2018-03-09 14:29     ` Russell King - ARM Linux

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.