iommu: Introduce iommu domain types

This allows to handle domains differently based on their
type in the future. An IOMMU driver can implement certain
optimizations for DMA-API domains for example.

The domain types can be extended later and some of the
existing domain attributes can be migrated to become domain
flags.

Tested-by: Thierry Reding <[email protected]>
Tested-by: Heiko Stuebner <[email protected]>
Reviewed-by: Alex Williamson <[email protected]>
Acked-by: Will Deacon <[email protected]>
Signed-off-by: Joerg Roedel <[email protected]>
This commit is contained in:
Joerg Roedel 2015-03-26 13:43:05 +01:00
commit 8539c7c16b
2 changed files with 29 additions and 3 deletions

View file

@ -909,14 +909,15 @@ struct iommu_domain *iommu_domain_alloc(struct bus_type *bus)
ops = bus->iommu_ops;
if (ops->domain_alloc)
domain = ops->domain_alloc();
domain = ops->domain_alloc(IOMMU_DOMAIN_UNMANAGED);
else
domain = kzalloc(sizeof(*domain), GFP_KERNEL);
if (!domain)
return NULL;
domain->ops = bus->iommu_ops;
domain->ops = bus->iommu_ops;
domain->type = IOMMU_DOMAIN_UNMANAGED;
if (ops->domain_init && domain->ops->domain_init(domain))
goto out_free;