Skip to content

Commit e89fe98

Browse files
committed
Merge branch 'etnaviv/fixes' of https://git.pengutronix.de/git/lst/linux into drm-fixes
one fix to get a proper DMA configuration in place for the etnaviv virtual device. I'm sending this as a fix, as a dma-mapping change at the ARC architecture side during the 4.19 cycle broke etnaviv on this platform, which gets remedied with this patch, but it also enables ARM64. Signed-off-by: Dave Airlie <airlied@redhat.com> From: Lucas Stach <l.stach@pengutronix.de> Link: https://patchwork.freedesktop.org/patch/msgid/ea1f712bf09bf9439c6b092bf2c2bde7bb01cf5e.camel@pengutronix.de
2 parents 6bf4ca7 + 1a86630 commit e89fe98

File tree

1 file changed

+21
-6
lines changed

1 file changed

+21
-6
lines changed

drivers/gpu/drm/etnaviv/etnaviv_drv.c

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -592,8 +592,6 @@ static int etnaviv_pdev_probe(struct platform_device *pdev)
592592
struct device *dev = &pdev->dev;
593593
struct component_match *match = NULL;
594594

595-
dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32));
596-
597595
if (!dev->platform_data) {
598596
struct device_node *core_node;
599597

@@ -655,13 +653,30 @@ static int __init etnaviv_init(void)
655653
for_each_compatible_node(np, NULL, "vivante,gc") {
656654
if (!of_device_is_available(np))
657655
continue;
658-
pdev = platform_device_register_simple("etnaviv", -1,
659-
NULL, 0);
660-
if (IS_ERR(pdev)) {
661-
ret = PTR_ERR(pdev);
656+
657+
pdev = platform_device_alloc("etnaviv", -1);
658+
if (!pdev) {
659+
ret = -ENOMEM;
660+
of_node_put(np);
661+
goto unregister_platform_driver;
662+
}
663+
pdev->dev.coherent_dma_mask = DMA_BIT_MASK(40);
664+
pdev->dev.dma_mask = &pdev->dev.coherent_dma_mask;
665+
666+
/*
667+
* Apply the same DMA configuration to the virtual etnaviv
668+
* device as the GPU we found. This assumes that all Vivante
669+
* GPUs in the system share the same DMA constraints.
670+
*/
671+
of_dma_configure(&pdev->dev, np, true);
672+
673+
ret = platform_device_add(pdev);
674+
if (ret) {
675+
platform_device_put(pdev);
662676
of_node_put(np);
663677
goto unregister_platform_driver;
664678
}
679+
665680
etnaviv_drm = pdev;
666681
of_node_put(np);
667682
break;

0 commit comments

Comments
 (0)