Skip to content

Commit 41b03a2

Browse files
Stepan Moskovchenkobebarino
authored andcommitted
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 <[email protected]>
1 parent 7a9d3fc commit 41b03a2

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

drivers/iommu/iommu.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ void iommu_set_fault_handler(struct iommu_domain *domain,
136136
}
137137
EXPORT_SYMBOL_GPL(iommu_set_fault_handler);
138138

139-
struct iommu_domain *iommu_domain_alloc(struct bus_type *bus)
139+
struct iommu_domain *iommu_domain_alloc(struct bus_type *bus, int flags)
140140
{
141141
struct iommu_domain *domain;
142142
int ret;
@@ -150,7 +150,7 @@ struct iommu_domain *iommu_domain_alloc(struct bus_type *bus)
150150

151151
domain->ops = bus->iommu_ops;
152152

153-
ret = domain->ops->domain_init(domain);
153+
ret = domain->ops->domain_init(domain, flags);
154154
if (ret)
155155
goto out_free;
156156

drivers/iommu/msm_iommu.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ static void __program_context(void __iomem *base, int ctx, phys_addr_t pgtable)
210210
SET_M(base, ctx, 1);
211211
}
212212

213-
static int msm_iommu_domain_init(struct iommu_domain *domain)
213+
static int msm_iommu_domain_init(struct iommu_domain *domain, int flags)
214214
{
215215
struct msm_priv *priv = kzalloc(sizeof(*priv), GFP_KERNEL);
216216

include/linux/iommu.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ struct iommu_domain {
6363
* @pgsize_bitmap: bitmap of supported page sizes
6464
*/
6565
struct iommu_ops {
66-
int (*domain_init)(struct iommu_domain *domain);
66+
int (*domain_init)(struct iommu_domain *domain, int flags);
6767
void (*domain_destroy)(struct iommu_domain *domain);
6868
int (*attach_dev)(struct iommu_domain *domain, struct device *dev);
6969
void (*detach_dev)(struct iommu_domain *domain, struct device *dev);
@@ -85,7 +85,7 @@ struct iommu_ops {
8585

8686
extern int bus_set_iommu(struct bus_type *bus, struct iommu_ops *ops);
8787
extern bool iommu_present(struct bus_type *bus);
88-
extern struct iommu_domain *iommu_domain_alloc(struct bus_type *bus);
88+
extern struct iommu_domain *iommu_domain_alloc(struct bus_type *bus, int flags);
8989
extern void iommu_domain_free(struct iommu_domain *domain);
9090
extern int iommu_attach_device(struct iommu_domain *domain,
9191
struct device *dev);
@@ -155,7 +155,7 @@ static inline bool iommu_present(struct bus_type *bus)
155155
return false;
156156
}
157157

158-
static inline struct iommu_domain *iommu_domain_alloc(struct bus_type *bus)
158+
static inline struct iommu_domain *iommu_domain_alloc(struct bus_type *bus, int flags)
159159
{
160160
return NULL;
161161
}

virt/kvm/iommu.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ int kvm_iommu_map_guest(struct kvm *kvm)
242242

243243
mutex_lock(&kvm->slots_lock);
244244

245-
kvm->arch.iommu_domain = iommu_domain_alloc(&pci_bus_type);
245+
kvm->arch.iommu_domain = iommu_domain_alloc(&pci_bus_type, 0);
246246
if (!kvm->arch.iommu_domain) {
247247
r = -ENOMEM;
248248
goto out_unlock;

0 commit comments

Comments
 (0)