]> git.baikalelectronics.ru Git - kernel.git/commitdiff
drm/i915/gt: Prefer local path to runtime powermanagement
authorChris Wilson <chris@chris-wilson.co.uk>
Mon, 7 Oct 2019 15:45:31 +0000 (16:45 +0100)
committerChris Wilson <chris@chris-wilson.co.uk>
Mon, 7 Oct 2019 20:44:02 +0000 (21:44 +0100)
Avoid going to the base i915 device when we already have a path from gt
to the runtime powermanagement interface. The benefit is that it looks a
bit more self-consistent to always be acquiring the gt->uncore->rpm for
use with the gt->uncore.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20191007154531.1750-1-chris@chris-wilson.co.uk
14 files changed:
drivers/gpu/drm/i915/gt/intel_context.c
drivers/gpu/drm/i915/gt/intel_engine_cs.c
drivers/gpu/drm/i915/gt/intel_engine_pm.c
drivers/gpu/drm/i915/gt/intel_gt.c
drivers/gpu/drm/i915/gt/intel_gt_pm.c
drivers/gpu/drm/i915/gt/intel_hangcheck.c
drivers/gpu/drm/i915/gt/intel_reset.c
drivers/gpu/drm/i915/gt/selftest_hangcheck.c
drivers/gpu/drm/i915/gt/selftest_reset.c
drivers/gpu/drm/i915/gt/selftest_workarounds.c
drivers/gpu/drm/i915/gt/uc/intel_guc_log.c
drivers/gpu/drm/i915/gt/uc/intel_huc.c
drivers/gpu/drm/i915/gt/uc/intel_uc.c
drivers/gpu/drm/i915/i915_irq.c

index be34d97ac18f0a348109ae524b1d0c0ad3cb8c81..59c3083c1ec17bbd91b0f204fd5891f62a2483a2 100644 (file)
@@ -62,7 +62,7 @@ int __intel_context_do_pin(struct intel_context *ce)
                }
 
                err = 0;
-               with_intel_runtime_pm(&ce->engine->i915->runtime_pm, wakeref)
+               with_intel_runtime_pm(ce->engine->uncore->rpm, wakeref)
                        err = ce->ops->pin(ce);
                if (err)
                        goto err;
