Skip to content

Commit 07f3a48

Browse files
committed
drm: apple: Use piodma default iommu domain
Required to keep the bootloader mappings. iommu_paging_domain_alloc() will end up with an empty domain and remapping the boot loader mapping from reserved-memory is quite verbose to type. Signed-off-by: Janne Grunau <j@jannau.net>
1 parent 3c7d380 commit 07f3a48

1 file changed

Lines changed: 6 additions & 13 deletions

File tree

  • drivers/gpu/drm/apple

drivers/gpu/drm/apple/dcp.c

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -748,22 +748,16 @@ static int dcp_create_piodma_iommu_dev(struct apple_dcp *dcp)
748748
}
749749
of_node_put(node);
750750

751-
dcp->iommu_dom = iommu_paging_domain_alloc(&dcp->piodma->dev);
751+
dcp->iommu_dom = iommu_get_domain_for_dev(&dcp->piodma->dev);
752752
if (IS_ERR(dcp->iommu_dom)) {
753-
ret = PTR_ERR(dcp->iommu_dom);
753+
ret = dev_err_probe(dcp->dev, PTR_ERR(dcp->iommu_dom),
754+
"Failed to get default iommu domain for "
755+
"piodma device\n");
756+
dcp->iommu_dom = NULL;
754757
goto err_destroy_pdev;
755758
}
756759

757-
ret = iommu_attach_device(dcp->iommu_dom, &dcp->piodma->dev);
758-
if (ret) {
759-
ret = dev_err_probe(dcp->dev, ret,
760-
"Failed to attach IOMMU child domain\n");
761-
goto err_free_domain;
762-
}
763-
764760
return 0;
765-
err_free_domain:
766-
iommu_domain_free(dcp->iommu_dom);
767761
err_destroy_pdev:
768762
of_node_put(node);
769763
of_platform_device_destroy(&dcp->piodma->dev, NULL);
@@ -1137,8 +1131,7 @@ static void dcp_comp_unbind(struct device *dev, struct device *main, void *data)
11371131
iomfb_shutdown(dcp);
11381132

11391133
if (dcp->piodma) {
1140-
iommu_detach_device(dcp->iommu_dom, &dcp->piodma->dev);
1141-
iommu_domain_free(dcp->iommu_dom);
1134+
dcp->iommu_dom = NULL;
11421135
of_platform_device_destroy(&dcp->piodma->dev, NULL);
11431136
dcp->piodma = NULL;
11441137
}

0 commit comments

Comments
 (0)