drm/etnaviv: add DMA configuration for etnaviv platform device
The etnaviv device is a virtual device backing the DRM device, which may drive multiple hardware GPU core devices. As most of the dma-mapping handling is done through the virtual device, we need to make sure that a proper DMA setup is in place. The easiest way to get a reasonable configuration is to let the virtual device share the DMA configuration with one of the GPU devices, so call of_dma_configure() with the right parameters manually. This assumes that all etnaviv driven GPU devices in the system share the same DMA configuration. If we ever encounter a SoC where the GPUs are on busses with different offsets or behind different IOMMUs that will require much deeper changes to the driver, as we would need to implement etnaviv specific versions of most of the DRM helper functions. For now we should be fine with this solution. Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Tested-by: Guido Günther <agx@sigxcpu.org> Tested-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
This commit is contained in:
parent
5b394b2ddf
commit
1a866306e0
|
@ -592,8 +592,6 @@ static int etnaviv_pdev_probe(struct platform_device *pdev)
|
||||||
struct device *dev = &pdev->dev;
|
struct device *dev = &pdev->dev;
|
||||||
struct component_match *match = NULL;
|
struct component_match *match = NULL;
|
||||||
|
|
||||||
dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32));
|
|
||||||
|
|
||||||
if (!dev->platform_data) {
|
if (!dev->platform_data) {
|
||||||
struct device_node *core_node;
|
struct device_node *core_node;
|
||||||
|
|
||||||
|
@ -655,13 +653,30 @@ static int __init etnaviv_init(void)
|
||||||
for_each_compatible_node(np, NULL, "vivante,gc") {
|
for_each_compatible_node(np, NULL, "vivante,gc") {
|
||||||
if (!of_device_is_available(np))
|
if (!of_device_is_available(np))
|
||||||
continue;
|
continue;
|
||||||
pdev = platform_device_register_simple("etnaviv", -1,
|
|
||||||
NULL, 0);
|
pdev = platform_device_alloc("etnaviv", -1);
|
||||||
if (IS_ERR(pdev)) {
|
if (!pdev) {
|
||||||
ret = PTR_ERR(pdev);
|
ret = -ENOMEM;
|
||||||
of_node_put(np);
|
of_node_put(np);
|
||||||
goto unregister_platform_driver;
|
goto unregister_platform_driver;
|
||||||
}
|
}
|
||||||
|
pdev->dev.coherent_dma_mask = DMA_BIT_MASK(40);
|
||||||
|
pdev->dev.dma_mask = &pdev->dev.coherent_dma_mask;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Apply the same DMA configuration to the virtual etnaviv
|
||||||
|
* device as the GPU we found. This assumes that all Vivante
|
||||||
|
* GPUs in the system share the same DMA constraints.
|
||||||
|
*/
|
||||||
|
of_dma_configure(&pdev->dev, np, true);
|
||||||
|
|
||||||
|
ret = platform_device_add(pdev);
|
||||||
|
if (ret) {
|
||||||
|
platform_device_put(pdev);
|
||||||
|
of_node_put(np);
|
||||||
|
goto unregister_platform_driver;
|
||||||
|
}
|
||||||
|
|
||||||
etnaviv_drm = pdev;
|
etnaviv_drm = pdev;
|
||||||
of_node_put(np);
|
of_node_put(np);
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue