Merge tag 'drm-intel-fixes-2024-11-14' of https://gitlab.freedesktop.org/drm/i915/kernel into drm-fixes

- Don't load GSC on ARL-H and ARL-U if too old FW
- Avoid potential OOPS in enabling/disabling TV output

Signed-off-by: Dave Airlie <airlied@redhat.com>
From: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/ZzWksU6CMGLPfjkT@jlahtine-mobl.ger.corp.intel.com

+77 -32
+2 -2
drivers/gpu/drm/i915/display/intel_tv.c
··· 928 const struct intel_crtc_state *pipe_config, 929 const struct drm_connector_state *conn_state) 930 { 931 - struct intel_display *display = to_intel_display(state); 932 933 /* Prevents vblank waits from timing out in intel_tv_detect_type() */ 934 intel_crtc_wait_for_next_vblank(to_intel_crtc(pipe_config->uapi.crtc)); ··· 942 const struct intel_crtc_state *old_crtc_state, 943 const struct drm_connector_state *old_conn_state) 944 { 945 - struct intel_display *display = to_intel_display(state); 946 947 intel_de_rmw(display, TV_CTL, TV_ENC_ENABLE, 0); 948 }
··· 928 const struct intel_crtc_state *pipe_config, 929 const struct drm_connector_state *conn_state) 930 { 931 + struct intel_display *display = to_intel_display(encoder); 932 933 /* Prevents vblank waits from timing out in intel_tv_detect_type() */ 934 intel_crtc_wait_for_next_vblank(to_intel_crtc(pipe_config->uapi.crtc)); ··· 942 const struct intel_crtc_state *old_crtc_state, 943 const struct drm_connector_state *old_conn_state) 944 { 945 + struct intel_display *display = to_intel_display(encoder); 946 947 intel_de_rmw(display, TV_CTL, TV_ENC_ENABLE, 0); 948 }
+32 -18
drivers/gpu/drm/i915/gt/uc/intel_gsc_fw.c
··· 80 const struct intel_gsc_cpd_header_v2 *cpd_header = NULL; 81 const struct intel_gsc_cpd_entry *cpd_entry = NULL; 82 const struct intel_gsc_manifest_header *manifest; 83 size_t min_size = sizeof(*layout); 84 int i; 85 ··· 213 } 214 } 215 216 - if (IS_ARROWLAKE(gt->i915)) { 217 bool too_old = false; 218 219 - /* 220 - * ARL requires a newer firmware than MTL did (102.0.10.1878) but the 221 - * firmware is actually common. So, need to do an explicit version check 222 - * here rather than using a separate table entry. And if the older 223 - * MTL-only version is found, then just don't use GSC rather than aborting 224 - * the driver load. 225 - */ 226 - if (gsc->release.major < 102) { 227 too_old = true; 228 - } else if (gsc->release.major == 102) { 229 - if (gsc->release.minor == 0) { 230 - if (gsc->release.patch < 10) { 231 too_old = true; 232 - } else if (gsc->release.patch == 10) { 233 - if (gsc->release.build < 1878) 234 - too_old = true; 235 - } 236 } 237 } 238 239 if (too_old) { 240 - gt_info(gt, "GSC firmware too old for ARL, got %d.%d.%d.%d but need at least 102.0.10.1878", 241 gsc->release.major, gsc->release.minor, 242 - gsc->release.patch, gsc->release.build); 243 return -EINVAL; 244 } 245 }
··· 80 const struct intel_gsc_cpd_header_v2 *cpd_header = NULL; 81 const struct intel_gsc_cpd_entry *cpd_entry = NULL; 82 const struct intel_gsc_manifest_header *manifest; 83 + struct intel_uc_fw_ver min_ver = { 0 }; 84 size_t min_size = sizeof(*layout); 85 int i; 86 ··· 212 } 213 } 214 215 + /* 216 + * ARL SKUs require newer firmwares, but the blob is actually common 217 + * across all MTL and ARL SKUs, so we need to do an explicit version check 218 + * here rather than using a separate table entry. If a too old version 219 + * is found, then just don't use GSC rather than aborting the driver load. 220 + * Note that the major number in the GSC FW version is used to indicate 221 + * the platform, so we expect it to always be 102 for MTL/ARL binaries. 222 + */ 223 + if (IS_ARROWLAKE_S(gt->i915)) 224 + min_ver = (struct intel_uc_fw_ver){ 102, 0, 10, 1878 }; 225 + else if (IS_ARROWLAKE_H(gt->i915) || IS_ARROWLAKE_U(gt->i915)) 226 + min_ver = (struct intel_uc_fw_ver){ 102, 1, 15, 1926 }; 227 + 228 + if (IS_METEORLAKE(gt->i915) && gsc->release.major != 102) { 229 + gt_info(gt, "Invalid GSC firmware for MTL/ARL, got %d.%d.%d.%d but need 102.x.x.x", 230 + gsc->release.major, gsc->release.minor, 231 + gsc->release.patch, gsc->release.build); 232 + return -EINVAL; 233 + } 234 + 235 + if (min_ver.major) { 236 bool too_old = false; 237 238 + if (gsc->release.minor < min_ver.minor) { 239 too_old = true; 240 + } else if (gsc->release.minor == min_ver.minor) { 241 + if (gsc->release.patch < min_ver.patch) { 242 + too_old = true; 243 + } else if (gsc->release.patch == min_ver.patch) { 244 + if (gsc->release.build < min_ver.build) 245 too_old = true; 246 } 247 } 248 249 if (too_old) { 250 + gt_info(gt, "GSC firmware too old for ARL, got %d.%d.%d.%d but need at least %d.%d.%d.%d", 251 gsc->release.major, gsc->release.minor, 252 + gsc->release.patch, gsc->release.build, 253 + min_ver.major, min_ver.minor, 254 + min_ver.patch, min_ver.build); 255 return -EINVAL; 256 } 257 }
+6 -2
drivers/gpu/drm/i915/i915_drv.h
··· 540 #define IS_LUNARLAKE(i915) (0 && i915) 541 #define IS_BATTLEMAGE(i915) (0 && i915) 542 543 - #define IS_ARROWLAKE(i915) \ 544 - IS_SUBPLATFORM(i915, INTEL_METEORLAKE, INTEL_SUBPLATFORM_ARL) 545 #define IS_DG2_G10(i915) \ 546 IS_SUBPLATFORM(i915, INTEL_DG2, INTEL_SUBPLATFORM_G10) 547 #define IS_DG2_G11(i915) \
··· 540 #define IS_LUNARLAKE(i915) (0 && i915) 541 #define IS_BATTLEMAGE(i915) (0 && i915) 542 543 + #define IS_ARROWLAKE_H(i915) \ 544 + IS_SUBPLATFORM(i915, INTEL_METEORLAKE, INTEL_SUBPLATFORM_ARL_H) 545 + #define IS_ARROWLAKE_U(i915) \ 546 + IS_SUBPLATFORM(i915, INTEL_METEORLAKE, INTEL_SUBPLATFORM_ARL_U) 547 + #define IS_ARROWLAKE_S(i915) \ 548 + IS_SUBPLATFORM(i915, INTEL_METEORLAKE, INTEL_SUBPLATFORM_ARL_S) 549 #define IS_DG2_G10(i915) \ 550 IS_SUBPLATFORM(i915, INTEL_DG2, INTEL_SUBPLATFORM_G10) 551 #define IS_DG2_G11(i915) \
+19 -5
drivers/gpu/drm/i915/intel_device_info.c
··· 200 INTEL_DG2_G12_IDS(ID), 201 }; 202 203 - static const u16 subplatform_arl_ids[] = { 204 - INTEL_ARL_IDS(ID), 205 }; 206 207 static bool find_devid(u16 id, const u16 *p, unsigned int num) ··· 269 } else if (find_devid(devid, subplatform_g12_ids, 270 ARRAY_SIZE(subplatform_g12_ids))) { 271 mask = BIT(INTEL_SUBPLATFORM_G12); 272 - } else if (find_devid(devid, subplatform_arl_ids, 273 - ARRAY_SIZE(subplatform_arl_ids))) { 274 - mask = BIT(INTEL_SUBPLATFORM_ARL); 275 } 276 277 GEM_BUG_ON(mask & ~INTEL_SUBPLATFORM_MASK);
··· 200 INTEL_DG2_G12_IDS(ID), 201 }; 202 203 + static const u16 subplatform_arl_h_ids[] = { 204 + INTEL_ARL_H_IDS(ID), 205 + }; 206 + 207 + static const u16 subplatform_arl_u_ids[] = { 208 + INTEL_ARL_U_IDS(ID), 209 + }; 210 + 211 + static const u16 subplatform_arl_s_ids[] = { 212 + INTEL_ARL_S_IDS(ID), 213 }; 214 215 static bool find_devid(u16 id, const u16 *p, unsigned int num) ··· 261 } else if (find_devid(devid, subplatform_g12_ids, 262 ARRAY_SIZE(subplatform_g12_ids))) { 263 mask = BIT(INTEL_SUBPLATFORM_G12); 264 + } else if (find_devid(devid, subplatform_arl_h_ids, 265 + ARRAY_SIZE(subplatform_arl_h_ids))) { 266 + mask = BIT(INTEL_SUBPLATFORM_ARL_H); 267 + } else if (find_devid(devid, subplatform_arl_u_ids, 268 + ARRAY_SIZE(subplatform_arl_u_ids))) { 269 + mask = BIT(INTEL_SUBPLATFORM_ARL_U); 270 + } else if (find_devid(devid, subplatform_arl_s_ids, 271 + ARRAY_SIZE(subplatform_arl_s_ids))) { 272 + mask = BIT(INTEL_SUBPLATFORM_ARL_S); 273 } 274 275 GEM_BUG_ON(mask & ~INTEL_SUBPLATFORM_MASK);
+3 -1
drivers/gpu/drm/i915/intel_device_info.h
··· 128 #define INTEL_SUBPLATFORM_RPLU 2 129 130 /* MTL */ 131 - #define INTEL_SUBPLATFORM_ARL 0 132 133 enum intel_ppgtt_type { 134 INTEL_PPGTT_NONE = I915_GEM_PPGTT_NONE,
··· 128 #define INTEL_SUBPLATFORM_RPLU 2 129 130 /* MTL */ 131 + #define INTEL_SUBPLATFORM_ARL_H 0 132 + #define INTEL_SUBPLATFORM_ARL_U 1 133 + #define INTEL_SUBPLATFORM_ARL_S 2 134 135 enum intel_ppgtt_type { 136 INTEL_PPGTT_NONE = I915_GEM_PPGTT_NONE,
+15 -4
include/drm/intel/i915_pciids.h
··· 771 INTEL_ATS_M150_IDS(MACRO__, ## __VA_ARGS__), \ 772 INTEL_ATS_M75_IDS(MACRO__, ## __VA_ARGS__) 773 774 - /* MTL */ 775 - #define INTEL_ARL_IDS(MACRO__, ...) \ 776 - MACRO__(0x7D41, ## __VA_ARGS__), \ 777 MACRO__(0x7D51, ## __VA_ARGS__), \ 778 - MACRO__(0x7D67, ## __VA_ARGS__), \ 779 MACRO__(0x7DD1, ## __VA_ARGS__) 780 781 #define INTEL_MTL_IDS(MACRO__, ...) \ 782 INTEL_ARL_IDS(MACRO__, ## __VA_ARGS__), \ 783 MACRO__(0x7D40, ## __VA_ARGS__), \
··· 771 INTEL_ATS_M150_IDS(MACRO__, ## __VA_ARGS__), \ 772 INTEL_ATS_M75_IDS(MACRO__, ## __VA_ARGS__) 773 774 + /* ARL */ 775 + #define INTEL_ARL_H_IDS(MACRO__, ...) \ 776 MACRO__(0x7D51, ## __VA_ARGS__), \ 777 MACRO__(0x7DD1, ## __VA_ARGS__) 778 779 + #define INTEL_ARL_U_IDS(MACRO__, ...) \ 780 + MACRO__(0x7D41, ## __VA_ARGS__) \ 781 + 782 + #define INTEL_ARL_S_IDS(MACRO__, ...) \ 783 + MACRO__(0x7D67, ## __VA_ARGS__), \ 784 + MACRO__(0xB640, ## __VA_ARGS__) 785 + 786 + #define INTEL_ARL_IDS(MACRO__, ...) \ 787 + INTEL_ARL_H_IDS(MACRO__, ## __VA_ARGS__), \ 788 + INTEL_ARL_U_IDS(MACRO__, ## __VA_ARGS__), \ 789 + INTEL_ARL_S_IDS(MACRO__, ## __VA_ARGS__) 790 + 791 + /* MTL */ 792 #define INTEL_MTL_IDS(MACRO__, ...) \ 793 INTEL_ARL_IDS(MACRO__, ## __VA_ARGS__), \ 794 MACRO__(0x7D40, ## __VA_ARGS__), \