Chris Wilson | 94b4f3b | 2016-07-05 10:40:20 +0100 | [diff] [blame] | 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 | |
| 25 | #include "i915_drv.h" |
| 26 | |
Jani Nikula | 2e0d26f | 2016-12-01 14:49:55 +0200 | [diff] [blame] | 27 | #define PLATFORM_NAME(x) [INTEL_##x] = #x |
| 28 | static 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 Nikula | c0f8683 | 2016-12-07 12:13:04 +0200 | [diff] [blame] | 39 | PLATFORM_NAME(I965G), |
| 40 | PLATFORM_NAME(I965GM), |
Jani Nikula | f69c11a | 2016-11-30 17:43:05 +0200 | [diff] [blame] | 41 | PLATFORM_NAME(G45), |
| 42 | PLATFORM_NAME(GM45), |
Jani Nikula | 2e0d26f | 2016-12-01 14:49:55 +0200 | [diff] [blame] | 43 | 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 Vivi | 71851fa | 2017-06-08 08:49:58 -0700 | [diff] [blame] | 54 | PLATFORM_NAME(COFFEELAKE), |
Rodrigo Vivi | 413f3c1 | 2017-06-06 13:30:30 -0700 | [diff] [blame] | 55 | PLATFORM_NAME(CANNONLAKE), |
Jani Nikula | 2e0d26f | 2016-12-01 14:49:55 +0200 | [diff] [blame] | 56 | }; |
| 57 | #undef PLATFORM_NAME |
| 58 | |
| 59 | const char *intel_platform_name(enum intel_platform platform) |
| 60 | { |
Jani Nikula | 9160095 | 2017-02-28 13:11:43 +0200 | [diff] [blame] | 61 | BUILD_BUG_ON(ARRAY_SIZE(platform_names) != INTEL_MAX_PLATFORMS); |
| 62 | |
Jani Nikula | 2e0d26f | 2016-12-01 14:49:55 +0200 | [diff] [blame] | 63 | 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 Wilson | 94b4f3b | 2016-07-05 10:40:20 +0100 | [diff] [blame] | 70 | void intel_device_info_dump(struct drm_i915_private *dev_priv) |
| 71 | { |
| 72 | const struct intel_device_info *info = &dev_priv->info; |
| 73 | |
Jani Nikula | 2e0d26f | 2016-12-01 14:49:55 +0200 | [diff] [blame] | 74 | DRM_DEBUG_DRIVER("i915 device info: platform=%s gen=%i pciid=0x%04x rev=0x%02x", |
| 75 | intel_platform_name(info->platform), |
Chris Wilson | 94b4f3b | 2016-07-05 10:40:20 +0100 | [diff] [blame] | 76 | info->gen, |
| 77 | dev_priv->drm.pdev->device, |
Joonas Lahtinen | 604db65 | 2016-10-05 13:50:16 +0300 | [diff] [blame] | 78 | 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 Wilson | 94b4f3b | 2016-07-05 10:40:20 +0100 | [diff] [blame] | 82 | #undef PRINT_FLAG |
Chris Wilson | 94b4f3b | 2016-07-05 10:40:20 +0100 | [diff] [blame] | 83 | } |
| 84 | |
| 85 | static void cherryview_sseu_info_init(struct drm_i915_private *dev_priv) |
| 86 | { |
Imre Deak | 43b6799 | 2016-08-31 19:13:02 +0300 | [diff] [blame] | 87 | struct sseu_dev_info *sseu = &mkwrite_device_info(dev_priv)->sseu; |
Chris Wilson | 94b4f3b | 2016-07-05 10:40:20 +0100 | [diff] [blame] | 88 | u32 fuse, eu_dis; |
| 89 | |
| 90 | fuse = I915_READ(CHV_FUSE_GT); |
| 91 | |
Imre Deak | f08a0c9 | 2016-08-31 19:13:04 +0300 | [diff] [blame] | 92 | sseu->slice_mask = BIT(0); |
Chris Wilson | 94b4f3b | 2016-07-05 10:40:20 +0100 | [diff] [blame] | 93 | |
| 94 | if (!(fuse & CHV_FGT_DISABLE_SS0)) { |
Imre Deak | 57ec171 | 2016-08-31 19:13:05 +0300 | [diff] [blame] | 95 | sseu->subslice_mask |= BIT(0); |
Chris Wilson | 94b4f3b | 2016-07-05 10:40:20 +0100 | [diff] [blame] | 96 | eu_dis = fuse & (CHV_FGT_EU_DIS_SS0_R0_MASK | |
| 97 | CHV_FGT_EU_DIS_SS0_R1_MASK); |
Imre Deak | 43b6799 | 2016-08-31 19:13:02 +0300 | [diff] [blame] | 98 | sseu->eu_total += 8 - hweight32(eu_dis); |
Chris Wilson | 94b4f3b | 2016-07-05 10:40:20 +0100 | [diff] [blame] | 99 | } |
| 100 | |
| 101 | if (!(fuse & CHV_FGT_DISABLE_SS1)) { |
Imre Deak | 57ec171 | 2016-08-31 19:13:05 +0300 | [diff] [blame] | 102 | sseu->subslice_mask |= BIT(1); |
Chris Wilson | 94b4f3b | 2016-07-05 10:40:20 +0100 | [diff] [blame] | 103 | eu_dis = fuse & (CHV_FGT_EU_DIS_SS1_R0_MASK | |
| 104 | CHV_FGT_EU_DIS_SS1_R1_MASK); |
Imre Deak | 43b6799 | 2016-08-31 19:13:02 +0300 | [diff] [blame] | 105 | sseu->eu_total += 8 - hweight32(eu_dis); |
Chris Wilson | 94b4f3b | 2016-07-05 10:40:20 +0100 | [diff] [blame] | 106 | } |
| 107 | |
Chris Wilson | 94b4f3b | 2016-07-05 10:40:20 +0100 | [diff] [blame] | 108 | /* |
| 109 | * CHV expected to always have a uniform distribution of EU |
| 110 | * across subslices. |
| 111 | */ |
Imre Deak | 57ec171 | 2016-08-31 19:13:05 +0300 | [diff] [blame] | 112 | sseu->eu_per_subslice = sseu_subslice_total(sseu) ? |
| 113 | sseu->eu_total / sseu_subslice_total(sseu) : |
Chris Wilson | 94b4f3b | 2016-07-05 10:40:20 +0100 | [diff] [blame] | 114 | 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 Deak | 43b6799 | 2016-08-31 19:13:02 +0300 | [diff] [blame] | 120 | sseu->has_slice_pg = 0; |
Imre Deak | 57ec171 | 2016-08-31 19:13:05 +0300 | [diff] [blame] | 121 | sseu->has_subslice_pg = sseu_subslice_total(sseu) > 1; |
Imre Deak | 43b6799 | 2016-08-31 19:13:02 +0300 | [diff] [blame] | 122 | sseu->has_eu_pg = (sseu->eu_per_subslice > 2); |
Chris Wilson | 94b4f3b | 2016-07-05 10:40:20 +0100 | [diff] [blame] | 123 | } |
| 124 | |
| 125 | static void gen9_sseu_info_init(struct drm_i915_private *dev_priv) |
| 126 | { |
| 127 | struct intel_device_info *info = mkwrite_device_info(dev_priv); |
Imre Deak | 43b6799 | 2016-08-31 19:13:02 +0300 | [diff] [blame] | 128 | struct sseu_dev_info *sseu = &info->sseu; |
Chris Wilson | 94b4f3b | 2016-07-05 10:40:20 +0100 | [diff] [blame] | 129 | int s_max = 3, ss_max = 4, eu_max = 8; |
| 130 | int s, ss; |
Imre Deak | 57ec171 | 2016-08-31 19:13:05 +0300 | [diff] [blame] | 131 | u32 fuse2, eu_disable; |
Chris Wilson | 94b4f3b | 2016-07-05 10:40:20 +0100 | [diff] [blame] | 132 | u8 eu_mask = 0xff; |
| 133 | |
| 134 | fuse2 = I915_READ(GEN8_FUSE2); |
Imre Deak | f08a0c9 | 2016-08-31 19:13:04 +0300 | [diff] [blame] | 135 | sseu->slice_mask = (fuse2 & GEN8_F2_S_ENA_MASK) >> GEN8_F2_S_ENA_SHIFT; |
Chris Wilson | 94b4f3b | 2016-07-05 10:40:20 +0100 | [diff] [blame] | 136 | |
Chris Wilson | 94b4f3b | 2016-07-05 10:40:20 +0100 | [diff] [blame] | 137 | /* |
| 138 | * The subslice disable field is global, i.e. it applies |
| 139 | * to each of the enabled slices. |
| 140 | */ |
Imre Deak | 57ec171 | 2016-08-31 19:13:05 +0300 | [diff] [blame] | 141 | sseu->subslice_mask = (1 << ss_max) - 1; |
| 142 | sseu->subslice_mask &= ~((fuse2 & GEN9_F2_SS_DIS_MASK) >> |
| 143 | GEN9_F2_SS_DIS_SHIFT); |
Chris Wilson | 94b4f3b | 2016-07-05 10:40:20 +0100 | [diff] [blame] | 144 | |
| 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 Deak | f08a0c9 | 2016-08-31 19:13:04 +0300 | [diff] [blame] | 150 | if (!(sseu->slice_mask & BIT(s))) |
Chris Wilson | 94b4f3b | 2016-07-05 10:40:20 +0100 | [diff] [blame] | 151 | /* 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 Deak | 57ec171 | 2016-08-31 19:13:05 +0300 | [diff] [blame] | 158 | if (!(sseu->subslice_mask & BIT(ss))) |
Chris Wilson | 94b4f3b | 2016-07-05 10:40:20 +0100 | [diff] [blame] | 159 | /* 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 Deak | 43b6799 | 2016-08-31 19:13:02 +0300 | [diff] [blame] | 171 | sseu->subslice_7eu[s] |= BIT(ss); |
Chris Wilson | 94b4f3b | 2016-07-05 10:40:20 +0100 | [diff] [blame] | 172 | |
Imre Deak | 43b6799 | 2016-08-31 19:13:02 +0300 | [diff] [blame] | 173 | sseu->eu_total += eu_per_ss; |
Chris Wilson | 94b4f3b | 2016-07-05 10:40:20 +0100 | [diff] [blame] | 174 | } |
| 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 Deak | 57ec171 | 2016-08-31 19:13:05 +0300 | [diff] [blame] | 184 | sseu->eu_per_subslice = sseu_subslice_total(sseu) ? |
Imre Deak | 43b6799 | 2016-08-31 19:13:02 +0300 | [diff] [blame] | 185 | DIV_ROUND_UP(sseu->eu_total, |
Imre Deak | 57ec171 | 2016-08-31 19:13:05 +0300 | [diff] [blame] | 186 | sseu_subslice_total(sseu)) : 0; |
Chris Wilson | 94b4f3b | 2016-07-05 10:40:20 +0100 | [diff] [blame] | 187 | /* |
Rodrigo Vivi | c7ae7e9 | 2017-06-06 13:30:36 -0700 | [diff] [blame] | 188 | * SKL+ supports slice power gating on devices with more than |
Chris Wilson | 94b4f3b | 2016-07-05 10:40:20 +0100 | [diff] [blame] | 189 | * one slice, and supports EU power gating on devices with |
Rodrigo Vivi | c7ae7e9 | 2017-06-06 13:30:36 -0700 | [diff] [blame] | 190 | * more than one EU pair per subslice. BXT+ supports subslice |
Chris Wilson | 94b4f3b | 2016-07-05 10:40:20 +0100 | [diff] [blame] | 191 | * 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 Deak | 43b6799 | 2016-08-31 19:13:02 +0300 | [diff] [blame] | 195 | sseu->has_slice_pg = |
Rodrigo Vivi | c7ae7e9 | 2017-06-06 13:30:36 -0700 | [diff] [blame] | 196 | !IS_GEN9_LP(dev_priv) && hweight8(sseu->slice_mask) > 1; |
Imre Deak | 43b6799 | 2016-08-31 19:13:02 +0300 | [diff] [blame] | 197 | sseu->has_subslice_pg = |
Michel Thierry | 254e093 | 2017-01-09 16:51:35 +0200 | [diff] [blame] | 198 | IS_GEN9_LP(dev_priv) && sseu_subslice_total(sseu) > 1; |
Imre Deak | 43b6799 | 2016-08-31 19:13:02 +0300 | [diff] [blame] | 199 | sseu->has_eu_pg = sseu->eu_per_subslice > 2; |
Chris Wilson | 94b4f3b | 2016-07-05 10:40:20 +0100 | [diff] [blame] | 200 | |
Ander Conselvan de Oliveira | 234516a | 2017-03-17 16:04:36 +0200 | [diff] [blame] | 201 | if (IS_GEN9_LP(dev_priv)) { |
Imre Deak | 57ec171 | 2016-08-31 19:13:05 +0300 | [diff] [blame] | 202 | #define IS_SS_DISABLED(ss) (!(sseu->subslice_mask & BIT(ss))) |
Ander Conselvan de Oliveira | 234516a | 2017-03-17 16:04:36 +0200 | [diff] [blame] | 203 | info->has_pooled_eu = hweight8(sseu->subslice_mask) == 3; |
| 204 | |
Chris Wilson | 94b4f3b | 2016-07-05 10:40:20 +0100 | [diff] [blame] | 205 | /* |
| 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 Oliveira | 234516a | 2017-03-17 16:04:36 +0200 | [diff] [blame] | 212 | info->has_pooled_eu |= (hweight8(sseu->subslice_mask) == 2 && |
| 213 | IS_BXT_REVID(dev_priv, 0, BXT_REVID_B_LAST)); |
Chris Wilson | 94b4f3b | 2016-07-05 10:40:20 +0100 | [diff] [blame] | 214 | |
Imre Deak | 43b6799 | 2016-08-31 19:13:02 +0300 | [diff] [blame] | 215 | sseu->min_eu_in_pool = 0; |
Chris Wilson | 94b4f3b | 2016-07-05 10:40:20 +0100 | [diff] [blame] | 216 | if (info->has_pooled_eu) { |
Imre Deak | 57ec171 | 2016-08-31 19:13:05 +0300 | [diff] [blame] | 217 | if (IS_SS_DISABLED(2) || IS_SS_DISABLED(0)) |
Imre Deak | 43b6799 | 2016-08-31 19:13:02 +0300 | [diff] [blame] | 218 | sseu->min_eu_in_pool = 3; |
Imre Deak | 57ec171 | 2016-08-31 19:13:05 +0300 | [diff] [blame] | 219 | else if (IS_SS_DISABLED(1)) |
Imre Deak | 43b6799 | 2016-08-31 19:13:02 +0300 | [diff] [blame] | 220 | sseu->min_eu_in_pool = 6; |
Chris Wilson | 94b4f3b | 2016-07-05 10:40:20 +0100 | [diff] [blame] | 221 | else |
Imre Deak | 43b6799 | 2016-08-31 19:13:02 +0300 | [diff] [blame] | 222 | sseu->min_eu_in_pool = 9; |
Chris Wilson | 94b4f3b | 2016-07-05 10:40:20 +0100 | [diff] [blame] | 223 | } |
| 224 | #undef IS_SS_DISABLED |
| 225 | } |
| 226 | } |
| 227 | |
| 228 | static void broadwell_sseu_info_init(struct drm_i915_private *dev_priv) |
| 229 | { |
Imre Deak | 43b6799 | 2016-08-31 19:13:02 +0300 | [diff] [blame] | 230 | struct sseu_dev_info *sseu = &mkwrite_device_info(dev_priv)->sseu; |
Chris Wilson | 94b4f3b | 2016-07-05 10:40:20 +0100 | [diff] [blame] | 231 | const int s_max = 3, ss_max = 3, eu_max = 8; |
| 232 | int s, ss; |
Jani Nikula | ff64aa1 | 2016-10-04 12:54:12 +0300 | [diff] [blame] | 233 | u32 fuse2, eu_disable[3]; /* s_max */ |
Chris Wilson | 94b4f3b | 2016-07-05 10:40:20 +0100 | [diff] [blame] | 234 | |
| 235 | fuse2 = I915_READ(GEN8_FUSE2); |
Imre Deak | f08a0c9 | 2016-08-31 19:13:04 +0300 | [diff] [blame] | 236 | sseu->slice_mask = (fuse2 & GEN8_F2_S_ENA_MASK) >> GEN8_F2_S_ENA_SHIFT; |
Imre Deak | 57ec171 | 2016-08-31 19:13:05 +0300 | [diff] [blame] | 237 | /* |
| 238 | * The subslice disable field is global, i.e. it applies |
| 239 | * to each of the enabled slices. |
| 240 | */ |
Joonas Lahtinen | 3c779a4 | 2017-02-08 15:12:09 +0200 | [diff] [blame] | 241 | sseu->subslice_mask = GENMASK(ss_max - 1, 0); |
Imre Deak | 57ec171 | 2016-08-31 19:13:05 +0300 | [diff] [blame] | 242 | sseu->subslice_mask &= ~((fuse2 & GEN8_F2_SS_DIS_MASK) >> |
| 243 | GEN8_F2_SS_DIS_SHIFT); |
Chris Wilson | 94b4f3b | 2016-07-05 10:40:20 +0100 | [diff] [blame] | 244 | |
| 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 Wilson | 94b4f3b | 2016-07-05 10:40:20 +0100 | [diff] [blame] | 253 | /* |
Chris Wilson | 94b4f3b | 2016-07-05 10:40:20 +0100 | [diff] [blame] | 254 | * Iterate through enabled slices and subslices to |
| 255 | * count the total enabled EU. |
| 256 | */ |
| 257 | for (s = 0; s < s_max; s++) { |
Imre Deak | f08a0c9 | 2016-08-31 19:13:04 +0300 | [diff] [blame] | 258 | if (!(sseu->slice_mask & BIT(s))) |
Chris Wilson | 94b4f3b | 2016-07-05 10:40:20 +0100 | [diff] [blame] | 259 | /* skip disabled slice */ |
| 260 | continue; |
| 261 | |
| 262 | for (ss = 0; ss < ss_max; ss++) { |
| 263 | u32 n_disabled; |
| 264 | |
Imre Deak | 57ec171 | 2016-08-31 19:13:05 +0300 | [diff] [blame] | 265 | if (!(sseu->subslice_mask & BIT(ss))) |
Chris Wilson | 94b4f3b | 2016-07-05 10:40:20 +0100 | [diff] [blame] | 266 | /* 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 Deak | 43b6799 | 2016-08-31 19:13:02 +0300 | [diff] [blame] | 275 | sseu->subslice_7eu[s] |= 1 << ss; |
Chris Wilson | 94b4f3b | 2016-07-05 10:40:20 +0100 | [diff] [blame] | 276 | |
Imre Deak | 43b6799 | 2016-08-31 19:13:02 +0300 | [diff] [blame] | 277 | sseu->eu_total += eu_max - n_disabled; |
Chris Wilson | 94b4f3b | 2016-07-05 10:40:20 +0100 | [diff] [blame] | 278 | } |
| 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 Deak | 57ec171 | 2016-08-31 19:13:05 +0300 | [diff] [blame] | 286 | sseu->eu_per_subslice = sseu_subslice_total(sseu) ? |
| 287 | DIV_ROUND_UP(sseu->eu_total, |
| 288 | sseu_subslice_total(sseu)) : 0; |
Chris Wilson | 94b4f3b | 2016-07-05 10:40:20 +0100 | [diff] [blame] | 289 | |
| 290 | /* |
| 291 | * BDW supports slice power gating on devices with more than |
| 292 | * one slice. |
| 293 | */ |
Imre Deak | f08a0c9 | 2016-08-31 19:13:04 +0300 | [diff] [blame] | 294 | sseu->has_slice_pg = hweight8(sseu->slice_mask) > 1; |
Imre Deak | 43b6799 | 2016-08-31 19:13:02 +0300 | [diff] [blame] | 295 | sseu->has_subslice_pg = 0; |
| 296 | sseu->has_eu_pg = 0; |
Chris Wilson | 94b4f3b | 2016-07-05 10:40:20 +0100 | [diff] [blame] | 297 | } |
| 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 | */ |
| 312 | void 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 Oliveira | 0bf0230 | 2017-01-02 15:54:41 +0200 | [diff] [blame] | 317 | 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 Wilson | 94b4f3b | 2016-07-05 10:40:20 +0100 | [diff] [blame] | 323 | /* |
| 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 Irwin | 8366be9 | 2017-06-06 13:30:35 -0700 | [diff] [blame] | 331 | if (IS_GEN10(dev_priv) || IS_GEMINILAKE(dev_priv)) |
Ander Conselvan de Oliveira | e9c9882 | 2016-12-02 10:23:57 +0200 | [diff] [blame] | 332 | for_each_pipe(dev_priv, pipe) |
| 333 | info->num_sprites[pipe] = 3; |
| 334 | else if (IS_BROXTON(dev_priv)) { |
Chris Wilson | 94b4f3b | 2016-07-05 10:40:20 +0100 | [diff] [blame] | 335 | info->num_sprites[PIPE_A] = 2; |
| 336 | info->num_sprites[PIPE_B] = 2; |
| 337 | info->num_sprites[PIPE_C] = 1; |
Ville Syrjälä | 33edc24 | 2016-10-25 18:58:00 +0300 | [diff] [blame] | 338 | } else if (IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv)) { |
Chris Wilson | 94b4f3b | 2016-07-05 10:40:20 +0100 | [diff] [blame] | 339 | for_each_pipe(dev_priv, pipe) |
| 340 | info->num_sprites[pipe] = 2; |
Ville Syrjälä | ab33081 | 2017-04-21 21:14:32 +0300 | [diff] [blame] | 341 | } else if (INTEL_GEN(dev_priv) >= 5 || IS_G4X(dev_priv)) { |
Chris Wilson | 94b4f3b | 2016-07-05 10:40:20 +0100 | [diff] [blame] | 342 | for_each_pipe(dev_priv, pipe) |
| 343 | info->num_sprites[pipe] = 1; |
Ville Syrjälä | 33edc24 | 2016-10-25 18:58:00 +0300 | [diff] [blame] | 344 | } |
Chris Wilson | 94b4f3b | 2016-07-05 10:40:20 +0100 | [diff] [blame] | 345 | |
Michal Wajdeczko | 4f044a8 | 2017-09-19 19:38:44 +0000 | [diff] [blame^] | 346 | if (i915_modparams.disable_display) { |
Chris Wilson | 94b4f3b | 2016-07-05 10:40:20 +0100 | [diff] [blame] | 347 | 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ä | b9eb89b | 2017-06-20 16:03:06 +0300 | [diff] [blame] | 366 | (HAS_PCH_CPT(dev_priv) && |
Chris Wilson | 94b4f3b | 2016-07-05 10:40:20 +0100 | [diff] [blame] | 367 | !(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 Deak | c67ba53 | 2016-08-31 19:13:06 +0300 | [diff] [blame] | 415 | DRM_DEBUG_DRIVER("slice mask: %04x\n", info->sseu.slice_mask); |
Imre Deak | f08a0c9 | 2016-08-31 19:13:04 +0300 | [diff] [blame] | 416 | DRM_DEBUG_DRIVER("slice total: %u\n", hweight8(info->sseu.slice_mask)); |
Imre Deak | 57ec171 | 2016-08-31 19:13:05 +0300 | [diff] [blame] | 417 | DRM_DEBUG_DRIVER("subslice total: %u\n", |
| 418 | sseu_subslice_total(&info->sseu)); |
Imre Deak | c67ba53 | 2016-08-31 19:13:06 +0300 | [diff] [blame] | 419 | DRM_DEBUG_DRIVER("subslice mask %04x\n", info->sseu.subslice_mask); |
Imre Deak | 43b6799 | 2016-08-31 19:13:02 +0300 | [diff] [blame] | 420 | DRM_DEBUG_DRIVER("subslice per slice: %u\n", |
Imre Deak | 57ec171 | 2016-08-31 19:13:05 +0300 | [diff] [blame] | 421 | hweight8(info->sseu.subslice_mask)); |
Imre Deak | 43b6799 | 2016-08-31 19:13:02 +0300 | [diff] [blame] | 422 | 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 Wilson | 94b4f3b | 2016-07-05 10:40:20 +0100 | [diff] [blame] | 424 | DRM_DEBUG_DRIVER("has slice power gating: %s\n", |
Imre Deak | 43b6799 | 2016-08-31 19:13:02 +0300 | [diff] [blame] | 425 | info->sseu.has_slice_pg ? "y" : "n"); |
Chris Wilson | 94b4f3b | 2016-07-05 10:40:20 +0100 | [diff] [blame] | 426 | DRM_DEBUG_DRIVER("has subslice power gating: %s\n", |
Imre Deak | 43b6799 | 2016-08-31 19:13:02 +0300 | [diff] [blame] | 427 | info->sseu.has_subslice_pg ? "y" : "n"); |
Chris Wilson | 94b4f3b | 2016-07-05 10:40:20 +0100 | [diff] [blame] | 428 | DRM_DEBUG_DRIVER("has EU power gating: %s\n", |
Imre Deak | 43b6799 | 2016-08-31 19:13:02 +0300 | [diff] [blame] | 429 | info->sseu.has_eu_pg ? "y" : "n"); |
Chris Wilson | 94b4f3b | 2016-07-05 10:40:20 +0100 | [diff] [blame] | 430 | } |