#include "i915_drv.h"
-static void user_forcewake(struct intel_gt *gt, bool suspend)
-{
- int count = atomic_read(>->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(>->wakeref.count));
- atomic_sub(count, >->wakeref.count);
- } else {
- atomic_add(count, >->wakeref.count);
- }
- intel_gt_pm_put(gt);
-}
-
void i915_gem_suspend(struct drm_i915_private *i915)
{
GEM_TRACE("\n");
intel_wakeref_auto(&i915->ggtt.userfault_wakeref, 0);
flush_workqueue(i915->wq);
- user_forcewake(&i915->gt, true);
-
/*
* We have to flush all the executing contexts to main memory so
* that they can saved in the hibernation image. To ensure the last
if (intel_gt_resume(&i915->gt))
goto err_wedged;
- user_forcewake(&i915->gt, false);
-
out_unlock:
intel_uncore_forcewake_put(&i915->uncore, FORCEWAKE_ALL);
return;
#include "intel_rps.h"
#include "intel_wakeref.h"
+static void user_forcewake(struct intel_gt *gt, bool suspend)
+{
+ int count = atomic_read(>->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(>->wakeref.count));
+ atomic_sub(count, >->wakeref.count);
+ } else {
+ atomic_add(count, >->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);
intel_uc_resume(>->uc);
+ user_forcewake(gt, false);
+
intel_uncore_forcewake_put(gt->uncore, FORCEWAKE_ALL);
intel_gt_pm_put(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);