mirror of
https://github.com/FEX-Emu/linux.git
synced 2024-12-15 13:22:55 +00:00
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 <ohad@wizery.com> Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
This commit is contained in:
parent
30bd918c71
commit
0ed6d2d27b
@ -43,6 +43,12 @@ EXPORT_SYMBOL_GPL(iommu_found);
|
|||||||
* iommu_set_fault_handler() - set a fault handler for an iommu domain
|
* iommu_set_fault_handler() - set a fault handler for an iommu domain
|
||||||
* @domain: iommu domain
|
* @domain: iommu domain
|
||||||
* @handler: fault handler
|
* @handler: fault handler
|
||||||
|
*
|
||||||
|
* This function should be used by IOMMU users which want to be notified
|
||||||
|
* whenever an IOMMU fault happens.
|
||||||
|
*
|
||||||
|
* The fault handler itself should return 0 on success, and an appropriate
|
||||||
|
* error code otherwise.
|
||||||
*/
|
*/
|
||||||
void iommu_set_fault_handler(struct iommu_domain *domain,
|
void iommu_set_fault_handler(struct iommu_domain *domain,
|
||||||
iommu_fault_handler_t handler)
|
iommu_fault_handler_t handler)
|
||||||
|
@ -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
|
* Returns 0 on success and an appropriate error code otherwise (if dynamic
|
||||||
* PTE/TLB loading will one day be supported, implementations will be able
|
* PTE/TLB loading will one day be supported, implementations will be able
|
||||||
* to tell whether it succeeded or not according to this return value).
|
* 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,
|
static inline int report_iommu_fault(struct iommu_domain *domain,
|
||||||
struct device *dev, unsigned long iova, int flags)
|
struct device *dev, unsigned long iova, int flags)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = -ENOSYS;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* if upper layers showed interest and installed a fault handler,
|
* if upper layers showed interest and installed a fault handler,
|
||||||
|
Loading…
Reference in New Issue
Block a user