intel-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Imre Deak <imre.deak@intel.com>
To: Paulo Zanoni <przanoni@gmail.com>
Cc: Intel Graphics Development <intel-gfx@lists.freedesktop.org>,
	Paulo Zanoni <paulo.r.zanoni@intel.com>
Subject: Re: [RFC 1/6] drm/i915: add initial Runtime PM functions
Date: Thu, 07 Nov 2013 11:38:37 +0200	[thread overview]
Message-ID: <1383817117.2374.25.camel@ideak-mobl> (raw)
In-Reply-To: <CA+gsUGRnJ11BbhvZ-J+_gZ_09xAKDz9xBzGHt-_fFuSFw0DCDg@mail.gmail.com>

On Wed, 2013-11-06 at 18:32 -0200, Paulo Zanoni wrote:
> 2013/10/28 Imre Deak <imre.deak@intel.com>:
> > On Tue, 2013-10-22 at 17:30 -0200, Paulo Zanoni wrote:
> >> From: Paulo Zanoni <paulo.r.zanoni@intel.com>
> >>
> >> This patch adds the initial infrastructure to allow a Runtime PM
> >> implementation that sets the device to its D3 state. The patch just
> >> adds the necessary callbacks and the initial infrastructure.
> >>
> >> We still don't have any platform that actually uses this
> >> infrastructure, we still don't call get/put in all the places we need
> >> to, and we don't have any function to save/restore the state of the
> >> registers. This is not a problem since no platform uses the code added
> >> by this patch. We have a few people simultaneously working on runtime
> >> PM, so this initial code could help everybody make their plans.
> >>
> >> Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
> >> ---
> >>  drivers/gpu/drm/i915/i915_dma.c     | 38 +++++++++++++++++++++++++++++++++
> >>  drivers/gpu/drm/i915/i915_drv.c     | 42 +++++++++++++++++++++++++++++++++++++
> >>  drivers/gpu/drm/i915/i915_drv.h     |  7 +++++++
> >>  drivers/gpu/drm/i915/intel_drv.h    |  2 ++
> >>  drivers/gpu/drm/i915/intel_pm.c     | 26 +++++++++++++++++++++++
> >>  drivers/gpu/drm/i915/intel_uncore.c |  9 ++++++++
> >>  6 files changed, 124 insertions(+)
> >>
> >> diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
> >> index fd848ef..6aa044e 100644
> >> --- a/drivers/gpu/drm/i915/i915_dma.c
> >> +++ b/drivers/gpu/drm/i915/i915_dma.c
> >> @@ -42,6 +42,8 @@
> >>  #include <linux/vga_switcheroo.h>
> >>  #include <linux/slab.h>
> >>  #include <acpi/video.h>
> >> +#include <linux/pm.h>
> >> +#include <linux/pm_runtime.h>
> >>
> >>  #define LP_RING(d) (&((struct drm_i915_private *)(d))->ring[RCS])
> >>
> >> @@ -1449,6 +1451,38 @@ static void i915_dump_device_info(struct drm_i915_private *dev_priv)
> >>  #undef SEP_COMMA
> >>  }
> >>
> >> +static void i915_init_runtime_pm(struct drm_i915_private *dev_priv)
> >> +{
> >> +     struct drm_device *dev = dev_priv->dev;
> >> +     struct device *device = &dev->pdev->dev;
> >> +
> >> +     dev_priv->pm.suspended = false;
> >> +
> >> +     if (!HAS_RUNTIME_PM(dev))
> >> +             return;
> >> +
> >> +     pm_runtime_set_active(device);
> >> +     pm_runtime_enable(device);
> >> +
> >> +     pm_runtime_set_autosuspend_delay(device, 10000); /* 10s */
> >> +     pm_runtime_mark_last_busy(device);
> >> +     pm_runtime_use_autosuspend(device);
> >> +     pm_runtime_allow(device);
> >
> > This shouldn't be needed as we get here already with an allowed state.
> > It's not a problem as it's just a nop here, but imo it's confusing that
> > we don't have the corresponding pm_runtime_forbid() in
> > i915_fini_runtime_pm().
> 
> If we don't call this, when we boot the machine the "power/control"
> sysfs file will be "on", which means runtime PM is disabled. We have
> to manually "echo auto > control" to enable runtime PM then. But I
> guess leaving runtime PM disabled by default might be what we want, so
> I'll remove the call here.

Right, I haven't noticed that pci_pm_init() does an explicit
pm_runtime_forbid(). Documentation/runtime_pm.txt says that drivers
should call pm_runtime_forbid() explicitly if they want to disable user
control. Imo the PCI subsystem doing this in the background is somewhat
deceiving for driver authors.

I noticed only now by looking at pci_pm_init() that the same goes for
pm_runtime_set_active(), pm_runtime_enable() above. Since these are
already called for you, atm you'll get an "unbalanced pm_runtime_enable"
message, though this doesn't cause any other problem. Again contrary to
what you'd expect reading runtime_pm.txt.

--Imre

  reply	other threads:[~2013-11-07  9:38 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-22 19:30 [RFC 0/6] Haswell runtime PM support + D3 Paulo Zanoni
2013-10-22 19:30 ` [RFC 1/6] drm/i915: add initial Runtime PM functions Paulo Zanoni
2013-10-28 13:21   ` Imre Deak
2013-11-06 20:32     ` Paulo Zanoni
2013-11-07  9:38       ` Imre Deak [this message]
2013-11-07 11:36         ` Imre Deak
2013-11-07 18:13           ` Imre Deak
2013-10-22 19:30 ` [RFC 2/6] drm/i915: do adapter power state notification at runtime PM Paulo Zanoni
2013-10-22 19:30 ` [RFC 3/6] drm/i915: add enable_runtime_pm option Paulo Zanoni
2013-10-28 13:27   ` Imre Deak
2013-11-04 21:36     ` Ville Syrjälä
2013-11-06 20:04       ` Paulo Zanoni
2013-10-22 19:30 ` [RFC 4/6] drm/i915: add runtime put/get calls at the basic places Paulo Zanoni
2013-10-22 19:30 ` [RFC 5/6] drm/i915: add some runtime PM get/put calls Paulo Zanoni
2013-10-22 19:30 ` [RFC 6/6] drm/i915: add runtime PM support on Haswell Paulo Zanoni
2013-10-25 13:44 ` [RFC i-g-t] tests: add runtime_pm Paulo Zanoni
2013-10-27 13:37   ` Daniel Vetter
2013-10-28 12:20     ` Paulo Zanoni
2013-10-28 16:05       ` Daniel Vetter
2013-11-04 21:40       ` Ville Syrjälä
2013-11-08 18:19         ` Paulo Zanoni
2013-11-08 18:42           ` Daniel Vetter
2013-10-28 13:09 ` [RFC 0/6] Haswell runtime PM support + D3 Imre Deak
2013-10-28 16:10   ` Daniel Vetter
2013-10-28 20:02     ` Jesse Barnes

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=1383817117.2374.25.camel@ideak-mobl \
    --to=imre.deak@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=paulo.r.zanoni@intel.com \
    --cc=przanoni@gmail.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 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).