Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1666717
| From | Joerg Roedel <joro@8bytes.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 1/2] iommu/s390: Use iommu_group_get_for_dev() in s390_iommu_add_device() |
| Date | 2017-06-15 15:20 +0200 |
| Message-ID | <tSCQO-2X8-9@gated-at.bofh.it> (permalink) |
| References | <tSCQN-2X8-5@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
From: Joerg Roedel <jroedel@suse.de>
The iommu_group_get_for_dev() function also attaches the
device to its group, so this code doesn't need to be in the
iommu driver.
Further by using this function the driver can make use of
default domains in the future.
Signed-off-by: Joerg Roedel <jroedel@suse.de>
---
drivers/iommu/s390-iommu.c | 15 +++++----------
1 file changed, 5 insertions(+), 10 deletions(-)
diff --git a/drivers/iommu/s390-iommu.c b/drivers/iommu/s390-iommu.c
index 179e636..8788640 100644
--- a/drivers/iommu/s390-iommu.c
+++ b/drivers/iommu/s390-iommu.c
@@ -165,20 +165,14 @@ static void s390_iommu_detach_device(struct iommu_domain *domain,
static int s390_iommu_add_device(struct device *dev)
{
- struct iommu_group *group;
- int rc;
+ struct iommu_group *group = iommu_group_get_for_dev(dev);
- group = iommu_group_get(dev);
- if (!group) {
- group = iommu_group_alloc();
- if (IS_ERR(group))
- return PTR_ERR(group);
- }
+ if (IS_ERR(group))
+ return PTR_ERR(group);
- rc = iommu_group_add_device(group, dev);
iommu_group_put(group);
- return rc;
+ return 0;
}
static void s390_iommu_remove_device(struct device *dev)
@@ -344,6 +338,7 @@ static struct iommu_ops s390_iommu_ops = {
.iova_to_phys = s390_iommu_iova_to_phys,
.add_device = s390_iommu_add_device,
.remove_device = s390_iommu_remove_device,
+ .device_group = generic_device_group,
.pgsize_bitmap = S390_IOMMU_PGSIZES,
};
--
2.7.4
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 0/2 v2] iommu/s390: Improve iommu-groups and add sysfs support Joerg Roedel <joro@8bytes.org> - 2017-06-15 15:20 +0200
[PATCH 1/2] iommu/s390: Use iommu_group_get_for_dev() in s390_iommu_add_device() Joerg Roedel <joro@8bytes.org> - 2017-06-15 15:20 +0200
Re: [PATCH 1/2] iommu/s390: Use iommu_group_get_for_dev() in s390_iommu_add_device() Gerald Schaefer <gerald.schaefer@de.ibm.com> - 2017-06-16 19:40 +0200
[PATCH 2/2] iommu/s390: Add support for iommu_device handling Joerg Roedel <joro@8bytes.org> - 2017-06-15 15:20 +0200
Re: [PATCH 2/2] iommu/s390: Add support for iommu_device handling Gerald Schaefer <gerald.schaefer@de.ibm.com> - 2017-06-19 17:10 +0200
csiph-web