Skip to content

Commit 29ecd78

Browse files
committed
drm/i915: Define a separate variable and control for RPS waitboost frequency
To allow the user finer control over waitboosting, allow them to set the frequency we request for the boost. This also them allows to effectively disable the boosting by setting the boost request to a low frequency. Signed-off-by: Chris Wilson <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected] Reviewed-by: Mika Kuoppala <[email protected]>
1 parent 99ac961 commit 29ecd78

File tree

5 files changed

+50
-5
lines changed

5 files changed

+50
-5
lines changed

drivers/gpu/drm/i915/i915_debugfs.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1381,6 +1381,8 @@ static int i915_frequency_info(struct seq_file *m, void *unused)
13811381
intel_gpu_freq(dev_priv, dev_priv->rps.idle_freq));
13821382
seq_printf(m, "Min freq: %d MHz\n",
13831383
intel_gpu_freq(dev_priv, dev_priv->rps.min_freq));
1384+
seq_printf(m, "Boost freq: %d MHz\n",
1385+
intel_gpu_freq(dev_priv, dev_priv->rps.boost_freq));
13841386
seq_printf(m, "Max freq: %d MHz\n",
13851387
intel_gpu_freq(dev_priv, dev_priv->rps.max_freq));
13861388
seq_printf(m,

drivers/gpu/drm/i915/i915_drv.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1170,6 +1170,7 @@ struct intel_gen6_power_mgmt {
11701170
u8 max_freq_softlimit; /* Max frequency permitted by the driver */
11711171
u8 max_freq; /* Maximum frequency, RP0 if not overclocking */
11721172
u8 min_freq; /* AKA RPn. Minimum frequency */
1173+
u8 boost_freq; /* Frequency to request when wait boosting */
11731174
u8 idle_freq; /* Frequency to request when we are idle */
11741175
u8 efficient_freq; /* AKA RPe. Pre-determined balanced frequency */
11751176
u8 rp1_freq; /* "less than" RP0 power/freqency */

drivers/gpu/drm/i915/i915_irq.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1105,9 +1105,10 @@ static void gen6_pm_rps_work(struct work_struct *work)
11051105
new_delay = dev_priv->rps.cur_freq;
11061106
min = dev_priv->rps.min_freq_softlimit;
11071107
max = dev_priv->rps.max_freq_softlimit;
1108-
1109-
if (client_boost) {
1110-
new_delay = dev_priv->rps.max_freq_softlimit;
1108+
if (client_boost || any_waiters(dev_priv))
1109+
max = dev_priv->rps.max_freq;
1110+
if (client_boost && new_delay < dev_priv->rps.boost_freq) {
1111+
new_delay = dev_priv->rps.boost_freq;
11111112
adj = 0;
11121113
} else if (pm_iir & GEN6_PM_RP_UP_THRESHOLD) {
11131114
if (adj > 0)
@@ -1122,7 +1123,7 @@ static void gen6_pm_rps_work(struct work_struct *work)
11221123
new_delay = dev_priv->rps.efficient_freq;
11231124
adj = 0;
11241125
}
1125-
} else if (any_waiters(dev_priv)) {
1126+
} else if (client_boost || any_waiters(dev_priv)) {
11261127
adj = 0;
11271128
} else if (pm_iir & GEN6_PM_RP_DOWN_TIMEOUT) {
11281129
if (dev_priv->rps.cur_freq > dev_priv->rps.efficient_freq)

drivers/gpu/drm/i915/i915_sysfs.c

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,41 @@ static ssize_t gt_cur_freq_mhz_show(struct device *kdev,
318318
return snprintf(buf, PAGE_SIZE, "%d\n", ret);
319319
}
320320

321+
static ssize_t gt_boost_freq_mhz_show(struct device *kdev, struct device_attribute *attr, char *buf)
322+
{
323+
struct drm_minor *minor = dev_to_drm_minor(kdev);
324+
struct drm_i915_private *dev_priv = to_i915(minor->dev);
325+
326+
return snprintf(buf, PAGE_SIZE, "%d\n",
327+
intel_gpu_freq(dev_priv, dev_priv->rps.boost_freq));
328+
}
329+
330+
static ssize_t gt_boost_freq_mhz_store(struct device *kdev,
331+
struct device_attribute *attr,
332+
const char *buf, size_t count)
333+
{
334+
struct drm_minor *minor = dev_to_drm_minor(kdev);
335+
struct drm_device *dev = minor->dev;
336+
struct drm_i915_private *dev_priv = dev->dev_private;
337+
u32 val;
338+
ssize_t ret;
339+
340+
ret = kstrtou32(buf, 0, &val);
341+
if (ret)
342+
return ret;
343+
344+
/* Validate against (static) hardware limits */
345+
val = intel_freq_opcode(dev_priv, val);
346+
if (val < dev_priv->rps.min_freq || val > dev_priv->rps.max_freq)
347+
return -EINVAL;
348+
349+
mutex_lock(&dev_priv->rps.hw_lock);
350+
dev_priv->rps.boost_freq = val;
351+
mutex_unlock(&dev_priv->rps.hw_lock);
352+
353+
return count;
354+
}
355+
321356
static ssize_t vlv_rpe_freq_mhz_show(struct device *kdev,
322357
struct device_attribute *attr, char *buf)
323358
{
@@ -465,6 +500,7 @@ static ssize_t gt_min_freq_mhz_store(struct device *kdev,
465500

466501
static DEVICE_ATTR(gt_act_freq_mhz, S_IRUGO, gt_act_freq_mhz_show, NULL);
467502
static DEVICE_ATTR(gt_cur_freq_mhz, S_IRUGO, gt_cur_freq_mhz_show, NULL);
503+
static DEVICE_ATTR(gt_boost_freq_mhz, S_IRUGO, gt_boost_freq_mhz_show, gt_boost_freq_mhz_store);
468504
static DEVICE_ATTR(gt_max_freq_mhz, S_IRUGO | S_IWUSR, gt_max_freq_mhz_show, gt_max_freq_mhz_store);
469505
static DEVICE_ATTR(gt_min_freq_mhz, S_IRUGO | S_IWUSR, gt_min_freq_mhz_show, gt_min_freq_mhz_store);
470506

@@ -498,6 +534,7 @@ static ssize_t gt_rp_mhz_show(struct device *kdev, struct device_attribute *attr
498534
static const struct attribute *gen6_attrs[] = {
499535
&dev_attr_gt_act_freq_mhz.attr,
500536
&dev_attr_gt_cur_freq_mhz.attr,
537+
&dev_attr_gt_boost_freq_mhz.attr,
501538
&dev_attr_gt_max_freq_mhz.attr,
502539
&dev_attr_gt_min_freq_mhz.attr,
503540
&dev_attr_gt_RP0_freq_mhz.attr,
@@ -509,6 +546,7 @@ static const struct attribute *gen6_attrs[] = {
509546
static const struct attribute *vlv_attrs[] = {
510547
&dev_attr_gt_act_freq_mhz.attr,
511548
&dev_attr_gt_cur_freq_mhz.attr,
549+
&dev_attr_gt_boost_freq_mhz.attr,
512550
&dev_attr_gt_max_freq_mhz.attr,
513551
&dev_attr_gt_min_freq_mhz.attr,
514552
&dev_attr_gt_RP0_freq_mhz.attr,

drivers/gpu/drm/i915/intel_pm.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4911,7 +4911,7 @@ void gen6_rps_boost(struct drm_i915_private *dev_priv,
49114911
*/
49124912
if (!(dev_priv->gt.awake &&
49134913
dev_priv->rps.enabled &&
4914-
dev_priv->rps.cur_freq < dev_priv->rps.max_freq_softlimit))
4914+
dev_priv->rps.cur_freq < dev_priv->rps.boost_freq))
49154915
return;
49164916

49174917
/* Force a RPS boost (and don't count it against the client) if
@@ -6532,6 +6532,9 @@ void intel_init_gt_powersave(struct drm_i915_private *dev_priv)
65326532
}
65336533
}
65346534

6535+
/* Finally allow us to boost to max by default */
6536+
dev_priv->rps.boost_freq = dev_priv->rps.max_freq;
6537+
65356538
mutex_unlock(&dev_priv->rps.hw_lock);
65366539
}
65376540

0 commit comments

Comments
 (0)