Hi Jean,

> -----Original Message-----
> From: Jean-Philippe Brucker <jean-philippe.bruc...@arm.com>
> Sent: Friday, 10 May, 2019 07:07 PM
> To: Pankaj Bansal <pankaj.ban...@nxp.com>; Will Deacon
> <will.dea...@arm.com>; Robin Murphy <robin.mur...@arm.com>; Joerg
> Roedel <j...@8bytes.org>
> Cc: iommu@lists.linux-foundation.org; Varun Sethi <v.se...@nxp.com>; linux-
> arm-ker...@lists.infradead.org; Nipun Gupta <nipun.gu...@nxp.com>
> Subject: Re: [ARM SMMU] Dynamic StreamID allocation
> 
> 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://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Felix
> > ir.bootlin.com%2Flinux%2Flatest%2Fsource%2FDocumentation%2Fdevicetree%
> > 2Fbindings%2Fiommu%2Farm%2Csmmu-
> v3.txt%23L39&amp;data=02%7C01%7Cpankaj
> > .bansal%40nxp.com%7C3cbe8bd4827e425afd0f08d6d54c925e%7C686ea1d3b
> c2b4c6
> >
> fa92cd99c5c301635%7C0%7C0%7C636930922220665343&amp;sdata=vIG5u5n
> XR5iRp
> > uuuGjeFxKBtA5f5ohf91znXX0QWm1c%3D&amp;reserved=0
> >
> > 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://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Felixir.boo
> tlin.com%2Flinux%2Flatest%2Fsource%2FDocumentation%2Fdevicetree%2Fbind
> ings%2Fpci%2Fpci-
> iommu.txt&amp;data=02%7C01%7Cpankaj.bansal%40nxp.com%7C3cbe8bd482
> 7e425afd0f08d6d54c925e%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0
> %7C636930922220665343&amp;sdata=GkkovEnvhd5dN%2BGdh%2FnKCyW5Cd
> EnLDP3cWTrk%2B%2FO7EQ%3D&amp;reserved=0
> 
> It describes the streamIDs of all possible BDFs, including hotplugged 
> functions.

You mean that we should increase the "length" parameter (in 
(rid-base,iommu,iommu-base,length) touple) ?
This would cater to any *new* Bus Device Function being detected on PCIE bus?
Is that right ?
Right now when we make iommu-map in bootloader, we are giving one RID per BDF:
https://elixir.bootlin.com/u-boot/latest/source/drivers/pci/pcie_layerscape_fixup.c#L168

But isn't the better approach to make it dynamic in linux?
i.e. as soon as a new device is detected "requester id" is allocated to it from 
available pool.
When device is removed, return the "requester id" to pool.
is there any h/w limitation which prevents it?

Regards,
Pankaj Bansal
> 
> 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
> > https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Flists
> > .infradead.org%2Fmailman%2Flistinfo%2Flinux-arm-
> kernel&amp;data=02%7C0
> >
> 1%7Cpankaj.bansal%40nxp.com%7C3cbe8bd4827e425afd0f08d6d54c925e%7C6
> 86ea
> >
> 1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C636930922220665343&amp;sda
> ta=2La
> > GBHO2%2Bbqk519uJvCatlHyRCtAPPjKO8Gxu1bQHBM%3D&amp;reserved=0
> >

_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

Reply via email to