iommufd/fault: Move two fault functions out of the header

There is no need to keep them in the header. The vEVENTQ version of these
two functions will turn out to be a different implementation and will not
share with this fault version. Thus, move them out of the header.

Link: https://patch.msgid.link/r/7eebe32f3d354799f5e28128c693c3c284740b21.1741719725.git.nicolinc@nvidia.com
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
Signed-off-by: Nicolin Chen <nicolinc@nvidia.com>
Reviewed-by: Lu Baolu <baolu.lu@linux.intel.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
This commit is contained in:
Nicolin Chen 2025-03-11 12:44:19 -07:00 committed by Jason Gunthorpe
parent 55c85fa757
commit dbf00d7d89
2 changed files with 25 additions and 25 deletions

View File

@ -138,6 +138,31 @@ static void iommufd_compose_fault_message(struct iommu_fault *fault,
hwpt_fault->cookie = cookie;
}
/* Fetch the first node out of the fault->deliver list */
static struct iopf_group *
iommufd_fault_deliver_fetch(struct iommufd_fault *fault)
{
struct list_head *list = &fault->deliver;
struct iopf_group *group = NULL;
spin_lock(&fault->lock);
if (!list_empty(list)) {
group = list_first_entry(list, struct iopf_group, node);
list_del(&group->node);
}
spin_unlock(&fault->lock);
return group;
}
/* Restore a node back to the head of the fault->deliver list */
static void iommufd_fault_deliver_restore(struct iommufd_fault *fault,
struct iopf_group *group)
{
spin_lock(&fault->lock);
list_add(&group->node, &fault->deliver);
spin_unlock(&fault->lock);
}
static ssize_t iommufd_fault_fops_read(struct file *filep, char __user *buf,
size_t count, loff_t *ppos)
{

View File

@ -472,31 +472,6 @@ struct iommufd_fault {
struct wait_queue_head wait_queue;
};
/* Fetch the first node out of the fault->deliver list */
static inline struct iopf_group *
iommufd_fault_deliver_fetch(struct iommufd_fault *fault)
{
struct list_head *list = &fault->deliver;
struct iopf_group *group = NULL;
spin_lock(&fault->lock);
if (!list_empty(list)) {
group = list_first_entry(list, struct iopf_group, node);
list_del(&group->node);
}
spin_unlock(&fault->lock);
return group;
}
/* Restore a node back to the head of the fault->deliver list */
static inline void iommufd_fault_deliver_restore(struct iommufd_fault *fault,
struct iopf_group *group)
{
spin_lock(&fault->lock);
list_add(&group->node, &fault->deliver);
spin_unlock(&fault->lock);
}
struct iommufd_attach_handle {
struct iommu_attach_handle handle;
struct iommufd_device *idev;