Re: [PATCH v6 09/18] iommu/vt-d: Combine disable_dmar_iommu() and free_dmar_iommu()

From: Samiullah Khawaja

Date: Wed Oct 28 2026 - 20:34:08 EST


On Wed, Oct 28, 2026 at 02:01:08PM +0800, Baolu Lu wrote:
On 10/25/26 10:19, Samiullah Khawaja wrote:
Every caller of disable_dmar_iommu() immediately follows it with a call
to free_dmar_iommu(). Combine the two helpers into release_dmar_iommu()
and simplify the teardown and error paths in init_dmars(),
intel_iommu_add(), and dmar_iommu_hotplug().

Also drop the early return when
WARN_ON(!ida_is_empty(&iommu->domain_ida)) triggers so translation is
still disabled before freeing the IOMMU resources.

Signed-off-by: Samiullah Khawaja <skhawaja@xxxxxxxxxx>
---
drivers/iommu/intel/iommu.c | 30 ++++++++++--------------------
1 file changed, 10 insertions(+), 20 deletions(-)


[snip]

@@ -2310,12 +2302,10 @@ int dmar_iommu_hotplug(struct dmar_drhd_unit *dmaru, bool insert)
if (iommu == NULL)
return -EINVAL;
- if (insert) {
+ if (insert)
ret = intel_iommu_add(dmaru);
- } else {
- disable_dmar_iommu(iommu);
- free_dmar_iommu(iommu);
- }
+ else
+ release_dmar_iommu(iommu);
return ret;
}

Reviewed-by: Lu Baolu <baolu.lu@xxxxxxxxxxxxxxx>

Thanks,
Sami