Re: [PATCH] iommu/amd: Remove dead code for exclusion ranges in IVMD

From: Joerg Roedel

Date: Mon May 11 2026 - 03:37:33 EST


On Tue, Mar 31, 2026 at 11:25:50PM +0800, Yu Zhang wrote:
> Exclusion ranges in IVMD are treated as unity mappings with r&w
> permissions since commit 0bbe4ced53e3 ("iommu/amd: Fix the
> overwritten field in IVMD header"), using 1:1 mappings. And IOMMU
> Exclusion Base & Range Limit Registers (0x0020/0x0028) are actually
> no longer used.
>
> As a result, several definitions and code paths became dead code:
>
> - exclusion_start/exclusion_length in struct amd_iommu are never
> assigned,
> - iommu_set_exclusion_range() always returns 0 now.
> - MMIO_EXCL_ENABLE_MASK & MMIO_EXCL_ALLOW_MASK are only used by
> the removed iommu_set_exclusion_range().
> - DEV_ENTRY_EX is no longer set in any DTE.
> - IOMMU_UNITY_MAP_FLAG_EXCL_RANGE is no longer set, thus the
> IOMMU_RESV_RESERVED branch in amd_iommu_get_resv_regions() is
> no longer reachable.
>
> Just remove all of the dead code. No functional change.
>
> Signed-off-by: Yu Zhang <zhangyu1@xxxxxxxxxxxxxxxxxxx>
> ---
> drivers/iommu/amd/amd_iommu_types.h | 12 ------------
> drivers/iommu/amd/init.c | 23 -----------------------
> drivers/iommu/amd/iommu.c | 3 ---
> 3 files changed, 38 deletions(-)

Applied, thanks.