[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <8a75e90f-596e-407b-976f-e8a509c9065d@arm.com>
Date: Fri, 24 Oct 2025 11:20:33 +0100
From: Robin Murphy <robin.murphy@....com>
To: Jason Gunthorpe <jgg@...pe.ca>, Reaper Li <reaperlioc@...nfly.com>
Cc: will@...nel.org, joro@...tes.org, linux-arm-kernel@...ts.infradead.org,
iommu@...ts.linux.dev, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] iommu/arm-smmu-v3: fix probe device bug due to duplicated
stream IDS.
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@...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().
>
> 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.
Powered by blists - more mailing lists