Lines Matching full:iommu
3 * IOMMU sysfs class support
10 #include <linux/iommu.h>
16 * As devices are added to the IOMMU, we'll add links to the group.
38 .name = "iommu",
50 * Init the struct device for the IOMMU. IOMMU specific attributes can
52 * IOMMU type.
54 int iommu_device_sysfs_add(struct iommu_device *iommu, in iommu_device_sysfs_add() argument
62 iommu->dev = kzalloc(sizeof(*iommu->dev), GFP_KERNEL); in iommu_device_sysfs_add()
63 if (!iommu->dev) in iommu_device_sysfs_add()
66 device_initialize(iommu->dev); in iommu_device_sysfs_add()
68 iommu->dev->class = &iommu_class; in iommu_device_sysfs_add()
69 iommu->dev->parent = parent; in iommu_device_sysfs_add()
70 iommu->dev->groups = groups; in iommu_device_sysfs_add()
73 ret = kobject_set_name_vargs(&iommu->dev->kobj, fmt, vargs); in iommu_device_sysfs_add()
78 ret = device_add(iommu->dev); in iommu_device_sysfs_add()
82 dev_set_drvdata(iommu->dev, iommu); in iommu_device_sysfs_add()
87 put_device(iommu->dev); in iommu_device_sysfs_add()
92 void iommu_device_sysfs_remove(struct iommu_device *iommu) in iommu_device_sysfs_remove() argument
94 dev_set_drvdata(iommu->dev, NULL); in iommu_device_sysfs_remove()
95 device_unregister(iommu->dev); in iommu_device_sysfs_remove()
96 iommu->dev = NULL; in iommu_device_sysfs_remove()
101 * IOMMU drivers can indicate a device is managed by a given IOMMU using
103 * directory of the IOMMU device in sysfs and an "iommu" link will be
104 * created under the linked device, pointing back at the IOMMU device.
106 int iommu_device_link(struct iommu_device *iommu, struct device *link) in iommu_device_link() argument
110 ret = sysfs_add_link_to_group(&iommu->dev->kobj, "devices", in iommu_device_link()
115 ret = sysfs_create_link_nowarn(&link->kobj, &iommu->dev->kobj, "iommu"); in iommu_device_link()
117 sysfs_remove_link_from_group(&iommu->dev->kobj, "devices", in iommu_device_link()
123 void iommu_device_unlink(struct iommu_device *iommu, struct device *link) in iommu_device_unlink() argument
125 sysfs_remove_link(&link->kobj, "iommu"); in iommu_device_unlink()
126 sysfs_remove_link_from_group(&iommu->dev->kobj, "devices", dev_name(link)); in iommu_device_unlink()