intel_device_info.c 18 KB

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