diff options
author | Joerg Roedel <jroedel@suse.de> | 2015-10-21 23:51:43 +0200 |
---|---|---|
committer | Joerg Roedel <jroedel@suse.de> | 2015-10-22 00:00:49 +0200 |
commit | 1228236de5f978970fb814cc27138cdb00cbb48d (patch) | |
tree | a5b3157912558f49859458325d6bdad57dd89dd5 /drivers/iommu | |
parent | 391811e185408671180745dfd30914bb64f6368e (diff) |
iommu: Move default domain allocation to iommu_group_get_for_dev()
Now that the iommu core support for iommu groups is not
pci-centric anymore, we can move default domain allocation
to the bus independent iommu_group_get_for_dev() function.
Signed-off-by: Joerg Roedel <jroedel@suse.de>
Diffstat (limited to 'drivers/iommu')
-rw-r--r-- | drivers/iommu/iommu.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c index e2b5526506fd..abae363c7b9b 100644 --- a/drivers/iommu/iommu.c +++ b/drivers/iommu/iommu.c @@ -810,14 +810,6 @@ struct iommu_group *pci_device_group(struct device *dev) if (IS_ERR(group)) return NULL; - /* - * Try to allocate a default domain - needs support from the - * IOMMU driver. - */ - group->default_domain = __iommu_domain_alloc(pdev->dev.bus, - IOMMU_DOMAIN_DMA); - group->domain = group->default_domain; - return group; } @@ -849,6 +841,16 @@ struct iommu_group *iommu_group_get_for_dev(struct device *dev) if (IS_ERR(group)) return group; + /* + * Try to allocate a default domain - needs support from the + * IOMMU driver. + */ + if (!group->default_domain) { + group->default_domain = __iommu_domain_alloc(dev->bus, + IOMMU_DOMAIN_DMA); + group->domain = group->default_domain; + } + ret = iommu_group_add_device(group, dev); if (ret) { iommu_group_put(group); |