From 7f72f4984b27344b10ef763e351988b4630e575f Mon Sep 17 00:00:00 2001 From: Mitchel Humpherys Date: Wed, 19 Aug 2015 11:33:42 -0700 Subject: [PATCH] iommu: Add flags parameter to .trigger_fault IOMMU drivers might want more control over the types of faults being triggered with iommu_trigger_fault. Add a flags parameter that can be used to provide more control over the types of faults that can be triggered. Change-Id: I2f21b383437430e957ab52070d3575e8cb3dee90 Signed-off-by: Mitchel Humpherys --- drivers/iommu/arm-smmu.c | 3 ++- drivers/iommu/iommu-debug.c | 2 +- drivers/iommu/iommu.c | 4 ++-- include/linux/iommu.h | 8 +++++--- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c index 08728c118129..9af3b2beb2b4 100644 --- a/drivers/iommu/arm-smmu.c +++ b/drivers/iommu/arm-smmu.c @@ -1203,7 +1203,8 @@ static irqreturn_t arm_smmu_global_fault(int irq, void *dev) return IRQ_HANDLED; } -static void arm_smmu_trigger_fault(struct iommu_domain *domain) +static void arm_smmu_trigger_fault(struct iommu_domain *domain, + unsigned long flags) { struct arm_smmu_domain *smmu_domain = domain->priv; struct arm_smmu_cfg *cfg = &smmu_domain->cfg; diff --git a/drivers/iommu/iommu-debug.c b/drivers/iommu/iommu-debug.c index 877291e950bc..78c566130717 100644 --- a/drivers/iommu/iommu-debug.c +++ b/drivers/iommu/iommu-debug.c @@ -95,7 +95,7 @@ static ssize_t iommu_debug_attachment_trigger_fault_write( { struct iommu_debug_attachment *attach = file->private_data; - iommu_trigger_fault(attach->domain); + iommu_trigger_fault(attach->domain, 0); return count; } diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c index 7137b9657870..19319a6af476 100644 --- a/drivers/iommu/iommu.c +++ b/drivers/iommu/iommu.c @@ -896,10 +896,10 @@ EXPORT_SYMBOL_GPL(iommu_set_fault_handler); * This function should only be used for debugging purposes, for obvious * reasons. */ -void iommu_trigger_fault(struct iommu_domain *domain) +void iommu_trigger_fault(struct iommu_domain *domain, unsigned long flags) { if (domain->ops->trigger_fault) - domain->ops->trigger_fault(domain); + domain->ops->trigger_fault(domain, flags); } struct iommu_domain *iommu_domain_alloc(struct bus_type *bus) diff --git a/include/linux/iommu.h b/include/linux/iommu.h index faf3b3dc457f..9a631f87d9d5 100644 --- a/include/linux/iommu.h +++ b/include/linux/iommu.h @@ -158,7 +158,7 @@ struct iommu_ops { u32 (*domain_get_windows)(struct iommu_domain *domain); int (*dma_supported)(struct iommu_domain *domain, struct device *dev, u64 mask); - void (*trigger_fault)(struct iommu_domain *domain); + void (*trigger_fault)(struct iommu_domain *domain, unsigned long flags); unsigned long pgsize_bitmap; }; @@ -194,7 +194,8 @@ extern phys_addr_t iommu_iova_to_phys_hard(struct iommu_domain *domain, dma_addr_t iova); extern void iommu_set_fault_handler(struct iommu_domain *domain, iommu_fault_handler_t handler, void *token); -extern void iommu_trigger_fault(struct iommu_domain *domain); +extern void iommu_trigger_fault(struct iommu_domain *domain, + unsigned long flags); extern int iommu_attach_group(struct iommu_domain *domain, struct iommu_group *group); @@ -384,7 +385,8 @@ static inline void iommu_set_fault_handler(struct iommu_domain *domain, { } -static inline void iommu_trigger_fault(struct iommu_domain *domain) +static inline void iommu_trigger_fault(struct iommu_domain *domain, + unsigned long flags) { }