index 80fd072ac719d472abc3a874b14f21f3c49a5d89..6220b7151bb96c20a7509f0c930996c9054487e0 100644 (file)
@@ -1458,10 +1458,10 @@ void intel_engine_dump(struct intel_engine_cs *engine,
        spin_unlock_irqrestore(&engine->active.lock, flags);
 
        drm_printf(m, "\tMMIO base:  0x%08x\n", engine->mmio_base);
-       wakeref = intel_runtime_pm_get_if_in_use(&engine->i915->runtime_pm);
+       wakeref = intel_runtime_pm_get_if_in_use(engine->uncore->rpm);
        if (wakeref) {
                intel_engine_print_registers(engine, m);
-               intel_runtime_pm_put(&engine->i915->runtime_pm, wakeref);
+               intel_runtime_pm_put(engine->uncore->rpm, wakeref);
        } else {
                drm_printf(m, "\tDevice is asleep; skipping register dump\n");
        }
index 8e5e513eddc9fe8dba56d8012b94e44f09286e10..67eb6183648a724937134845c45c952f4a7aa652 100644 (file)
@@ -185,7 +185,7 @@ static const struct intel_wakeref_ops wf_ops = {
 
 void intel_engine_init__pm(struct intel_engine_cs *engine)
 {
-       struct intel_runtime_pm *rpm = &engine->i915->runtime_pm;
+       struct intel_runtime_pm *rpm = engine->uncore->rpm;
 
        intel_wakeref_init(&engine->wakeref, rpm, &wf_ops);
 }
index 8f44cf8c79b2a832ccb64666ee9090850204c869..b3619a2a5d0e02cdf0ec120ce7cf3914a3e665aa 100644 (file)
@@ -273,7 +273,7 @@ void intel_gt_check_and_clear_faults(struct intel_gt *gt)
 
 void intel_gt_flush_ggtt_writes(struct intel_gt *gt)
 {
-       struct drm_i915_private *i915 = gt->i915;
+       struct intel_uncore *uncore = gt->uncore;
        intel_wakeref_t wakeref;
 
        /*
@@ -297,13 +297,12 @@ void intel_gt_flush_ggtt_writes(struct intel_gt *gt)
 
        wmb();
 
-       if (INTEL_INFO(i915)->has_coherent_ggtt)
+       if (INTEL_INFO(gt->i915)->has_coherent_ggtt)
                return;
 
        intel_gt_chipset_flush(gt);
 
-       with_intel_runtime_pm(&i915->runtime_pm, wakeref) {
-               struct intel_uncore *uncore = gt->uncore;
+       with_intel_runtime_pm(uncore->rpm, wakeref) {
                unsigned long flags;
 
                spin_lock_irqsave(&uncore->lock, flags);
index b52e2ba3d09223835c693717f905857d67102d59..87e34e0b6427851600f1cf9b75ee463b097b1f79 100644 (file)
@@ -94,7 +94,7 @@ static const struct intel_wakeref_ops wf_ops = {
 
 void intel_gt_pm_init_early(struct intel_gt *gt)
 {
-       intel_wakeref_init(&gt->wakeref, &gt->i915->runtime_pm, &wf_ops);
+       intel_wakeref_init(&gt->wakeref, gt->uncore->rpm, &wf_ops);
 
        BLOCKING_INIT_NOTIFIER_HEAD(&gt->pm_notifications);
 }
@@ -222,7 +222,7 @@ void intel_gt_suspend(struct intel_gt *gt)
        /* We expect to be idle already; but also want to be independent */
        wait_for_idle(gt);
 
-       with_intel_runtime_pm(&gt->i915->runtime_pm, wakeref)
+       with_intel_runtime_pm(gt->uncore->rpm, wakeref)
                intel_rc6_disable(&gt->rc6);
 }
 
index 9814b18b32adccbc0e66bbb2fb8c9ba19cd368af..c14dbeb3ccc30c0e136e4b823d8d4a7bb6f05c8e 100644 (file)
@@ -271,7 +271,7 @@ static void hangcheck_elapsed(struct work_struct *work)
        if (intel_gt_is_wedged(gt))
                return;
 
-       wakeref = intel_runtime_pm_get_if_in_use(&gt->i915->runtime_pm);
+       wakeref = intel_runtime_pm_get_if_in_use(gt->uncore->rpm);
        if (!wakeref)
                return;
 
@@ -322,7 +322,7 @@ static void hangcheck_elapsed(struct work_struct *work)
        if (hung)
                hangcheck_declare_hang(gt, hung, stuck);
 
-       intel_runtime_pm_put(&gt->i915->runtime_pm, wakeref);
+       intel_runtime_pm_put(gt->uncore->rpm, wakeref);
 
        /* Reset timer in case GPU hangs without another request being added */
        intel_gt_queue_hangcheck(gt);
index ae8f9cef6b132828f461d7a75378031297d37b25..34791fc79deacefa6d2518f6e9f07cb87f0e3919 100644 (file)
@@ -811,7 +811,7 @@ void intel_gt_set_wedged(struct intel_gt *gt)
        intel_wakeref_t wakeref;
 
        mutex_lock(&gt->reset.mutex);
-       with_intel_runtime_pm(&gt->i915->runtime_pm, wakeref)
+       with_intel_runtime_pm(gt->uncore->rpm, wakeref)
                __intel_gt_set_wedged(gt);
        mutex_unlock(&gt->reset.mutex);
 }
@@ -1186,7 +1186,7 @@ void intel_gt_handle_error(struct intel_gt *gt,
         * 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(&gt->i915->runtime_pm);
+       wakeref = intel_runtime_pm_get(gt->uncore->rpm);
 
        engine_mask &= INTEL_INFO(gt->i915)->engine_mask;
 
@@ -1246,7 +1246,7 @@ void intel_gt_handle_error(struct intel_gt *gt,
        wake_up_all(&gt->reset.queue);
 
 out:
-       intel_runtime_pm_put(&gt->i915->runtime_pm, wakeref);
+       intel_runtime_pm_put(gt->uncore->rpm, wakeref);
 }
 
 int intel_gt_reset_trylock(struct intel_gt *gt, int *srcu)
index e8a40df79bd0147ab97d1091c880beb9ef6bf688..569a4105d49e38c31c1e43d15ead5c2a5842bdbf 100644 (file)
@@ -1695,14 +1695,14 @@ int intel_hangcheck_live_selftests(struct drm_i915_private *i915)
        if (intel_gt_is_wedged(gt))
                return -EIO; /* we're long past hope of a successful reset */
 
-       wakeref = intel_runtime_pm_get(&gt->i915->runtime_pm);
+       wakeref = intel_runtime_pm_get(gt->uncore->rpm);
        saved_hangcheck = fetch_and_zero(&i915_modparams.enable_hangcheck);
        drain_delayed_work(&gt->hangcheck.work); /* flush param */
 
        err = intel_gt_live_subtests(tests, gt);
 
        i915_modparams.enable_hangcheck = saved_hangcheck;
-       intel_runtime_pm_put(&gt->i915->runtime_pm, wakeref);
+       intel_runtime_pm_put(gt->uncore->rpm, wakeref);
 
        return err;
 }
index d79482db7fe88845db0b3f74a3c2d83a29abe8d5..419b38fa782843fa18a88939720ac8a6c0b4c064 100644 (file)
@@ -17,7 +17,7 @@ static int igt_global_reset(void *arg)
        /* Check that we can issue a global GPU reset */
 
        igt_global_reset_lock(gt);
-       wakeref = intel_runtime_pm_get(&gt->i915->runtime_pm);
+       wakeref = intel_runtime_pm_get(gt->uncore->rpm);
 
        reset_count = i915_reset_count(&gt->i915->gpu_error);
 
@@ -28,7 +28,7 @@ static int igt_global_reset(void *arg)
                err = -EINVAL;
        }
 
