aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/iommu/iommu.c
diff options
context:
space:
mode:
authorOhad Ben-Cohen <ohad@wizery.com>2012-05-21 13:20:05 -0400
committerJoerg Roedel <joerg.roedel@amd.com>2012-05-22 12:08:08 -0400
commit77ca23323594589ac8cba1c8d59bfe7e85d3cb8b (patch)
tree7b2f6e2c95e799084043e36266cecdc0a6198e01 /drivers/iommu/iommu.c
parent76e10d158efb6d4516018846f60c2ab5501900bc (diff)
iommu/core: pass a user-provided token to fault handlers
Sometimes a single IOMMU user may have to deal with several different IOMMU devices (e.g. remoteproc). When an IOMMU fault happens, such users have to regain their context in order to deal with the fault. Users can't use the private fields of neither the iommu_domain nor the IOMMU device, because those are already used by the IOMMU core and low level driver (respectively). This patch just simply allows users to pass a private token (most notably their own context pointer) to iommu_set_fault_handler(), and then makes sure it is provided back to the users whenever an IOMMU fault happens. The patch also adopts remoteproc to the new fault handling interface, but the real functionality using this (recovery of remote processors) will only be added later in a subsequent patch set. Cc: Fernando Guzman Lugo <fernando.lugo@ti.com> Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com> Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Diffstat (limited to 'drivers/iommu/iommu.c')
-rw-r--r--drivers/iommu/iommu.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
index 2198b2dbbcd3..8b9ded88e6f5 100644
--- a/drivers/iommu/iommu.c
+++ b/drivers/iommu/iommu.c
@@ -119,6 +119,7 @@ EXPORT_SYMBOL_GPL(iommu_present);
119 * iommu_set_fault_handler() - set a fault handler for an iommu domain 119 * iommu_set_fault_handler() - set a fault handler for an iommu domain
120 * @domain: iommu domain 120 * @domain: iommu domain
121 * @handler: fault handler 121 * @handler: fault handler
122 * @token: user data, will be passed back to the fault handler
122 * 123 *
123 * This function should be used by IOMMU users which want to be notified 124 * This function should be used by IOMMU users which want to be notified
124 * whenever an IOMMU fault happens. 125 * whenever an IOMMU fault happens.
@@ -127,11 +128,13 @@ EXPORT_SYMBOL_GPL(iommu_present);
127 * error code otherwise. 128 * error code otherwise.
128 */ 129 */
129void iommu_set_fault_handler(struct iommu_domain *domain, 130void iommu_set_fault_handler(struct iommu_domain *domain,
130 iommu_fault_handler_t handler) 131 iommu_fault_handler_t handler,
132 void *token)
131{ 133{
132 BUG_ON(!domain); 134 BUG_ON(!domain);
133 135
134 domain->handler = handler; 136 domain->handler = handler;
137 domain->handler_token = token;
135} 138}
136EXPORT_SYMBOL_GPL(iommu_set_fault_handler); 139EXPORT_SYMBOL_GPL(iommu_set_fault_handler);
137 140