From 683f4a129f0415ded14ae968740642f69c1f5b19 Mon Sep 17 00:00:00 2001 From: Ohad Ben-Cohen Date: Tue, 27 Sep 2011 07:36:40 -0400 Subject: iommu/core: let drivers know if an iommu fault handler isn't installed Make report_iommu_fault() return -ENOSYS whenever an iommu fault handler isn't installed, so IOMMU drivers can then do their own platform-specific default behavior if they wanted. Fault handlers can still return -ENOSYS in case they want to elicit the default behavior of the IOMMU drivers. Signed-off-by: Ohad Ben-Cohen Signed-off-by: Joerg Roedel --- include/linux/iommu.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'include') 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, * Returns 0 on success and an appropriate error code otherwise (if dynamic * PTE/TLB loading will one day be supported, implementations will be able * to tell whether it succeeded or not according to this return value). + * + * 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). */ static inline int report_iommu_fault(struct iommu_domain *domain, struct device *dev, unsigned long iova, int flags) { - int ret = 0; + int ret = -ENOSYS; /* * if upper layers showed interest and installed a fault handler, -- cgit v1.2.3