-       intel_runtime_pm_put(&gt->i915->runtime_pm, wakeref);
+       intel_runtime_pm_put(gt->uncore->rpm, wakeref);
        igt_global_reset_unlock(gt);
 
        if (intel_gt_is_wedged(gt))
@@ -45,14 +45,14 @@ static int igt_wedged_reset(void *arg)
        /* Check that we can recover a wedged device with a GPU reset */
 
        igt_global_reset_lock(gt);
-       wakeref = intel_runtime_pm_get(&gt->i915->runtime_pm);
+       wakeref = intel_runtime_pm_get(gt->uncore->rpm);
 
        intel_gt_set_wedged(gt);
 
        GEM_BUG_ON(!intel_gt_is_wedged(gt));
        intel_gt_reset(gt, ALL_ENGINES, NULL);
 
-       intel_runtime_pm_put(&gt->i915->runtime_pm, wakeref);
+       intel_runtime_pm_put(gt->uncore->rpm, wakeref);
        igt_global_reset_unlock(gt);
 
        return intel_gt_is_wedged(gt) ? -EIO : 0;
index 95627e80f2463694473b22fc8d0255b12bc2d951..74952bda925616bdff4a7aac89593cddd3ae0734 100644 (file)
@@ -256,7 +256,7 @@ switch_to_scratch_context(struct intel_engine_cs *engine,
        GEM_BUG_ON(IS_ERR(ce));
 
        rq = ERR_PTR(-ENODEV);
-       with_intel_runtime_pm(&engine->i915->runtime_pm, wakeref)
+       with_intel_runtime_pm(engine->uncore->rpm, wakeref)
                rq = igt_spinner_create_request(spin, ce, MI_NOOP);
 
        intel_context_put(ce);
@@ -313,7 +313,7 @@ static int check_whitelist_across_reset(struct intel_engine_cs *engine,
        if (err)
                goto out_spin;
 
-       with_intel_runtime_pm(&i915->runtime_pm, wakeref)
+       with_intel_runtime_pm(engine->uncore->rpm, wakeref)
                err = reset(engine);
 
        igt_spinner_end(&spin);
index 36332064de9ce277f5f2a60197fb09121b4f87a0..2cf2d3314f6289d6f2c92b51a7e62127c8a88c85 100644 (file)
@@ -607,7 +607,6 @@ out_unlock:
 void intel_guc_log_relay_flush(struct intel_guc_log *log)
 {
        struct intel_guc *guc = log_to_guc(log);
-       struct drm_i915_private *i915 = guc_to_gt(guc)->i915;
        intel_wakeref_t wakeref;
 
        /*
@@ -616,7 +615,7 @@ void intel_guc_log_relay_flush(struct intel_guc_log *log)
         */
        flush_work(&log->relay.flush_work);
 
-       with_intel_runtime_pm(&i915->runtime_pm, wakeref)
+       with_intel_runtime_pm(guc_to_gt(guc)->uncore->rpm, wakeref)
                guc_action_flush_log(guc);
 
        /* GuC would have updated log buffer by now, so capture it */
index d4625c97b4f9e4a5c220648ef29a1ca5a480a531..33608a114d4e674bfe3b9ecfb87b7fd4c4b4b54a 100644 (file)
@@ -185,7 +185,7 @@ int intel_huc_check_status(struct intel_huc *huc)
        if (!intel_huc_is_supported(huc))
                return -ENODEV;
 
-       with_intel_runtime_pm(&gt->i915->runtime_pm, wakeref)
+       with_intel_runtime_pm(gt->uncore->rpm, wakeref)
                status = intel_uncore_read(gt->uncore, huc->status.reg);
 
        return (status & huc->status.mask) == huc->status.value;
index 29a9eec60d2e0e6de284c90d8d40379862264a0e..3fdbc935d155b8344e3b8df147383fa6aaa3b10e 100644 (file)
@@ -587,7 +587,7 @@ void intel_uc_suspend(struct intel_uc *uc)
        if (!intel_guc_is_running(guc))
                return;
 
-       with_intel_runtime_pm(&uc_to_gt(uc)->i915->runtime_pm, wakeref)
+       with_intel_runtime_pm(uc_to_gt(uc)->uncore->rpm, wakeref)
                intel_uc_runtime_suspend(uc);
 }
 
index f2371b6083c6d7852de83e46064f4d6b7f78d2ec..3af7f7914c40b6f4a55f30aae6689125ed5f570c 100644 (file)
@@ -412,7 +412,7 @@ void gen9_reset_guc_interrupts(struct intel_guc *guc)
 {
        struct intel_gt *gt = guc_to_gt(guc);
 
-       assert_rpm_wakelock_held(&gt->i915->runtime_pm);
+       assert_rpm_wakelock_held(gt->uncore->rpm);
 
        spin_lock_irq(&gt->irq_lock);
        gen6_gt_pm_reset_iir(gt, gt->pm_guc_events);
@@ -423,7 +423,7 @@ void gen9_enable_guc_interrupts(struct intel_guc *guc)
 {
        struct intel_gt *gt = guc_to_gt(guc);
 
-       assert_rpm_wakelock_held(&gt->i915->runtime_pm);
+       assert_rpm_wakelock_held(gt->uncore->rpm);
 
        spin_lock_irq(&gt->irq_lock);
        if (!guc->interrupts.enabled) {
@@ -440,7 +440,7 @@ void gen9_disable_guc_interrupts(struct intel_guc *guc)
 {
        struct intel_gt *gt = guc_to_gt(guc);
 
-       assert_rpm_wakelock_held(&gt->i915->runtime_pm);
+       assert_rpm_wakelock_held(gt->uncore->rpm);
 
        spin_lock_irq(&gt->irq_lock);
        guc->interrupts.enabled = false;