[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20251011023003.159922-1-reaperlioc@glenfly.com>
Date: Sat, 11 Oct 2025 10:30:03 +0800
From: Reaper Li <reaperlioc@...nfly.com>
To: <will@...nel.org>, <robin.murphy@....com>
CC: <joro@...tes.org>, <linux-arm-kernel@...ts.infradead.org>,
<iommu@...ts.linux.dev>, <linux-kernel@...r.kernel.org>,
<reaperlioc@...nfly.com>
Subject: [PATCH] iommu/arm-smmu-v3: fix probe device bug due to duplicated stream IDS.
From: Reaper <reaperlioc@...nfly.com>
Commit 9246b487ab3c ("PCI: Add function 0 DMA alias quirk for Glenfly Arise
chip ") add quirk to fix hda dma request issue, but IORT logic populaties
two identical IDs into the fwspec->ids array via DMA aliasing in
iort_pci_iommu_init() called by pci_for_each_dma_alias().
Signed-off-by: ReaperLi <reaperlioc@...nfly.com>
---
drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
index 2a8b46b94..996d3c0f8 100644
--- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
+++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
@@ -3476,10 +3476,21 @@ static int arm_smmu_insert_master(struct arm_smmu_device *smmu,
rb_entry(existing, struct arm_smmu_stream, node)
->master;
+ struct device *mdev = master->dev;
+ struct device *existing_mdev = existing_master->dev;
+
/* Bridged PCI devices may end up with duplicated IDs */
if (existing_master == master)
continue;
+ /* Dma alias PCI devices may end up with duplicated IDs */
+ if (existing_mdev != mdev &&
+ dev_is_pci(existing_mdev) && dev_is_pci(mdev) &&
+ to_pci_dev(existing_mdev)->bus == to_pci_dev(mdev)->bus &&
+ pci_devs_are_dma_aliases(to_pci_dev(existing_mdev),
+ to_pci_dev(mdev)))
+ continue;
+
dev_warn(master->dev,
"Aliasing StreamID 0x%x (from %s) unsupported, expect DMA to be broken\n",
sid, dev_name(existing_master->dev));
--
2.34.1
Powered by blists - more mailing lists