RE: [PATCH v2] devicetree: Add generic IOMMU device tree bindings

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





> -----Original Message-----
> From: Will Deacon [mailto:will.deacon@xxxxxxx]
> Sent: Monday, June 16, 2014 10:28 AM
> To: Sethi Varun-B16395
> Cc: Thierry Reding; Mark Rutland; devicetree@xxxxxxxxxxxxxxx; linux-
> samsung-soc@xxxxxxxxxxxxxxx; Pawel Moll; Arnd Bergmann; Ian Campbell;
> Grant Grundler; Stephen Warren; linux-kernel@xxxxxxxxxxxxxxx; Marc
> Zyngier; Linux IOMMU; Rob Herring; Kumar Gala; linux-
> tegra@xxxxxxxxxxxxxxx; Cho KyongHo; Dave P Martin; linux-arm-
> kernel@xxxxxxxxxxxxxxxxxxx; Yoder Stuart-B08248
> Subject: Re: [PATCH v2] devicetree: Add generic IOMMU device tree
> bindings
> 
> Hi Varun,
> 
> On Thu, Jun 05, 2014 at 08:10:19PM +0100, Varun Sethi wrote:
> > > The set of StreamIDs that can be generated by a master is fixed in
> the
> > > hardware. The SMMU can then be programmed to map these incoming IDs
> onto
> > > a context ID (or a set of context IDs), which are the IDs used
> internally
> > > by the SMMU to find the page tables etc.
> > >
> > > The StreamID -> ContextID mapping is dynamic and controlled by
> software.
> > > The Master -> StreamIDs mapping is fixed in the hardware.
> > The Master -> StreamIDs mapping may not always be fixed in the
> hardware.
> > At, least in our case we plan to program these via software. PCI
> devices
> > is one place where this mapping would have to be dynamic (based on the
> > topology i.e. if the devices are connected to a bridge etc). Also, we
> have
> > a hot plug device architecture where the stream ID is software
> > programmable.
> >
> > Other than that, based on the isolation requirements (iommu domain)
> > software programmability offers greater flexibility.
> 
> For the sake of consistency, I'd really like to treat the master ->
> streamIDs mapping as fixed. If that means setting it once during boot in
> your case, then so be it (ideally in the firmware). That way, we just
> describe the fixed mapping to the kernel and the driver doesn't have to
> worry about changing the mapping, especially given that that's likely to
> be
> highly error-prone once the SMMU is in us.
> 
> Do you have use-cases where you really need to change these mappings
> dynamically?

Yes.  In the case of a PCI bus-- you may not know in advance how many
PCI devices there are until you probe the bus.   We have another FSL
proprietary bus we call the "fsl-mc" bus that is similar.

Another thing to consider-- starting with SMMUv2, as you know, there
is a new distributed architecture with multiple TBUs and a centralized
TCU that walks the SMMU page tables.  So instead of sprinkling multiple
SMMUs all over an SoC you now have the option a 1 central TCU and sprinkling
multiple TBUs around.   However, this means that the stream ID namespace
is now global and can be pretty limited.  In the SMMU implementation we 
have there are only 64 stream ID total for our Soc.  But we have many more
masters than that.

So we look at stream IDs as really corresponding to an 'isolation context'
and not to a bus master.  An isolation context is the domain you are
trying to isolate with the SMMU.  Devices that all belong to the same
'isolation context' can share the same stream ID, since they share
the same domain and page tables.

So, perhaps by default some/most SMMU masters may have a default stream ID
of 0x0 that is used by the host...and that could be represented
statically in the device tree.

But, we absolutely will need to dynamically set new stream IDs
into masters when a new IOMMU 'domain' is created and devices
are added to it.   All the devices in a domain will share
the same stream ID.

So whatever we do, let's please have an architecture flexible enough
to allow for this.

Thanks,
Stuart






--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]
  Powered by Linux