Re: [PATCH v6 13/18] iommu/vt-d: Handle reattach of the restored domain
From: Baolu Lu
Date: Thu Oct 29 2026 - 19:39:18 EST
On 10/30/26 06:34, Samiullah Khawaja wrote:
diff --git a/drivers/iommu/intel/liveupdate.c b/drivers/iommu/intel/ liveupdate.c
index 36816d3651e6..665ebb81bd61 100644
--- a/drivers/iommu/intel/liveupdate.c
+++ b/drivers/iommu/intel/liveupdate.c
@@ -394,6 +394,137 @@ void intel_iommu_handle_drhd_restore_failure(struct intel_iommu *iommu)
iommu->name);
}
+static void domain_detach_restored_iommu(struct dmar_domain *domain,
+ struct intel_iommu *iommu)
+{
+ struct iommu_domain_info *info;
+
+ guard(mutex)(&iommu->did_lock);
+ info = xa_load(&domain->iommu_array, iommu->seq_id);
+ if (--info->refcnt == 0) {
+ xa_erase(&domain->iommu_array, iommu->seq_id);
+ kfree(info);
+ }
This seems to be different from normal domain_detach_iommu(), which
looks like this,
if (--info->refcnt == 0) {
ida_free(&iommu->domain_ida, info->did);
xa_erase(&domain->iommu_array, iommu->seq_id);
kfree(info);
}
why ida_free() is skipped in the restored path?
The restored device can be removed and probed again while the PASID and
context entries stay intact. So the restored did is not freed in this
path. Once the domain is reclaimed by the iommufd, then it takes the
normal detach path.
Can you please add a comment to explain this?
Thanks,
baolu