From 850c1975913d85d047e5a6e08366ea4680d212ea Mon Sep 17 00:00:00 2001 From: Sushmita Susheelendra Date: Tue, 2 Jun 2015 15:46:24 -0600 Subject: iommu: Improve client fault handling On some platforms, certain IOMMU hardware state might be cleared before reaching client fault handlers, making it difficult for client fault handlers to do much useful processing. Add some flags so that this information can be passed to client fault handlers directly, rather than expecting clients to read the hardware themselves. Also provide a mechanism for client fault handlers to request that the IOMMU driver not clear the fault or resume/retry the faulting transaction. The client fault handler can return -EBUSY to request this behavior. Change-Id: I9780beb52b4257fff99d708a493173c9fe0a9d8a Signed-off-by: Sushmita Susheelendra --- include/linux/iommu.h | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'include/linux') diff --git a/include/linux/iommu.h b/include/linux/iommu.h index 614363f84b38..1cc549a75853 100644 --- a/include/linux/iommu.h +++ b/include/linux/iommu.h @@ -39,8 +39,11 @@ struct iommu_domain; struct notifier_block; /* iommu fault flags */ -#define IOMMU_FAULT_READ 0x0 -#define IOMMU_FAULT_WRITE 0x1 +#define IOMMU_FAULT_READ (1 << 0) +#define IOMMU_FAULT_WRITE (1 << 1) +#define IOMMU_FAULT_TRANSLATION (1 << 2) +#define IOMMU_FAULT_PERMISSION (1 << 3) +#define IOMMU_FAULT_TRANSACTION_STALLED (1 << 4) typedef int (*iommu_fault_handler_t)(struct iommu_domain *, struct device *, unsigned long, int, void *); @@ -240,6 +243,11 @@ extern void iommu_domain_window_disable(struct iommu_domain *domain, u32 wnd_nr) * Specifically, -ENOSYS is returned if a fault handler isn't installed * (though fault handlers can also return -ENOSYS, in case they want to * elicit the default behavior of the IOMMU drivers). + + * Client fault handler returns -EBUSY to signal to the IOMMU driver + * that the client will take responsibility for any further fault + * handling, including clearing fault status registers or retrying + * the faulting transaction. */ static inline int report_iommu_fault(struct iommu_domain *domain, struct device *dev, unsigned long iova, int flags) -- cgit v1.2.3