]> git.baikalelectronics.ru Git - kernel.git/commitdiff
drm/i915/selftests: Delay spinner before waiting for an interrupt
authorChris Wilson <chris@chris-wilson.co.uk>
Fri, 17 Apr 2020 09:39:27 +0000 (10:39 +0100)
committerChris Wilson <chris@chris-wilson.co.uk>
Fri, 17 Apr 2020 13:47:15 +0000 (14:47 +0100)
It seems that although (perhaps because of the memory stall?) the
spinner has signaled that it has started, it still takes some time to
spin up to 100% utilisation of the HW. Since the test depends on the
full utilisation of the HW to trigger the RPS interrupt, wait a little
bit and flush the interrupt status to be sure that the event we see if
from the spinner.

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/20200417093928.17822-1-chris@chris-wilson.co.uk
drivers/gpu/drm/i915/gt/selftest_rps.c

index 26aadc2ae3be074b2c02ca0a7af2ba39e4cc2397..199d608aa7638394aab83e8615e2ac32734d7a84 100644 (file)
@@ -14,6 +14,20 @@ static void dummy_rps_work(struct work_struct *wrk)
 {
 }
 
+static void sleep_for_ei(struct intel_rps *rps, int timeout_us)
+{
+       /* Flush any previous EI */
+       usleep_range(timeout_us, 2 * timeout_us);
+
+       /* Reset the interrupt status */
+       rps_disable_interrupts(rps);
+       GEM_BUG_ON(rps->pm_iir);
+       rps_enable_interrupts(rps);
+
+       /* And then wait for the timeout, for real this time */
+       usleep_range(2 * timeout_us, 3 * timeout_us);
+}
+
 static int __rps_up_interrupt(struct intel_rps *rps,
                              struct intel_engine_cs *engine,
                              struct igt_spinner *spin)
@@ -28,7 +42,6 @@ static int __rps_up_interrupt(struct intel_rps *rps,
        intel_gt_pm_wait_for_idle(engine->gt);
        GEM_BUG_ON(rps->active);
 
-       rps->pm_iir = 0;
        rps->cur_freq = rps->min_freq;
 
        rq = igt_spinner_create_request(spin, engine->kernel_context, MI_NOOP);
@@ -71,7 +84,7 @@ static int __rps_up_interrupt(struct intel_rps *rps,
        timeout = intel_uncore_read(uncore, GEN6_RP_UP_EI);
        timeout = GT_PM_INTERVAL_TO_US(engine->i915, timeout);
 
-       usleep_range(2 * timeout, 3 * timeout);
+       sleep_for_ei(rps, timeout);
        GEM_BUG_ON(i915_request_completed(rq));
 
        igt_spinner_end(spin);
@@ -122,16 +135,7 @@ static int __rps_down_interrupt(struct intel_rps *rps,
        timeout = intel_uncore_read(uncore, GEN6_RP_DOWN_EI);
        timeout = GT_PM_INTERVAL_TO_US(engine->i915, timeout);
 
-       /* Flush any previous EI */
-       usleep_range(timeout, 2 * timeout);
-
-       /* Reset the interrupt status */
-       rps_disable_interrupts(rps);
-       GEM_BUG_ON(rps->pm_iir);
-       rps_enable_interrupts(rps);
-
-       /* And then wait for the timeout, for real this time */
-       usleep_range(2 * timeout, 3 * timeout);
+       sleep_for_ei(rps, timeout);
 
        if (rps->cur_freq != rps->max_freq) {
                pr_err("%s: Frequency unexpectedly changed [down], now %d!\n",