summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/host1x/dev.c
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2018-02-16 15:47:26 +0100
committerThomas Gleixner <tglx@linutronix.de>2018-02-16 15:47:26 +0100
commit6dee6ae9d62642e81def4d461d71f13a6496ab59 (patch)
tree6c75d416c427a59f190e197ad83fe59b7bebf656 /drivers/gpu/host1x/dev.c
parent1beaeacdc88b537703d04d5536235d0bbb36db93 (diff)
parent0b24a0bbe2147815d982d9335c41bb10c04f40bc (diff)
downloadtalos-op-linux-6dee6ae9d62642e81def4d461d71f13a6496ab59.tar.gz
talos-op-linux-6dee6ae9d62642e81def4d461d71f13a6496ab59.zip
Merge tag 'irqchip-4.16-2' of git://git.kernel.org/pub/scm/linux/kernel/git/maz/arm-platforms into irq/urgent
Pull irqchip updates for 4.16-rc2 from Marc Zyngier - A MIPS GIC fix for spurious, masked interrupts - A fix for a subtle IPI bug in GICv3 - Do not probe GICv3 ITSs that are marked as disabled - Multi-MSI support for GICv2m - Various cleanups
Diffstat (limited to 'drivers/gpu/host1x/dev.c')
-rw-r--r--drivers/gpu/host1x/dev.c36
1 files changed, 23 insertions, 13 deletions
diff --git a/drivers/gpu/host1x/dev.c b/drivers/gpu/host1x/dev.c
index bf67c3aeb634..03db71173f5d 100644
--- a/drivers/gpu/host1x/dev.c
+++ b/drivers/gpu/host1x/dev.c
@@ -218,20 +218,27 @@ static int host1x_probe(struct platform_device *pdev)
return err;
}
- if (iommu_present(&platform_bus_type)) {
+ host->group = iommu_group_get(&pdev->dev);
+ if (host->group) {
struct iommu_domain_geometry *geometry;
unsigned long order;
host->domain = iommu_domain_alloc(&platform_bus_type);
- if (!host->domain)
- return -ENOMEM;
-
- err = iommu_attach_device(host->domain, &pdev->dev);
- if (err == -ENODEV) {
- iommu_domain_free(host->domain);
- host->domain = NULL;
- goto skip_iommu;
- } else if (err) {
+ if (!host->domain) {
+ err = -ENOMEM;
+ goto put_group;
+ }
+
+ err = iommu_attach_group(host->domain, host->group);
+ if (err) {
+ if (err == -ENODEV) {
+ iommu_domain_free(host->domain);
+ host->domain = NULL;
+ iommu_group_put(host->group);
+ host->group = NULL;
+ goto skip_iommu;
+ }
+
goto fail_free_domain;
}
@@ -294,13 +301,15 @@ fail_unprepare_disable:
fail_free_channels:
host1x_channel_list_free(&host->channel_list);
fail_detach_device:
- if (host->domain) {
+ if (host->group && host->domain) {
put_iova_domain(&host->iova);
- iommu_detach_device(host->domain, &pdev->dev);
+ iommu_detach_group(host->domain, host->group);
}
fail_free_domain:
if (host->domain)
iommu_domain_free(host->domain);
+put_group:
+ iommu_group_put(host->group);
return err;
}
@@ -317,8 +326,9 @@ static int host1x_remove(struct platform_device *pdev)
if (host->domain) {
put_iova_domain(&host->iova);
- iommu_detach_device(host->domain, &pdev->dev);
+ iommu_detach_group(host->domain, host->group);
iommu_domain_free(host->domain);
+ iommu_group_put(host->group);
}
return 0;
OpenPOWER on IntegriCloud