mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 18:51:56 -04:00
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 <[email protected]> Signed-off-by: Ohad Ben-Cohen <[email protected]> Signed-off-by: Joerg Roedel <[email protected]>
This commit is contained in:
parent
76e10d158e
commit
77ca233235
3 changed files with 12 additions and 7 deletions
|
|
@ -119,6 +119,7 @@ EXPORT_SYMBOL_GPL(iommu_present);
|
|||
* iommu_set_fault_handler() - set a fault handler for an iommu domain
|
||||
* @domain: iommu domain
|
||||
* @handler: fault handler
|
||||
* @token: user data, will be passed back to the fault handler
|
||||
*
|
||||
* This function should be used by IOMMU users which want to be notified
|
||||
* whenever an IOMMU fault happens.
|
||||
|
|
@ -127,11 +128,13 @@ EXPORT_SYMBOL_GPL(iommu_present);
|
|||
* error code otherwise.
|
||||
*/
|
||||
void iommu_set_fault_handler(struct iommu_domain *domain,
|
||||
iommu_fault_handler_t handler)
|
||||
iommu_fault_handler_t handler,
|
||||
void *token)
|
||||
{
|
||||
BUG_ON(!domain);
|
||||
|
||||
domain->handler = handler;
|
||||
domain->handler_token = token;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(iommu_set_fault_handler);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue