From: Nicolin Chen <nicolinc@nvidia.com>
To: Jason Gunthorpe <jgg@nvidia.com>
Cc: Robin Murphy <robin.murphy@arm.com>, <will@kernel.org>,
<joro@8bytes.org>, <jsnitsel@redhat.com>, <praan@google.com>,
<linux-arm-kernel@lists.infradead.org>, <iommu@lists.linux.dev>,
<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] iommu/arm-smmu-v3: Allow stream table to have nodes with the same ID
Date: Fri, 11 Apr 2025 17:07:00 -0700 [thread overview]
Message-ID: <Z/mupP6m0gRbeYtg@Asurada-Nvidia> (raw)
In-Reply-To: <20250411234419.GC252886@nvidia.com>
On Fri, Apr 11, 2025 at 08:44:19PM -0300, Jason Gunthorpe wrote:
> 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?
iort_iommu_configure_id
|=> pci_for_each_dma_alias
|=> iort_pci_iommu_init
| |=> iort_iommu_xlate
| |=> acpi_iommu_fwspec_init
| |=> iommu_fwspec_add_id(sid=0x10700) //index=0
|=> iort_pci_iommu_init
|=> iort_iommu_xlate
|=> acpi_iommu_fwspec_init
|=> iommu_fwspec_add_id(sid=0x10700) //index=1
We could add a piece of code in iommu_fwspec_add_ids() rejecting
a duplicated ID, which would be smaller than we do in SMMU driver
that requires a device_group change too?
Thanks
Nicolin
next prev parent reply other threads:[~2025-04-12 1:13 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-11 4:47 [PATCH] iommu/arm-smmu-v3: Allow stream table to have nodes with the same ID Nicolin Chen
2025-04-11 11:45 ` Jason Gunthorpe
2025-04-11 12:10 ` Robin Murphy
2025-04-11 13:01 ` Jason Gunthorpe
2025-04-11 13:35 ` Pranjal Shrivastava
2025-04-11 13:42 ` Jason Gunthorpe
2025-04-11 15:13 ` Robin Murphy
2025-04-11 23:33 ` Nicolin Chen
2025-04-11 23:44 ` Jason Gunthorpe
2025-04-12 0:07 ` Nicolin Chen [this message]
2025-04-12 3:39 ` Nicolin Chen
2025-04-12 13:55 ` Jason Gunthorpe
2025-04-12 17:03 ` Nicolin Chen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Z/mupP6m0gRbeYtg@Asurada-Nvidia \
--to=nicolinc@nvidia.com \
--cc=iommu@lists.linux.dev \
--cc=jgg@nvidia.com \
--cc=joro@8bytes.org \
--cc=jsnitsel@redhat.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=praan@google.com \
--cc=robin.murphy@arm.com \
--cc=will@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).