diff options
author | Joerg Roedel <jroedel@suse.de> | 2017-02-01 13:23:08 +0100 |
---|---|---|
committer | Joerg Roedel <jroedel@suse.de> | 2017-02-10 13:44:57 +0100 |
commit | b0119e870837dcd15a207b4701542ebac5d19b45 (patch) | |
tree | 07c547fed49f739a7d9b4a64c8163d9908db48e2 /drivers/iommu/iommu.c | |
parent | c09e22d5370739e16463c113525df51b5980b1d5 (diff) | |
download | talos-obmc-linux-b0119e870837dcd15a207b4701542ebac5d19b45.tar.gz talos-obmc-linux-b0119e870837dcd15a207b4701542ebac5d19b45.zip |
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 = \ #define to_iommu_group(_kobj) \ container_of(_kobj, struct iommu_group, kobj) +static LIST_HEAD(iommu_device_list); +static DEFINE_SPINLOCK(iommu_device_lock); + +int iommu_device_register(struct iommu_device *iommu) +{ + spin_lock(&iommu_device_lock); + list_add_tail(&iommu->list, &iommu_device_list); + spin_unlock(&iommu_device_lock); + + return 0; +} + +void iommu_device_unregister(struct iommu_device *iommu) +{ + spin_lock(&iommu_device_lock); + list_del(&iommu->list); + spin_unlock(&iommu_device_lock); +} + static struct iommu_domain *__iommu_domain_alloc(struct bus_type *bus, unsigned type); static int __iommu_attach_device(struct iommu_domain *domain, |