Message ID | 150029671059.22030.9200719361237858789.sendpatchset@little-apple (mailing list archive) |
---|---|
State | Accepted |
Delegated to: | Geert Uytterhoeven |
Headers | show |
On Mon, Jul 17, 2017 at 10:05:10PM +0900, Magnus Damm wrote: > --- 0001/drivers/iommu/ipmmu-vmsa.c > +++ work/drivers/iommu/ipmmu-vmsa.c 2017-07-17 21:01:47.140607110 +0900 > @@ -35,6 +35,7 @@ > struct ipmmu_vmsa_device { > struct device *dev; > void __iomem *base; > + struct iommu_device iommu; > struct list_head list; > > unsigned int num_utlbs; > @@ -1054,6 +1055,13 @@ static int ipmmu_probe(struct platform_d > > ipmmu_device_reset(mmu); > > + iommu_device_set_ops(&mmu->iommu, &ipmmu_ops); > + iommu_device_set_fwnode(&mmu->iommu, &pdev->dev.of_node->fwnode); > + > + ret = iommu_device_register(&mmu->iommu); > + if (ret) > + return ret; > + Looks good so far, why don't you also add the iommu to sysfs with iommu_device_sysfs_add()? Joerg
--- 0001/drivers/iommu/ipmmu-vmsa.c +++ work/drivers/iommu/ipmmu-vmsa.c 2017-07-17 21:01:47.140607110 +0900 @@ -35,6 +35,7 @@ struct ipmmu_vmsa_device { struct device *dev; void __iomem *base; + struct iommu_device iommu; struct list_head list; unsigned int num_utlbs; @@ -1054,6 +1055,13 @@ static int ipmmu_probe(struct platform_d ipmmu_device_reset(mmu); + iommu_device_set_ops(&mmu->iommu, &ipmmu_ops); + iommu_device_set_fwnode(&mmu->iommu, &pdev->dev.of_node->fwnode); + + ret = iommu_device_register(&mmu->iommu); + if (ret) + return ret; + /* * We can't create the ARM mapping here as it requires the bus to have * an IOMMU, which only happens when bus_set_iommu() is called in @@ -1077,6 +1085,8 @@ static int ipmmu_remove(struct platform_ list_del(&mmu->list); spin_unlock(&ipmmu_devices_lock); + iommu_device_unregister(&mmu->iommu); + #if defined(CONFIG_ARM) && !defined(CONFIG_IOMMU_DMA) arm_iommu_release_mapping(mmu->mapping); #endif