[PATCH] drm/i915/selftests: Forcewake stress
Tvrtko Ursulin
tvrtko.ursulin at linux.intel.com
Fri Dec 10 15:09:45 UTC 2021
From: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
...
Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
---
drivers/gpu/drm/i915/selftests/intel_uncore.c | 56 +++++++++++++++++++
1 file changed, 56 insertions(+)
diff --git a/drivers/gpu/drm/i915/selftests/intel_uncore.c b/drivers/gpu/drm/i915/selftests/intel_uncore.c
index bc8128170a99..3e3d74e4370f 100644
--- a/drivers/gpu/drm/i915/selftests/intel_uncore.c
+++ b/drivers/gpu/drm/i915/selftests/intel_uncore.c
@@ -336,12 +336,68 @@ static int live_fw_table(void *arg)
GRAPHICS_VER(gt->i915) >= 9);
}
+static int live_forcewake_stress(void *arg)
+{
+ struct intel_gt *gt = arg;
+ struct intel_uncore *uncore = gt->uncore;
+ unsigned int period_us = 16667;
+ intel_wakeref_t wakeref;
+
+ if (!uncore->fw_domains)
+ return 0;
+
+ wakeref = intel_runtime_pm_get(uncore->rpm);
+
+ while (period_us) {
+ struct intel_uncore_forcewake_domain *d;
+ unsigned long cnt;
+ unsigned int tmp;
+ ktime_t start;
+
+ for_each_fw_domain(d, uncore, tmp) {
+ start = ktime_get();
+ cnt = 0;
+
+ do {
+ intel_uncore_forcewake_get(uncore, d->mask);
+ udelay(period_us / 2);
+ intel_uncore_forcewake_put(uncore, d->mask);
+ udelay(period_us / 2);
+ cnt++;
+ } while (ktime_to_ms(ktime_sub(ktime_get(), start)) < 200);
+
+ pr_info("fw-domain-%x: %lu cycles with %uus period\n",
+ d->mask, cnt, period_us);
+ }
+
+ start = ktime_get();
+ cnt = 0;
+ do {
+ intel_uncore_forcewake_get(uncore, FORCEWAKE_ALL);
+ udelay(period_us / 2);
+ intel_uncore_forcewake_put(uncore, FORCEWAKE_ALL);
+ udelay(period_us / 2);
+ cnt++;
+ } while (ktime_to_ms(ktime_sub(ktime_get(), start)) < 200);
+
+ pr_info("all-fw-domains: %lu cycles with %uus period\n",
+ cnt, period_us);
+
+ period_us /= 2;
+ }
+
+ intel_runtime_pm_put(uncore->rpm, wakeref);
+
+ return 0;
+}
+
int intel_uncore_live_selftests(struct drm_i915_private *i915)
{
static const struct i915_subtest tests[] = {
SUBTEST(live_fw_table),
SUBTEST(live_forcewake_ops),
SUBTEST(live_forcewake_domains),
+ SUBTEST(live_forcewake_stress),
};
return intel_gt_live_subtests(tests, &i915->gt);
--
2.32.0
More information about the Intel-gfx-trybot
mailing list