diff mbox

[v2] drm/etnaviv: init DMA ops for virtual master device

Message ID 20180322104324.6232-1-l.stach@pengutronix.de (mailing list archive)
State New, archived
Headers show

Commit Message

Lucas Stach March 22, 2018, 10:43 a.m. UTC
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>
---
v2: Create device with correct DMA mask/ops, instead of fixing up in
probe function.
---
 drivers/gpu/drm/etnaviv/etnaviv_drv.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

Comments

kernel test robot March 24, 2018, 1:43 a.m. UTC | #1
Hi Lucas,

I love your patch! Yet something to improve:

[auto build test ERROR on drm/drm-next]
[also build test ERROR on next-20180323]
[cannot apply to v4.16-rc6]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Lucas-Stach/drm-etnaviv-init-DMA-ops-for-virtual-master-device/20180324-045537
base:   git://people.freedesktop.org/~airlied/linux.git drm-next
config: arm-multi_v7_defconfig (attached as .config)
compiler: arm-linux-gnueabi-gcc (Debian 7.2.0-11) 7.2.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=arm 

All errors (new ones prefixed by >>):

>> ERROR: "arch_setup_dma_ops" [drivers/gpu/drm/etnaviv/etnaviv.ko] undefined!

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
diff mbox

Patch

diff --git a/drivers/gpu/drm/etnaviv/etnaviv_drv.c b/drivers/gpu/drm/etnaviv/etnaviv_drv.c
index ab50090d066c..31c49a7bc93f 100644
--- a/drivers/gpu/drm/etnaviv/etnaviv_drv.c
+++ b/drivers/gpu/drm/etnaviv/etnaviv_drv.c
@@ -655,8 +655,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;
 
@@ -693,6 +691,8 @@  static struct platform_driver etnaviv_platform_driver = {
 	},
 };
 
+static u64 etnaviv_dmamask = DMA_BIT_MASK(32);
+
 static int __init etnaviv_init(void)
 {
 	int ret;
@@ -713,10 +713,16 @@  static int __init etnaviv_init(void)
 	 * the DRM platform device.
 	 */
 	for_each_compatible_node(np, NULL, "vivante,gc") {
+		struct platform_device *pdev;
+
 		if (!of_device_is_available(np))
 			continue;
 
-		platform_device_register_simple("etnaviv", -1, NULL, 0);
+		pdev = platform_device_register_simple("etnaviv", -1, NULL, 0);
+		pdev->dev.dma_mask = &etnaviv_dmamask;
+		pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
+		arch_setup_dma_ops(&pdev->dev, 0, 0x100000000, NULL, false);
+
 		of_node_put(np);
 		break;
 	}