From 41b03a2df8a0bedcc14eb2f5981c9c455805fbef Mon Sep 17 00:00:00 2001 From: Stepan Moskovchenko Date: Wed, 31 Aug 2011 17:13:32 -0700 Subject: [PATCH] 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 --- drivers/iommu/iommu.c | 4 ++-- drivers/iommu/msm_iommu.c | 2 +- include/linux/iommu.h | 6 +++--- virt/kvm/iommu.c | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c index 52e42f54934..f1126834d2e 100644 --- a/drivers/iommu/iommu.c +++ b/drivers/iommu/iommu.c @@ -136,7 +136,7 @@ void iommu_set_fault_handler(struct iommu_domain *domain, } 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; int ret; @@ -150,7 +150,7 @@ struct iommu_domain *iommu_domain_alloc(struct bus_type *bus) domain->ops = bus->iommu_ops; - ret = domain->ops->domain_init(domain); + ret = domain->ops->domain_init(domain, flags); if (ret) goto out_free; diff --git a/drivers/iommu/msm_iommu.c b/drivers/iommu/msm_iommu.c index cee307e8660..8a4d9a9d4ca 100644 --- a/drivers/iommu/msm_iommu.c +++ b/drivers/iommu/msm_iommu.c @@ -210,7 +210,7 @@ static void __program_context(void __iomem *base, int ctx, phys_addr_t pgtable) 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); diff --git a/include/linux/iommu.h b/include/linux/iommu.h index 15350f2d78c..40720fc9556 100644 --- a/include/linux/iommu.h +++ b/include/linux/iommu.h @@ -63,7 +63,7 @@ struct iommu_domain { * @pgsize_bitmap: bitmap of supported page sizes */ 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); int (*attach_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 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 int iommu_attach_device(struct iommu_domain *domain, struct device *dev); @@ -155,7 +155,7 @@ static inline bool iommu_present(struct bus_type *bus) 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; } diff --git a/virt/kvm/iommu.c b/virt/kvm/iommu.c index e9fff9830bf..5aefbc49201 100644 --- a/virt/kvm/iommu.c +++ b/virt/kvm/iommu.c @@ -242,7 +242,7 @@ int kvm_iommu_map_guest(struct kvm *kvm) 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) { r = -ENOMEM; goto out_unlock;