From 6944e3330890678a83bb6d770b1a034ad56c17d5 Mon Sep 17 00:00:00 2001 From: LeoLiu-oc Date: Tue, 23 Dec 2025 19:23:20 +0800 Subject: [PATCH] anolis: iommu/dma: Fix not fully traversing iova reservations issue ANBZ: #28469 For multiple devices in the same iommu group, sorted later device (based on Bus:Dev.Func) have the RMRR. Sorted earlier device (without RMRR) initialized the iova domain causing the sorted later device goto done_unlock. Then, the sorted later device (with RMRR) cannot execute the iova_reserve_iommu_regions to reserve the RMRR in the group's iova domain, and other devices (in the same group) alloc iova in RMRR are permitted. DMA iova addresses conflict with RMRR in this case. Goto iova_reserve_iommu_regions could avoid the problem (make sure all devices of the same group execute reserve iova) Signed-off-by: LeoLiu-oc --- drivers/iommu/dma-iommu.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/iommu/dma-iommu.c b/drivers/iommu/dma-iommu.c index 0d1352b7a7a1..f8a705b44bab 100644 --- a/drivers/iommu/dma-iommu.c +++ b/drivers/iommu/dma-iommu.c @@ -470,6 +470,12 @@ static int iommu_dma_init_domain(struct iommu_domain *domain, dma_addr_t base, return -EFAULT; } +#if defined(CONFIG_X86) + if (boot_cpu_data.x86_vendor == X86_VENDOR_CENTAUR || + boot_cpu_data.x86_vendor == X86_VENDOR_ZHAOXIN) + return iova_reserve_iommu_regions(dev, domain); +#endif + return 0; } -- Gitee