On 02/10/18 04:48, Yang Yang wrote:
Hi all, I have a very basic question, what's the difference betwee arm_smmu_attach_dev() and arm_smmu_add_device() in ARM SMMUv3 driver? When should I use which method?
Add/remove are the low-level interface that give the IOMMU driver a chance to do any internal housekeeping relevant to the existence of the given device (note that remove effectively only matters for hotpluggable devices). Unless you're actually writing an IOMMU driver, you probably don't need to care.
Attach/detach are the operations for managing which address space (domain) the device is currently associated with. If you want to make a driver or subsystem IOMMU-aware and explicitly control its devices' address mappings, then allocating your own domain, attaching to it, and using iommu_map/unmap() is the way to go. I'd recommend using iommu_group_get() and iommu_attach_group() in new code, since iommu_attach_device() is a bit of a legacy interface, and may not be valid for some system topologies.
Robin. _______________________________________________ iommu mailing list [email protected] https://lists.linuxfoundation.org/mailman/listinfo/iommu
