From: Nicolin Chen <nicolinc@nvidia.com>
To: Robin Murphy <robin.murphy@arm.com>
Cc: <will@kernel.org>, <joro@8bytes.org>, <jgg@nvidia.com>,
<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 16:33:44 -0700 [thread overview]
Message-ID: <Z/mm2EQAQtOqpVCy@Asurada-Nvidia> (raw)
In-Reply-To: <5c8d16f9-246e-45d0-aaac-45b7712cefb5@arm.com>
On Fri, Apr 11, 2025 at 04:13:01PM +0100, Robin Murphy wrote:
> On 11/04/2025 5:47 am, Nicolin Chen wrote:
> > From: Jason Gunthorpe <jgg@nvidia.com>
> >
> > ASPEED VGA card has two built-in devices:
> > 0008:06:00.0 PCI bridge: ASPEED Technology, Inc. AST1150 PCI-to-PCI Bridge (rev 06)
> > 0008:07:00.0 VGA compatible controller: ASPEED Technology, Inc. ASPEED Graphics Family (rev 52)
> >
> > Its toplogy looks like this:
> > +-[0008:00]---00.0-[01-09]--+-00.0-[02-09]--+-00.0-[03]----00.0 Sandisk Corp Device 5017
> > | +-01.0-[04]--
> > | +-02.0-[05]----00.0 NVIDIA Corporation Device
> > | +-03.0-[06-07]----00.0-[07]----00.0 ASPEED Technology, Inc. ASPEED Graphics Family
> > | +-04.0-[08]----00.0 Renesas Technology Corp. uPD720201 USB 3.0 Host Controller
> > | \-05.0-[09]----00.0 Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller
> > \-00.1 PMC-Sierra Inc. Device 4028
> >
> > Being a legacy PCI device that does not have RID on the wire, the system
> > does not preserve a RID for that PCI bridge (0008:06), so the IORT code
> > has to dma alias for iort_pci_iommu_init() via pci_for_each_dma_alias(),
> > resulting in both of them getting the same Stream ID.
>
> Hmm, actually, this doesn't even make a whole heap of sense, and it's
> not what's happening here at all.
>
> 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]?
Thanks
Nicolin
next prev parent reply other threads:[~2025-04-11 23:36 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 [this message]
2025-04-11 23:44 ` Jason Gunthorpe
2025-04-12 0:07 ` Nicolin Chen
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/mm2EQAQtOqpVCy@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