@@ -451,6 +451,17 @@ struct iommufd_fault {
struct wait_queue_head wait_queue;
};
+static inline int iommufd_fault_notify(struct iommufd_fault *fault,
+ struct list_head *new_fault)
+{
+ mutex_lock(&fault->mutex);
+ list_add_tail(new_fault, &fault->deliver);
+ mutex_unlock(&fault->mutex);
+
+ wake_up_interruptible(&fault->wait_queue);
+ return 0;
+}
+
struct iommufd_attach_handle {
struct iommu_attach_handle handle;
struct iommufd_device *idev;
@@ -469,7 +480,14 @@ iommufd_get_fault(struct iommufd_ucmd *ucmd, u32 id)
int iommufd_fault_alloc(struct iommufd_ucmd *ucmd);
void iommufd_fault_destroy(struct iommufd_object *obj);
-int iommufd_fault_iopf_handler(struct iopf_group *group);
+
+static inline int iommufd_fault_iopf_handler(struct iopf_group *group)
+{
+ struct iommufd_hw_pagetable *hwpt =
+ group->attach_handle->domain->fault_data;
+
+ return iommufd_fault_notify(hwpt->fault, &group->node);
+}
int iommufd_fault_domain_attach_dev(struct iommufd_hw_pagetable *hwpt,
struct iommufd_device *idev);
@@ -433,20 +433,3 @@ int iommufd_fault_alloc(struct iommufd_ucmd *ucmd)
return rc;
}
-
-int iommufd_fault_iopf_handler(struct iopf_group *group)
-{
- struct iommufd_hw_pagetable *hwpt;
- struct iommufd_fault *fault;
-
- hwpt = group->attach_handle->domain->fault_data;
- fault = hwpt->fault;
-
- mutex_lock(&fault->mutex);
- list_add_tail(&group->node, &fault->deliver);
- mutex_unlock(&fault->mutex);
-
- wake_up_interruptible(&fault->wait_queue);
-
- return 0;
-}