From: Naresh Kumar Kachhi <naresh.kumar.kachhi@intel.com>
To: Daniel Vetter <daniel@ffwll.ch>
Cc: intel-gfx@lists.freedesktop.org, "Satyanantha,
Rama Gopal M" <rama.gopal.m.satyanantha@intel.com>
Subject: Re: [RFC 5/6] drm/i915: device specific runtime suspend/resume
Date: Fri, 24 Jan 2014 20:53:18 +0530 [thread overview]
Message-ID: <52E28566.3080703@intel.com> (raw)
In-Reply-To: <20140122125805.GH9772@phenom.ffwll.local>
On 01/22/2014 06:28 PM, Daniel Vetter wrote:
> On Wed, Jan 22, 2014 at 05:34:21PM +0530, naresh.kumar.kachhi@intel.com wrote:
>> From: Naresh Kumar Kachhi <naresh.kumar.kachhi@intel.com>
>>
>> we might need special handling for different platforms.
>> for ex. baytrail. To handle this this patch creates function
>> pointers for runtime suspend/resume which are assigned
>> during driver load time
>>
>> Signed-off-by: Naresh Kumar Kachhi <naresh.kumar.kachhi@intel.com>
> Again NAK on principles: vtables always have a cost, so before we add a
> new one we need to demonstrate the need. Which means 2-3 different
> implementations for the vfunc must exist. Sometimes some of these are
> still embargo'ed in the -internal tree (like with the ppgtt refactor a
> year ago) and that's ok.
>
> The other reason I don't like this is that thus far the driver
> load/teardown and suspend/resume sequences are generic. There are tricky
> (sometimes really tricky) dependcies, but that's the design thus far. So
> if we want to switch the design to per-platform functions we need good
> reasons for that switch in general. Which means likely the same issues
> will crop up in the normal suspend/resume and driver load/teardown paths.
> Which leaves me wondering why we don't have this here.
>
> Finally we've been bitten countless times through superflous differences
> and duplicated codepaths between normal operation, suspend/resume, driver
> load/teardown and now runtime pm. So again deviating from a shared code
> pattern need excellent justification. Yes I know that atm pc8 has its own
> stuff, and I expect this to hurt us eventually ;-)
>
> Looking at this patch I don't see any of this.
> -Daniel
Hi Daniel,
I agree with you here, we should try to have a generic solutions. But we have
different scenario in case of LP platform and mainstream. In case of LP we
might go to deeper sleep state (causing Gunit power gate), and might need
some extra work during runtime_suspend/resume. Also as on BYT interrupts are
routed through display power island, making display power gating dependent on
runtime_suspend/resume. which might not be the case for other platforms.
Yes, this patch is not conclusive to prove the need of a separate function
I am working on BYT runtime runtime_suspend/resume. Once done, we can evaluate if we
need a separate functions or not.
>> ---
>> drivers/gpu/drm/i915/i915_drv.c | 23 ++++++++---------------
>> drivers/gpu/drm/i915/i915_drv.h | 6 ++++++
>> drivers/gpu/drm/i915/intel_pm.c | 38 ++++++++++++++++++++++++++++++++++++++
>> 3 files changed, 52 insertions(+), 15 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
>> index 80965be..dc1cfab 100644
>> --- a/drivers/gpu/drm/i915/i915_drv.c
>> +++ b/drivers/gpu/drm/i915/i915_drv.c
>> @@ -935,19 +935,10 @@ static int i915_runtime_suspend(struct device *device)
>>
>> DRM_DEBUG_KMS("Suspending device\n");
>>
>> - i915_gem_release_all_mmaps(dev_priv);
>> -
>> - del_timer_sync(&dev_priv->gpu_error.hangcheck_timer);
>> - dev_priv->pm.suspended = true;
>> -
>> - /*
>> - * current versions of firmware which depend on this opregion
>> - * notification have repurposed the D1 definition to mean
>> - * "runtime suspended" vs. what you would normally expect (D3)
>> - * to distinguish it from notifications that might be sent
>> - * via the suspend path.
>> - */
>> - intel_opregion_notify_adapter(dev, PCI_D1);
>> + if (dev_priv->pm.funcs.runtime_suspend)
>> + dev_priv->pm.funcs.runtime_suspend(dev_priv);
>> + else
>> + DRM_ERROR("Device does not have runtime functions");
>>
>> return 0;
>> }
>> @@ -962,8 +953,10 @@ static int i915_runtime_resume(struct device *device)
>>
>> DRM_DEBUG_KMS("Resuming device\n");
>>
>> - intel_opregion_notify_adapter(dev, PCI_D0);
>> - dev_priv->pm.suspended = false;
>> + if (dev_priv->pm.funcs.runtime_resume)
>> + dev_priv->pm.funcs.runtime_resume(dev_priv);
>> + else
>> + DRM_ERROR("Device does not have runtime functions");
>>
>> return 0;
>> }
>> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
>> index 6a6f046..54aa31d 100644
>> --- a/drivers/gpu/drm/i915/i915_drv.h
>> +++ b/drivers/gpu/drm/i915/i915_drv.h
>> @@ -1322,11 +1322,17 @@ struct i915_package_c8 {
>> } regsave;
>> };
>>
>> +struct i915_runtime_pm_funcs {
>> + int (*runtime_suspend)(struct drm_i915_private *dev_priv);
>> + int (*runtime_resume)(struct drm_i915_private *dev_priv);
>> +};
>> +
>> struct i915_runtime_pm {
>> bool suspended;
>> bool gpu_idle;
>> bool disp_idle;
>> struct mutex lock;
>> + struct i915_runtime_pm_funcs funcs;
>> };
>>
>> enum intel_pipe_crc_source {
>> diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
>> index 9d6d0e1..6713995 100644
>> --- a/drivers/gpu/drm/i915/intel_pm.c
>> +++ b/drivers/gpu/drm/i915/intel_pm.c
>> @@ -5588,6 +5588,41 @@ void intel_runtime_pm_put(struct drm_i915_private *dev_priv)
>> pm_runtime_put_autosuspend(device);
>> }
>>
>> +static int hsw_runtime_suspend(struct drm_i915_private *dev_priv)
>> +{
>> + struct drm_device *dev = dev_priv->dev;
>> +
>> + WARN_ON(!HAS_RUNTIME_PM(dev));
>> +
>> + i915_gem_release_all_mmaps(dev_priv);
>> +
>> + del_timer_sync(&dev_priv->gpu_error.hangcheck_timer);
>> + dev_priv->pm.suspended = true;
>> +
>> + /*
>> + * current versions of firmware which depend on this opregion
>> + * notification have repurposed the D1 definition to mean
>> + * "runtime suspended" vs. what you would normally expect (D3)
>> + * to distinguish it from notifications that might be sent
>> + * via the suspend path.
>> + */
>> + intel_opregion_notify_adapter(dev, PCI_D1);
>> +
>> +
>> + return 0;
>> +}
>> +
>> +static int hsw_runtime_resume(struct drm_i915_private *dev_priv)
>> +{
>> + struct drm_device *dev = dev_priv->dev;
>> + WARN_ON(!HAS_RUNTIME_PM(dev));
>> +
>> + intel_opregion_notify_adapter(dev_priv->dev, PCI_D0);
>> + dev_priv->pm.suspended = false;
>> +
>> + return 0;
>> +}
>> +
>> void intel_init_runtime_pm(struct drm_i915_private *dev_priv)
>> {
>> struct drm_device *dev = dev_priv->dev;
>> @@ -5606,6 +5641,9 @@ void intel_init_runtime_pm(struct drm_i915_private *dev_priv)
>> pm_runtime_set_autosuspend_delay(device, 10000); /* 10s */
>> pm_runtime_mark_last_busy(device);
>> pm_runtime_use_autosuspend(device);
>> +
>> + dev_priv->pm.funcs.runtime_suspend = hsw_runtime_suspend;
>> + dev_priv->pm.funcs.runtime_resume = hsw_runtime_resume;
>> }
>>
>> void intel_fini_runtime_pm(struct drm_i915_private *dev_priv)
>> --
>> 1.8.1.2
>>
>> _______________________________________________
>> Intel-gfx mailing list
>> Intel-gfx@lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2014-01-24 15:24 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-22 12:04 [RFC 0/6] enabling runtime on BYT naresh.kumar.kachhi
2014-01-22 12:04 ` [RFC 1/6] drm/i915: cover ioctls with runtime_get/put naresh.kumar.kachhi
2014-01-22 12:51 ` Daniel Vetter
2014-01-22 13:23 ` Imre Deak
2014-01-24 15:05 ` Naresh Kumar Kachhi
2014-01-24 15:56 ` Paulo Zanoni
2014-02-24 5:17 ` Naresh Kumar Kachhi
2014-01-24 17:23 ` Imre Deak
2014-02-21 20:07 ` Jesse Barnes
2014-02-24 5:30 ` Naresh Kumar Kachhi
2014-01-22 13:35 ` Paulo Zanoni
2014-01-22 12:04 ` [RFC 2/6] drm/i915: cover ring access with rpm get/put naresh.kumar.kachhi
2014-01-22 13:39 ` Paulo Zanoni
2014-01-22 12:04 ` [RFC 3/6] drm/i915: introduce runtime get/put based on display activity naresh.kumar.kachhi
2014-01-22 13:40 ` Paulo Zanoni
2014-02-24 5:21 ` Naresh Kumar Kachhi
2014-01-22 12:04 ` [RFC 4/6] drm/i915/vlv: call runtime get/put based on disp activity naresh.kumar.kachhi
2014-01-22 12:04 ` [RFC 5/6] drm/i915: device specific runtime suspend/resume naresh.kumar.kachhi
2014-01-22 12:58 ` Daniel Vetter
2014-01-24 15:23 ` Naresh Kumar Kachhi [this message]
2014-01-22 12:04 ` [RFC 6/6] FOR_UPSTREAM [VPG]: drm/i915: call init_runtime_pm before gem_init naresh.kumar.kachhi
2014-01-22 13:44 ` Paulo Zanoni
2014-01-24 15:11 ` Naresh Kumar Kachhi
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=52E28566.3080703@intel.com \
--to=naresh.kumar.kachhi@intel.com \
--cc=daniel@ffwll.ch \
--cc=intel-gfx@lists.freedesktop.org \
--cc=rama.gopal.m.satyanantha@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox