On 10/05/2019 13:33, Pankaj Bansal wrote: > Hi Will/Robin/Joerg, > > I am s/w engineer from NXP India Pvt. Ltd. > We are using SMMU-V3 in one of NXP SOC. > I have a question about the SMMU Stream ID allocation in linux. > > Right now the Stream IDs allocated to a device are mapped via device tree to > the device. > https://elixir.bootlin.com/linux/latest/source/Documentation/devicetree/bindings/iommu/arm,smmu-v3.txt#L39 > > As the device tree is passed from bootloader to linux, we detect all the > stream IDs needed by a device in bootloader and add their IDs in respective > device nodes. > For each PCIE Endpoint (a unique BDF (Bus Device Function)) on PCIE bus, we > are assigning a unique Stream ID in bootloader. > > However, this poses an issue with PCIE hot plug. > If we plug in a pcie device while linux is running, a unique BDF is assigned > to the device, for which there is no stream ID in device tree. > > How can this problem be solved in linux?
Assuming the streamID associated to a BDF is predictable (streamID = BDF + constant), using the iommu-map property should just work: https://elixir.bootlin.com/linux/latest/source/Documentation/devicetree/bindings/pci/pci-iommu.txt It describes the streamIDs of all possible BDFs, including hotplugged functions. Thanks, Jean > > Is there a way to assign (and revoke) stream IDs at run time? > > Regards, > Pankaj Bansal > > > _______________________________________________ > linux-arm-kernel mailing list > linux-arm-ker...@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel > _______________________________________________ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu