[PATCH v2 2/4] iommu/amd: Do not convert IVMD exclusion range to unity range
From: Suravee Suthikulpanit
Date: Fri Apr 24 2026 - 05:23:22 EST
Original problem was there could be multiple IVMD exclusion entries
conflicting over a single exclusion range supported in older Linux
kernel. The fix was first introduced in commit 387caf0b759a ("iommu/amd:
Treat per-device exclusion ranges as r/w unity-mapped regions") and in
commit 0bbe4ced53e3 ("iommu/amd: Fix the overwritten field in IVMD header")
, where IVMD exclusions are converted to separate unity_map_entry objects
in pci_seg->unity_map so amd_iommu_get_resv_regions() treated every such
entry as IOMMU_RESV_DIRECT with R/W.
Since the AMD IOMMU driver no longer support the Exclusion Range base/limit
registers and rely on Linux kernel to exclude the specified IOVA ranges
from being mapped this logic is no longer needed.
Remove the special case that forced e->prot to RW-UNITY mapping
(i.e. IVMD_FLAG_IW | IVMD_FLAG_IR | IVMD_FLAG_UNITY) whenever
IVMD_FLAG_EXCL_RANGE was set.
Fixes: 0bbe4ced53e3 ("iommu/amd: Fix the overwritten field in IVMD header")
Cc: Baoquan He <bhe@xxxxxxxxxx>
Cc: Adrian Huang <ahuang12@xxxxxxxxxx>
Cc: Jerry Snitselaar <jsnitsel@xxxxxxxxxx>
Signed-off-by: Suravee Suthikulpanit <suravee.suthikulpanit@xxxxxxx>
---
drivers/iommu/amd/init.c | 10 ----------
1 file changed, 10 deletions(-)
diff --git a/drivers/iommu/amd/init.c b/drivers/iommu/amd/init.c
index 866249d3673e..2e854f4639a7 100644
--- a/drivers/iommu/amd/init.c
+++ b/drivers/iommu/amd/init.c
@@ -2644,16 +2644,6 @@ static int __init init_unity_map_range(struct ivmd_header *m,
e->address_end = e->address_start + PAGE_ALIGN(m->range_length);
e->prot = m->flags >> 1;
- /*
- * Treat per-device exclusion ranges as r/w unity-mapped regions
- * since some buggy BIOSes might lead to the overwritten exclusion
- * range (exclusion_start and exclusion_length members). This
- * happens when there are multiple exclusion ranges (IVMD entries)
- * defined in ACPI table.
- */
- if (m->flags & IVMD_FLAG_EXCL_RANGE)
- e->prot = (IVMD_FLAG_IW | IVMD_FLAG_IR) >> 1;
-
DUMP_printk("%s devid_start: %04x:%02x:%02x.%x devid_end: "
"%04x:%02x:%02x.%x range_start: %016llx range_end: %016llx"
" flags: %x\n", s, m->pci_seg,
--
2.34.1