linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH] iommu/arm-smmu-v3: Allow stream ID sharing for devices behind PCIe-to-PCI bridges
@ 2025-12-11 13:39 Nirmoy Das
  2025-12-12  6:40 ` Jason Gunthorpe
  0 siblings, 1 reply; 4+ messages in thread
From: Nirmoy Das @ 2025-12-11 13:39 UTC (permalink / raw)
  To: will, robin.murphy, joro, nicolinc
  Cc: jgg, linux-arm-kernel, iommu, linux-kernel, Nirmoy Das

ASPEED BMC controllers have VGA and USB functions behind a PCIe-to-PCI
bridge that causes them to share the same stream ID:

  \-[0005:e0]---00.0-[e1-e2]----00.0-[e2]--+-00.0  ASPEED Graphics Family
                                           \-02.0  ASPEED USB Controller

Both devices get stream ID(0x5e200) due to bridge aliasing. Currently this
USB controller gets rejected with "Aliasing StreamID unsupported", causing
USB timeout errors. Allow stream ID sharing when both devices are on
the same bus behind a PCIe-to-PCI bridge to fix this issue.

Signed-off-by: Nirmoy Das <nirmoyd@nvidia.com>
---
 drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
index 2a8b46b948f05..411b8803eb46f 100644
--- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
+++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
@@ -3480,6 +3480,17 @@ static int arm_smmu_insert_master(struct arm_smmu_device *smmu,
 			if (existing_master == master)
 				continue;

+			/* Allow PCI devices on the same bus to share stream IDs
+			 * due to PCIe-to-PCI bridge aliasing.
+			 */
+			if (dev_is_pci(master->dev) && dev_is_pci(existing_master->dev)) {
+				struct pci_dev *pdev = to_pci_dev(master->dev);
+				struct pci_dev *existing_pdev = to_pci_dev(existing_master->dev);
+
+				if (pdev->bus == existing_pdev->bus)
+					continue;
+			}
+
 			dev_warn(master->dev,
 				 "Aliasing StreamID 0x%x (from %s) unsupported, expect DMA to be broken\n",
 				 sid, dev_name(existing_master->dev));
--
2.43.0



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [RFC PATCH] iommu/arm-smmu-v3: Allow stream ID sharing for devices behind PCIe-to-PCI bridges
  2025-12-11 13:39 [RFC PATCH] iommu/arm-smmu-v3: Allow stream ID sharing for devices behind PCIe-to-PCI bridges Nirmoy Das
@ 2025-12-12  6:40 ` Jason Gunthorpe
  2025-12-12 10:46   ` Robin Murphy
  0 siblings, 1 reply; 4+ messages in thread
From: Jason Gunthorpe @ 2025-12-12  6:40 UTC (permalink / raw)
  To: Nirmoy Das
  Cc: will, robin.murphy, joro, nicolinc, linux-arm-kernel, iommu,
	linux-kernel

On Thu, Dec 11, 2025 at 05:39:33AM -0800, Nirmoy Das wrote:
> ASPEED BMC controllers have VGA and USB functions behind a PCIe-to-PCI
> bridge that causes them to share the same stream ID:
> 
>   \-[0005:e0]---00.0-[e1-e2]----00.0-[e2]--+-00.0  ASPEED Graphics Family
>                                            \-02.0  ASPEED USB Controller
> 
> Both devices get stream ID(0x5e200) due to bridge aliasing. Currently this
> USB controller gets rejected with "Aliasing StreamID unsupported", causing
> USB timeout errors. Allow stream ID sharing when both devices are on
> the same bus behind a PCIe-to-PCI bridge to fix this issue.

I don't think this is right, if you actually need stream ID sharing
then I seem to recall the driver needs more changes. We don't want
this in general.

IMHO ASPEED has wrong PCI config space and there isn't any actual PCI
bus here that would force RID aliasing to worry about. I suggest going
to ASPEED to find out and confirm that they don't actually share the
RIDs and then let's quirk the PCI devices to disable alias generation
in the first place.

Also, complain to them to fix their config space to report a PCIe bridge
type in future devices. :)

Jason


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [RFC PATCH] iommu/arm-smmu-v3: Allow stream ID sharing for devices behind PCIe-to-PCI bridges
  2025-12-12  6:40 ` Jason Gunthorpe
@ 2025-12-12 10:46   ` Robin Murphy
  2025-12-12 12:40     ` Nirmoy Das
  0 siblings, 1 reply; 4+ messages in thread
From: Robin Murphy @ 2025-12-12 10:46 UTC (permalink / raw)
  To: Jason Gunthorpe, Nirmoy Das
  Cc: will, joro, nicolinc, linux-arm-kernel, iommu, linux-kernel

On 2025-12-12 6:40 am, Jason Gunthorpe wrote:
> On Thu, Dec 11, 2025 at 05:39:33AM -0800, Nirmoy Das wrote:
>> ASPEED BMC controllers have VGA and USB functions behind a PCIe-to-PCI
>> bridge that causes them to share the same stream ID:
>>
>>    \-[0005:e0]---00.0-[e1-e2]----00.0-[e2]--+-00.0  ASPEED Graphics Family
>>                                             \-02.0  ASPEED USB Controller
>>
>> Both devices get stream ID(0x5e200) due to bridge aliasing. Currently this
>> USB controller gets rejected with "Aliasing StreamID unsupported", causing
>> USB timeout errors. Allow stream ID sharing when both devices are on
>> the same bus behind a PCIe-to-PCI bridge to fix this issue.
> 
> I don't think this is right, if you actually need stream ID sharing
> then I seem to recall the driver needs more changes. We don't want
> this in general.

Yes, as I said on the last one not so long ago, we cannot simply cross 
our fingers and hope that aliasing at the SMMU StreamID level stems from 
something at the PCI RID level that pci_device_group() would be aware 
of, because there is no guarantee that RID->StreamID mappings are 1:1.

Thanks,
Robin.

> IMHO ASPEED has wrong PCI config space and there isn't any actual PCI
> bus here that would force RID aliasing to worry about. I suggest going
> to ASPEED to find out and confirm that they don't actually share the
> RIDs and then let's quirk the PCI devices to disable alias generation
> in the first place.
> 
> Also, complain to them to fix their config space to report a PCIe bridge
> type in future devices. :)
> 
> Jason



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [RFC PATCH] iommu/arm-smmu-v3: Allow stream ID sharing for devices behind PCIe-to-PCI bridges
  2025-12-12 10:46   ` Robin Murphy
@ 2025-12-12 12:40     ` Nirmoy Das
  0 siblings, 0 replies; 4+ messages in thread
From: Nirmoy Das @ 2025-12-12 12:40 UTC (permalink / raw)
  To: Robin Murphy, Jason Gunthorpe
  Cc: will, joro, nicolinc, linux-arm-kernel, iommu, linux-kernel


On 12.12.25 11:46, Robin Murphy wrote:
> On 2025-12-12 6:40 am, Jason Gunthorpe wrote:
>> On Thu, Dec 11, 2025 at 05:39:33AM -0800, Nirmoy Das wrote:
>>> ASPEED BMC controllers have VGA and USB functions behind a PCIe-to-PCI
>>> bridge that causes them to share the same stream ID:
>>>
>>>    \-[0005:e0]---00.0-[e1-e2]----00.0-[e2]--+-00.0  ASPEED Graphics 
>>> Family
>>>                                             \-02.0  ASPEED USB 
>>> Controller
>>>
>>> Both devices get stream ID(0x5e200) due to bridge aliasing. 
>>> Currently this
>>> USB controller gets rejected with "Aliasing StreamID unsupported", 
>>> causing
>>> USB timeout errors. Allow stream ID sharing when both devices are on
>>> the same bus behind a PCIe-to-PCI bridge to fix this issue.
>>
>> I don't think this is right, if you actually need stream ID sharing
>> then I seem to recall the driver needs more changes. We don't want
>> this in general.
>
> Yes, as I said on the last one not so long ago, we cannot simply cross 
> our fingers and hope that aliasing at the SMMU StreamID level stems 
> from something at the PCI RID level that pci_device_group() would be 
> aware of, because there is no guarantee that RID->StreamID mappings 
> are 1:1.
>
> Thanks,
> Robin.
>

Thanks, Jason and Robin for your feedback. I will reach out to ASPEED to 
find out if they are actually sharing RID as suggested by Jason.

>> IMHO ASPEED has wrong PCI config space and there isn't any actual PCI
>> bus here that would force RID aliasing to worry about. I suggest going
>> to ASPEED to find out and confirm that they don't actually share the
>> RIDs and then let's quirk the PCI devices to disable alias generation
>> in the first place.
>>
>> Also, complain to them to fix their config space to report a PCIe bridge
>> type in future devices. :)

I will do that :)


Thanks,

Nirmoy

>>
>> Jason
>


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-12-12 12:41 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-11 13:39 [RFC PATCH] iommu/arm-smmu-v3: Allow stream ID sharing for devices behind PCIe-to-PCI bridges Nirmoy Das
2025-12-12  6:40 ` Jason Gunthorpe
2025-12-12 10:46   ` Robin Murphy
2025-12-12 12:40     ` Nirmoy Das

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).