Re: [PATCH] iommu/arm-smmu-v3: Allow stream table to have nodes with the same ID

Jason Gunthorpe
2025-04-12T00:07:13Z

On Fri, Apr 11, 2025 at 04:33:44PM -0700, Nicolin Chen wrote:

> > The bridge *does* claim its own RID, and per the aliasing rules the
> > devices behind it claim both their own RID and the alias to function
> > 00.0 on the bridge's secondary bus, like so in action:
>
> Yea, I just found out that the bridge does have a different SID.
> It was actually the VGA controller itself having two fwspec->ids
> populated by the IORT code. Then, the SMMU driver allocated two
> separate streams with the same set of device pointer and SID:
> pci 0008:06:00.0: arm_smmu_insert_master: fwspec index=0, sid=0x10600
> pci 0008:06:00.0: Adding to iommu group 21
> pci 0008:07:00.0: arm_smmu_insert_master: fwspec index=0, sid=0x10700
> pci 0008:07:00.0: arm_smmu_insert_master: fwspec index=1, sid=0x10700
> pci 0008:07:00.0: Adding to iommu group 21
>
> Perhaps the duplicated fwspec->id should be avoided in the IORT
> code at the first place v.s. bypassing the fwspec->ids[1]?

It is a much easier fix if all you have to do is ignore hits in the RB
tree that match to the same master, just don't fail on duplicates and
don't add the duplicate rb node at all?

Seem strange though. Where did the duplicate come from?

Jason