intel_device_info.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564
  1. /*
  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. #include "i915_drv.h"
  25. #define PLATFORM_NAME(x) [INTEL_##x] = #x
  26. static const char * const platform_names[] = {
  27. PLATFORM_NAME(I830),
  28. PLATFORM_NAME(I845G),
  29. PLATFORM_NAME(I85X),
  30. PLATFORM_NAME(I865G),
  31. PLATFORM_NAME(I915G),
  32. PLATFORM_NAME(I915GM),
  33. PLATFORM_NAME(I945G),
  34. PLATFORM_NAME(I945GM),
  35. PLATFORM_NAME(G33),
  36. PLATFORM_NAME(PINEVIEW),
  37. PLATFORM_NAME(I965G),
  38. PLATFORM_NAME(I965GM),
  39. PLATFORM_NAME(G45),
  40. PLATFORM_NAME(GM45),
  41. PLATFORM_NAME(IRONLAKE),
  42. PLATFORM_NAME(SANDYBRIDGE),
  43. PLATFORM_NAME(IVYBRIDGE),
  44. PLATFORM_NAME(VALLEYVIEW),
  45. PLATFORM_NAME(HASWELL),
  46. PLATFORM_NAME(BROADWELL),
  47. PLATFORM_NAME(CHERRYVIEW),
  48. PLATFORM_NAME(SKYLAKE),
  49. PLATFORM_NAME(BROXTON),
  50. PLATFORM_NAME(KABYLAKE),
  51. PLATFORM_NAME(GEMINILAKE),
  52. PLATFORM_NAME(COFFEELAKE),
  53. PLATFORM_NAME(CANNONLAKE),
  54. };
  55. #undef PLATFORM_NAME
  56. const char *intel_platform_name(enum intel_platform platform)
  57. {
  58. BUILD_BUG_ON(ARRAY_SIZE(platform_names) != INTEL_MAX_PLATFORMS);
  59. if (WARN_ON_ONCE(platform >= ARRAY_SIZE(platform_names) ||
  60. platform_names[platform] == NULL))
  61. return "<unknown>";
  62. return platform_names[platform];
  63. }
  64. void intel_device_info_dump(struct drm_i915_private *dev_priv)
  65. {
  66. const struct intel_device_info *info = &dev_priv->info;
  67. DRM_DEBUG_DRIVER("i915 device info: platform=%s gen=%i pciid=0x%04x rev=0x%02x",
  68. intel_platform_name(info->platform),
  69. info->gen,
  70. dev_priv->drm.pdev->device,
  71. dev_priv->drm.pdev->revision);
  72. #define PRINT_FLAG(name) \
  73. DRM_DEBUG_DRIVER("i915 device info: " #name ": %s", yesno(info->name))
  74. DEV_INFO_FOR_EACH_FLAG(PRINT_FLAG);
  75. #undef PRINT_FLAG
  76. }
  77. static void gen10_sseu_info_init(struct drm_i915_private *dev_priv)
  78. {
  79. struct sseu_dev_info *sseu = &mkwrite_device_info(dev_priv)->sseu;
  80. const u32 fuse2 = I915_READ(GEN8_FUSE2);
  81. sseu->slice_mask = (fuse2 & GEN10_F2_S_ENA_MASK) >>
  82. GEN10_F2_S_ENA_SHIFT;
  83. sseu->subslice_mask = (1 << 4) - 1;
  84. sseu->subslice_mask &= ~((fuse2 & GEN10_F2_SS_DIS_MASK) >>
  85. GEN10_F2_SS_DIS_SHIFT);
  86. sseu->eu_total = hweight32(~I915_READ(GEN8_EU_DISABLE0));
  87. sseu->eu_total += hweight32(~I915_READ(GEN8_EU_DISABLE1));
  88. sseu->eu_total += hweight32(~I915_READ(GEN8_EU_DISABLE2));
  89. sseu->eu_total += hweight8(~(I915_READ(GEN10_EU_DISABLE3) &
  90. GEN10_EU_DIS_SS_MASK));
  91. /*
  92. * CNL is expected to always have a uniform distribution
  93. * of EU across subslices with the exception that any one
  94. * EU in any one subslice may be fused off for die
  95. * recovery.
  96. */
  97. sseu->eu_per_subslice = sseu_subslice_total(sseu) ?
  98. DIV_ROUND_UP(sseu->eu_total,
  99. sseu_subslice_total(sseu)) : 0;
  100. /* No restrictions on Power Gating */
  101. sseu->has_slice_pg = 1;
  102. sseu->has_subslice_pg = 1;
  103. sseu->has_eu_pg = 1;
  104. }
  105. static void cherryview_sseu_info_init(struct drm_i915_private *dev_priv)
  106. {
  107. struct sseu_dev_info *sseu = &mkwrite_device_info(dev_priv)->sseu;
  108. u32 fuse, eu_dis;
  109. fuse = I915_READ(CHV_FUSE_GT);
  110. sseu->slice_mask = BIT(0);
  111. if (!(fuse & CHV_FGT_DISABLE_SS0)) {
  112. sseu->subslice_mask |= BIT(0);
  113. eu_dis = fuse & (CHV_FGT_EU_DIS_SS0_R0_MASK |
  114. CHV_FGT_EU_DIS_SS0_R1_MASK);
  115. sseu->eu_total += 8 - hweight32(eu_dis);
  116. }
  117. if (!(fuse & CHV_FGT_DISABLE_SS1)) {
  118. sseu->subslice_mask |= BIT(1);
  119. eu_dis = fuse & (CHV_FGT_EU_DIS_SS1_R0_MASK |
  120. CHV_FGT_EU_DIS_SS1_R1_MASK);
  121. sseu->eu_total += 8 - hweight32(eu_dis);
  122. }
  123. /*
  124. * CHV expected to always have a uniform distribution of EU
  125. * across subslices.
  126. */
  127. sseu->eu_per_subslice = sseu_subslice_total(sseu) ?
  128. sseu->eu_total / sseu_subslice_total(sseu) :
  129. 0;
  130. /*
  131. * CHV supports subslice power gating on devices with more than
  132. * one subslice, and supports EU power gating on devices with
  133. * more than one EU pair per subslice.
  134. */
  135. sseu->has_slice_pg = 0;
  136. sseu->has_subslice_pg = sseu_subslice_total(sseu) > 1;
  137. sseu->has_eu_pg = (sseu->eu_per_subslice > 2);
  138. }
  139. static void gen9_sseu_info_init(struct drm_i915_private *dev_priv)
  140. {
  141. struct intel_device_info *info = mkwrite_device_info(dev_priv);
  142. struct sseu_dev_info *sseu = &info->sseu;
  143. int s_max = 3, ss_max = 4, eu_max = 8;
  144. int s, ss;
  145. u32 fuse2, eu_disable;
  146. u8 eu_mask = 0xff;
  147. fuse2 = I915_READ(GEN8_FUSE2);
  148. sseu->slice_mask = (fuse2 & GEN8_F2_S_ENA_MASK) >> GEN8_F2_S_ENA_SHIFT;
  149. /*
  150. * The subslice disable field is global, i.e. it applies
  151. * to each of the enabled slices.
  152. */
  153. sseu->subslice_mask = (1 << ss_max) - 1;
  154. sseu->subslice_mask &= ~((fuse2 & GEN9_F2_SS_DIS_MASK) >>
  155. GEN9_F2_SS_DIS_SHIFT);
  156. /*
  157. * Iterate through enabled slices and subslices to
  158. * count the total enabled EU.
  159. */
  160. for (s = 0; s < s_max; s++) {
  161. if (!(sseu->slice_mask & BIT(s)))
  162. /* skip disabled slice */
  163. continue;
  164. eu_disable = I915_READ(GEN9_EU_DISABLE(s));
  165. for (ss = 0; ss < ss_max; ss++) {
  166. int eu_per_ss;
  167. if (!(sseu->subslice_mask & BIT(ss)))
  168. /* skip disabled subslice */
  169. continue;
  170. eu_per_ss = eu_max - hweight8((eu_disable >> (ss*8)) &
  171. eu_mask);
  172. /*
  173. * Record which subslice(s) has(have) 7 EUs. we
  174. * can tune the hash used to spread work among
  175. * subslices if they are unbalanced.
  176. */
  177. if (eu_per_ss == 7)
  178. sseu->subslice_7eu[s] |= BIT(ss);
  179. sseu->eu_total += eu_per_ss;
  180. }
  181. }
  182. /*
  183. * SKL is expected to always have a uniform distribution
  184. * of EU across subslices with the exception that any one
  185. * EU in any one subslice may be fused off for die
  186. * recovery. BXT is expected to be perfectly uniform in EU
  187. * distribution.
  188. */
  189. sseu->eu_per_subslice = sseu_subslice_total(sseu) ?
  190. DIV_ROUND_UP(sseu->eu_total,
  191. sseu_subslice_total(sseu)) : 0;
  192. /*
  193. * SKL+ supports slice power gating on devices with more than
  194. * one slice, and supports EU power gating on devices with
  195. * more than one EU pair per subslice. BXT+ supports subslice
  196. * power gating on devices with more than one subslice, and
  197. * supports EU power gating on devices with more than one EU
  198. * pair per subslice.
  199. */
  200. sseu->has_slice_pg =
  201. !IS_GEN9_LP(dev_priv) && hweight8(sseu->slice_mask) > 1;
  202. sseu->has_subslice_pg =
  203. IS_GEN9_LP(dev_priv) && sseu_subslice_total(sseu) > 1;
  204. sseu->has_eu_pg = sseu->eu_per_subslice > 2;
  205. if (IS_GEN9_LP(dev_priv)) {
  206. #define IS_SS_DISABLED(ss) (!(sseu->subslice_mask & BIT(ss)))
  207. info->has_pooled_eu = hweight8(sseu->subslice_mask) == 3;
  208. sseu->min_eu_in_pool = 0;
  209. if (info->has_pooled_eu) {
  210. if (IS_SS_DISABLED(2) || IS_SS_DISABLED(0))
  211. sseu->min_eu_in_pool = 3;
  212. else if (IS_SS_DISABLED(1))
  213. sseu->min_eu_in_pool = 6;
  214. else
  215. sseu->min_eu_in_pool = 9;
  216. }
  217. #undef IS_SS_DISABLED
  218. }
  219. }
  220. static void broadwell_sseu_info_init(struct drm_i915_private *dev_priv)
  221. {
  222. struct sseu_dev_info *sseu = &mkwrite_device_info(dev_priv)->sseu;
  223. const int s_max = 3, ss_max = 3, eu_max = 8;
  224. int s, ss;
  225. u32 fuse2, eu_disable[3]; /* s_max */
  226. fuse2 = I915_READ(GEN8_FUSE2);
  227. sseu->slice_mask = (fuse2 & GEN8_F2_S_ENA_MASK) >> GEN8_F2_S_ENA_SHIFT;
  228. /*
  229. * The subslice disable field is global, i.e. it applies
  230. * to each of the enabled slices.
  231. */
  232. sseu->subslice_mask = GENMASK(ss_max - 1, 0);
  233. sseu->subslice_mask &= ~((fuse2 & GEN8_F2_SS_DIS_MASK) >>
  234. GEN8_F2_SS_DIS_SHIFT);
  235. eu_disable[0] = I915_READ(GEN8_EU_DISABLE0) & GEN8_EU_DIS0_S0_MASK;
  236. eu_disable[1] = (I915_READ(GEN8_EU_DISABLE0) >> GEN8_EU_DIS0_S1_SHIFT) |
  237. ((I915_READ(GEN8_EU_DISABLE1) & GEN8_EU_DIS1_S1_MASK) <<
  238. (32 - GEN8_EU_DIS0_S1_SHIFT));
  239. eu_disable[2] = (I915_READ(GEN8_EU_DISABLE1) >> GEN8_EU_DIS1_S2_SHIFT) |
  240. ((I915_READ(GEN8_EU_DISABLE2) & GEN8_EU_DIS2_S2_MASK) <<
  241. (32 - GEN8_EU_DIS1_S2_SHIFT));
  242. /*
  243. * Iterate through enabled slices and subslices to
  244. * count the total enabled EU.
  245. */
  246. for (s = 0; s < s_max; s++) {
  247. if (!(sseu->slice_mask & BIT(s)))
  248. /* skip disabled slice */
  249. continue;
  250. for (ss = 0; ss < ss_max; ss++) {
  251. u32 n_disabled;
  252. if (!(sseu->subslice_mask & BIT(ss)))
  253. /* skip disabled subslice */
  254. continue;
  255. n_disabled = hweight8(eu_disable[s] >> (ss * eu_max));
  256. /*
  257. * Record which subslices have 7 EUs.
  258. */
  259. if (eu_max - n_disabled == 7)
  260. sseu->subslice_7eu[s] |= 1 << ss;
  261. sseu->eu_total += eu_max - n_disabled;
  262. }
  263. }
  264. /*
  265. * BDW is expected to always have a uniform distribution of EU across
  266. * subslices with the exception that any one EU in any one subslice may
  267. * be fused off for die recovery.
  268. */
  269. sseu->eu_per_subslice = sseu_subslice_total(sseu) ?
  270. DIV_ROUND_UP(sseu->eu_total,
  271. sseu_subslice_total(sseu)) : 0;
  272. /*
  273. * BDW supports slice power gating on devices with more than
  274. * one slice.
  275. */
  276. sseu->has_slice_pg = hweight8(sseu->slice_mask) > 1;
  277. sseu->has_subslice_pg = 0;
  278. sseu->has_eu_pg = 0;
  279. }
  280. static u32 read_reference_ts_freq(struct drm_i915_private *dev_priv)
  281. {
  282. u32 ts_override = I915_READ(GEN9_TIMESTAMP_OVERRIDE);
  283. u32 base_freq, frac_freq;
  284. base_freq = ((ts_override & GEN9_TIMESTAMP_OVERRIDE_US_COUNTER_DIVIDER_MASK) >>
  285. GEN9_TIMESTAMP_OVERRIDE_US_COUNTER_DIVIDER_SHIFT) + 1;
  286. base_freq *= 1000;
  287. frac_freq = ((ts_override &
  288. GEN9_TIMESTAMP_OVERRIDE_US_COUNTER_DENOMINATOR_MASK) >>
  289. GEN9_TIMESTAMP_OVERRIDE_US_COUNTER_DENOMINATOR_SHIFT);
  290. frac_freq = 1000 / (frac_freq + 1);
  291. return base_freq + frac_freq;
  292. }
  293. static u32 read_timestamp_frequency(struct drm_i915_private *dev_priv)
  294. {
  295. u32 f12_5_mhz = 12500;
  296. u32 f19_2_mhz = 19200;
  297. u32 f24_mhz = 24000;
  298. if (INTEL_GEN(dev_priv) <= 4) {
  299. /* PRMs say:
  300. *
  301. * "The value in this register increments once every 16
  302. * hclks." (through the “Clocking Configuration”
  303. * (“CLKCFG”) MCHBAR register)
  304. */
  305. return dev_priv->rawclk_freq / 16;
  306. } else if (INTEL_GEN(dev_priv) <= 8) {
  307. /* PRMs say:
  308. *
  309. * "The PCU TSC counts 10ns increments; this timestamp
  310. * reflects bits 38:3 of the TSC (i.e. 80ns granularity,
  311. * rolling over every 1.5 hours).
  312. */
  313. return f12_5_mhz;
  314. } else if (INTEL_GEN(dev_priv) <= 9) {
  315. u32 ctc_reg = I915_READ(CTC_MODE);
  316. u32 freq = 0;
  317. if ((ctc_reg & CTC_SOURCE_PARAMETER_MASK) == CTC_SOURCE_DIVIDE_LOGIC) {
  318. freq = read_reference_ts_freq(dev_priv);
  319. } else {
  320. freq = IS_GEN9_LP(dev_priv) ? f19_2_mhz : f24_mhz;
  321. /* Now figure out how the command stream's timestamp
  322. * register increments from this frequency (it might
  323. * increment only every few clock cycle).
  324. */
  325. freq >>= 3 - ((ctc_reg & CTC_SHIFT_PARAMETER_MASK) >>
  326. CTC_SHIFT_PARAMETER_SHIFT);
  327. }
  328. return freq;
  329. } else if (INTEL_GEN(dev_priv) <= 10) {
  330. u32 ctc_reg = I915_READ(CTC_MODE);
  331. u32 freq = 0;
  332. u32 rpm_config_reg = 0;
  333. /* First figure out the reference frequency. There are 2 ways
  334. * we can compute the frequency, either through the
  335. * TIMESTAMP_OVERRIDE register or through RPM_CONFIG. CTC_MODE
  336. * tells us which one we should use.
  337. */
  338. if ((ctc_reg & CTC_SOURCE_PARAMETER_MASK) == CTC_SOURCE_DIVIDE_LOGIC) {
  339. freq = read_reference_ts_freq(dev_priv);
  340. } else {
  341. u32 crystal_clock;
  342. rpm_config_reg = I915_READ(RPM_CONFIG0);
  343. crystal_clock = (rpm_config_reg &
  344. GEN9_RPM_CONFIG0_CRYSTAL_CLOCK_FREQ_MASK) >>
  345. GEN9_RPM_CONFIG0_CRYSTAL_CLOCK_FREQ_SHIFT;
  346. switch (crystal_clock) {
  347. case GEN9_RPM_CONFIG0_CRYSTAL_CLOCK_FREQ_19_2_MHZ:
  348. freq = f19_2_mhz;
  349. break;
  350. case GEN9_RPM_CONFIG0_CRYSTAL_CLOCK_FREQ_24_MHZ:
  351. freq = f24_mhz;
  352. break;
  353. }
  354. }
  355. /* Now figure out how the command stream's timestamp register
  356. * increments from this frequency (it might increment only
  357. * every few clock cycle).
  358. */
  359. freq >>= 3 - ((rpm_config_reg &
  360. GEN10_RPM_CONFIG0_CTC_SHIFT_PARAMETER_MASK) >>
  361. GEN10_RPM_CONFIG0_CTC_SHIFT_PARAMETER_SHIFT);
  362. return freq;
  363. }
  364. DRM_ERROR("Unknown gen, unable to compute command stream timestamp frequency\n");
  365. return 0;
  366. }
  367. /*
  368. * Determine various intel_device_info fields at runtime.
  369. *
  370. * Use it when either:
  371. * - it's judged too laborious to fill n static structures with the limit
  372. * when a simple if statement does the job,
  373. * - run-time checks (eg read fuse/strap registers) are needed.
  374. *
  375. * This function needs to be called:
  376. * - after the MMIO has been setup as we are reading registers,
  377. * - after the PCH has been detected,
  378. * - before the first usage of the fields it can tweak.
  379. */
  380. void intel_device_info_runtime_init(struct drm_i915_private *dev_priv)
  381. {
  382. struct intel_device_info *info = mkwrite_device_info(dev_priv);
  383. enum pipe pipe;
  384. if (INTEL_GEN(dev_priv) >= 10) {
  385. for_each_pipe(dev_priv, pipe)
  386. info->num_scalers[pipe] = 2;
  387. } else if (INTEL_GEN(dev_priv) == 9) {
  388. info->num_scalers[PIPE_A] = 2;
  389. info->num_scalers[PIPE_B] = 2;
  390. info->num_scalers[PIPE_C] = 1;
  391. }
  392. /*
  393. * Skylake and Broxton currently don't expose the topmost plane as its
  394. * use is exclusive with the legacy cursor and we only want to expose
  395. * one of those, not both. Until we can safely expose the topmost plane
  396. * as a DRM_PLANE_TYPE_CURSOR with all the features exposed/supported,
  397. * we don't expose the topmost plane at all to prevent ABI breakage
  398. * down the line.
  399. */
  400. if (IS_GEN10(dev_priv) || IS_GEMINILAKE(dev_priv))
  401. for_each_pipe(dev_priv, pipe)
  402. info->num_sprites[pipe] = 3;
  403. else if (IS_BROXTON(dev_priv)) {
  404. info->num_sprites[PIPE_A] = 2;
  405. info->num_sprites[PIPE_B] = 2;
  406. info->num_sprites[PIPE_C] = 1;
  407. } else if (IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv)) {
  408. for_each_pipe(dev_priv, pipe)
  409. info->num_sprites[pipe] = 2;
  410. } else if (INTEL_GEN(dev_priv) >= 5 || IS_G4X(dev_priv)) {
  411. for_each_pipe(dev_priv, pipe)
  412. info->num_sprites[pipe] = 1;
  413. }
  414. if (i915_modparams.disable_display) {
  415. DRM_INFO("Display disabled (module parameter)\n");
  416. info->num_pipes = 0;
  417. } else if (info->num_pipes > 0 &&
  418. (IS_GEN7(dev_priv) || IS_GEN8(dev_priv)) &&
  419. HAS_PCH_SPLIT(dev_priv)) {
  420. u32 fuse_strap = I915_READ(FUSE_STRAP);
  421. u32 sfuse_strap = I915_READ(SFUSE_STRAP);
  422. /*
  423. * SFUSE_STRAP is supposed to have a bit signalling the display
  424. * is fused off. Unfortunately it seems that, at least in
  425. * certain cases, fused off display means that PCH display
  426. * reads don't land anywhere. In that case, we read 0s.
  427. *
  428. * On CPT/PPT, we can detect this case as SFUSE_STRAP_FUSE_LOCK
  429. * should be set when taking over after the firmware.
  430. */
  431. if (fuse_strap & ILK_INTERNAL_DISPLAY_DISABLE ||
  432. sfuse_strap & SFUSE_STRAP_DISPLAY_DISABLED ||
  433. (HAS_PCH_CPT(dev_priv) &&
  434. !(sfuse_strap & SFUSE_STRAP_FUSE_LOCK))) {
  435. DRM_INFO("Display fused off, disabling\n");
  436. info->num_pipes = 0;
  437. } else if (fuse_strap & IVB_PIPE_C_DISABLE) {
  438. DRM_INFO("PipeC fused off\n");
  439. info->num_pipes -= 1;
  440. }
  441. } else if (info->num_pipes > 0 && IS_GEN9(dev_priv)) {
  442. u32 dfsm = I915_READ(SKL_DFSM);
  443. u8 disabled_mask = 0;
  444. bool invalid;
  445. int num_bits;
  446. if (dfsm & SKL_DFSM_PIPE_A_DISABLE)
  447. disabled_mask |= BIT(PIPE_A);
  448. if (dfsm & SKL_DFSM_PIPE_B_DISABLE)
  449. disabled_mask |= BIT(PIPE_B);
  450. if (dfsm & SKL_DFSM_PIPE_C_DISABLE)
  451. disabled_mask |= BIT(PIPE_C);
  452. num_bits = hweight8(disabled_mask);
  453. switch (disabled_mask) {
  454. case BIT(PIPE_A):
  455. case BIT(PIPE_B):
  456. case BIT(PIPE_A) | BIT(PIPE_B):
  457. case BIT(PIPE_A) | BIT(PIPE_C):
  458. invalid = true;
  459. break;
  460. default:
  461. invalid = false;
  462. }
  463. if (num_bits > info->num_pipes || invalid)
  464. DRM_ERROR("invalid pipe fuse configuration: 0x%x\n",
  465. disabled_mask);
  466. else
  467. info->num_pipes -= num_bits;
  468. }
  469. /* Initialize slice/subslice/EU info */
  470. if (IS_CHERRYVIEW(dev_priv))
  471. cherryview_sseu_info_init(dev_priv);
  472. else if (IS_BROADWELL(dev_priv))
  473. broadwell_sseu_info_init(dev_priv);
  474. else if (INTEL_GEN(dev_priv) == 9)
  475. gen9_sseu_info_init(dev_priv);
  476. else if (INTEL_GEN(dev_priv) >= 10)
  477. gen10_sseu_info_init(dev_priv);
  478. /* Initialize command stream timestamp frequency */
  479. info->cs_timestamp_frequency_khz = read_timestamp_frequency(dev_priv);
  480. DRM_DEBUG_DRIVER("slice mask: %04x\n", info->sseu.slice_mask);
  481. DRM_DEBUG_DRIVER("slice total: %u\n", hweight8(info->sseu.slice_mask));
  482. DRM_DEBUG_DRIVER("subslice total: %u\n",
  483. sseu_subslice_total(&info->sseu));
  484. DRM_DEBUG_DRIVER("subslice mask %04x\n", info->sseu.subslice_mask);
  485. DRM_DEBUG_DRIVER("subslice per slice: %u\n",
  486. hweight8(info->sseu.subslice_mask));
  487. DRM_DEBUG_DRIVER("EU total: %u\n", info->sseu.eu_total);
  488. DRM_DEBUG_DRIVER("EU per subslice: %u\n", info->sseu.eu_per_subslice);
  489. DRM_DEBUG_DRIVER("has slice power gating: %s\n",
  490. info->sseu.has_slice_pg ? "y" : "n");
  491. DRM_DEBUG_DRIVER("has subslice power gating: %s\n",
  492. info->sseu.has_subslice_pg ? "y" : "n");
  493. DRM_DEBUG_DRIVER("has EU power gating: %s\n",
  494. info->sseu.has_eu_pg ? "y" : "n");
  495. DRM_DEBUG_DRIVER("CS timestamp frequency: %u kHz\n",
  496. info->cs_timestamp_frequency_khz);
  497. }