mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v3 1/2] gpu: host1x: Set DMA ops on device creation
@ 2016-02-25 10:00 Alexandre Courbot
  2016-02-25 10:00 ` [PATCH v3 2/2] gpu: host1x: Set the DMA mask for host1x devices Alexandre Courbot
  0 siblings, 1 reply; 2+ messages in thread
From: Alexandre Courbot @ 2016-02-25 10:00 UTC (permalink / raw)
  To: Thierry Reding, Terje Bergström, Stephen Warren
  Cc: dri-devel, linux-tegra, linux-kernel, gnurou, Alexandre Courbot

Currently host1x-instanciated devices have their dma_ops left to NULL,
which makes any DMA operation (like buffer import) on ARM64 fallback
to the dummy_dma_ops and fail with an error.

This patch calls of_dma_configure() with the host1x node when creating
such a device, so the proper DMA operations are set.

Suggested-by: Thierry Reding <thierry.reding@gmail.com>
Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
---
Changes since v2:
- Re-roll with patch 2/2 for completeness

 drivers/gpu/host1x/bus.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/gpu/host1x/bus.c b/drivers/gpu/host1x/bus.c
index c2e7fba370bb..c27858ae0552 100644
--- a/drivers/gpu/host1x/bus.c
+++ b/drivers/gpu/host1x/bus.c
@@ -18,6 +18,7 @@
 #include <linux/host1x.h>
 #include <linux/of.h>
 #include <linux/slab.h>
+#include <linux/of_device.h>
 
 #include "bus.h"
 #include "dev.h"
@@ -396,6 +397,7 @@ static int host1x_device_add(struct host1x *host1x,
 	device->dev.coherent_dma_mask = host1x->dev->coherent_dma_mask;
 	device->dev.dma_mask = &device->dev.coherent_dma_mask;
 	dev_set_name(&device->dev, "%s", driver->driver.name);
+	of_dma_configure(&device->dev, host1x->dev->of_node);
 	device->dev.release = host1x_device_release;
 	device->dev.bus = &host1x_bus_type;
 	device->dev.parent = host1x->dev;
-- 
2.7.1

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

* [PATCH v3 2/2] gpu: host1x: Set the DMA mask for host1x devices
  2016-02-25 10:00 [PATCH v3 1/2] gpu: host1x: Set DMA ops on device creation Alexandre Courbot
@ 2016-02-25 10:00 ` Alexandre Courbot
  0 siblings, 0 replies; 2+ messages in thread
From: Alexandre Courbot @ 2016-02-25 10:00 UTC (permalink / raw)
  To: Thierry Reding, Terje Bergström, Stephen Warren
  Cc: dri-devel, linux-tegra, linux-kernel, gnurou, Alexandre Courbot

The default DMA mask covers a 32 bits address range, but devices can
address more than that. Set the DMA mask to the actual addressable range
to avoid the use of unneeded bounce buffers.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
---
Changes since v1:
- set the mask at the bus level so of_dma_configure() does the right thing

 drivers/gpu/host1x/bus.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/host1x/bus.c b/drivers/gpu/host1x/bus.c
index c27858ae0552..e04c7114f976 100644
--- a/drivers/gpu/host1x/bus.c
+++ b/drivers/gpu/host1x/bus.c
@@ -19,6 +19,7 @@
 #include <linux/of.h>
 #include <linux/slab.h>
 #include <linux/of_device.h>
+#include <linux/dma-mapping.h>
 
 #include "bus.h"
 #include "dev.h"
@@ -394,7 +395,7 @@ static int host1x_device_add(struct host1x *host1x,
 	INIT_LIST_HEAD(&device->list);
 	device->driver = driver;
 
-	device->dev.coherent_dma_mask = host1x->dev->coherent_dma_mask;
+	device->dev.coherent_dma_mask = DMA_BIT_MASK(34);
 	device->dev.dma_mask = &device->dev.coherent_dma_mask;
 	dev_set_name(&device->dev, "%s", driver->driver.name);
 	of_dma_configure(&device->dev, host1x->dev->of_node);
-- 
2.7.1

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

end of thread, other threads:[~2016-02-25 10:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-25 10:00 [PATCH v3 1/2] gpu: host1x: Set DMA ops on device creation Alexandre Courbot
2016-02-25 10:00 ` [PATCH v3 2/2] gpu: host1x: Set the DMA mask for host1x devices Alexandre Courbot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome