[PATCH v2 5/6] drm/i915/pm: Allow drivers/pci to manage our pci state normally
Rodrigo Vivi
rodrigo.vivi at intel.com
Sat Mar 15 00:56:33 UTC 2025
On Tue, Mar 11, 2025 at 09:56:23PM +0200, Ville Syrjala wrote:
> From: Ville Syrjälä <ville.syrjala at linux.intel.com>
>
> Stop doing the pci_save_state(), except when we need to prevent
> D3 due to BIOS bugs, so that the code in drivers/pci is allowed
> to manage the state of the PCI device. Less chance something
> getting left by the wayside by i915 if/when the things change in
> drivers/pci.
>
> Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
> ---
> drivers/gpu/drm/i915/i915_driver.c | 11 +++++------
> 1 file changed, 5 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_driver.c b/drivers/gpu/drm/i915/i915_driver.c
> index a199e21c7bb4..503f1b6b694f 100644
> --- a/drivers/gpu/drm/i915/i915_driver.c
> +++ b/drivers/gpu/drm/i915/i915_driver.c
> @@ -1154,9 +1154,8 @@ static int i915_drm_suspend_noirq(struct drm_device *dev, bool hibernation)
> * 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);
> + if (hibernation && GRAPHICS_VER(dev_priv) < 6)
> + pci_save_state(pdev);
>
> return 0;
> }
> @@ -1164,6 +1163,7 @@ static int i915_drm_suspend_noirq(struct drm_device *dev, bool hibernation)
> int i915_driver_suspend_switcheroo(struct drm_i915_private *i915,
> pm_message_t state)
> {
> + struct pci_dev *pdev = to_pci_dev(i915->drm.dev);
> int error;
>
> if (drm_WARN_ON_ONCE(&i915->drm, state.event != PM_EVENT_SUSPEND &&
> @@ -1181,9 +1181,8 @@ int i915_driver_suspend_switcheroo(struct drm_i915_private *i915,
> if (error)
> return error;
>
> - error = i915_drm_suspend_noirq(&i915->drm, false);
> - if (error)
> - return error;
> + pci_save_state(pdev);
> + pci_set_power_state(pdev, PCI_D3hot);
Cc: Badal Nilawar <badal.nilawar at intel.com>
he hit an issue in Xe recently related to the lack of this iirc.
Hopefully this is right here and we can get this right here and port to Xe.
>
> return 0;
> }
> --
> 2.45.3
>
More information about the Intel-gfx
mailing list