All of lore.kernel.org
 help / color / mirror / Atom feed
From: Krzysztof Kozlowski <krzk@kernel.org>
To: Marek Szyprowski <m.szyprowski@samsung.com>
Cc: Krzysztof Kozlowski <krzk@kernel.org>,
	linux-samsung-soc@vger.kernel.org, dmaengine@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.org,
	Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>,
	Vinod Koul <vinod.koul@intel.com>,
	Ulf Hansson <ulf.hansson@linaro.org>,
	"Rafael J. Wysocki" <rjw@rjwysocki.net>,
	Inki Dae <inki.dae@samsung.com>
Subject: Re: [PATCH 3/3] dmaengine: pl330: Don't require irq-safe runtime PM
Date: Sat, 24 Dec 2016 11:19:41 +0200	[thread overview]
Message-ID: <20161224091941.GA4254@kozik-lap> (raw)
In-Reply-To: <7e12d7cc-2dc1-2708-cabe-987d650ba3c5@samsung.com>

On Fri, Dec 23, 2016 at 11:38:19AM +0100, Marek Szyprowski wrote:

(...)

> >>The main assumption for it is an
> >>observation that there can be only one slave device using each DMA channel.
> >Wait, observation, real requirement or assumption?
> >
> >Later in the code I see adding such requirement.
> 
> Well, observation which result in assumption. I cannot imagine a hardware
> which
> shares slave DMA channel between devices. Also none of the existing platform
> does it.

OK for me.

> 
> >>Using recently introduced device dependencies (links) infrastructure one can
> >>ensure proper runtime PM state of PL330 DMA controller. In this approach in
> >>pl330_alloc_chan_resources() function a new dependency is being created
> >>between PL330 DMA controller device (as supplier) and given slave device
> >>(as consumer). This way PL330 DMA controller device runtime active counter
> >>is increased when the slave device is resumed and decreased the same time
> >>when given slave device is put to suspend. This way it has been ensured to
> >>keep PL330 DMA controller runtime active if there is an active used of any
> >>of its DMA channels. Slave device pointer is initially stored in per-channel
> >>data in of_dma_xlate callback. This is similar to what has been already
> >>implemented in Exynos IOMMU driver in commit 2f5f44f205cc958b
> >>("iommu/exynos: Use device dependency links to control runtime pm").
> >Sounds convincing... Interesting approach!
> >
> >My doubts are:
> >1. What with more then one slave device? (assumption?)
> 
> See above, there are no such cases.
> 
> >2. If slave device does not implement runtime PM, then pl330 will be
> >    active all the time?
> 
> Right, but the goal is to have runtime pm added to all devices in the
> system.
> 
> >3. If slave device implements runtime PM in a way that it's enabled in
> >    probe and released in remove, then pl330 will be active all the time?
> 
> Then it will force power domain to be turned on all the time and even
> optional
> fine-grained irq-safe runtiem pm in pl330 driver won't help much to reduce
> power
> consumption. I assume that the real goal with runtime pm is to let
> respective
> power domains to be turned off, what gives the best results in terms of
> power
> saving.

Indeed existing runtime PM for pl330 was not bringing much benefits of
its own - only clocks were enabled/disabled.

Thanks for clarifications.

(...)

> >>@@ -2113,14 +2089,63 @@ static struct dma_chan *of_dma_pl330_xlate(struct of_phandle_args *dma_spec,
> >>  	if (chan_id >= pl330->num_peripherals)
> >>  		return NULL;
> >>+	if (!pl330->peripherals[chan_id].slave)
> >>+		pl330->peripherals[chan_id].slave = slave;
> >>+	else if (pl330->peripherals[chan_id].slave != slave) {
> >>+		dev_err(pl330->ddma.dev,
> >>+			"Can't use same channel with multiple slave devices!\n");
> >>+		return NULL;
> >>+	}
> >This could be nicely split into separate patch.
> 
> Okay, if you want, I can move this change to separate patch.

Yes, please do it. Beside that patch looked fine to me.

Best regards,
Krzysztof

WARNING: multiple messages have this Message-ID (diff)
From: krzk@kernel.org (Krzysztof Kozlowski)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 3/3] dmaengine: pl330: Don't require irq-safe runtime PM
Date: Sat, 24 Dec 2016 11:19:41 +0200	[thread overview]
Message-ID: <20161224091941.GA4254@kozik-lap> (raw)
In-Reply-To: <7e12d7cc-2dc1-2708-cabe-987d650ba3c5@samsung.com>

On Fri, Dec 23, 2016 at 11:38:19AM +0100, Marek Szyprowski wrote:

(...)

