]> git.baikalelectronics.ru Git - kernel.git/commitdiff
drm/i915/guc: Fix runtime suspend
authorChris Wilson <chris@chris-wilson.co.uk>
Thu, 2 May 2019 20:30:09 +0000 (21:30 +0100)
committerChris Wilson <chris@chris-wilson.co.uk>
Fri, 3 May 2019 07:38:37 +0000 (08:38 +0100)
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 that acquires the wakeref
as necessary (intel_uc_suspend).

Reported-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
Fixes: 14ab88e3a048 ("drm/i915: Invert the GEM wakeref hierarchy")
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
Reviewed-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190502203009.15727-1-chris@chris-wilson.co.uk
drivers/gpu/drm/i915/i915_drv.c
drivers/gpu/drm/i915/intel_uc.c
drivers/gpu/drm/i915/intel_uc.h

index e6ce530d7581e8056c19d894870fc4ac7fa67175..5ed864752c7bb5a6a7204c7cefbcdb85f90cea02 100644 (file)
@@ -2890,7 +2890,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);
 
index 01ea36e3150cd320b0518a5f699836a010b9b51a..1ee70df516271c907b14815b4aeaa6e7e43cab39 100644 (file)
@@ -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)
index c92436b1f1c53ef9a62cbe928f7d245f001d0997..3ea06c87dfcdd1137ac475a959b8b4ddfb1e5e75 100644 (file)
@@ -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)