Skip to content

Commit

Permalink
drivers: iommu: Add flags to iommu_domain_alloc
Browse files Browse the repository at this point in the history
Add the ability to pass flags into the iommu_domain_alloc
function to specify domain attributes.

Signed-off-by: Stepan Moskovchenko <stepanm@codeaurora.org>
  • Loading branch information
Stepan Moskovchenko authored and TomGiordano committed Jun 10, 2012
1 parent ea35b62 commit 0fa46d3
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion arch/arm/mach-msm/iommu.c
Expand Up @@ -236,7 +236,7 @@ static void __program_context(void __iomem *base, int ctx, int ncb,
mb(); mb();
} }


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);


Expand Down
2 changes: 1 addition & 1 deletion arch/arm/mach-msm/iommu_domains.c
Expand Up @@ -199,7 +199,7 @@ static int __init msm_subsystem_iommu_init(void)
int i; int i;


for (i = 0; i < (ARRAY_SIZE(msm_iommu_domains) - 1); i++) for (i = 0; i < (ARRAY_SIZE(msm_iommu_domains) - 1); i++)
msm_iommu_domains[i] = iommu_domain_alloc(); msm_iommu_domains[i] = iommu_domain_alloc(0);


for (i = 0; i < ARRAY_SIZE(msm_iommu_iova_pools); i++) { for (i = 0; i < ARRAY_SIZE(msm_iommu_iova_pools); i++) {
mutex_init(&msm_iommu_iova_pools[i].pool_mutex); mutex_init(&msm_iommu_iova_pools[i].pool_mutex);
Expand Down
4 changes: 2 additions & 2 deletions drivers/base/iommu.c
Expand Up @@ -39,7 +39,7 @@ bool iommu_found(void)
} }
EXPORT_SYMBOL_GPL(iommu_found); EXPORT_SYMBOL_GPL(iommu_found);


struct iommu_domain *iommu_domain_alloc(void) struct iommu_domain *iommu_domain_alloc(int flags)
{ {
struct iommu_domain *domain; struct iommu_domain *domain;
int ret; int ret;
Expand All @@ -48,7 +48,7 @@ struct iommu_domain *iommu_domain_alloc(void)
if (!domain) if (!domain)
return NULL; return NULL;


ret = iommu_ops->domain_init(domain); ret = iommu_ops->domain_init(domain, flags);
if (ret) if (ret)
goto out_free; goto out_free;


Expand Down
6 changes: 3 additions & 3 deletions include/linux/iommu.h
Expand Up @@ -32,7 +32,7 @@ struct iommu_domain {
#define IOMMU_CAP_CACHE_COHERENCY 0x1 #define IOMMU_CAP_CACHE_COHERENCY 0x1


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);
Expand All @@ -50,7 +50,7 @@ struct iommu_ops {


extern void register_iommu(struct iommu_ops *ops); extern void register_iommu(struct iommu_ops *ops);
extern bool iommu_found(void); extern bool iommu_found(void);
extern struct iommu_domain *iommu_domain_alloc(void); extern struct iommu_domain *iommu_domain_alloc(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);
Expand All @@ -76,7 +76,7 @@ static inline bool iommu_found(void)
return false; return false;
} }


static inline struct iommu_domain *iommu_domain_alloc(void) static inline struct iommu_domain *iommu_domain_alloc(int flags)
{ {
return NULL; return NULL;
} }
Expand Down
2 changes: 1 addition & 1 deletion virt/kvm/iommu.c
Expand Up @@ -223,7 +223,7 @@ int kvm_iommu_map_guest(struct kvm *kvm)
return -ENODEV; return -ENODEV;
} }


kvm->arch.iommu_domain = iommu_domain_alloc(); kvm->arch.iommu_domain = iommu_domain_alloc(0);
if (!kvm->arch.iommu_domain) if (!kvm->arch.iommu_domain)
return -ENOMEM; return -ENOMEM;


Expand Down

0 comments on commit 0fa46d3

Please sign in to comment.