> >>The main assumption for it is an
> >>observation that there can be only one slave device using each DMA channel.
> >Wait, observation, real requirement or assumption?
> >
> >Later in the code I see adding such requirement.
> 
> Well, observation which result in assumption. I cannot imagine a hardware
> which
> shares slave DMA channel between devices. Also none of the existing platform
> does it.

OK for me.

> 
> >>Using recently introduced device dependencies (links) infrastructure one can
> >>ensure proper runtime PM state of PL330 DMA controller. In this approach in
> >>pl330_alloc_chan_resources() function a new dependency is being created
> >>between PL330 DMA controller device (as supplier) and given slave device
> >>(as consumer). This way PL330 DMA controller device runtime active counter
> >>is increased when the slave device is resumed and decreased the same time
> >>when given slave device is put to suspend. This way it has been ensured to
> >>keep PL330 DMA controller runtime active if there is an active used of any
> >>of its DMA channels. Slave device pointer is initially stored in per-channel
> >>data in of_dma_xlate callback. This is similar to what has been already
> >>implemented in Exynos IOMMU driver in commit 2f5f44f205cc958b
> >>("iommu/exynos: Use device dependency links to control runtime pm").
> >Sounds convincing... Interesting approach!
> >
> >My doubts are:
> >1. What with more then one slave device? (assumption?)
> 
> See above, there are no such cases.
> 
> >2. If slave device does not implement runtime PM, then pl330 will be
> >    active all the time?
> 
> Right, but the goal is to have runtime pm added to all devices in the
> system.
> 
> >3. If slave device implements runtime PM in a way that it's enabled in
> >    probe and released in remove, then pl330 will be active all the time?
> 
> Then it will force power domain to be turned on all the time and even
> optional
> fine-grained irq-safe runtiem pm in pl330 driver won't help much to reduce
> power
> consumption. I assume that the real goal with runtime pm is to let
> respective
> power domains to be turned off, what gives the best results in terms of
> power
> saving.

Indeed existing runtime PM for pl330 was not bringing much benefits of
its own - only clocks were enabled/disabled.

Thanks for clarifications.

(...)

> >>@@ -2113,14 +2089,63 @@ static struct dma_chan *of_dma_pl330_xlate(struct of_phandle_args *dma_spec,
> >>  	if (chan_id >= pl330->num_peripherals)
> >>  		return NULL;
> >>+	if (!pl330->peripherals[chan_id].slave)
> >>+		pl330->peripherals[chan_id].slave = slave;
> >>+	else if (pl330->peripherals[chan_id].slave != slave) {
> >>+		dev_err(pl330->ddma.dev,
> >>+			"Can't use same channel with multiple slave devices!\n");
> >>+		return NULL;
> >>+	}
> >This could be nicely split into separate patch.
> 
> Okay, if you want, I can move this change to separate patch.

Yes, please do it. Beside that patch looked fine to me.

Best regards,
Krzysztof

  reply	other threads:[~2016-12-24  9:19 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20161222121148epcas5p11d4e49a3724e375a989aa173f731346f@epcas5p1.samsung.com>
2016-12-22 12:11 ` [PATCH 0/3] DMA Engine: switch PL330 driver to non-irq-safe runtime PM Marek Szyprowski
2016-12-22 12:11   ` Marek Szyprowski
2016-12-22 12:11   ` [PATCH 1/3] dmaengine: pl330: remove pdata based initialization Marek Szyprowski
2016-12-22 12:11     ` Marek Szyprowski
2016-12-22 12:11   ` [PATCH 2/3] dmaengine: Forward slave device pointer to of_xlate callback Marek Szyprowski
2016-12-22 12:11     ` Marek Szyprowski
2016-12-22 12:11   ` [PATCH 3/3] dmaengine: pl330: Don't require irq-safe runtime PM Marek Szyprowski
2016-12-22 12:11     ` Marek Szyprowski
2016-12-23  2:48     ` Krzysztof Kozlowski
2016-12-23  2:48       ` Krzysztof Kozlowski
2016-12-23 10:38       ` Marek Szyprowski
2016-12-23 10:38         ` Marek Szyprowski
2016-12-24  9:19         ` Krzysztof Kozlowski [this message]
2016-12-24  9:19           ` Krzysztof Kozlowski

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=20161224091941.GA4254@kozik-lap \
    --to=krzk@kernel.org \
    --cc=b.zolnierkie@samsung.com \
    --cc=dmaengine@vger.kernel.org \
    --cc=inki.dae@samsung.com \
    --cc=linux-arm-kernel@lists.infradead.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 \
    --cc=vinod.koul@intel.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.