Skip to content

Commit d1b739f

Browse files
vsyrjalajnikula
authored andcommitted
drm/i915: Deal with machines that expose less than three QGV points
When SAGV is forced to disabled/min/med/max in the BIOS pcode will only hand us a single QGV point instead of the normal three. Fix the code to deal with that instead declaring the bandwidth limit to be 0 MB/s (and thus preventing any planes from being enabled). Also shrink the max_bw sturct a bit while at it, and change the deratedbw type to unsigned since the code returns the bw as an unsigned int. Since we now keep track of how many qgv points we got from pcode we can drop the earlier check added for the "pcode doesn't support the memory subsystem query" case. Cc: [email protected] Cc: Mark Janes <[email protected]> Cc: Matt Roper <[email protected]> Cc: Clint Taylor <[email protected]> Fixes: c457d9c ("drm/i915: Make sure we have enough memory bandwidth on ICL") Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=110838 Signed-off-by: Ville Syrjälä <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected] Reviewed-by: Matt Roper <[email protected]> (cherry picked from commit 56e9371) Signed-off-by: Jani Nikula <[email protected]>
1 parent fdcc789 commit d1b739f

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

drivers/gpu/drm/i915/display/intel_bw.c

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,8 @@ static int icl_get_bw_info(struct drm_i915_private *dev_priv)
178178
clpchgroup = (sa->deburst * deinterleave / num_channels) << i;
179179
bi->num_planes = (ipqdepth - clpchgroup) / clpchgroup + 1;
180180

181+
bi->num_qgv_points = qi.num_points;
182+
181183
for (j = 0; j < qi.num_points; j++) {
182184
const struct intel_qgv_point *sp = &qi.points[j];
183185
int ct, bw;
@@ -195,7 +197,7 @@ static int icl_get_bw_info(struct drm_i915_private *dev_priv)
195197
bi->deratedbw[j] = min(maxdebw,
196198
bw * 9 / 10); /* 90% */
197199

198-
DRM_DEBUG_KMS("BW%d / QGV %d: num_planes=%d deratedbw=%d\n",
200+
DRM_DEBUG_KMS("BW%d / QGV %d: num_planes=%d deratedbw=%u\n",
199201
i, j, bi->num_planes, bi->deratedbw[j]);
200202
}
201203

@@ -211,14 +213,17 @@ static unsigned int icl_max_bw(struct drm_i915_private *dev_priv,
211213
{
212214
int i;
213215

214-
/* Did we initialize the bw limits successfully? */
215-
if (dev_priv->max_bw[0].num_planes == 0)
216-
return UINT_MAX;
217-
218216
for (i = 0; i < ARRAY_SIZE(dev_priv->max_bw); i++) {
219217
const struct intel_bw_info *bi =
220218
&dev_priv->max_bw[i];
221219

220+
/*
221+
* Pcode will not expose all QGV points when
222+
* SAGV is forced to off/min/med/max.
223+
*/
224+
if (qgv_point >= bi->num_qgv_points)
225+
return UINT_MAX;
226+
222227
if (num_planes >= bi->num_planes)
223228
return bi->deratedbw[qgv_point];
224229
}

drivers/gpu/drm/i915/i915_drv.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1674,8 +1674,9 @@ struct drm_i915_private {
16741674
} dram_info;
16751675

16761676
struct intel_bw_info {
1677-
int num_planes;
1678-
int deratedbw[3];
1677+
unsigned int deratedbw[3]; /* for each QGV point */
1678+
u8 num_qgv_points;
1679+
u8 num_planes;
16791680
} max_bw[6];
16801681

16811682
struct drm_private_obj bw_obj;

0 commit comments

Comments
 (0)