* [PATCH] drm/i915: Disable D3Cold in s2idle and runtime pm
@ 2021-11-15 15:40 Tilak Tangudu
2021-11-15 19:20 ` [Intel-gfx] " Rodrigo Vivi
0 siblings, 1 reply; 3+ messages in thread
From: Tilak Tangudu @ 2021-11-15 15:40 UTC (permalink / raw)
To: intel-gfx, dri-devel
Cc: jon.ewins, anshuman.gupta, tilak.tangudu, badal.nilawar,
rodrigo.vivi
s2idle and runtime pm puts the pci gfx device in D3Hot, ACPI runtime
monitors the pci tree,if it sees complete tree as D3Hot,it transitions
the device to D3Cold.But i915 do not have D3Cold support in S2idle or in
runtime pm. so disabling D3cold in above flows and its FIXME.
Added pci D3Cold enable/disable in s2idle and runtime suspend/resume
flows.
Signed-off-by: Tilak Tangudu <tilak.tangudu@intel.com>
---
drivers/gpu/drm/i915/i915_drv.c | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index 46bf3315f616..af6868f12ef0 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -1194,6 +1194,14 @@ static int i915_drm_suspend_late(struct drm_device *dev, bool hibernation)
goto out;
}
+ /*
+ * FIXME: Temporary hammer to avoid freezing the machine on our DGFX
+ * This should be totally removed when we handle the pci states properly
+ * on runtime PM and on s2idle cases.
+ */
+ if (suspend_to_idle(dev_priv))
+ pci_d3cold_disable(pdev);
+
pci_disable_device(pdev);
/*
* During hibernation on some platforms the BIOS may try to access
@@ -1357,6 +1365,8 @@ static int i915_drm_resume_early(struct drm_device *dev)
pci_set_master(pdev);
+ pci_d3cold_enable(pdev);
+
disable_rpm_wakeref_asserts(&dev_priv->runtime_pm);
ret = vlv_resume_prepare(dev_priv, false);
@@ -1533,6 +1543,7 @@ static int intel_runtime_suspend(struct device *kdev)
{
struct drm_i915_private *dev_priv = kdev_to_i915(kdev);
struct intel_runtime_pm *rpm = &dev_priv->runtime_pm;
+ struct pci_dev *pdev = to_pci_dev(dev_priv->drm.dev);
int ret;
if (drm_WARN_ON_ONCE(&dev_priv->drm, !HAS_RUNTIME_PM(dev_priv)))
@@ -1578,6 +1589,12 @@ static int intel_runtime_suspend(struct device *kdev)
drm_err(&dev_priv->drm,
"Unclaimed access detected prior to suspending\n");
+ /*
+ * FIXME: Temporary hammer to avoid freezing the machine on our DGFX
+ * This should be totally removed when we handle the pci states properly
+ * on runtime PM and on s2idle cases.
+ */
+ pci_d3cold_disable(pdev);
rpm->suspended = true;
/*
@@ -1616,6 +1633,7 @@ static int intel_runtime_resume(struct device *kdev)
{
struct drm_i915_private *dev_priv = kdev_to_i915(kdev);
struct intel_runtime_pm *rpm = &dev_priv->runtime_pm;
+ struct pci_dev *pdev = to_pci_dev(dev_priv->drm.dev);
int ret;
if (drm_WARN_ON_ONCE(&dev_priv->drm, !HAS_RUNTIME_PM(dev_priv)))
@@ -1628,6 +1646,7 @@ static int intel_runtime_resume(struct device *kdev)
intel_opregion_notify_adapter(dev_priv, PCI_D0);
rpm->suspended = false;
+ pci_d3cold_enable(pdev);
if (intel_uncore_unclaimed_mmio(&dev_priv->uncore))
drm_dbg(&dev_priv->drm,
"Unclaimed access during suspend, bios?\n");
--
2.25.1
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [Intel-gfx] [PATCH] drm/i915: Disable D3Cold in s2idle and runtime pm
2021-11-15 15:40 [PATCH] drm/i915: Disable D3Cold in s2idle and runtime pm Tilak Tangudu
@ 2021-11-15 19:20 ` Rodrigo Vivi
2021-11-16 14:48 ` Rodrigo Vivi
0 siblings, 1 reply; 3+ messages in thread
From: Rodrigo Vivi @ 2021-11-15 19:20 UTC (permalink / raw)
To: Tilak Tangudu; +Cc: intel-gfx, dri-devel
On Mon, Nov 15, 2021 at 09:10:54PM +0530, Tilak Tangudu wrote:
> s2idle and runtime pm puts the pci gfx device in D3Hot, ACPI runtime
> monitors the pci tree,if it sees complete tree as D3Hot,it transitions
> the device to D3Cold.But i915 do not have D3Cold support in S2idle or in
> runtime pm. so disabling D3cold in above flows and its FIXME.
>
> Added pci D3Cold enable/disable in s2idle and runtime suspend/resume
> flows.
>
> Signed-off-by: Tilak Tangudu <tilak.tangudu@intel.com>
Just for the clear record, I always preferred the unconditional disallow
of d3cold, but it looks some internal experiments for s3/s4 failed with that
and this approach here was the safest one, so let's move with this and
prevent the d3cold for now and then allow the runtime_pm autosuspend
enabled by default everywhere.
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
> ---
> drivers/gpu/drm/i915/i915_drv.c | 19 +++++++++++++++++++
> 1 file changed, 19 insertions(+)
>
> diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
> index 46bf3315f616..af6868f12ef0 100644
> --- a/drivers/gpu/drm/i915/i915_drv.c
> +++ b/drivers/gpu/drm/i915/i915_drv.c
> @@ -1194,6 +1194,14 @@ static int i915_drm_suspend_late(struct drm_device *dev, bool hibernation)
> goto out;
> }
>
> + /*
> + * FIXME: Temporary hammer to avoid freezing the machine on our DGFX
> + * This should be totally removed when we handle the pci states properly
> + * on runtime PM and on s2idle cases.
> + */
> + if (suspend_to_idle(dev_priv))
> + pci_d3cold_disable(pdev);
> +
> pci_disable_device(pdev);
> /*
> * During hibernation on some platforms the BIOS may try to access
> @@ -1357,6 +1365,8 @@ static int i915_drm_resume_early(struct drm_device *dev)
>
> pci_set_master(pdev);
>
> + pci_d3cold_enable(pdev);
> +
> disable_rpm_wakeref_asserts(&dev_priv->runtime_pm);
>
> ret = vlv_resume_prepare(dev_priv, false);
> @@ -1533,6 +1543,7 @@ static int intel_runtime_suspend(struct device *kdev)
> {
> struct drm_i915_private *dev_priv = kdev_to_i915(kdev);
> struct intel_runtime_pm *rpm = &dev_priv->runtime_pm;
> + struct pci_dev *pdev = to_pci_dev(dev_priv->drm.dev);
> int ret;
>
> if (drm_WARN_ON_ONCE(&dev_priv->drm, !HAS_RUNTIME_PM(dev_priv)))
> @@ -1578,6 +1589,12 @@ static int intel_runtime_suspend(struct device *kdev)
> drm_err(&dev_priv->drm,
> "Unclaimed access detected prior to suspending\n");
>
> + /*
> + * FIXME: Temporary hammer to avoid freezing the machine on our DGFX
> + * This should be totally removed when we handle the pci states properly
> + * on runtime PM and on s2idle cases.
> + */
> + pci_d3cold_disable(pdev);
> rpm->suspended = true;
>
> /*
> @@ -1616,6 +1633,7 @@ static int intel_runtime_resume(struct device *kdev)
> {
> struct drm_i915_private *dev_priv = kdev_to_i915(kdev);
> struct intel_runtime_pm *rpm = &dev_priv->runtime_pm;
> + struct pci_dev *pdev = to_pci_dev(dev_priv->drm.dev);
> int ret;
>
> if (drm_WARN_ON_ONCE(&dev_priv->drm, !HAS_RUNTIME_PM(dev_priv)))
> @@ -1628,6 +1646,7 @@ static int intel_runtime_resume(struct device *kdev)
>
> intel_opregion_notify_adapter(dev_priv, PCI_D0);
> rpm->suspended = false;
> + pci_d3cold_enable(pdev);
> if (intel_uncore_unclaimed_mmio(&dev_priv->uncore))
> drm_dbg(&dev_priv->drm,
> "Unclaimed access during suspend, bios?\n");
> --
> 2.25.1
>
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [Intel-gfx] [PATCH] drm/i915: Disable D3Cold in s2idle and runtime pm
2021-11-15 19:20 ` [Intel-gfx] " Rodrigo Vivi
@ 2021-11-16 14:48 ` Rodrigo Vivi
0 siblings, 0 replies; 3+ messages in thread
From: Rodrigo Vivi @ 2021-11-16 14:48 UTC (permalink / raw)
To: Tilak Tangudu; +Cc: intel-gfx, dri-devel
On Mon, Nov 15, 2021 at 02:20:36PM -0500, Rodrigo Vivi wrote:
> On Mon, Nov 15, 2021 at 09:10:54PM +0530, Tilak Tangudu wrote:
> > s2idle and runtime pm puts the pci gfx device in D3Hot, ACPI runtime
> > monitors the pci tree,if it sees complete tree as D3Hot,it transitions
> > the device to D3Cold.But i915 do not have D3Cold support in S2idle or in
> > runtime pm. so disabling D3cold in above flows and its FIXME.
> >
> > Added pci D3Cold enable/disable in s2idle and runtime suspend/resume
> > flows.
> >
> > Signed-off-by: Tilak Tangudu <tilak.tangudu@intel.com>
>
> Just for the clear record, I always preferred the unconditional disallow
> of d3cold, but it looks some internal experiments for s3/s4 failed with that
> and this approach here was the safest one, so let's move with this and
> prevent the d3cold for now and then allow the runtime_pm autosuspend
> enabled by default everywhere.
>
> Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
and pushed, thanks for the patch.
>
> > ---
> > drivers/gpu/drm/i915/i915_drv.c | 19 +++++++++++++++++++
> > 1 file changed, 19 insertions(+)
> >
> > diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
> > index 46bf3315f616..af6868f12ef0 100644
> > --- a/drivers/gpu/drm/i915/i915_drv.c
> > +++ b/drivers/gpu/drm/i915/i915_drv.c
> > @@ -1194,6 +1194,14 @@ static int i915_drm_suspend_late(struct drm_device *dev, bool hibernation)
> > goto out;
> > }
> >
> > + /*
> > + * FIXME: Temporary hammer to avoid freezing the machine on our DGFX
> > + * This should be totally removed when we handle the pci states properly
> > + * on runtime PM and on s2idle cases.
> > + */
> > + if (suspend_to_idle(dev_priv))
> > + pci_d3cold_disable(pdev);
> > +
> > pci_disable_device(pdev);
> > /*
> > * During hibernation on some platforms the BIOS may try to access
> > @@ -1357,6 +1365,8 @@ static int i915_drm_resume_early(struct drm_device *dev)
> >
> > pci_set_master(pdev);
> >
> > + pci_d3cold_enable(pdev);
> > +
> > disable_rpm_wakeref_asserts(&dev_priv->runtime_pm);
> >
> > ret = vlv_resume_prepare(dev_priv, false);
> > @@ -1533,6 +1543,7 @@ static int intel_runtime_suspend(struct device *kdev)
> > {
> > struct drm_i915_private *dev_priv = kdev_to_i915(kdev);
> > struct intel_runtime_pm *rpm = &dev_priv->runtime_pm;
> > + struct pci_dev *pdev = to_pci_dev(dev_priv->drm.dev);
> > int ret;
> >
> > if (drm_WARN_ON_ONCE(&dev_priv->drm, !HAS_RUNTIME_PM(dev_priv)))
> > @@ -1578,6 +1589,12 @@ static int intel_runtime_suspend(struct device *kdev)
> > drm_err(&dev_priv->drm,
> > "Unclaimed access detected prior to suspending\n");
> >
> > + /*
> > + * FIXME: Temporary hammer to avoid freezing the machine on our DGFX
> > + * This should be totally removed when we handle the pci states properly
> > + * on runtime PM and on s2idle cases.
> > + */
> > + pci_d3cold_disable(pdev);
> > rpm->suspended = true;
> >
> > /*
> > @@ -1616,6 +1633,7 @@ static int intel_runtime_resume(struct device *kdev)
> > {
> > struct drm_i915_private *dev_priv = kdev_to_i915(kdev);
> > struct intel_runtime_pm *rpm = &dev_priv->runtime_pm;
> > + struct pci_dev *pdev = to_pci_dev(dev_priv->drm.dev);
> > int ret;
> >
> > if (drm_WARN_ON_ONCE(&dev_priv->drm, !HAS_RUNTIME_PM(dev_priv)))
> > @@ -1628,6 +1646,7 @@ static int intel_runtime_resume(struct device *kdev)
> >
> > intel_opregion_notify_adapter(dev_priv, PCI_D0);
> > rpm->suspended = false;
> > + pci_d3cold_enable(pdev);
> > if (intel_uncore_unclaimed_mmio(&dev_priv->uncore))
> > drm_dbg(&dev_priv->drm,
> > "Unclaimed access during suspend, bios?\n");
> > --
> > 2.25.1
> >
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-11-16 14:48 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-11-15 15:40 [PATCH] drm/i915: Disable D3Cold in s2idle and runtime pm Tilak Tangudu
2021-11-15 19:20 ` [Intel-gfx] " Rodrigo Vivi
2021-11-16 14:48 ` Rodrigo Vivi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox