iommu/arm-smmu-v3: Allow stream ID sharing for devices behind PCIe-to-PCI bridges
Subsystems (2)
RFC PATCH 1/1 iommu/arm-smmu-v3: Allow stream ID sharing for devices behind PCIe-to-PCI bridges
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.
--- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c +11 -0
@@ -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
Quoted 10 lines · 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 ControllerBoth 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
Robin Murphy
reviewerQuoted 7 lines · Jason Gunthorpe
Quoted 6 lines · 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
Quoted 8 lines
Quoted 4 lines
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.
Quoted 10 lines
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
Quoted 13 lines · Robin Murphy
Quoted 12 lines · Jason Gunthorpe
Quoted 10 lines · 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.
Quoted 9 lines
Quoted 3 lines
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 thatRID->StreamIDmappings 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.
Quoted 8 lines
Quoted 8 lines
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
Quoted 3 lines
Quoted 2 lines
Jason