Commit 9755f055 authored by Imre Deak's avatar Imre Deak

drm/i915: Restore memory mapping for DPT FBs across system suspend/resume

At least during hibernation the DPT mappings are lost with all stolen
memory content, so suspend/resume these mappings similarly to GGTT
mappings.

This fixes a problem where the restoring modeset during system resume fails
with pipe faults if a tiled framebuffer was active before suspend.

v2: Clarify the way restore works in intel_dpt_resume()'s Docbook entry.
    (Chris)

Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: Vunny Sodhi <vunny.sodhi@intel.com>
Reported-and-tested-by: default avatarVunny Sodhi <vunny.sodhi@intel.com>
Signed-off-by: default avatarImre Deak <imre.deak@intel.com>
Reviewed-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20211101183551.3580546-2-imre.deak@intel.com
parent 8d2f683f
...@@ -167,6 +167,58 @@ void intel_dpt_unpin(struct i915_address_space *vm) ...@@ -167,6 +167,58 @@ void intel_dpt_unpin(struct i915_address_space *vm)
i915_vma_put(dpt->vma); i915_vma_put(dpt->vma);
} }
/**
* intel_dpt_resume - restore the memory mapping for all DPT FBs during system resume
* @i915: device instance
*
* Restore the memory mapping during system resume for all framebuffers which
* are mapped to HW via a GGTT->DPT page table. The content of these page
* tables are not stored in the hibernation image during S4 and S3RST->S4
* transitions, so here we reprogram the PTE entries in those tables.
*
* This function must be called after the mappings in GGTT have been restored calling
* i915_ggtt_resume().
*/
void intel_dpt_resume(struct drm_i915_private *i915)
{
struct drm_framebuffer *drm_fb;
mutex_lock(&i915->drm.mode_config.fb_lock);
drm_for_each_fb(drm_fb, &i915->drm) {
struct intel_framebuffer *fb = to_intel_framebuffer(drm_fb);
if (fb->dpt_vm)
i915_ggtt_resume_vm(fb->dpt_vm);
}
mutex_unlock(&i915->drm.mode_config.fb_lock);
}
/**
* intel_dpt_suspend - suspend the memory mapping for all DPT FBs during system suspend
* @i915: device instance
*
* Suspend the memory mapping during system suspend for all framebuffers which
* are mapped to HW via a GGTT->DPT page table.
*
* This function must be called before the mappings in GGTT are suspended calling
* i915_ggtt_suspend().
*/
void intel_dpt_suspend(struct drm_i915_private *i915)
{
struct drm_framebuffer *drm_fb;
mutex_lock(&i915->drm.mode_config.fb_lock);
drm_for_each_fb(drm_fb, &i915->drm) {
struct intel_framebuffer *fb = to_intel_framebuffer(drm_fb);
if (fb->dpt_vm)
i915_ggtt_suspend_vm(fb->dpt_vm);
}
mutex_unlock(&i915->drm.mode_config.fb_lock);
}
struct i915_address_space * struct i915_address_space *
intel_dpt_create(struct intel_framebuffer *fb) intel_dpt_create(struct intel_framebuffer *fb)
{ {
......
...@@ -6,6 +6,8 @@ ...@@ -6,6 +6,8 @@
#ifndef __INTEL_DPT_H__ #ifndef __INTEL_DPT_H__
#define __INTEL_DPT_H__ #define __INTEL_DPT_H__
struct drm_i915_private;
struct i915_address_space; struct i915_address_space;
struct i915_vma; struct i915_vma;
struct intel_framebuffer; struct intel_framebuffer;
...@@ -13,6 +15,8 @@ struct intel_framebuffer; ...@@ -13,6 +15,8 @@ struct intel_framebuffer;
void intel_dpt_destroy(struct i915_address_space *vm); void intel_dpt_destroy(struct i915_address_space *vm);
struct i915_vma *intel_dpt_pin(struct i915_address_space *vm); struct i915_vma *intel_dpt_pin(struct i915_address_space *vm);
void intel_dpt_unpin(struct i915_address_space *vm); void intel_dpt_unpin(struct i915_address_space *vm);
void intel_dpt_suspend(struct drm_i915_private *i915);
void intel_dpt_resume(struct drm_i915_private *i915);
struct i915_address_space * struct i915_address_space *
intel_dpt_create(struct intel_framebuffer *fb); intel_dpt_create(struct intel_framebuffer *fb);
......
...@@ -51,6 +51,7 @@ ...@@ -51,6 +51,7 @@
#include "display/intel_dmc.h" #include "display/intel_dmc.h"
#include "display/intel_display_types.h" #include "display/intel_display_types.h"
#include "display/intel_dp.h" #include "display/intel_dp.h"
#include "display/intel_dpt.h"
#include "display/intel_fbdev.h" #include "display/intel_fbdev.h"
#include "display/intel_hotplug.h" #include "display/intel_hotplug.h"
#include "display/intel_overlay.h" #include "display/intel_overlay.h"
...@@ -1128,6 +1129,8 @@ static int i915_drm_suspend(struct drm_device *dev) ...@@ -1128,6 +1129,8 @@ static int i915_drm_suspend(struct drm_device *dev)
intel_suspend_hw(dev_priv); intel_suspend_hw(dev_priv);
/* Must be called before GGTT is suspended. */
intel_dpt_suspend(dev_priv);
i915_ggtt_suspend(&dev_priv->ggtt); i915_ggtt_suspend(&dev_priv->ggtt);
i915_save_display(dev_priv); i915_save_display(dev_priv);
...@@ -1244,6 +1247,8 @@ static int i915_drm_resume(struct drm_device *dev) ...@@ -1244,6 +1247,8 @@ static int i915_drm_resume(struct drm_device *dev)
drm_err(&dev_priv->drm, "failed to re-enable GGTT\n"); drm_err(&dev_priv->drm, "failed to re-enable GGTT\n");
i915_ggtt_resume(&dev_priv->ggtt); i915_ggtt_resume(&dev_priv->ggtt);
/* Must be called after GGTT is resumed. */
intel_dpt_resume(dev_priv);
intel_dmc_ucode_resume(dev_priv); intel_dmc_ucode_resume(dev_priv);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment