summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMika Kuoppala <mika.kuoppala@intel.com>2017-07-14 13:57:37 +0300
committerMika Kuoppala <mika.kuoppala@intel.com>2017-07-14 15:49:45 +0300
commit88163c3d6436d9aefc8fc2745fc0e3ff9364bca0 (patch)
tree4490b5ca030a1e212514b730a8bff2900459e72a
parent5182881eef4843638e993d15f93a8dbb8c89e429 (diff)
drm/i915: Allow control of idle freq through debugfsmin_idle
Sometimes it is beneficial to be able to park the gpu into a specific frequency to observe the effect on the spoolup time and latencies. Note that we don't save the value during suspend/resume. We could but we don't want to clutter the mechanics with another softcap variable and accept this limitation. Cc: Chris Wilson <chris@chris-wilson.co.uk> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> Signed-off-by: Mika Kuoppala <mika.kuoppala@intel.com>
-rw-r--r--drivers/gpu/drm/i915/i915_debugfs.c56
1 files changed, 56 insertions, 0 deletions
diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
index 620c9218d1c1..82959b892a82 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -4510,6 +4510,61 @@ DEFINE_SIMPLE_ATTRIBUTE(i915_min_freq_fops,
"%llu\n");
static int
+i915_idle_freq_get(void *data, u64 *val)
+{
+ struct drm_i915_private *dev_priv = data;
+
+ if (INTEL_GEN(dev_priv) < 6)
+ return -ENODEV;
+
+ *val = intel_gpu_freq(dev_priv, dev_priv->rps.idle_freq);
+ return 0;
+}
+
+static int
+i915_idle_freq_set(void *data, u64 val)
+{
+ struct drm_i915_private *dev_priv = data;
+ u32 hw_max, hw_min;
+ int ret;
+
+ if (INTEL_GEN(dev_priv) < 6)
+ return -ENODEV;
+
+ DRM_DEBUG_DRIVER("Manually setting idle freq to %llu\n", val);
+
+ ret = mutex_lock_interruptible(&dev_priv->rps.hw_lock);
+ if (ret)
+ return ret;
+
+ /*
+ * Turbo will still be enabled, but won't go below the set value.
+ */
+ val = intel_freq_opcode(dev_priv, val);
+
+ hw_max = dev_priv->rps.max_freq;
+ hw_min = dev_priv->rps.min_freq;
+
+ if (val < hw_min || val > hw_max) {
+ mutex_unlock(&dev_priv->rps.hw_lock);
+ return -EINVAL;
+ }
+
+ dev_priv->rps.idle_freq = val;
+
+ if (intel_set_rps(dev_priv, val))
+ DRM_DEBUG_DRIVER("failed to update RPS to new idle\n");
+
+ mutex_unlock(&dev_priv->rps.hw_lock);
+
+ return 0;
+}
+
+DEFINE_SIMPLE_ATTRIBUTE(i915_idle_freq_fops,
+ i915_idle_freq_get, i915_idle_freq_set,
+ "%llu\n");
+
+static int
i915_cache_sharing_get(void *data, u64 *val)
{
struct drm_i915_private *dev_priv = data;
@@ -4911,6 +4966,7 @@ static const struct i915_debugfs_files {
{"i915_wedged", &i915_wedged_fops},
{"i915_max_freq", &i915_max_freq_fops},
{"i915_min_freq", &i915_min_freq_fops},
+ {"i915_idle_freq", &i915_idle_freq_fops},
{"i915_cache_sharing", &i915_cache_sharing_fops},
{"i915_ring_missed_irq", &i915_ring_missed_irq_fops},
{"i915_ring_test_irq", &i915_ring_test_irq_fops},