drm/i915/gt: Introduce intel_gt_runtime_suspend/resume
authorDaniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
Thu, 1 Aug 2019 00:57:09 +0000 (17:57 -0700)
committerChris Wilson <chris@chris-wilson.co.uk>
Thu, 1 Aug 2019 16:58:54 +0000 (17:58 +0100)
To be called from the top level runtime functions, to hide the
gt-specific bits (mainly related to intel_uc).

v2: rebased

Signed-off-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Link: https://patchwork.freedesktop.org/patch/msgid/20190801005709.34092-3-daniele.ceraolospurio@intel.com
drivers/gpu/drm/i915/gt/intel_gt_pm.c
drivers/gpu/drm/i915/gt/intel_gt_pm.h
drivers/gpu/drm/i915/i915_drv.c

index 65c0d0c9d54339a44c4ea361b69b64cf712bad4a..6c8970271a7f93b4d43f8d544183ff6ede184835 100644 (file)
@@ -164,3 +164,15 @@ int intel_gt_resume(struct intel_gt *gt)
 
        return err;
 }
+
+void intel_gt_runtime_suspend(struct intel_gt *gt)
+{
+       intel_uc_runtime_suspend(&gt->uc);
+}
+
+int intel_gt_runtime_resume(struct intel_gt *gt)
+{
+       intel_gt_init_swizzling(gt);
+
+       return intel_uc_runtime_resume(&gt->uc);
+}
index ba960e1fc209863df1729d3b2fe86d4149abeab0..527894fe134588cb179e8a9102b11072784ffba1 100644 (file)
@@ -23,5 +23,7 @@ void intel_gt_pm_init_early(struct intel_gt *gt);
 
 void intel_gt_sanitize(struct intel_gt *gt, bool force);
 int intel_gt_resume(struct intel_gt *gt);
+void intel_gt_runtime_suspend(struct intel_gt *gt);
+int intel_gt_runtime_resume(struct intel_gt *gt);
 
 #endif /* INTEL_GT_PM_H */
index 1fde2357e167e9bedfbac0f92cf1286f6af99300..d6178f5c6b502c8c657dc1f0307bbb2dc89654e7 100644 (file)
@@ -2925,7 +2925,7 @@ static int intel_runtime_suspend(struct device *kdev)
         */
        i915_gem_runtime_suspend(dev_priv);
 
-       intel_uc_runtime_suspend(&dev_priv->gt.uc);
+       intel_gt_runtime_suspend(&dev_priv->gt);
 
        intel_runtime_pm_disable_interrupts(dev_priv);
 
@@ -2950,9 +2950,8 @@ static int intel_runtime_suspend(struct device *kdev)
 
                intel_runtime_pm_enable_interrupts(dev_priv);
 
-               intel_uc_runtime_resume(&dev_priv->gt.uc);
+               intel_gt_runtime_resume(&dev_priv->gt);
 
-               intel_gt_init_swizzling(&dev_priv->gt);
                i915_gem_restore_fences(dev_priv);
 
                enable_rpm_wakeref_asserts(rpm);
@@ -3047,13 +3046,11 @@ static int intel_runtime_resume(struct device *kdev)
 
        intel_runtime_pm_enable_interrupts(dev_priv);
 
-       intel_uc_runtime_resume(&dev_priv->gt.uc);
-
        /*
         * No point of rolling back things in case of an error, as the best
         * we can do is to hope that things will still work (and disable RPM).
         */
-       intel_gt_init_swizzling(&dev_priv->gt);
+       intel_gt_runtime_resume(&dev_priv->gt);
        i915_gem_restore_fences(dev_priv);
 
        /*