Skip to content

Commit 395b3ef

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 84048df commit 395b3ef

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
@@ -751,22 +751,16 @@ static int dcp_create_piodma_iommu_dev(struct apple_dcp *dcp)
751751
}
752752
of_node_put(node);
753753

754-
dcp->iommu_dom = iommu_paging_domain_alloc(&dcp->piodma->dev);
754+
dcp->iommu_dom = iommu_get_domain_for_dev(&dcp->piodma->dev);
755755
if (IS_ERR(dcp->iommu_dom)) {
756-
ret = PTR_ERR(dcp->iommu_dom);
756+
ret = dev_err_probe(dcp->dev, PTR_ERR(dcp->iommu_dom),
757+
"Failed to get default iommu domain for "
758+
"piodma device\n");
759+
dcp->iommu_dom = NULL;
757760
goto err_destroy_pdev;
758761
}
759762

760-
ret = iommu_attach_device(dcp->iommu_dom, &dcp->piodma->dev);
761-
if (ret) {
762-
ret = dev_err_probe(dcp->dev, ret,
763-
"Failed to attach IOMMU child domain\n");
764-
goto err_free_domain;
765-
}
766-
767763
return 0;
768-
err_free_domain:
769-
iommu_domain_free(dcp->iommu_dom);
770764
err_destroy_pdev:
771765
of_node_put(node);
772766
of_platform_device_destroy(&dcp->piodma->dev, NULL);
@@ -1140,8 +1134,7 @@ static void dcp_comp_unbind(struct device *dev, struct device *main, void *data)
11401134
iomfb_shutdown(dcp);
11411135

11421136
if (dcp->piodma) {
1143-
iommu_detach_device(dcp->iommu_dom, &dcp->piodma->dev);
1144-
iommu_domain_free(dcp->iommu_dom);
1137+
dcp->iommu_dom = NULL;
11451138
of_platform_device_destroy(&dcp->piodma->dev, NULL);
11461139
dcp->piodma = NULL;
11471140
}

0 commit comments

Comments
 (0)