Re: [PATCH 12/14] iommufd: Add APIs to preserve/unpreserve a vfio cdev

Samiullah Khawaja
2026-03-23T21:39:06Z

On Mon, Mar 23, 2026 at 01:59:13PM -0700, Vipin Sharma wrote:
>On Tue, Feb 03, 2026 at 10:09:46PM +0000, Samiullah Khawaja wrote:
>> diff --git a/drivers/iommu/iommufd/device.c b/drivers/iommu/iommufd/device.c
>> +#ifdef CONFIG_IOMMU_LIVEUPDATE
>> +int iommufd_device_preserve(struct liveupdate_session *s,
>> + struct iommufd_device *idev,
>> + u64 *tokenp)
>> +{
>> + struct iommufd_group *igroup = idev->igroup;
>> + struct iommufd_hwpt_paging *hwpt_paging;
>> + struct iommufd_hw_pagetable *hwpt;
>> + struct iommufd_attach *attach;
>> + int ret;
>> +
>> + mutex_lock(&igroup->lock);
>> + attach = xa_load(&igroup->pasid_attach, IOMMU_NO_PASID);
>> + if (!attach) {
>> + ret = -ENOENT;
>> + goto out;
>> + }
>
>Should VFIO in its can_preserve() add this check?

Good Point. We can move this check over there.
>
>> +void iommufd_device_unpreserve(struct liveupdate_session *s,
>> + struct iommufd_device *idev,
>> + u64 token)
>
>Where is token used in this function?

Will remove.
>