public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Robin Murphy <robin.murphy@arm.com>
To: Jason Gunthorpe <jgg@ziepe.ca>, Reaper Li <reaperlioc@glenfly.com>
Cc: will@kernel.org, joro@8bytes.org,
	linux-arm-kernel@lists.infradead.org, iommu@lists.linux.dev,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] iommu/arm-smmu-v3: fix probe device bug due to duplicated stream IDS.
Date: Fri, 24 Oct 2025 11:20:33 +0100	[thread overview]
Message-ID: <8a75e90f-596e-407b-976f-e8a509c9065d@arm.com> (raw)
In-Reply-To: <20251023181235.GH21554@ziepe.ca>

On 2025-10-23 7:12 pm, Jason Gunthorpe wrote:
> On Sat, Oct 11, 2025 at 10:30:03AM +0800, Reaper Li wrote:
>> From: Reaper <reaperlioc@glenfly.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().
> 
> I'd rather we not have duplicate IDs in the same fwspec, can we avoid
> that at the source?

The original reason for not doing that is that there are multiple 
sources - the drivers' own .of_xlate routines for DT, but the 
IORT/VIOT/RIMT/whatever code for ACPI. Yes, iommu_fwspec_add_ids() is in 
a common path there, but that's only responsible for appending an opaque 
block of data to another opaque block of data - only the producer or 
consumer of that data know how to interpret it (e.g. for SMMUv2, 
[0x00000002, 0x00000003] may or may not be considered equivalent to 
[0x00010002]).

Anyway, this patch is wrong regardless, and it is definitely not fixing 
any bug. SMMUv3 has explicitly never supported StreamID aliasing between 
*different* devices, because doing that correctly is a challenge. It 
needs custom group assignment based on StreamID-to-group lookup (like 
SMMUv2) - we can't just assume it's OK for PCI devices, since as soon as 
we allow aliasing at all then we also allow it outside the PCI hierarchy 
where pci_device_group() can't see it (like on the Arm Juno platform). 
These days we do have arm_smmu_find_master() which makes *that* 
feasible, but conversely means we now also have to be concerned with 
disallowing ATS/PRI and working out what to do with anything else that 
is subtly broken by no longer having the assumed 1:1 correspondence of 
StreamID:device.

Thanks,
Robin.

      reply	other threads:[~2025-10-24 10:20 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-11  2:30 [PATCH] iommu/arm-smmu-v3: fix probe device bug due to duplicated stream IDS Reaper Li
2025-10-23 18:12 ` Jason Gunthorpe
2025-10-24 10:20   ` Robin Murphy [this message]

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=8a75e90f-596e-407b-976f-e8a509c9065d@arm.com \
    --to=robin.murphy@arm.com \
    --cc=iommu@lists.linux.dev \
    --cc=jgg@ziepe.ca \
    --cc=joro@8bytes.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=reaperlioc@glenfly.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