[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <930cb2d2d47e2785711bab59d80e8ad188bd882d.camel@suse.de>
Date: Wed, 09 Oct 2019 17:24:33 +0200
From: Nicolas Saenz Julienne <nsaenzjulienne@...e.de>
To: Rob Herring <robh@...nel.org>
Cc: devicetree@...r.kernel.org,
Florian Fainelli <f.fainelli@...il.com>,
Geert Uytterhoeven <geert+renesas@...der.be>,
Arnd Bergmann <arnd@...db.de>,
Robin Murphy <robin.murphy@....com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Christoph Hellwig <hch@...radead.org>,
Marek Vasut <marek.vasut@...il.com>,
Lorenzo Pieralisi <lorenzo.pieralisi@....com>,
Stefan Wahren <wahrenst@....net>,
Simon Horman <horms+renesas@...ge.net.au>,
Frank Rowand <frowand.list@...il.com>,
"moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE"
<linux-arm-kernel@...ts.infradead.org>
Subject: Re: [PATCH v2] of: Make of_dma_get_range() work on bus nodes
On Tue, 2019-10-08 at 20:03 -0500, Rob Herring wrote:
> On Tue, Oct 8, 2019 at 3:52 PM Nicolas Saenz Julienne
> <nsaenzjulienne@...e.de> wrote:
> > Hi Rob/Robin,
> >
> > On Tue, 2019-10-08 at 14:52 -0500, Rob Herring wrote:
> > > From: Robin Murphy <robin.murphy@....com>
> > >
> > > Since the "dma-ranges" property is only valid for a node representing a
> > > bus, of_dma_get_range() currently assumes the node passed in is a leaf
> > > representing a device, and starts the walk from its parent. In cases
> > > like PCI host controllers on typical FDT systems, however, where the PCI
> > > endpoints are probed dynamically the initial leaf node represents the
> > > 'bus' itself, and this logic means we fail to consider any "dma-ranges"
> > > describing the host bridge itself. Rework the logic such that
> > > of_dma_get_range() also works correctly starting from a bus node
> > > containing "dma-ranges".
> > >
> > > While this does mean "dma-ranges" could incorrectly be in a device leaf
> > > node, there isn't really any way in this function to ensure that a leaf
> > > node is or isn't a bus node.
> >
> > Sorry, I'm not totally sure if this is what you're pointing out with the
> > last
> > sentence. But, what about the case of a bus configuring a device which also
> > happens to be a memory mapped bus (say a PCI platform device). It'll get
> > it's
> > dma config based on its own dma-ranges which is not what we want.
>
> What I was trying to say is we just can't tell if we should be looking
> in the current node or the parent. 'dma-ranges' in a leaf node can be
> correct or incorrect.
>
> Your example is a bit different. I'm not sure that case is valid or
> can ever work if it is. It's certainly valid that a PCI bridge's
> parent has dma-ranges and now we'll actually handle any translation.
> The bridge itself is not a DMA-capable device, but just passing thru
> DMA.
Yes, you're right, I hadn't thought of it from that perspective. Thanks!
> Do we ever need to know the parent's dma-ranges in that case? Or
> to put it another way, is looking at anything other than leaf
> dma-ranges useful?
There is no need at all indeed.
With that,
Reviewed-by: Nicolas Saenz Julienne <nsaenzjulienne@...e.de>
and
Tested-by: Nicolas Saenz Julienne <nsaenzjulienne@...e.de>
On a Raspberry Pi 4 with pcie-brcmstb.c which is still work in progress but
depends on this.
Regards,
Nicolas
Download attachment "signature.asc" of type "application/pgp-signature" (489 bytes)
Powered by blists - more mailing lists