intel-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Rodrigo Vivi <rodrigo.vivi@intel.com>
To: Ville Syrjala <ville.syrjala@linux.intel.com>
Cc: <intel-gfx@lists.freedesktop.org>
Subject: Re: [PATCH v2 2/6] drm/i915/pm: Hoist pci_save_state()+pci_set_power_state() to the end of pm _late() hook
Date: Fri, 14 Mar 2025 20:51:12 -0400	[thread overview]
Message-ID: <Z9TPANpe1zkXPNzb@intel.com> (raw)
In-Reply-To: <20250311195624.22420-3-ville.syrjala@linux.intel.com>

On Tue, Mar 11, 2025 at 09:56:20PM +0200, Ville Syrjala wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> drivers/pci does the pci_save_state()+pci_set_power_state() from
> the _noirq() pm hooks. Move our manual calls (needed for the
> hibernate vs. D3 workaround with buggy BIOSes) towards that same
> point. We currently have no _noirq() hooks, so end of _late()
> hooks is the best we can do right now.

fair enough, let's just get CI back and try it again there

Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>


> 
> Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  drivers/gpu/drm/i915/i915_driver.c | 19 ++++++++++++++-----
>  1 file changed, 14 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_driver.c b/drivers/gpu/drm/i915/i915_driver.c
> index be232caef9df..e06f2956382c 100644
> --- a/drivers/gpu/drm/i915/i915_driver.c
> +++ b/drivers/gpu/drm/i915/i915_driver.c
> @@ -1045,7 +1045,6 @@ static int i915_drm_suspend(struct drm_device *dev)
>  {
>  	struct drm_i915_private *dev_priv = to_i915(dev);
>  	struct intel_display *display = &dev_priv->display;
> -	struct pci_dev *pdev = to_pci_dev(dev_priv->drm.dev);
>  	pci_power_t opregion_target_state;
>  
>  	disable_rpm_wakeref_asserts(&dev_priv->runtime_pm);
> @@ -1059,8 +1058,6 @@ static int i915_drm_suspend(struct drm_device *dev)
>  		intel_display_driver_disable_user_access(display);
>  	}
>  
> -	pci_save_state(pdev);
> -
>  	intel_display_driver_suspend(display);
>  
>  	intel_irq_suspend(dev_priv);
> @@ -1117,10 +1114,16 @@ static int i915_drm_suspend_late(struct drm_device *dev, bool hibernation)
>  		drm_err(&dev_priv->drm, "Suspend complete failed: %d\n", ret);
>  		intel_display_power_resume_early(display);
>  
> -		goto out;
> +		goto fail;
>  	}
>  
> +	enable_rpm_wakeref_asserts(rpm);
> +
> +	if (!dev_priv->uncore.user_forcewake_count)
> +		intel_runtime_pm_driver_release(rpm);
> +
>  	pci_disable_device(pdev);
> +
>  	/*
>  	 * During hibernation on some platforms the BIOS may try to access
>  	 * the device even though it's already in D3 and hang the machine. So
> @@ -1132,11 +1135,17 @@ static int i915_drm_suspend_late(struct drm_device *dev, bool hibernation)
>  	 * Lenovo Thinkpad X301, X61s, X60, T60, X41
>  	 * Fujitsu FSC S7110
>  	 * Acer Aspire 1830T
> +	 *
> +	 * pci_save_state() prevents drivers/pci from
> +	 * automagically putting the device into D3.
>  	 */
> +	pci_save_state(pdev);
>  	if (!(hibernation && GRAPHICS_VER(dev_priv) < 6))
>  		pci_set_power_state(pdev, PCI_D3hot);
>  
> -out:
> +	return 0;
> +
> +fail:
>  	enable_rpm_wakeref_asserts(rpm);
>  	if (!dev_priv->uncore.user_forcewake_count)
>  		intel_runtime_pm_driver_release(rpm);
> -- 
> 2.45.3
> 

  reply	other threads:[~2025-03-15  0:51 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-11 19:56 [PATCH v2 0/6] drm/i915/pm: Clean up the hibernate vs. PCI D3 quirk Ville Syrjala
2025-03-11 19:56 ` [PATCH v2 1/6] drm/i915/pm: Simplify pm hook documentation Ville Syrjala
2025-09-12 13:51   ` Hogander, Jouni
2025-03-11 19:56 ` [PATCH v2 2/6] drm/i915/pm: Hoist pci_save_state()+pci_set_power_state() to the end of pm _late() hook Ville Syrjala
2025-03-15  0:51   ` Rodrigo Vivi [this message]
2025-03-17  7:17   ` Raag Jadav
2025-09-12 13:52   ` Hogander, Jouni
2025-03-11 19:56 ` [PATCH v2 3/6] drm/i915/pm: Move the hibernate+D3 quirk stuff into noirq() pm hooks Ville Syrjala
2025-09-12 13:52   ` Hogander, Jouni
2025-03-11 19:56 ` [PATCH v2 4/6] drm/i915/pm: Do pci_restore_state() in switcheroo resume hook Ville Syrjala
2025-03-15  0:55   ` Rodrigo Vivi
2025-09-12 13:53   ` Hogander, Jouni
2025-03-11 19:56 ` [PATCH v2 5/6] drm/i915/pm: Allow drivers/pci to manage our pci state normally Ville Syrjala
2025-03-15  0:56   ` Rodrigo Vivi
2025-09-12 13:53   ` Hogander, Jouni
2025-03-11 19:56 ` [PATCH v2 6/6] drm/i915/pm: Drop redundant pci stuff from suspend/resume paths Ville Syrjala
2025-03-15  1:00   ` Rodrigo Vivi
2025-09-12  9:44   ` Hogander, Jouni
2025-09-12 12:56     ` Ville Syrjälä
2025-09-12 13:54   ` Hogander, Jouni
2025-03-11 23:15 ` ✗ i915.CI.BAT: failure for drm/i915/pm: Clean up the hibernate vs. PCI D3 quirk (rev2) Patchwork
2025-03-12  9:52   ` Ville Syrjälä
2025-03-12 10:05     ` Saarinen, Jani
2025-03-12 10:07       ` Saarinen, Jani
2025-03-12 11:53         ` Saarinen, Jani
2025-03-12 12:06       ` Knop, Ryszard
2025-04-25 18:08 ` ✗ Fi.CI.BUILD: warning for drm/i915/pm: Clean up the hibernate vs. PCI D3 quirk (rev3) Patchwork
2025-04-25 19:40 ` ✓ i915.CI.BAT: success " Patchwork
2025-04-26  3:56 ` ✓ i915.CI.Full: " Patchwork

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=Z9TPANpe1zkXPNzb@intel.com \
    --to=rodrigo.vivi@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=ville.syrjala@linux.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;
as well as URLs for NNTP newsgroup(s).