On 5/2/19 1:30 PM, Chris Wilson wrote:
We are not allowed to rpm_get() inside the runtime-suspend callback, so
split the intel_uc_suspend() into the core that assumes the caller holds
the wakeref (intel_uc_runtime_suspend), and one acquires the wakeref as
necessary (intel_uc_suspend).

Reported-by: Daniele Ceraolo Spurio <daniele.ceraolospu...@intel.com>
Fixes: 79ffac8599c4 ("drm/i915: Invert the GEM wakeref hierarchy")
Signed-off-by: Chris Wilson <ch...@chris-wilson.co.uk>
Cc: Daniele Ceraolo Spurio <daniele.ceraolospu...@intel.com>

Reviewed-by: Daniele Ceraolo Spurio <daniele.ceraolospu...@intel.com>

And we now have a new failure to look at that we weren't seeing before because the execution was cut short... :(

Daniele

---
  drivers/gpu/drm/i915/i915_drv.c |  2 +-
  drivers/gpu/drm/i915/intel_uc.c | 25 +++++++++++++++++--------
  drivers/gpu/drm/i915/intel_uc.h |  1 +
  3 files changed, 19 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index 21dac5a09fbe..74e46d129e6c 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -2886,7 +2886,7 @@ static int intel_runtime_suspend(struct device *kdev)
         */
        i915_gem_runtime_suspend(dev_priv);
- intel_uc_suspend(dev_priv);
+       intel_uc_runtime_suspend(dev_priv);
intel_runtime_pm_disable_interrupts(dev_priv); diff --git a/drivers/gpu/drm/i915/intel_uc.c b/drivers/gpu/drm/i915/intel_uc.c
index 01ea36e3150c..1ee70df51627 100644
--- a/drivers/gpu/drm/i915/intel_uc.c
+++ b/drivers/gpu/drm/i915/intel_uc.c
@@ -481,22 +481,31 @@ void intel_uc_reset_prepare(struct drm_i915_private *i915)
        intel_uc_sanitize(i915);
  }
-void intel_uc_suspend(struct drm_i915_private *i915)
+void intel_uc_runtime_suspend(struct drm_i915_private *i915)
  {
        struct intel_guc *guc = &i915->guc;
-       intel_wakeref_t wakeref;
        int err;
if (guc->fw.load_status != INTEL_UC_FIRMWARE_SUCCESS)
                return;
- with_intel_runtime_pm(i915, wakeref) {
-               err = intel_guc_suspend(guc);
-               if (err)
-                       DRM_DEBUG_DRIVER("Failed to suspend GuC, err=%d", err);
+       err = intel_guc_suspend(guc);
+       if (err)
+               DRM_DEBUG_DRIVER("Failed to suspend GuC, err=%d", err);
- guc_disable_communication(guc);
-       }
+       guc_disable_communication(guc);
+}
+
+void intel_uc_suspend(struct drm_i915_private *i915)
+{
+       struct intel_guc *guc = &i915->guc;
+       intel_wakeref_t wakeref;
+
+       if (guc->fw.load_status != INTEL_UC_FIRMWARE_SUCCESS)
+               return;
+
+       with_intel_runtime_pm(i915, wakeref)
+               intel_uc_runtime_suspend(i915);
  }
int intel_uc_resume(struct drm_i915_private *i915)
diff --git a/drivers/gpu/drm/i915/intel_uc.h b/drivers/gpu/drm/i915/intel_uc.h
index c92436b1f1c5..3ea06c87dfcd 100644
--- a/drivers/gpu/drm/i915/intel_uc.h
+++ b/drivers/gpu/drm/i915/intel_uc.h
@@ -40,6 +40,7 @@ int intel_uc_init(struct drm_i915_private *dev_priv);
  void intel_uc_fini(struct drm_i915_private *dev_priv);
  void intel_uc_reset_prepare(struct drm_i915_private *i915);
  void intel_uc_suspend(struct drm_i915_private *i915);
+void intel_uc_runtime_suspend(struct drm_i915_private *i915);
  int intel_uc_resume(struct drm_i915_private *dev_priv);
static inline bool intel_uc_is_using_guc(struct drm_i915_private *i915)

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reply via email to