From: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
To: Rob Herring <robh@kernel.org>
Cc: devicetree@vger.kernel.org,
Florian Fainelli <f.fainelli@gmail.com>,
Geert Uytterhoeven <geert+renesas@glider.be>,
Arnd Bergmann <arnd@arndb.de>,
Robin Murphy <robin.murphy@arm.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Christoph Hellwig <hch@infradead.org>,
Marek Vasut <marek.vasut@gmail.com>,
Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>,
Stefan Wahren <wahrenst@gmx.net>,
Simon Horman <horms+renesas@verge.net.au>,
Frank Rowand <frowand.list@gmail.com>,
"moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE"
<linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH v2] of: Make of_dma_get_range() work on bus nodes
Date: Wed, 09 Oct 2019 17:24:33 +0200 [thread overview]
Message-ID: <930cb2d2d47e2785711bab59d80e8ad188bd882d.camel@suse.de> (raw)
In-Reply-To: <CAL_Jsq+RjC0b1ZXzgmMdn5Gd1=3zkN62Jdq_QKeZ8-X4pCiDPw@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 2472 bytes --]
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@suse.de> wrote:
> > Hi Rob/Robin,
> >
> > On Tue, 2019-10-08 at 14:52 -0500, Rob Herring wrote:
> > > From: Robin Murphy <robin.murphy@arm.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@suse.de>
and
Tested-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
On a Raspberry Pi 4 with pcie-brcmstb.c which is still work in progress but
depends on this.
Regards,
Nicolas
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
next prev parent reply other threads:[~2019-10-09 15:24 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-08 19:52 [PATCH v2] of: Make of_dma_get_range() work on bus nodes Rob Herring
2019-10-08 20:51 ` Nicolas Saenz Julienne
2019-10-09 1:03 ` Rob Herring
2019-10-09 15:24 ` Nicolas Saenz Julienne [this message]
2019-10-09 10:56 ` Robin Murphy
-- strict thread matches above, loose matches on Subject: below --
2019-10-08 19:43 Rob Herring
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=930cb2d2d47e2785711bab59d80e8ad188bd882d.camel@suse.de \
--to=nsaenzjulienne@suse.de \
--cc=arnd@arndb.de \
--cc=devicetree@vger.kernel.org \
--cc=f.fainelli@gmail.com \
--cc=frowand.list@gmail.com \
--cc=geert+renesas@glider.be \
--cc=hch@infradead.org \
--cc=horms+renesas@verge.net.au \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lorenzo.pieralisi@arm.com \
--cc=marek.vasut@gmail.com \
--cc=robh@kernel.org \
--cc=robin.murphy@arm.com \
--cc=wahrenst@gmx.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).