@@ -1693,7 +1693,15 @@ static int i915_drm_resume(struct drm_device *dev)
}
mutex_unlock(&dev->struct_mutex);
- intel_guc_resume(dev_priv);
+ /*
+ * NB: Full gem reinitialization is being done above, hence
+ * intel_uc_resume will be of no use. Currently intel_uc_resume
+ * is nop. If full reinitialization is removed, will need to put
+ * functionality to resume from sleep in intel_uc_resume.
+ */
+ ret = intel_uc_resume(dev_priv);
+ if (ret)
+ DRM_ERROR("failed to resume uc\n");
intel_modeset_init_hw(dev);
@@ -2495,7 +2503,12 @@ static int intel_runtime_suspend(struct device *kdev)
*/
i915_gem_runtime_suspend(dev_priv);
- intel_guc_suspend(dev_priv);
+ ret = intel_uc_runtime_suspend(dev_priv);
+ if (ret) {
+ DRM_ERROR("uc runtime suspend failed, disabling it(%d)\n", ret);
+ enable_rpm_wakeref_asserts(dev_priv);
+ return ret;
+ }
intel_runtime_pm_disable_interrupts(dev_priv);
@@ -2580,7 +2593,11 @@ static int intel_runtime_resume(struct device *kdev)
if (intel_uncore_unclaimed_mmio(dev_priv))
DRM_DEBUG_DRIVER("Unclaimed access during suspend, bios?\n");
- intel_guc_resume(dev_priv);
+ ret = intel_uc_runtime_resume(dev_priv);
+ if (ret) {
+ DRM_ERROR("uc runtime resume failed (%d)\n", ret);
+ return ret;
+ }
if (IS_GEN9_LP(dev_priv)) {
bxt_disable_dc9(dev_priv);
@@ -4539,7 +4539,11 @@ int i915_gem_suspend(struct drm_i915_private *dev_priv)
i915_gem_contexts_lost(dev_priv);
mutex_unlock(&dev->struct_mutex);
- intel_guc_suspend(dev_priv);
+ ret = intel_uc_suspend(dev_priv);
+ if (ret) {
+ DRM_ERROR("uc suspend failed (%d)\n", ret);
+ goto out;
+ }
cancel_delayed_work_sync(&dev_priv->gpu_error.hangcheck_work);
cancel_delayed_work_sync(&dev_priv->gt.retire_work);
@@ -4583,6 +4587,7 @@ int i915_gem_suspend(struct drm_i915_private *dev_priv)
err_unlock:
mutex_unlock(&dev->struct_mutex);
+out:
intel_runtime_pm_put(dev_priv);
return ret;
}
@@ -422,3 +422,23 @@ void intel_uc_fini_hw(struct drm_i915_private *dev_priv)
i915_ggtt_disable_guc(dev_priv);
}
+
+int intel_uc_runtime_suspend(struct drm_i915_private *dev_priv)
+{
+ return intel_guc_suspend(dev_priv);
+}
+
+int intel_uc_runtime_resume(struct drm_i915_private *dev_priv)
+{
+ return intel_guc_resume(dev_priv);
+}
+
+int intel_uc_suspend(struct drm_i915_private *dev_priv)
+{
+ return intel_guc_suspend(dev_priv);
+}
+
+int intel_uc_resume(struct drm_i915_private *dev_priv)
+{
+ return 0;
+}
@@ -65,5 +65,9 @@ static inline const char *intel_uc_fw_type_repr(enum intel_uc_fw_type type)
void intel_uc_init_mmio(struct drm_i915_private *dev_priv);
int intel_uc_init_hw(struct drm_i915_private *dev_priv);
void intel_uc_fini_hw(struct drm_i915_private *dev_priv);
+int intel_uc_runtime_suspend(struct drm_i915_private *dev_priv);
+int intel_uc_runtime_resume(struct drm_i915_private *dev_priv);
+int intel_uc_suspend(struct drm_i915_private *dev_priv);
+int intel_uc_resume(struct drm_i915_private *dev_priv);
#endif
Prepared generic helpers intel_uc_suspend, intel_uc_resume, intel_uc_runtime_suspend, intel_uc_runtime_resume. Added error handling to all the calls for suspend/resume. Cc: Michal Wajdeczko <michal.wajdeczko@intel.com> Cc: MichaĆ Winiarski <michal.winiarski@intel.com> Signed-off-by: Sagar Arun Kamble <sagar.a.kamble@intel.com> --- drivers/gpu/drm/i915/i915_drv.c | 23 ++++++++++++++++++++--- drivers/gpu/drm/i915/i915_gem.c | 7 ++++++- drivers/gpu/drm/i915/intel_uc.c | 20 ++++++++++++++++++++ drivers/gpu/drm/i915/intel_uc.h | 4 ++++ 4 files changed, 50 insertions(+), 4 deletions(-)