Skip to content

Commit

Permalink
drm/i915: update rpm_get/put to use the rpm structure
Browse files Browse the repository at this point in the history
The functions where internally already only using the structure, so we
need to just flip the interface.

v2: rebase

Signed-off-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
Cc: Imre Deak <imre.deak@intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Acked-by: Imre Deak <imre.deak@intel.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Link: https://patchwork.freedesktop.org/patch/msgid/20190613232156.34940-7-daniele.ceraolospurio@intel.com
  • Loading branch information
Daniele Ceraolo Spurio authored and Chris Wilson committed Jun 14, 2019
1 parent 69c6635 commit d858d56
Show file tree
Hide file tree
Showing 41 changed files with 236 additions and 234 deletions.
11 changes: 6 additions & 5 deletions drivers/gpu/drm/i915/gem/i915_gem_mman.c
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@ vm_fault_t i915_gem_fault(struct vm_fault *vmf)
struct drm_i915_gem_object *obj = to_intel_bo(area->vm_private_data);
struct drm_device *dev = obj->base.dev;
struct drm_i915_private *i915 = to_i915(dev);
struct intel_runtime_pm *rpm = &i915->runtime_pm;
struct i915_ggtt *ggtt = &i915->ggtt;
bool write = area->vm_flags & VM_WRITE;
intel_wakeref_t wakeref;
Expand All @@ -243,7 +244,7 @@ vm_fault_t i915_gem_fault(struct vm_fault *vmf)
if (ret)
goto err;

wakeref = intel_runtime_pm_get(i915);
wakeref = intel_runtime_pm_get(rpm);

srcu = i915_reset_trylock(i915);
if (srcu < 0) {
Expand Down Expand Up @@ -308,7 +309,7 @@ vm_fault_t i915_gem_fault(struct vm_fault *vmf)
goto err_fence;

/* Mark as being mmapped into userspace for later revocation */
assert_rpm_wakelock_held(&i915->runtime_pm);
assert_rpm_wakelock_held(rpm);
if (!i915_vma_set_userfault(vma) && !obj->userfault_count++)
list_add(&obj->userfault_link, &i915->ggtt.userfault_list);
if (CONFIG_DRM_I915_USERFAULT_AUTOSUSPEND)
Expand All @@ -327,7 +328,7 @@ vm_fault_t i915_gem_fault(struct vm_fault *vmf)
err_reset:
i915_reset_unlock(i915, srcu);
err_rpm:
intel_runtime_pm_put(i915, wakeref);
intel_runtime_pm_put(rpm, wakeref);
i915_gem_object_unpin_pages(obj);
err:
switch (ret) {
Expand Down Expand Up @@ -410,7 +411,7 @@ void i915_gem_object_release_mmap(struct drm_i915_gem_object *obj)
* wakeref.
*/
lockdep_assert_held(&i915->drm.struct_mutex);
wakeref = intel_runtime_pm_get(i915);
wakeref = intel_runtime_pm_get(&i915->runtime_pm);

if (!obj->userfault_count)
goto out;
Expand All @@ -427,7 +428,7 @@ void i915_gem_object_release_mmap(struct drm_i915_gem_object *obj)
wmb();

out:
intel_runtime_pm_put(i915, wakeref);
intel_runtime_pm_put(&i915->runtime_pm, wakeref);
}

static int create_mmap_offset(struct drm_i915_gem_object *obj)
Expand Down
4 changes: 2 additions & 2 deletions drivers/gpu/drm/i915/gem/i915_gem_object.c
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ static void __i915_gem_free_objects(struct drm_i915_private *i915,
struct drm_i915_gem_object *obj, *on;
intel_wakeref_t wakeref;

wakeref = intel_runtime_pm_get(i915);
wakeref = intel_runtime_pm_get(&i915->runtime_pm);
llist_for_each_entry_safe(obj, on, freed, freed) {
struct i915_vma *vma, *vn;

Expand Down Expand Up @@ -243,7 +243,7 @@ static void __i915_gem_free_objects(struct drm_i915_private *i915,

cond_resched();
}
intel_runtime_pm_put(i915, wakeref);
intel_runtime_pm_put(&i915->runtime_pm, wakeref);
}

void i915_gem_flush_free_objects(struct drm_i915_private *i915)
Expand Down
4 changes: 2 additions & 2 deletions drivers/gpu/drm/i915/gem/i915_gem_shrinker.c
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ i915_gem_shrink(struct drm_i915_private *i915,
* we will force the wake during oom-notifier.
*/
if (shrink & I915_SHRINK_BOUND) {
wakeref = intel_runtime_pm_get_if_in_use(i915);
wakeref = intel_runtime_pm_get_if_in_use(&i915->runtime_pm);
if (!wakeref)
shrink &= ~I915_SHRINK_BOUND;
}
Expand Down Expand Up @@ -267,7 +267,7 @@ i915_gem_shrink(struct drm_i915_private *i915,
}

if (shrink & I915_SHRINK_BOUND)
intel_runtime_pm_put(i915, wakeref);
intel_runtime_pm_put(&i915->runtime_pm, wakeref);

i915_retire_requests(i915);

Expand Down
4 changes: 2 additions & 2 deletions drivers/gpu/drm/i915/gem/selftests/huge_pages.c
Original file line number Diff line number Diff line change
Expand Up @@ -1754,7 +1754,7 @@ int i915_gem_huge_page_live_selftests(struct drm_i915_private *dev_priv)
return PTR_ERR(file);

mutex_lock(&dev_priv->drm.struct_mutex);
wakeref = intel_runtime_pm_get(dev_priv);
wakeref = intel_runtime_pm_get(&dev_priv->runtime_pm);

ctx = live_context(dev_priv, file);
if (IS_ERR(ctx)) {
Expand All @@ -1768,7 +1768,7 @@ int i915_gem_huge_page_live_selftests(struct drm_i915_private *dev_priv)
err = i915_subtests(tests, ctx);

out_unlock:
intel_runtime_pm_put(dev_priv, wakeref);
intel_runtime_pm_put(&dev_priv->runtime_pm, wakeref);
mutex_unlock(&dev_priv->drm.struct_mutex);

mock_file_free(dev_priv, file);
Expand Down
4 changes: 2 additions & 2 deletions drivers/gpu/drm/i915/gem/selftests/i915_gem_coherency.c
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ static int igt_gem_coherency(void *arg)
values = offsets + ncachelines;

mutex_lock(&i915->drm.struct_mutex);
wakeref = intel_runtime_pm_get(i915);
wakeref = intel_runtime_pm_get(&i915->runtime_pm);
for (over = igt_coherency_mode; over->name; over++) {
if (!over->set)
continue;
Expand Down Expand Up @@ -371,7 +371,7 @@ static int igt_gem_coherency(void *arg)
}
}
unlock:
intel_runtime_pm_put(i915, wakeref);
intel_runtime_pm_put(&i915->runtime_pm, wakeref);
mutex_unlock(&i915->drm.struct_mutex);
kfree(offsets);
return err;
Expand Down
12 changes: 6 additions & 6 deletions drivers/gpu/drm/i915/gem/selftests/i915_gem_context.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ static int live_nop_switch(void *arg)
return PTR_ERR(file);

mutex_lock(&i915->drm.struct_mutex);
wakeref = intel_runtime_pm_get(i915);
wakeref = intel_runtime_pm_get(&i915->runtime_pm);

ctx = kcalloc(nctx, sizeof(*ctx), GFP_KERNEL);
if (!ctx) {
Expand Down Expand Up @@ -156,7 +156,7 @@ static int live_nop_switch(void *arg)
}

out_unlock:
intel_runtime_pm_put(i915, wakeref);
intel_runtime_pm_put(&i915->runtime_pm, wakeref);
mutex_unlock(&i915->drm.struct_mutex);
mock_file_free(i915, file);
return err;
Expand Down Expand Up @@ -1084,7 +1084,7 @@ __igt_ctx_sseu(struct drm_i915_private *i915,
goto out_unlock;
}

wakeref = intel_runtime_pm_get(i915);
wakeref = intel_runtime_pm_get(&i915->runtime_pm);

ce = i915_gem_context_get_engine(ctx, RCS0);
if (IS_ERR(ce)) {
Expand Down Expand Up @@ -1124,7 +1124,7 @@ __igt_ctx_sseu(struct drm_i915_private *i915,
out_context:
intel_context_put(ce);
out_rpm:
intel_runtime_pm_put(i915, wakeref);
intel_runtime_pm_put(&i915->runtime_pm, wakeref);
i915_gem_object_put(obj);

out_unlock:
Expand Down Expand Up @@ -1541,7 +1541,7 @@ static int igt_vm_isolation(void *arg)
GEM_BUG_ON(ctx_b->vm->total != vm_total);
vm_total -= I915_GTT_PAGE_SIZE;

wakeref = intel_runtime_pm_get(i915);
wakeref = intel_runtime_pm_get(&i915->runtime_pm);

count = 0;
for_each_engine(engine, i915, id) {
Expand Down Expand Up @@ -1586,7 +1586,7 @@ static int igt_vm_isolation(void *arg)
count, RUNTIME_INFO(i915)->num_engines);

out_rpm:
intel_runtime_pm_put(i915, wakeref);
intel_runtime_pm_put(&i915->runtime_pm, wakeref);
out_unlock:
if (igt_live_test_end(&t))
err = -EIO;
Expand Down
4 changes: 2 additions & 2 deletions drivers/gpu/drm/i915/gem/selftests/i915_gem_mman.c
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ static int igt_partial_tiling(void *arg)
}

mutex_lock(&i915->drm.struct_mutex);
wakeref = intel_runtime_pm_get(i915);
wakeref = intel_runtime_pm_get(&i915->runtime_pm);

if (1) {
IGT_TIMEOUT(end);
Expand Down Expand Up @@ -316,7 +316,7 @@ next_tiling: ;
}

out_unlock:
intel_runtime_pm_put(i915, wakeref);
intel_runtime_pm_put(&i915->runtime_pm, wakeref);
mutex_unlock(&i915->drm.struct_mutex);
i915_gem_object_unpin_pages(obj);
out:
Expand Down
8 changes: 4 additions & 4 deletions drivers/gpu/drm/i915/gt/intel_engine_cs.c
Original file line number Diff line number Diff line change
Expand Up @@ -1103,7 +1103,7 @@ static bool ring_is_idle(struct intel_engine_cs *engine)
return true;

/* If the whole device is asleep, the engine must be idle */
wakeref = intel_runtime_pm_get_if_in_use(dev_priv);
wakeref = intel_runtime_pm_get_if_in_use(&dev_priv->runtime_pm);
if (!wakeref)
return true;

Expand All @@ -1117,7 +1117,7 @@ static bool ring_is_idle(struct intel_engine_cs *engine)
!(ENGINE_READ(engine, RING_MI_MODE) & MODE_IDLE))
idle = false;

intel_runtime_pm_put(dev_priv, wakeref);
intel_runtime_pm_put(&dev_priv->runtime_pm, wakeref);

return idle;
}
Expand Down Expand Up @@ -1531,10 +1531,10 @@ void intel_engine_dump(struct intel_engine_cs *engine,

rcu_read_unlock();

wakeref = intel_runtime_pm_get_if_in_use(engine->i915);
wakeref = intel_runtime_pm_get_if_in_use(&engine->i915->runtime_pm);
if (wakeref) {
intel_engine_print_registers(engine, m);
intel_runtime_pm_put(engine->i915, wakeref);
intel_runtime_pm_put(&engine->i915->runtime_pm, wakeref);
} else {
drm_printf(m, "\tDevice is asleep; skipping register dump\n");
}
Expand Down
4 changes: 2 additions & 2 deletions drivers/gpu/drm/i915/gt/intel_hangcheck.c
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ static void i915_hangcheck_elapsed(struct work_struct *work)
if (i915_terminally_wedged(dev_priv))
return;

wakeref = intel_runtime_pm_get_if_in_use(dev_priv);
wakeref = intel_runtime_pm_get_if_in_use(&dev_priv->runtime_pm);
if (!wakeref)
return;

Expand Down Expand Up @@ -324,7 +324,7 @@ static void i915_hangcheck_elapsed(struct work_struct *work)
if (hung)
hangcheck_declare_hang(dev_priv, hung, stuck);

intel_runtime_pm_put(dev_priv, wakeref);
intel_runtime_pm_put(&dev_priv->runtime_pm, wakeref);

/* Reset timer in case GPU hangs without another request being added */
i915_queue_hangcheck(dev_priv);
Expand Down
4 changes: 2 additions & 2 deletions drivers/gpu/drm/i915/gt/intel_reset.c
Original file line number Diff line number Diff line change
Expand Up @@ -1311,7 +1311,7 @@ void i915_handle_error(struct drm_i915_private *i915,
* isn't the case at least when we get here by doing a
* simulated reset via debugfs, so get an RPM reference.
*/
wakeref = intel_runtime_pm_get(i915);
wakeref = intel_runtime_pm_get(&i915->runtime_pm);

engine_mask &= INTEL_INFO(i915)->engine_mask;

Expand Down Expand Up @@ -1374,7 +1374,7 @@ void i915_handle_error(struct drm_i915_private *i915,
wake_up_all(&error->reset_queue);

out:
intel_runtime_pm_put(i915, wakeref);
intel_runtime_pm_put(&i915->runtime_pm, wakeref);
}

int i915_reset_trylock(struct drm_i915_private *i915)
Expand Down
12 changes: 6 additions & 6 deletions drivers/gpu/drm/i915/gt/selftest_hangcheck.c
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ static int igt_reset_nop(void *arg)
}

i915_gem_context_clear_bannable(ctx);
wakeref = intel_runtime_pm_get(i915);
wakeref = intel_runtime_pm_get(&i915->runtime_pm);
reset_count = i915_reset_count(&i915->gpu_error);
count = 0;
do {
Expand Down Expand Up @@ -441,7 +441,7 @@ static int igt_reset_nop(void *arg)
err = igt_flush_test(i915, I915_WAIT_LOCKED);
mutex_unlock(&i915->drm.struct_mutex);

intel_runtime_pm_put(i915, wakeref);
intel_runtime_pm_put(&i915->runtime_pm, wakeref);

out:
mock_file_free(i915, file);
Expand Down Expand Up @@ -478,7 +478,7 @@ static int igt_reset_nop_engine(void *arg)
}

i915_gem_context_clear_bannable(ctx);
wakeref = intel_runtime_pm_get(i915);
wakeref = intel_runtime_pm_get(&i915->runtime_pm);
for_each_engine(engine, i915, id) {
unsigned int reset_count, reset_engine_count;
unsigned int count;
Expand Down Expand Up @@ -549,7 +549,7 @@ static int igt_reset_nop_engine(void *arg)
err = igt_flush_test(i915, I915_WAIT_LOCKED);
mutex_unlock(&i915->drm.struct_mutex);

intel_runtime_pm_put(i915, wakeref);
intel_runtime_pm_put(&i915->runtime_pm, wakeref);
out:
mock_file_free(i915, file);
if (i915_reset_failed(i915))
Expand Down Expand Up @@ -1749,7 +1749,7 @@ int intel_hangcheck_live_selftests(struct drm_i915_private *i915)
if (i915_terminally_wedged(i915))
return -EIO; /* we're long past hope of a successful reset */

wakeref = intel_runtime_pm_get(i915);
wakeref = intel_runtime_pm_get(&i915->runtime_pm);
saved_hangcheck = fetch_and_zero(&i915_modparams.enable_hangcheck);
drain_delayed_work(&i915->gpu_error.hangcheck_work); /* flush param */

Expand All @@ -1760,7 +1760,7 @@ int intel_hangcheck_live_selftests(struct drm_i915_private *i915)
mutex_unlock(&i915->drm.struct_mutex);

i915_modparams.enable_hangcheck = saved_hangcheck;
intel_runtime_pm_put(i915, wakeref);
intel_runtime_pm_put(&i915->runtime_pm, wakeref);

return err;
}
Loading

0 comments on commit d858d56

Please sign in to comment.