Re: [PATCH] iommu/vt-d: Remove unused code in dma_pte_free_pagetable

From: Baolu Lu
Date: Mon Nov 17 2025 - 21:00:33 EST


On 10/15/25 00:24, Aashish Sharma wrote:
'dma_pte_free_pagetable' is only called by
'switch_to_super_page' and is not intended to free the
whole page table (0..DOMAIN_MAX_PFN(domain->gaw)).

Hence remove the code that checks for this and frees the page
table pointed by 'domain->pgd'.

Signed-off-by: Aashish Sharma (Google)<aashish@xxxxxxxxxxxxxxxxx>
---
drivers/iommu/intel/iommu.c | 6 ------
1 file changed, 6 deletions(-)

diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c
index e236c7ec221f..3b3ad7b0c0ce 100644
--- a/drivers/iommu/intel/iommu.c
+++ b/drivers/iommu/intel/iommu.c
@@ -883,12 +883,6 @@ static void dma_pte_free_pagetable(struct dmar_domain *domain,
/* We don't need lock here; nobody else touches the iova range */
dma_pte_free_level(domain, agaw_to_level(domain->agaw), retain_level,
domain->pgd, 0, start_pfn, last_pfn);
-
- /* free pgd */
- if (start_pfn == 0 && last_pfn == DOMAIN_MAX_PFN(domain->gaw)) {
- iommu_free_pages(domain->pgd);
- domain->pgd = NULL;
- }
}

Thank you for the patch. The dma_pte_free_pagetable() helper has been
removed in the iommu/next branch.

/* When a page at a given level is being unlinked from its parent, we don't

Thanks,
baolu