blob: fdf9b54b71e9749dbe283cf419eea736ebbc4453 [file] [log] [blame]
Chris Wilson94b4f3b2016-07-05 10:40:20 +01001/*
2 * Copyright © 2016 Intel Corporation
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
13 * Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21 * IN THE SOFTWARE.
22 *
23 */
24
25#include "i915_drv.h"
26
Jani Nikula2e0d26f2016-12-01 14:49:55 +020027#define PLATFORM_NAME(x) [INTEL_##x] = #x
28static const char * const platform_names[] = {
29 PLATFORM_NAME(I830),
30 PLATFORM_NAME(I845G),
31 PLATFORM_NAME(I85X),
32 PLATFORM_NAME(I865G),
33 PLATFORM_NAME(I915G),
34 PLATFORM_NAME(I915GM),
35 PLATFORM_NAME(I945G),
36 PLATFORM_NAME(I945GM),
37 PLATFORM_NAME(G33),
38 PLATFORM_NAME(PINEVIEW),
Jani Nikulac0f86832016-12-07 12:13:04 +020039 PLATFORM_NAME(I965G),
40 PLATFORM_NAME(I965GM),
Jani Nikulaf69c11a2016-11-30 17:43:05 +020041 PLATFORM_NAME(G45),
42 PLATFORM_NAME(GM45),
Jani Nikula2e0d26f2016-12-01 14:49:55 +020043 PLATFORM_NAME(IRONLAKE),
44 PLATFORM_NAME(SANDYBRIDGE),
45 PLATFORM_NAME(IVYBRIDGE),
46 PLATFORM_NAME(VALLEYVIEW),
47 PLATFORM_NAME(HASWELL),
48 PLATFORM_NAME(BROADWELL),
49 PLATFORM_NAME(CHERRYVIEW),
50 PLATFORM_NAME(SKYLAKE),
51 PLATFORM_NAME(BROXTON),
52 PLATFORM_NAME(KABYLAKE),
53 PLATFORM_NAME(GEMINILAKE),
Rodrigo Vivi71851fa2017-06-08 08:49:58 -070054 PLATFORM_NAME(COFFEELAKE),
Rodrigo Vivi413f3c12017-06-06 13:30:30 -070055 PLATFORM_NAME(CANNONLAKE),
Jani Nikula2e0d26f2016-12-01 14:49:55 +020056};
57#undef PLATFORM_NAME
58
59const char *intel_platform_name(enum intel_platform platform)
60{
Jani Nikula91600952017-02-28 13:11:43 +020061 BUILD_BUG_ON(ARRAY_SIZE(platform_names) != INTEL_MAX_PLATFORMS);
62
Jani Nikula2e0d26f2016-12-01 14:49:55 +020063 if (WARN_ON_ONCE(platform >= ARRAY_SIZE(platform_names) ||
64 platform_names[platform] == NULL))
65 return "<unknown>";
66
67 return platform_names[platform];
68}
69
Chris Wilson94b4f3b2016-07-05 10:40:20 +010070void intel_device_info_dump(struct drm_i915_private *dev_priv)
71{
72 const struct intel_device_info *info = &dev_priv->info;
73
Jani Nikula2e0d26f2016-12-01 14:49:55 +020074 DRM_DEBUG_DRIVER("i915 device info: platform=%s gen=%i pciid=0x%04x rev=0x%02x",
75 intel_platform_name(info->platform),
Chris Wilson94b4f3b2016-07-05 10:40:20 +010076 info->gen,
77 dev_priv->drm.pdev->device,
Joonas Lahtinen604db652016-10-05 13:50:16 +030078 dev_priv->drm.pdev->revision);
79#define PRINT_FLAG(name) \
80 DRM_DEBUG_DRIVER("i915 device info: " #name ": %s", yesno(info->name))
81 DEV_INFO_FOR_EACH_FLAG(PRINT_FLAG);
Chris Wilson94b4f3b2016-07-05 10:40:20 +010082#undef PRINT_FLAG
Chris Wilson94b4f3b2016-07-05 10:40:20 +010083}
84
85static void cherryview_sseu_info_init(struct drm_i915_private *dev_priv)
86{
Imre Deak43b67992016-08-31 19:13:02 +030087 struct sseu_dev_info *sseu = &mkwrite_device_info(dev_priv)->sseu;
Chris Wilson94b4f3b2016-07-05 10:40:20 +010088 u32 fuse, eu_dis;
89
90 fuse = I915_READ(CHV_FUSE_GT);
91
Imre Deakf08a0c92016-08-31 19:13:04 +030092 sseu->slice_mask = BIT(0);
Chris Wilson94b4f3b2016-07-05 10:40:20 +010093
94 if (!(fuse & CHV_FGT_DISABLE_SS0)) {
Imre Deak57ec1712016-08-31 19:13:05 +030095 sseu->subslice_mask |= BIT(0);
Chris Wilson94b4f3b2016-07-05 10:40:20 +010096 eu_dis = fuse & (CHV_FGT_EU_DIS_SS0_R0_MASK |
97 CHV_FGT_EU_DIS_SS0_R1_MASK);
Imre Deak43b67992016-08-31 19:13:02 +030098 sseu->eu_total += 8 - hweight32(eu_dis);
Chris Wilson94b4f3b2016-07-05 10:40:20 +010099 }
100
101 if (!(fuse & CHV_FGT_DISABLE_SS1)) {
Imre Deak57ec1712016-08-31 19:13:05 +0300102 sseu->subslice_mask |= BIT(1);
Chris Wilson94b4f3b2016-07-05 10:40:20 +0100103 eu_dis = fuse & (CHV_FGT_EU_DIS_SS1_R0_MASK |
104 CHV_FGT_EU_DIS_SS1_R1_MASK);
Imre Deak43b67992016-08-31 19:13:02 +0300105 sseu->eu_total += 8 - hweight32(eu_dis);
Chris Wilson94b4f3b2016-07-05 10:40:20 +0100106 }
107
Chris Wilson94b4f3b2016-07-05 10:40:20 +0100108 /*
109 * CHV expected to always have a uniform distribution of EU
110 * across subslices.
111 */
Imre Deak57ec1712016-08-31 19:13:05 +0300112 sseu->eu_per_subslice = sseu_subslice_total(sseu) ?
113 sseu->eu_total / sseu_subslice_total(sseu) :
Chris Wilson94b4f3b2016-07-05 10:40:20 +0100114 0;
115 /*
116 * CHV supports subslice power gating on devices with more than
117 * one subslice, and supports EU power gating on devices with
118 * more than one EU pair per subslice.
119 */
Imre Deak43b67992016-08-31 19:13:02 +0300120 sseu->has_slice_pg = 0;
Imre Deak57ec1712016-08-31 19:13:05 +0300121 sseu->has_subslice_pg = sseu_subslice_total(sseu) > 1;
Imre Deak43b67992016-08-31 19:13:02 +0300122 sseu->has_eu_pg = (sseu->eu_per_subslice > 2);
Chris Wilson94b4f3b2016-07-05 10:40:20 +0100123}
124
125static void gen9_sseu_info_init(struct drm_i915_private *dev_priv)
126{
127 struct intel_device_info *info = mkwrite_device_info(dev_priv);
Imre Deak43b67992016-08-31 19:13:02 +0300128 struct sseu_dev_info *sseu = &info->sseu;
Chris Wilson94b4f3b2016-07-05 10:40:20 +0100129 int s_max = 3, ss_max = 4, eu_max = 8;
130 int s, ss;
Imre Deak57ec1712016-08-31 19:13:05 +0300131 u32 fuse2, eu_disable;
Chris Wilson94b4f3b2016-07-05 10:40:20 +0100132 u8 eu_mask = 0xff;
133
134 fuse2 = I915_READ(GEN8_FUSE2);
Imre Deakf08a0c92016-08-31 19:13:04 +0300135 sseu->slice_mask = (fuse2 & GEN8_F2_S_ENA_MASK) >> GEN8_F2_S_ENA_SHIFT;
Chris Wilson94b4f3b2016-07-05 10:40:20 +0100136
Chris Wilson94b4f3b2016-07-05 10:40:20 +0100137 /*
138 * The subslice disable field is global, i.e. it applies
139 * to each of the enabled slices.
140 */
Imre Deak57ec1712016-08-31 19:13:05 +0300141 sseu->subslice_mask = (1 << ss_max) - 1;
142 sseu->subslice_mask &= ~((fuse2 & GEN9_F2_SS_DIS_MASK) >>
143 GEN9_F2_SS_DIS_SHIFT);
Chris Wilson94b4f3b2016-07-05 10:40:20 +0100144
145 /*
146 * Iterate through enabled slices and subslices to
147 * count the total enabled EU.
148 */
149 for (s = 0; s < s_max; s++) {
Imre Deakf08a0c92016-08-31 19:13:04 +0300150 if (!(sseu->slice_mask & BIT(s)))
Chris Wilson94b4f3b2016-07-05 10:40:20 +0100151 /* skip disabled slice */
152 continue;
153
154 eu_disable = I915_READ(GEN9_EU_DISABLE(s));
155 for (ss = 0; ss < ss_max; ss++) {
156 int eu_per_ss;
157
Imre Deak57ec1712016-08-31 19:13:05 +0300158 if (!(sseu->subslice_mask & BIT(ss)))
Chris Wilson94b4f3b2016-07-05 10:40:20 +0100159 /* skip disabled subslice */
160 continue;
161
162 eu_per_ss = eu_max - hweight8((eu_disable >> (ss*8)) &
163 eu_mask);
164
165 /*
166 * Record which subslice(s) has(have) 7 EUs. we
167 * can tune the hash used to spread work among
168 * subslices if they are unbalanced.
169 */
170 if (eu_per_ss == 7)
Imre Deak43b67992016-08-31 19:13:02 +0300171 sseu->subslice_7eu[s] |= BIT(ss);
Chris Wilson94b4f3b2016-07-05 10:40:20 +0100172
Imre Deak43b67992016-08-31 19:13:02 +0300173 sseu->eu_total += eu_per_ss;
Chris Wilson94b4f3b2016-07-05 10:40:20 +0100174 }
175 }
176
177 /*
178 * SKL is expected to always have a uniform distribution
179 * of EU across subslices with the exception that any one
180 * EU in any one subslice may be fused off for die
181 * recovery. BXT is expected to be perfectly uniform in EU
182 * distribution.
183 */
Imre Deak57ec1712016-08-31 19:13:05 +0300184 sseu->eu_per_subslice = sseu_subslice_total(sseu) ?
Imre Deak43b67992016-08-31 19:13:02 +0300185 DIV_ROUND_UP(sseu->eu_total,
Imre Deak57ec1712016-08-31 19:13:05 +0300186 sseu_subslice_total(sseu)) : 0;
Chris Wilson94b4f3b2016-07-05 10:40:20 +0100187 /*
Rodrigo Vivic7ae7e92017-06-06 13:30:36 -0700188 * SKL+ supports slice power gating on devices with more than
Chris Wilson94b4f3b2016-07-05 10:40:20 +0100189 * one slice, and supports EU power gating on devices with
Rodrigo Vivic7ae7e92017-06-06 13:30:36 -0700190 * more than one EU pair per subslice. BXT+ supports subslice
Chris Wilson94b4f3b2016-07-05 10:40:20 +0100191 * power gating on devices with more than one subslice, and
192 * supports EU power gating on devices with more than one EU
193 * pair per subslice.
194 */
Imre Deak43b67992016-08-31 19:13:02 +0300195 sseu->has_slice_pg =
Rodrigo Vivic7ae7e92017-06-06 13:30:36 -0700196 !IS_GEN9_LP(dev_priv) && hweight8(sseu->slice_mask) > 1;
Imre Deak43b67992016-08-31 19:13:02 +0300197 sseu->has_subslice_pg =
Michel Thierry254e0932017-01-09 16:51:35 +0200198 IS_GEN9_LP(dev_priv) && sseu_subslice_total(sseu) > 1;
Imre Deak43b67992016-08-31 19:13:02 +0300199 sseu->has_eu_pg = sseu->eu_per_subslice > 2;
Chris Wilson94b4f3b2016-07-05 10:40:20 +0100200
Ander Conselvan de Oliveira234516a2017-03-17 16:04:36 +0200201 if (IS_GEN9_LP(dev_priv)) {
Imre Deak57ec1712016-08-31 19:13:05 +0300202#define IS_SS_DISABLED(ss) (!(sseu->subslice_mask & BIT(ss)))
Ander Conselvan de Oliveira234516a2017-03-17 16:04:36 +0200203 info->has_pooled_eu = hweight8(sseu->subslice_mask) == 3;
204
Chris Wilson94b4f3b2016-07-05 10:40:20 +0100205 /*
206 * There is a HW issue in 2x6 fused down parts that requires
207 * Pooled EU to be enabled as a WA. The pool configuration
208 * changes depending upon which subslice is fused down. This
209 * doesn't affect if the device has all 3 subslices enabled.
210 */
211 /* WaEnablePooledEuFor2x6:bxt */
Ander Conselvan de Oliveira234516a2017-03-17 16:04:36 +0200212 info->has_pooled_eu |= (hweight8(sseu->subslice_mask) == 2 &&
213 IS_BXT_REVID(dev_priv, 0, BXT_REVID_B_LAST));
Chris Wilson94b4f3b2016-07-05 10:40:20 +0100214
Imre Deak43b67992016-08-31 19:13:02 +0300215 sseu->min_eu_in_pool = 0;
Chris Wilson94b4f3b2016-07-05 10:40:20 +0100216 if (info->has_pooled_eu) {
Imre Deak57ec1712016-08-31 19:13:05 +0300217 if (IS_SS_DISABLED(2) || IS_SS_DISABLED(0))
Imre Deak43b67992016-08-31 19:13:02 +0300218 sseu->min_eu_in_pool = 3;
Imre Deak57ec1712016-08-31 19:13:05 +0300219 else if (IS_SS_DISABLED(1))
Imre Deak43b67992016-08-31 19:13:02 +0300220 sseu->min_eu_in_pool = 6;
Chris Wilson94b4f3b2016-07-05 10:40:20 +0100221 else
Imre Deak43b67992016-08-31 19:13:02 +0300222 sseu->min_eu_in_pool = 9;
Chris Wilson94b4f3b2016-07-05 10:40:20 +0100223 }
224#undef IS_SS_DISABLED
225 }
226}
227
228static void broadwell_sseu_info_init(struct drm_i915_private *dev_priv)
229{
Imre Deak43b67992016-08-31 19:13:02 +0300230 struct sseu_dev_info *sseu = &mkwrite_device_info(dev_priv)->sseu;
Chris Wilson94b4f3b2016-07-05 10:40:20 +0100231 const int s_max = 3, ss_max = 3, eu_max = 8;
232 int s, ss;
Jani Nikulaff64aa12016-10-04 12:54:12 +0300233 u32 fuse2, eu_disable[3]; /* s_max */
Chris Wilson94b4f3b2016-07-05 10:40:20 +0100234
235 fuse2 = I915_READ(GEN8_FUSE2);
Imre Deakf08a0c92016-08-31 19:13:04 +0300236 sseu->slice_mask = (fuse2 & GEN8_F2_S_ENA_MASK) >> GEN8_F2_S_ENA_SHIFT;
Imre Deak57ec1712016-08-31 19:13:05 +0300237 /*
238 * The subslice disable field is global, i.e. it applies
239 * to each of the enabled slices.
240 */
Joonas Lahtinen3c779a42017-02-08 15:12:09 +0200241 sseu->subslice_mask = GENMASK(ss_max - 1, 0);
Imre Deak57ec1712016-08-31 19:13:05 +0300242 sseu->subslice_mask &= ~((fuse2 & GEN8_F2_SS_DIS_MASK) >>
243 GEN8_F2_SS_DIS_SHIFT);
Chris Wilson94b4f3b2016-07-05 10:40:20 +0100244
245 eu_disable[0] = I915_READ(GEN8_EU_DISABLE0) & GEN8_EU_DIS0_S0_MASK;
246 eu_disable[1] = (I915_READ(GEN8_EU_DISABLE0) >> GEN8_EU_DIS0_S1_SHIFT) |
247 ((I915_READ(GEN8_EU_DISABLE1) & GEN8_EU_DIS1_S1_MASK) <<
248 (32 - GEN8_EU_DIS0_S1_SHIFT));
249 eu_disable[2] = (I915_READ(GEN8_EU_DISABLE1) >> GEN8_EU_DIS1_S2_SHIFT) |
250 ((I915_READ(GEN8_EU_DISABLE2) & GEN8_EU_DIS2_S2_MASK) <<
251 (32 - GEN8_EU_DIS1_S2_SHIFT));
252
Chris Wilson94b4f3b2016-07-05 10:40:20 +0100253 /*
Chris Wilson94b4f3b2016-07-05 10:40:20 +0100254 * Iterate through enabled slices and subslices to
255 * count the total enabled EU.
256 */
257 for (s = 0; s < s_max; s++) {
Imre Deakf08a0c92016-08-31 19:13:04 +0300258 if (!(sseu->slice_mask & BIT(s)))
Chris Wilson94b4f3b2016-07-05 10:40:20 +0100259 /* skip disabled slice */
260 continue;
261
262 for (ss = 0; ss < ss_max; ss++) {
263 u32 n_disabled;
264
Imre Deak57ec1712016-08-31 19:13:05 +0300265 if (!(sseu->subslice_mask & BIT(ss)))
Chris Wilson94b4f3b2016-07-05 10:40:20 +0100266 /* skip disabled subslice */
267 continue;
268
269 n_disabled = hweight8(eu_disable[s] >> (ss * eu_max));
270
271 /*
272 * Record which subslices have 7 EUs.
273 */
274 if (eu_max - n_disabled == 7)
Imre Deak43b67992016-08-31 19:13:02 +0300275 sseu->subslice_7eu[s] |= 1 << ss;
Chris Wilson94b4f3b2016-07-05 10:40:20 +0100276
Imre Deak43b67992016-08-31 19:13:02 +0300277 sseu->eu_total += eu_max - n_disabled;
Chris Wilson94b4f3b2016-07-05 10:40:20 +0100278 }
279 }
280
281 /*
282 * BDW is expected to always have a uniform distribution of EU across
283 * subslices with the exception that any one EU in any one subslice may
284 * be fused off for die recovery.
285 */
Imre Deak57ec1712016-08-31 19:13:05 +0300286 sseu->eu_per_subslice = sseu_subslice_total(sseu) ?
287 DIV_ROUND_UP(sseu->eu_total,
288 sseu_subslice_total(sseu)) : 0;
Chris Wilson94b4f3b2016-07-05 10:40:20 +0100289
290 /*
291 * BDW supports slice power gating on devices with more than
292 * one slice.
293 */
Imre Deakf08a0c92016-08-31 19:13:04 +0300294 sseu->has_slice_pg = hweight8(sseu->slice_mask) > 1;
Imre Deak43b67992016-08-31 19:13:02 +0300295 sseu->has_subslice_pg = 0;
296 sseu->has_eu_pg = 0;
Chris Wilson94b4f3b2016-07-05 10:40:20 +0100297}
298
299/*
300 * Determine various intel_device_info fields at runtime.
301 *
302 * Use it when either:
303 * - it's judged too laborious to fill n static structures with the limit
304 * when a simple if statement does the job,
305 * - run-time checks (eg read fuse/strap registers) are needed.
306 *
307 * This function needs to be called:
308 * - after the MMIO has been setup as we are reading registers,
309 * - after the PCH has been detected,
310 * - before the first usage of the fields it can tweak.
311 */
312void intel_device_info_runtime_init(struct drm_i915_private *dev_priv)
313{
314 struct intel_device_info *info = mkwrite_device_info(dev_priv);
315 enum pipe pipe;
316
Ander Conselvan de Oliveira0bf02302017-01-02 15:54:41 +0200317 if (INTEL_GEN(dev_priv) >= 9) {
318 info->num_scalers[PIPE_A] = 2;
319 info->num_scalers[PIPE_B] = 2;
320 info->num_scalers[PIPE_C] = 1;
321 }
322
Chris Wilson94b4f3b2016-07-05 10:40:20 +0100323 /*
324 * Skylake and Broxton currently don't expose the topmost plane as its
325 * use is exclusive with the legacy cursor and we only want to expose
326 * one of those, not both. Until we can safely expose the topmost plane
327 * as a DRM_PLANE_TYPE_CURSOR with all the features exposed/supported,
328 * we don't expose the topmost plane at all to prevent ABI breakage
329 * down the line.
330 */
James Irwin8366be92017-06-06 13:30:35 -0700331 if (IS_GEN10(dev_priv) || IS_GEMINILAKE(dev_priv))
Ander Conselvan de Oliveirae9c98822016-12-02 10:23:57 +0200332 for_each_pipe(dev_priv, pipe)
333 info->num_sprites[pipe] = 3;
334 else if (IS_BROXTON(dev_priv)) {
Chris Wilson94b4f3b2016-07-05 10:40:20 +0100335 info->num_sprites[PIPE_A] = 2;
336 info->num_sprites[PIPE_B] = 2;
337 info->num_sprites[PIPE_C] = 1;
Ville Syrjälä33edc242016-10-25 18:58:00 +0300338 } else if (IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv)) {
Chris Wilson94b4f3b2016-07-05 10:40:20 +0100339 for_each_pipe(dev_priv, pipe)
340 info->num_sprites[pipe] = 2;
Ville Syrjäläab330812017-04-21 21:14:32 +0300341 } else if (INTEL_GEN(dev_priv) >= 5 || IS_G4X(dev_priv)) {
Chris Wilson94b4f3b2016-07-05 10:40:20 +0100342 for_each_pipe(dev_priv, pipe)
343 info->num_sprites[pipe] = 1;
Ville Syrjälä33edc242016-10-25 18:58:00 +0300344 }
Chris Wilson94b4f3b2016-07-05 10:40:20 +0100345
Michal Wajdeczko4f044a82017-09-19 19:38:44 +0000346 if (i915_modparams.disable_display) {
Chris Wilson94b4f3b2016-07-05 10:40:20 +0100347 DRM_INFO("Display disabled (module parameter)\n");
348 info->num_pipes = 0;
349 } else if (info->num_pipes > 0 &&
350 (IS_GEN7(dev_priv) || IS_GEN8(dev_priv)) &&
351 HAS_PCH_SPLIT(dev_priv)) {
352 u32 fuse_strap = I915_READ(FUSE_STRAP);
353 u32 sfuse_strap = I915_READ(SFUSE_STRAP);
354
355 /*
356 * SFUSE_STRAP is supposed to have a bit signalling the display
357 * is fused off. Unfortunately it seems that, at least in
358 * certain cases, fused off display means that PCH display
359 * reads don't land anywhere. In that case, we read 0s.
360 *
361 * On CPT/PPT, we can detect this case as SFUSE_STRAP_FUSE_LOCK
362 * should be set when taking over after the firmware.
363 */
364 if (fuse_strap & ILK_INTERNAL_DISPLAY_DISABLE ||
365 sfuse_strap & SFUSE_STRAP_DISPLAY_DISABLED ||
Ville Syrjäläb9eb89b2017-06-20 16:03:06 +0300366 (HAS_PCH_CPT(dev_priv) &&
Chris Wilson94b4f3b2016-07-05 10:40:20 +0100367 !(sfuse_strap & SFUSE_STRAP_FUSE_LOCK))) {
368 DRM_INFO("Display fused off, disabling\n");
369 info->num_pipes = 0;
370 } else if (fuse_strap & IVB_PIPE_C_DISABLE) {
371 DRM_INFO("PipeC fused off\n");
372 info->num_pipes -= 1;
373 }
374 } else if (info->num_pipes > 0 && IS_GEN9(dev_priv)) {
375 u32 dfsm = I915_READ(SKL_DFSM);
376 u8 disabled_mask = 0;
377 bool invalid;
378 int num_bits;
379
380 if (dfsm & SKL_DFSM_PIPE_A_DISABLE)
381 disabled_mask |= BIT(PIPE_A);
382 if (dfsm & SKL_DFSM_PIPE_B_DISABLE)
383 disabled_mask |= BIT(PIPE_B);
384 if (dfsm & SKL_DFSM_PIPE_C_DISABLE)
385 disabled_mask |= BIT(PIPE_C);
386
387 num_bits = hweight8(disabled_mask);
388
389 switch (disabled_mask) {
390 case BIT(PIPE_A):
391 case BIT(PIPE_B):
392 case BIT(PIPE_A) | BIT(PIPE_B):
393 case BIT(PIPE_A) | BIT(PIPE_C):
394 invalid = true;
395 break;
396 default:
397 invalid = false;
398 }
399
400 if (num_bits > info->num_pipes || invalid)
401 DRM_ERROR("invalid pipe fuse configuration: 0x%x\n",
402 disabled_mask);
403 else
404 info->num_pipes -= num_bits;
405 }
406
407 /* Initialize slice/subslice/EU info */
408 if (IS_CHERRYVIEW(dev_priv))
409 cherryview_sseu_info_init(dev_priv);
410 else if (IS_BROADWELL(dev_priv))
411 broadwell_sseu_info_init(dev_priv);
412 else if (INTEL_INFO(dev_priv)->gen >= 9)
413 gen9_sseu_info_init(dev_priv);
414
Imre Deakc67ba532016-08-31 19:13:06 +0300415 DRM_DEBUG_DRIVER("slice mask: %04x\n", info->sseu.slice_mask);
Imre Deakf08a0c92016-08-31 19:13:04 +0300416 DRM_DEBUG_DRIVER("slice total: %u\n", hweight8(info->sseu.slice_mask));
Imre Deak57ec1712016-08-31 19:13:05 +0300417 DRM_DEBUG_DRIVER("subslice total: %u\n",
418 sseu_subslice_total(&info->sseu));
Imre Deakc67ba532016-08-31 19:13:06 +0300419 DRM_DEBUG_DRIVER("subslice mask %04x\n", info->sseu.subslice_mask);
Imre Deak43b67992016-08-31 19:13:02 +0300420 DRM_DEBUG_DRIVER("subslice per slice: %u\n",
Imre Deak57ec1712016-08-31 19:13:05 +0300421 hweight8(info->sseu.subslice_mask));
Imre Deak43b67992016-08-31 19:13:02 +0300422 DRM_DEBUG_DRIVER("EU total: %u\n", info->sseu.eu_total);
423 DRM_DEBUG_DRIVER("EU per subslice: %u\n", info->sseu.eu_per_subslice);
Chris Wilson94b4f3b2016-07-05 10:40:20 +0100424 DRM_DEBUG_DRIVER("has slice power gating: %s\n",
Imre Deak43b67992016-08-31 19:13:02 +0300425 info->sseu.has_slice_pg ? "y" : "n");
Chris Wilson94b4f3b2016-07-05 10:40:20 +0100426 DRM_DEBUG_DRIVER("has subslice power gating: %s\n",
Imre Deak43b67992016-08-31 19:13:02 +0300427 info->sseu.has_subslice_pg ? "y" : "n");
Chris Wilson94b4f3b2016-07-05 10:40:20 +0100428 DRM_DEBUG_DRIVER("has EU power gating: %s\n",
Imre Deak43b67992016-08-31 19:13:02 +0300429 info->sseu.has_eu_pg ? "y" : "n");
Chris Wilson94b4f3b2016-07-05 10:40:20 +0100430}