diff options
| author | Joerg Roedel <jroedel@suse.de> | 2017-02-01 07:23:08 -0500 |
|---|---|---|
| committer | Joerg Roedel <jroedel@suse.de> | 2017-02-10 07:44:57 -0500 |
| commit | b0119e870837dcd15a207b4701542ebac5d19b45 (patch) | |
| tree | 07c547fed49f739a7d9b4a64c8163d9908db48e2 /drivers/iommu/iommu.c | |
| parent | c09e22d5370739e16463c113525df51b5980b1d5 (diff) | |
iommu: Introduce new 'struct iommu_device'
This struct represents one hardware iommu in the iommu core
code. For now it only has the iommu-ops associated with it,
but that will be extended soon.
The register/unregister interface is also added, as well as
making use of it in the Intel and AMD IOMMU drivers.
Signed-off-by: Joerg Roedel <jroedel@suse.de>
Diffstat (limited to 'drivers/iommu/iommu.c')
| -rw-r--r-- | drivers/iommu/iommu.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c index cc569b1b66a2..1dfd70ea27e4 100644 --- a/drivers/iommu/iommu.c +++ b/drivers/iommu/iommu.c | |||
| @@ -77,6 +77,25 @@ struct iommu_group_attribute iommu_group_attr_##_name = \ | |||
| 77 | #define to_iommu_group(_kobj) \ | 77 | #define to_iommu_group(_kobj) \ |
| 78 | container_of(_kobj, struct iommu_group, kobj) | 78 | container_of(_kobj, struct iommu_group, kobj) |
| 79 | 79 | ||
| 80 | static LIST_HEAD(iommu_device_list); | ||
| 81 | static DEFINE_SPINLOCK(iommu_device_lock); | ||
| 82 | |||
| 83 | int iommu_device_register(struct iommu_device *iommu) | ||
| 84 | { | ||
| 85 | spin_lock(&iommu_device_lock); | ||
| 86 | list_add_tail(&iommu->list, &iommu_device_list); | ||
| 87 | spin_unlock(&iommu_device_lock); | ||
| 88 | |||
| 89 | return 0; | ||
| 90 | } | ||
| 91 | |||
| 92 | void iommu_device_unregister(struct iommu_device *iommu) | ||
| 93 | { | ||
| 94 | spin_lock(&iommu_device_lock); | ||
| 95 | list_del(&iommu->list); | ||
| 96 | spin_unlock(&iommu_device_lock); | ||
| 97 | } | ||
| 98 | |||
| 80 | static struct iommu_domain *__iommu_domain_alloc(struct bus_type *bus, | 99 | static struct iommu_domain *__iommu_domain_alloc(struct bus_type *bus, |
| 81 | unsigned type); | 100 | unsigned type); |
| 82 | static int __iommu_attach_device(struct iommu_domain *domain, | 101 | static int __iommu_attach_device(struct iommu_domain *domain, |
