aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/i915/gt/intel_gt_pm.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2019-11-01 14:10:08 +0000
committerJoonas Lahtinen <joonas.lahtinen@linux.intel.com>2019-11-05 16:05:25 +0200
commitd4033a9b03d8df375bca65290e9419c14392ddd0 (patch)
tree9ff367630328f5646e71d237c9d8962d424c30ec /drivers/gpu/drm/i915/gt/intel_gt_pm.c
parentdrm/i915/gem: Leave reloading kernel context on resume to GT (diff)
downloadlinux-dev-d4033a9b03d8df375bca65290e9419c14392ddd0.tar.xz
linux-dev-d4033a9b03d8df375bca65290e9419c14392ddd0.zip
drm/i915/gt: Move user_forcewake application to GT
We already track the debugfs user_forcewake on the GT, so it is natural to pull the suspend/resume handling under gt/ as well. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Andi Shyti <andi.shyti@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20191101141009.15581-3-chris@chris-wilson.co.uk (cherry picked from commit 9ab3fe2d7dc39b088591b0121f041cbfd6bb1ef8) Signed-off-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Diffstat (limited to '')
-rw-r--r--drivers/gpu/drm/i915/gt/intel_gt_pm.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/drivers/gpu/drm/i915/gt/intel_gt_pm.c b/drivers/gpu/drm/i915/gt/intel_gt_pm.c
index 1679f4f78d65..11661de8c40b 100644
--- a/drivers/gpu/drm/i915/gt/intel_gt_pm.c
+++ b/drivers/gpu/drm/i915/gt/intel_gt_pm.c
@@ -18,6 +18,24 @@
#include "intel_rps.h"
#include "intel_wakeref.h"
+static void user_forcewake(struct intel_gt *gt, bool suspend)
+{
+ int count = atomic_read(&gt->user_wakeref);
+
+ /* Inside suspend/resume so single threaded, no races to worry about. */
+ if (likely(!count))
+ return;
+
+ intel_gt_pm_get(gt);
+ if (suspend) {
+ GEM_BUG_ON(count > atomic_read(&gt->wakeref.count));
+ atomic_sub(count, &gt->wakeref.count);
+ } else {
+ atomic_add(count, &gt->wakeref.count);
+ }
+ intel_gt_pm_put(gt);
+}
+
static int __gt_unpark(struct intel_wakeref *wf)
{
struct intel_gt *gt = container_of(wf, typeof(*gt), wakeref);
@@ -210,6 +228,8 @@ int intel_gt_resume(struct intel_gt *gt)
intel_uc_resume(&gt->uc);
+ user_forcewake(gt, false);
+
intel_uncore_forcewake_put(gt->uncore, FORCEWAKE_ALL);
intel_gt_pm_put(gt);
@@ -233,6 +253,8 @@ void intel_gt_suspend(struct intel_gt *gt)
{
intel_wakeref_t wakeref;
+ user_forcewake(gt, true);
+
/* We expect to be idle already; but also want to be independent */
wait_for_idle(gt);