summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSushmita Susheelendra <ssusheel@codeaurora.org>2015-06-02 15:46:24 -0600
committerDavid Keitel <dkeitel@codeaurora.org>2016-03-22 11:12:59 -0700
commit850c1975913d85d047e5a6e08366ea4680d212ea (patch)
tree8b2226d9de7791eef4124e9862017c5b8556a9f8
parent4acf40f3756009964253440fcb113c8502705bf5 (diff)
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 <ssusheel@codeaurora.org>
-rw-r--r--include/linux/iommu.h12
1 files changed, 10 insertions, 2 deletions
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)