drivers: iommu: Add flags to iommu_domain_alloc

Add the ability to pass flags into the iommu_domain_alloc
function to specify domain attributes.

Signed-off-by: Stepan Moskovchenko <stepanm@codeaurora.org>
This commit is contained in:
Stepan Moskovchenko
2011-08-31 17:13:32 -07:00
committed by Stephen Boyd
parent 7a9d3fc77f
commit 41b03a2df8
4 changed files with 7 additions and 7 deletions

View File

@@ -136,7 +136,7 @@ void iommu_set_fault_handler(struct iommu_domain *domain,
} }
EXPORT_SYMBOL_GPL(iommu_set_fault_handler); EXPORT_SYMBOL_GPL(iommu_set_fault_handler);
struct iommu_domain *iommu_domain_alloc(struct bus_type *bus) struct iommu_domain *iommu_domain_alloc(struct bus_type *bus, int flags)
{ {
struct iommu_domain *domain; struct iommu_domain *domain;
int ret; int ret;
@@ -150,7 +150,7 @@ struct iommu_domain *iommu_domain_alloc(struct bus_type *bus)
domain->ops = bus->iommu_ops; domain->ops = bus->iommu_ops;
ret = domain->ops->domain_init(domain); ret = domain->ops->domain_init(domain, flags);
if (ret) if (ret)
goto out_free; goto out_free;

View File

@@ -210,7 +210,7 @@ static void __program_context(void __iomem *base, int ctx, phys_addr_t pgtable)
SET_M(base, ctx, 1); SET_M(base, ctx, 1);
} }
static int msm_iommu_domain_init(struct iommu_domain *domain) static int msm_iommu_domain_init(struct iommu_domain *domain, int flags)
{ {
struct msm_priv *priv = kzalloc(sizeof(*priv), GFP_KERNEL); struct msm_priv *priv = kzalloc(sizeof(*priv), GFP_KERNEL);

View File

@@ -63,7 +63,7 @@ struct iommu_domain {
* @pgsize_bitmap: bitmap of supported page sizes * @pgsize_bitmap: bitmap of supported page sizes
*/ */
struct iommu_ops { struct iommu_ops {
int (*domain_init)(struct iommu_domain *domain); int (*domain_init)(struct iommu_domain *domain, int flags);
void (*domain_destroy)(struct iommu_domain *domain); void (*domain_destroy)(struct iommu_domain *domain);
int (*attach_dev)(struct iommu_domain *domain, struct device *dev); int (*attach_dev)(struct iommu_domain *domain, struct device *dev);
void (*detach_dev)(struct iommu_domain *domain, struct device *dev); void (*detach_dev)(struct iommu_domain *domain, struct device *dev);
@@ -85,7 +85,7 @@ struct iommu_ops {
extern int bus_set_iommu(struct bus_type *bus, struct iommu_ops *ops); extern int bus_set_iommu(struct bus_type *bus, struct iommu_ops *ops);
extern bool iommu_present(struct bus_type *bus); extern bool iommu_present(struct bus_type *bus);
extern struct iommu_domain *iommu_domain_alloc(struct bus_type *bus); extern struct iommu_domain *iommu_domain_alloc(struct bus_type *bus, int flags);
extern void iommu_domain_free(struct iommu_domain *domain); extern void iommu_domain_free(struct iommu_domain *domain);
extern int iommu_attach_device(struct iommu_domain *domain, extern int iommu_attach_device(struct iommu_domain *domain,
struct device *dev); struct device *dev);
@@ -155,7 +155,7 @@ static inline bool iommu_present(struct bus_type *bus)
return false; return false;
} }
static inline struct iommu_domain *iommu_domain_alloc(struct bus_type *bus) static inline struct iommu_domain *iommu_domain_alloc(struct bus_type *bus, int flags)
{ {
return NULL; return NULL;
} }

View File

@@ -242,7 +242,7 @@ int kvm_iommu_map_guest(struct kvm *kvm)
mutex_lock(&kvm->slots_lock); mutex_lock(&kvm->slots_lock);
kvm->arch.iommu_domain = iommu_domain_alloc(&pci_bus_type); kvm->arch.iommu_domain = iommu_domain_alloc(&pci_bus_type, 0);
if (!kvm->arch.iommu_domain) { if (!kvm->arch.iommu_domain) {
r = -ENOMEM; r = -ENOMEM;
goto out_unlock; goto out_unlock;