mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-27 11:19:37 +00:00
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>
This commit is contained in:
parent
391811e185
commit
1228236de5
1 changed files with 10 additions and 8 deletions
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue