diff options
| -rw-r--r-- | drivers/iommu/iommu.c | 6 | ||||
| -rw-r--r-- | include/linux/iommu.h | 6 |
2 files changed, 11 insertions, 1 deletions
diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c index 3a072596b1b2..bd2d4d2764dd 100644 --- a/drivers/iommu/iommu.c +++ b/drivers/iommu/iommu.c | |||
| @@ -43,6 +43,12 @@ EXPORT_SYMBOL_GPL(iommu_found); | |||
| 43 | * iommu_set_fault_handler() - set a fault handler for an iommu domain | 43 | * iommu_set_fault_handler() - set a fault handler for an iommu domain |
| 44 | * @domain: iommu domain | 44 | * @domain: iommu domain |
| 45 | * @handler: fault handler | 45 | * @handler: fault handler |
| 46 | * | ||
| 47 | * This function should be used by IOMMU users which want to be notified | ||
| 48 | * whenever an IOMMU fault happens. | ||
| 49 | * | ||
| 50 | * The fault handler itself should return 0 on success, and an appropriate | ||
| 51 | * error code otherwise. | ||
| 46 | */ | 52 | */ |
| 47 | void iommu_set_fault_handler(struct iommu_domain *domain, | 53 | void iommu_set_fault_handler(struct iommu_domain *domain, |
| 48 | iommu_fault_handler_t handler) | 54 | iommu_fault_handler_t handler) |
diff --git a/include/linux/iommu.h b/include/linux/iommu.h index d084e8777e0e..ddad0ae0a433 100644 --- a/include/linux/iommu.h +++ b/include/linux/iommu.h | |||
| @@ -98,11 +98,15 @@ extern void iommu_set_fault_handler(struct iommu_domain *domain, | |||
| 98 | * Returns 0 on success and an appropriate error code otherwise (if dynamic | 98 | * Returns 0 on success and an appropriate error code otherwise (if dynamic |
| 99 | * PTE/TLB loading will one day be supported, implementations will be able | 99 | * PTE/TLB loading will one day be supported, implementations will be able |
| 100 | * to tell whether it succeeded or not according to this return value). | 100 | * to tell whether it succeeded or not according to this return value). |
| 101 | * | ||
| 102 | * Specifically, -ENOSYS is returned if a fault handler isn't installed | ||
| 103 | * (though fault handlers can also return -ENOSYS, in case they want to | ||
| 104 | * elicit the default behavior of the IOMMU drivers). | ||
| 101 | */ | 105 | */ |
| 102 | static inline int report_iommu_fault(struct iommu_domain *domain, | 106 | static inline int report_iommu_fault(struct iommu_domain *domain, |
| 103 | struct device *dev, unsigned long iova, int flags) | 107 | struct device *dev, unsigned long iova, int flags) |
| 104 | { | 108 | { |
| 105 | int ret = 0; | 109 | int ret = -ENOSYS; |
| 106 | 110 | ||
| 107 | /* | 111 | /* |
| 108 | * if upper layers showed interest and installed a fault handler, | 112 | * if upper layers showed interest and installed a fault handler, |
