From: Vinod Koul <vinod.koul@intel.com>
To: Marek Szyprowski <m.szyprowski@samsung.com>
Cc: alsa-devel@alsa-project.org, linux-samsung-soc@vger.kernel.org,
Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>,
linux-pm@vger.kernel.org, Mark Brown <broonie@kernel.org>,
Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>,
"Rafael J. Wysocki" <rjw@rjwysocki.net>,
linux-kernel@vger.kernel.org,
Krzysztof Kozlowski <krzk@kernel.org>,
Inki Dae <inki.dae@samsung.com>,
Lars-Peter Clausen <lars@metafoo.de>,
dmaengine@vger.kernel.org, Ulf Hansson <ulf.hansson@linaro.org>,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v7 2/4] dmaengine: Forward slave device pointer to of_xlate callback
Date: Thu, 9 Feb 2017 09:41:23 +0530 [thread overview]
Message-ID: <20170209041123.GK19244@localhost> (raw)
In-Reply-To: <49c9c23d-ff0a-268a-5edd-931e04eb98b5@samsung.com>
On Thu, Jan 26, 2017 at 03:43:05PM +0100, Marek Szyprowski wrote:
> Hi Lars,
>
> On 2017-01-25 14:12, Lars-Peter Clausen wrote:
> >On 01/25/2017 11:28 AM, Marek Szyprowski wrote:
> >>Add pointer to slave device to of_dma_xlate to let DMA engine driver
> >>to know which slave device is using given DMA channel. This will be
> >>later used to implement non-irq-safe runtime PM for DMA engine driver.
> >of_dma_xlate() is used to translate from a OF phandle and a specifier to a
> >DMA channel. On one hand this does not necessarily mean that the channel is
> >actually going to be used by the slave that called the xlate function.
> >Modifying the driver state when a lookup of the channel is done is a
> >layering violation. And this approach is also missing a way to disassociate
> >a slave from a DMA channel, e.g. when it is no longer used.
> >
> >On the other hand there are other mechanisms to translate between some kind
> >of firmware handle to a DMA channel which are completely ignored here.
> >
> >So this approach does not work. This is something that needs to be done at
> >the dmaengine level, not a the firmware resource translation level. And it
> >needs a matching method that is called when the channel is disassociated
> >from a device, when the device no longer uses the DMA channel.
>
> Frankly I agree that of_dma_xlate() should only return the requested channel
> to the dmaengine core and do not do any modification in the the
> driver state.
True..
> However the current dma engine design and implementation breaks this rule.
> Please check the drivers - how do they implement of_xlate callback. They
> usually call dma_get_any_slave_channel, dma_get_slave_channel or
> __dma_request_channel there, which in turn calls dma_chan_get, which then
> calls back to device_alloc_chan_resources callback. Some of the drivers also
> do a hardware configuration or other resource allocation in of_xlate.
> This is a bit messy design and leave no place in the core to set
> slave device
> before device_alloc_chan_resources callback, where one would expect to have
> it already set.
We shouldn't be doing much at this stage. We operate on a channel, so the
channel is returned to the client. We need to do these HW configurations
when the channel has to be prepred for a txn.
> The best place to add new calls to the dmaengine drivers to set slave device
> would be just before device_alloc_chan_resources(), what in turn means that
> the current dmaengine core should do in dma_chan_get(). This would
> require to
> forward the slave device pointer via even more layers including the of_xlate
> callback too. IMHO this is not worth the effort.
>
> DMA engine core and API definitely needs some cleanup. During such cleanup
> the slave device pointer might be moved out of xlate into separate callback
> when the core gets ready for such operation.
Yes agreed on that, plus the runtime handling needs to be built in, right
now the APIs dont work well with it, we disucssed these during the KS and
this goes without saying, patches are welcome :)
> I ignored other paths for other firmware handle to a DMA channel translation
> mechanism because for the current pl330 driver they are simply not used. I
> assume that if one needs to implement similar things for drivers relying on
> them, he will update the respective DMA engine core parts.
>
> Slave device assignments can be cleared in device_chan_release_resources if
> this is needed and that what existing DMA engine drivers do with the
> resources
> allocated in the of_xlate callback...
--
~Vinod
next prev parent reply other threads:[~2017-02-09 4:11 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20170125102822eucas1p29f2605060eb8255a6cf06638c1148ec4@eucas1p2.samsung.com>
2017-01-25 10:28 ` [PATCH v7 0/4] DMA Engine: switch PL330 driver to non-irq-safe runtime PM Marek Szyprowski
[not found] ` <CGME20170125102823eucas1p2a21db04249e4c844ac21d612f76b1e12@eucas1p2.samsung.com>
2017-01-25 10:28 ` [PATCH v7 1/4] dmaengine: pl330: remove pdata based initialization Marek Szyprowski
[not found] ` <CGME20170125102824eucas1p1cf027184286131ff628eb7113c3f9e60@eucas1p1.samsung.com>
2017-01-25 10:28 ` [PATCH v7 2/4] dmaengine: Forward slave device pointer to of_xlate callback Marek Szyprowski
2017-01-25 13:12 ` Lars-Peter Clausen
2017-01-26 14:43 ` Marek Szyprowski
2017-02-03 13:01 ` Marek Szyprowski
2017-02-05 12:04 ` Vinod Koul
2017-02-09 4:11 ` Vinod Koul [this message]
2017-02-09 9:22 ` Marek Szyprowski
2017-02-09 9:55 ` Ulf Hansson
2017-02-09 13:30 ` Marek Szyprowski
2017-02-09 16:28 ` Vinod Koul
[not found] ` <CGME20170125102824eucas1p25744330b6608c8d6e1a994b4894827bd@eucas1p2.samsung.com>
2017-01-25 10:28 ` [PATCH v7 3/4] dmaengine: pl330: Store pointer to slave device Marek Szyprowski
[not found] ` <CGME20170125102825eucas1p22f4f6dbe744d778f0e1b53b6b26da5de@eucas1p2.samsung.com>
2017-01-25 10:28 ` [PATCH v7 4/4] dmaengine: pl330: Don't require irq-safe runtime PM Marek Szyprowski
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=20170209041123.GK19244@localhost \
--to=vinod.koul@intel.com \
--cc=alsa-devel@alsa-project.org \
--cc=b.zolnierkie@samsung.com \
--cc=broonie@kernel.org \
--cc=dmaengine@vger.kernel.org \
--cc=inki.dae@samsung.com \
--cc=krzk@kernel.org \
--cc=kuninori.morimoto.gx@renesas.com \
--cc=lars@metafoo.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=linux-samsung-soc@vger.kernel.org \
--cc=m.szyprowski@samsung.com \
--cc=rjw@rjwysocki.net \
--cc=ulf.hansson@linaro.org \
/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).