diff mbox series

[RFC] etnaviv: missing dma_mask

Message ID 20180814141225.6123-1-Eugeniy.Paltsev@synopsys.com
State New
Headers show
Series [RFC] etnaviv: missing dma_mask | expand

Commit Message

Eugeniy Paltsev Aug. 14, 2018, 2:12 p.m. UTC
Hi Lucas, Christoph,

After switching ARC to generic dma_noncoherent cache ops 
etnaviv driver start failing on dma maping functions because of
dma_mask lack.

So I'm wondering is it valid case to have device which is
DMA capable and doesn't have dma_mask set?

If not, then I guess something like that should work
(at least it works for ARC):

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
---
 drivers/gpu/drm/etnaviv/etnaviv_drv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Christoph Hellwig Aug. 17, 2018, 6:42 a.m. UTC | #1
On Tue, Aug 14, 2018 at 05:12:25PM +0300, Eugeniy Paltsev wrote:
> Hi Lucas, Christoph,
> 
> After switching ARC to generic dma_noncoherent cache ops 
> etnaviv driver start failing on dma maping functions because of
> dma_mask lack.
> 
> So I'm wondering is it valid case to have device which is
> DMA capable and doesn't have dma_mask set?
> 
> If not, then I guess something like that should work
> (at least it works for ARC):

This looks ok is a minimal fix:

Reviewed-by: Christoph Hellwig <hch@lst.de>

But why doesn't this device have a dma-range property in DT?
Lucas Stach Aug. 23, 2018, 8:54 a.m. UTC | #2
Am Freitag, den 17.08.2018, 08:42 +0200 schrieb Christoph Hellwig:
> On Tue, Aug 14, 2018 at 05:12:25PM +0300, Eugeniy Paltsev wrote:
> > Hi Lucas, Christoph,
> > 
> > After switching ARC to generic dma_noncoherent cache opsĀ 
> > etnaviv driver start failing on dma maping functions because of
> > dma_mask lack.
> > 
> > So I'm wondering is it valid case to have device which is
> > DMA capable and doesn't have dma_mask set?
> > 
> > If not, then I guess something like that should work
> > (at least it works for ARC):
> 
> This looks ok is a minimal fix:
> 
> Reviewed-by: Christoph Hellwig <hch@lst.de>
> 
> But why doesn't this device have a dma-range property in DT?

Because the etnaviv device is a virtual device not represented in DT,
as it is only used to expose the DRM device, which may cover multiple
GPU core devices. The GPU core devices are properly configured from DT,
but unfortunately many of the dma related operations happen through the
DRM device. We could fix this by replacing many of the DRM helpers with
etnaviv specific functions handling dma per GPU core, but it isn't a
clear win right now, as generally on SoCs with multiple GPU cores, the
devices are on the same bus and have the same dma requirements.

Regards,
Lucas
diff mbox series

Patch

diff --git a/drivers/gpu/drm/etnaviv/etnaviv_drv.c b/drivers/gpu/drm/etnaviv/etnaviv_drv.c
index 540b59fb4103..69d80937e021 100644
--- a/drivers/gpu/drm/etnaviv/etnaviv_drv.c
+++ b/drivers/gpu/drm/etnaviv/etnaviv_drv.c
@@ -593,7 +593,7 @@  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));
+	dma_coerce_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
 
 	if (!dev->platform_data) {
 		struct device_node *core_node;