Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'drm-intel-gt-next-2023-02-01' of git://anongit.freedesktop.org/drm/drm-intel into drm-next

Driver Changes:

Fixes/improvements/new stuff:

- Fix bcs default context on Meteorlake (Lucas De Marchi)
- GAM registers don't need to be re-applied on engine resets (Matt Roper)
- Correct implementation of Wa_18018781329 (Matt Roper)
- Avoid potential vm use-after-free (Rob Clark)
- GuC error capture fixes (John Harrison)
- Fix potential bit_17 double-free (Rob Clark)
- Don't complain about missing regs on MTL (John Harrison)

Future platform enablement:

- Convert PSS_MODE2 to multicast register (Gustavo Sousa)
- Move/adjust register definitions related to Wa_22011450934 (Matt Roper)
- Move LSC_CHICKEN_BIT* workarounds to correct function (Gustavo Sousa)
- Document where to implement register workarounds (Gustavo Sousa)
- Use uabi engines for the default engine map (Tvrtko Ursulin)
- Flush all tiles on test exit (Tvrtko Ursulin)
- Annotate a couple more workaround registers as MCR (Matt Roper)

Driver refactors:

- Add and use GuC oriented print macros (Michal Wajdeczko)

Miscellaneous:

- Fix intel_selftest_modify_policy argument types (Arnd Bergmann)

Backmerges:

Merge drm/drm-next into drm-intel-gt-next (for conflict resolution) (Tvrtko Ursulin)

Signed-off-by: Dave Airlie <airlied@redhat.com>
From: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/Y9pOsq7VKnq7rgnW@tursulin-desk

+490 -340
+16 -9
drivers/gpu/drm/i915/gem/i915_gem_context.c
··· 1096 1096 static struct i915_gem_engines *default_engines(struct i915_gem_context *ctx, 1097 1097 struct intel_sseu rcs_sseu) 1098 1098 { 1099 - const struct intel_gt *gt = to_gt(ctx->i915); 1099 + const unsigned int max = I915_NUM_ENGINES; 1100 1100 struct intel_engine_cs *engine; 1101 1101 struct i915_gem_engines *e, *err; 1102 - enum intel_engine_id id; 1103 1102 1104 - e = alloc_engines(I915_NUM_ENGINES); 1103 + e = alloc_engines(max); 1105 1104 if (!e) 1106 1105 return ERR_PTR(-ENOMEM); 1107 1106 1108 - for_each_engine(engine, gt, id) { 1107 + for_each_uabi_engine(engine, ctx->i915) { 1109 1108 struct intel_context *ce; 1110 1109 struct intel_sseu sseu = {}; 1111 1110 int ret; ··· 1112 1113 if (engine->legacy_idx == INVALID_ENGINE) 1113 1114 continue; 1114 1115 1115 - GEM_BUG_ON(engine->legacy_idx >= I915_NUM_ENGINES); 1116 + GEM_BUG_ON(engine->legacy_idx >= max); 1116 1117 GEM_BUG_ON(e->engines[engine->legacy_idx]); 1117 1118 1118 1119 ce = intel_context_create(engine); ··· 1860 1861 vm = ctx->vm; 1861 1862 GEM_BUG_ON(!vm); 1862 1863 1863 - err = xa_alloc(&file_priv->vm_xa, &id, vm, xa_limit_32b, GFP_KERNEL); 1864 - if (err) 1865 - return err; 1866 - 1864 + /* 1865 + * Get a reference for the allocated handle. Once the handle is 1866 + * visible in the vm_xa table, userspace could try to close it 1867 + * from under our feet, so we need to hold the extra reference 1868 + * first. 1869 + */ 1867 1870 i915_vm_get(vm); 1871 + 1872 + err = xa_alloc(&file_priv->vm_xa, &id, vm, xa_limit_32b, GFP_KERNEL); 1873 + if (err) { 1874 + i915_vm_put(vm); 1875 + return err; 1876 + } 1868 1877 1869 1878 GEM_BUG_ON(id == 0); /* reserved for invalid/unassigned ppgtt */ 1870 1879 args->value = id;
+5 -4
drivers/gpu/drm/i915/gem/i915_gem_tiling.c
··· 305 305 spin_unlock(&obj->vma.lock); 306 306 307 307 obj->tiling_and_stride = tiling | stride; 308 - i915_gem_object_unlock(obj); 309 - 310 - /* Force the fence to be reacquired for GTT access */ 311 - i915_gem_object_release_mmap_gtt(obj); 312 308 313 309 /* Try to preallocate memory required to save swizzling on put-pages */ 314 310 if (i915_gem_object_needs_bit17_swizzle(obj)) { ··· 316 320 bitmap_free(obj->bit_17); 317 321 obj->bit_17 = NULL; 318 322 } 323 + 324 + i915_gem_object_unlock(obj); 325 + 326 + /* Force the fence to be reacquired for GTT access */ 327 + i915_gem_object_release_mmap_gtt(obj); 319 328 320 329 return 0; 321 330 }
+3 -1
drivers/gpu/drm/i915/gt/intel_context.c
··· 528 528 return rq; 529 529 } 530 530 531 - struct i915_request *intel_context_find_active_request(struct intel_context *ce) 531 + struct i915_request *intel_context_get_active_request(struct intel_context *ce) 532 532 { 533 533 struct intel_context *parent = intel_context_to_parent(ce); 534 534 struct i915_request *rq, *active = NULL; ··· 552 552 553 553 active = rq; 554 554 } 555 + if (active) 556 + active = i915_request_get_rcu(active); 555 557 spin_unlock_irqrestore(&parent->guc_state.lock, flags); 556 558 557 559 return active;
+1 -2
drivers/gpu/drm/i915/gt/intel_context.h
··· 268 268 269 269 struct i915_request *intel_context_create_request(struct intel_context *ce); 270 270 271 - struct i915_request * 272 - intel_context_find_active_request(struct intel_context *ce); 271 + struct i915_request *intel_context_get_active_request(struct intel_context *ce); 273 272 274 273 static inline bool intel_context_is_barrier(const struct intel_context *ce) 275 274 {
+2 -2
drivers/gpu/drm/i915/gt/intel_engine.h
··· 250 250 ktime_t intel_engine_get_busy_time(struct intel_engine_cs *engine, 251 251 ktime_t *now); 252 252 253 - struct i915_request * 254 - intel_engine_execlist_find_hung_request(struct intel_engine_cs *engine); 253 + void intel_engine_get_hung_entity(struct intel_engine_cs *engine, 254 + struct intel_context **ce, struct i915_request **rq); 255 255 256 256 u32 intel_engine_context_size(struct intel_gt *gt, u8 class); 257 257 struct intel_context *
+40 -39
drivers/gpu/drm/i915/gt/intel_engine_cs.c
··· 1584 1584 }; 1585 1585 u32 val; 1586 1586 1587 - if (!_reg[engine->id].reg) { 1588 - drm_err(&engine->i915->drm, 1589 - "MSG IDLE undefined for engine id %u\n", engine->id); 1587 + if (!_reg[engine->id].reg) 1590 1588 return 0; 1591 - } 1592 1589 1593 1590 val = intel_uncore_read(engine->uncore, _reg[engine->id]); 1594 1591 ··· 2111 2114 } 2112 2115 } 2113 2116 2114 - static unsigned long list_count(struct list_head *list) 2115 - { 2116 - struct list_head *pos; 2117 - unsigned long count = 0; 2118 - 2119 - list_for_each(pos, list) 2120 - count++; 2121 - 2122 - return count; 2123 - } 2124 - 2125 2117 static unsigned long read_ul(void *p, size_t x) 2126 2118 { 2127 2119 return *(unsigned long *)(p + x); ··· 2202 2216 } 2203 2217 } 2204 2218 2205 - static void engine_dump_active_requests(struct intel_engine_cs *engine, struct drm_printer *m) 2219 + static void engine_dump_active_requests(struct intel_engine_cs *engine, 2220 + struct drm_printer *m) 2206 2221 { 2222 + struct intel_context *hung_ce = NULL; 2207 2223 struct i915_request *hung_rq = NULL; 2208 - struct intel_context *ce; 2209 - bool guc; 2210 2224 2211 2225 /* 2212 2226 * No need for an engine->irq_seqno_barrier() before the seqno reads. ··· 2215 2229 * But the intention here is just to report an instantaneous snapshot 2216 2230 * so that's fine. 2217 2231 */ 2218 - lockdep_assert_held(&engine->sched_engine->lock); 2232 + intel_engine_get_hung_entity(engine, &hung_ce, &hung_rq); 2219 2233 2220 2234 drm_printf(m, "\tRequests:\n"); 2221 2235 2222 - guc = intel_uc_uses_guc_submission(&engine->gt->uc); 2223 - if (guc) { 2224 - ce = intel_engine_get_hung_context(engine); 2225 - if (ce) 2226 - hung_rq = intel_context_find_active_request(ce); 2227 - } else { 2228 - hung_rq = intel_engine_execlist_find_hung_request(engine); 2229 - } 2230 - 2231 2236 if (hung_rq) 2232 2237 engine_dump_request(hung_rq, m, "\t\thung"); 2238 + else if (hung_ce) 2239 + drm_printf(m, "\t\tGot hung ce but no hung rq!\n"); 2233 2240 2234 - if (guc) 2241 + if (intel_uc_uses_guc_submission(&engine->gt->uc)) 2235 2242 intel_guc_dump_active_requests(engine, hung_rq, m); 2236 2243 else 2237 - intel_engine_dump_active_requests(&engine->sched_engine->requests, 2238 - hung_rq, m); 2244 + intel_execlists_dump_active_requests(engine, hung_rq, m); 2245 + 2246 + if (hung_rq) 2247 + i915_request_put(hung_rq); 2239 2248 } 2240 2249 2241 2250 void intel_engine_dump(struct intel_engine_cs *engine, ··· 2240 2259 struct i915_gpu_error * const error = &engine->i915->gpu_error; 2241 2260 struct i915_request *rq; 2242 2261 intel_wakeref_t wakeref; 2243 - unsigned long flags; 2244 2262 ktime_t dummy; 2245 2263 2246 2264 if (header) { ··· 2276 2296 i915_reset_count(error)); 2277 2297 print_properties(engine, m); 2278 2298 2279 - spin_lock_irqsave(&engine->sched_engine->lock, flags); 2280 2299 engine_dump_active_requests(engine, m); 2281 - 2282 - drm_printf(m, "\tOn hold?: %lu\n", 2283 - list_count(&engine->sched_engine->hold)); 2284 - spin_unlock_irqrestore(&engine->sched_engine->lock, flags); 2285 2300 2286 2301 drm_printf(m, "\tMMIO base: 0x%08x\n", engine->mmio_base); 2287 2302 wakeref = intel_runtime_pm_get_if_in_use(engine->uncore->rpm); ··· 2323 2348 return siblings[0]->cops->create_virtual(siblings, count, flags); 2324 2349 } 2325 2350 2326 - struct i915_request * 2327 - intel_engine_execlist_find_hung_request(struct intel_engine_cs *engine) 2351 + static struct i915_request *engine_execlist_find_hung_request(struct intel_engine_cs *engine) 2328 2352 { 2329 2353 struct i915_request *request, *active = NULL; 2330 2354 ··· 2373 2399 } 2374 2400 2375 2401 return active; 2402 + } 2403 + 2404 + void intel_engine_get_hung_entity(struct intel_engine_cs *engine, 2405 + struct intel_context **ce, struct i915_request **rq) 2406 + { 2407 + unsigned long flags; 2408 + 2409 + *ce = intel_engine_get_hung_context(engine); 2410 + if (*ce) { 2411 + intel_engine_clear_hung_context(engine); 2412 + 2413 + *rq = intel_context_get_active_request(*ce); 2414 + return; 2415 + } 2416 + 2417 + /* 2418 + * Getting here with GuC enabled means it is a forced error capture 2419 + * with no actual hang. So, no need to attempt the execlist search. 2420 + */ 2421 + if (intel_uc_uses_guc_submission(&engine->gt->uc)) 2422 + return; 2423 + 2424 + spin_lock_irqsave(&engine->sched_engine->lock, flags); 2425 + *rq = engine_execlist_find_hung_request(engine); 2426 + if (*rq) 2427 + *rq = i915_request_get_rcu(*rq); 2428 + spin_unlock_irqrestore(&engine->sched_engine->lock, flags); 2376 2429 } 2377 2430 2378 2431 void xehp_enable_ccs_engines(struct intel_engine_cs *engine)
+1
drivers/gpu/drm/i915/gt/intel_engine_regs.h
··· 81 81 #define RING_EIR(base) _MMIO((base) + 0xb0) 82 82 #define RING_EMR(base) _MMIO((base) + 0xb4) 83 83 #define RING_ESR(base) _MMIO((base) + 0xb8) 84 + #define GEN12_STATE_ACK_DEBUG(base) _MMIO((base) + 0xbc) 84 85 #define RING_INSTPM(base) _MMIO((base) + 0xc0) 85 86 #define RING_CMD_CCTL(base) _MMIO((base) + 0xc4) 86 87 #define ACTHD(base) _MMIO((base) + 0xc8)
+27
drivers/gpu/drm/i915/gt/intel_execlists_submission.c
··· 4150 4150 spin_unlock_irqrestore(&sched_engine->lock, flags); 4151 4151 } 4152 4152 4153 + static unsigned long list_count(struct list_head *list) 4154 + { 4155 + struct list_head *pos; 4156 + unsigned long count = 0; 4157 + 4158 + list_for_each(pos, list) 4159 + count++; 4160 + 4161 + return count; 4162 + } 4163 + 4164 + void intel_execlists_dump_active_requests(struct intel_engine_cs *engine, 4165 + struct i915_request *hung_rq, 4166 + struct drm_printer *m) 4167 + { 4168 + unsigned long flags; 4169 + 4170 + spin_lock_irqsave(&engine->sched_engine->lock, flags); 4171 + 4172 + intel_engine_dump_active_requests(&engine->sched_engine->requests, hung_rq, m); 4173 + 4174 + drm_printf(m, "\tOn hold?: %lu\n", 4175 + list_count(&engine->sched_engine->hold)); 4176 + 4177 + spin_unlock_irqrestore(&engine->sched_engine->lock, flags); 4178 + } 4179 + 4153 4180 #if IS_ENABLED(CONFIG_DRM_I915_SELFTEST) 4154 4181 #include "selftest_execlists.c" 4155 4182 #endif
+4
drivers/gpu/drm/i915/gt/intel_execlists_submission.h
··· 32 32 int indent), 33 33 unsigned int max); 34 34 35 + void intel_execlists_dump_active_requests(struct intel_engine_cs *engine, 36 + struct i915_request *hung_rq, 37 + struct drm_printer *m); 38 + 35 39 bool 36 40 intel_engine_in_execlists_submission_mode(const struct intel_engine_cs *engine); 37 41
+12 -5
drivers/gpu/drm/i915/gt/intel_gt_regs.h
··· 407 407 #define GEN9_WM_CHICKEN3 _MMIO(0x5588) 408 408 #define GEN9_FACTOR_IN_CLR_VAL_HIZ (1 << 9) 409 409 410 + #define XEHP_CULLBIT1 MCR_REG(0x6100) 411 + 410 412 #define CHICKEN_RASTER_1 MCR_REG(0x6204) 411 413 #define DIS_SF_ROUND_NEAREST_EVEN REG_BIT(8) 412 414 ··· 459 457 #define HZ_DEPTH_TEST_LE_GE_OPT_DISABLE REG_BIT(13) 460 458 #define BDW_HIZ_POWER_COMPILER_CLOCK_GATING_DISABLE REG_BIT(3) 461 459 460 + #define XEHP_CULLBIT2 MCR_REG(0x7030) 461 + 462 462 #define GEN8_L3CNTLREG _MMIO(0x7034) 463 463 #define GEN8_ERRDETBCTRL (1 << 9) 464 464 465 - #define PSS_MODE2 _MMIO(0x703c) 465 + #define XEHP_PSS_MODE2 MCR_REG(0x703c) 466 466 #define SCOREBOARD_STALL_FLUSH_CONTROL REG_BIT(5) 467 467 468 468 #define GEN7_SC_INSTDONE _MMIO(0x7100) ··· 1100 1096 #define XEHP_MERT_MOD_CTRL MCR_REG(0xcf28) 1101 1097 #define RENDER_MOD_CTRL MCR_REG(0xcf2c) 1102 1098 #define COMP_MOD_CTRL MCR_REG(0xcf30) 1103 - #define VDBX_MOD_CTRL MCR_REG(0xcf34) 1104 - #define VEBX_MOD_CTRL MCR_REG(0xcf38) 1099 + #define XELPMP_GSC_MOD_CTRL _MMIO(0xcf30) /* media GT only */ 1100 + #define XEHP_VDBX_MOD_CTRL MCR_REG(0xcf34) 1101 + #define XELPMP_VDBX_MOD_CTRL _MMIO(0xcf34) 1102 + #define XEHP_VEBX_MOD_CTRL MCR_REG(0xcf38) 1103 + #define XELPMP_VEBX_MOD_CTRL _MMIO(0xcf38) 1105 1104 #define FORCE_MISS_FTLB REG_BIT(3) 1106 1105 1107 - #define GEN12_GAMSTLB_CTRL _MMIO(0xcf4c) 1106 + #define XEHP_GAMSTLB_CTRL MCR_REG(0xcf4c) 1108 1107 #define CONTROL_BLOCK_CLKGATE_DIS REG_BIT(12) 1109 1108 #define EGRESS_BLOCK_CLKGATE_DIS REG_BIT(11) 1110 1109 #define TAG_BLOCK_CLKGATE_DIS REG_BIT(7) 1111 1110 1112 - #define GEN12_GAMCNTRL_CTRL _MMIO(0xcf54) 1111 + #define XEHP_GAMCNTRL_CTRL MCR_REG(0xcf54) 1113 1112 #define INVALIDATION_BROADCAST_MODE_DIS REG_BIT(12) 1114 1113 #define GLOBAL_INVALIDATION_MODE REG_BIT(2) 1115 1114
+3 -3
drivers/gpu/drm/i915/gt/intel_lrc.c
··· 1316 1316 dg2_emit_rcs_hang_wabb(const struct intel_context *ce, u32 *cs) 1317 1317 { 1318 1318 *cs++ = MI_LOAD_REGISTER_IMM(1); 1319 - *cs++ = i915_mmio_reg_offset(GEN12_STATE_ACK_DEBUG); 1319 + *cs++ = i915_mmio_reg_offset(GEN12_STATE_ACK_DEBUG(ce->engine->mmio_base)); 1320 1320 *cs++ = 0x21; 1321 1321 1322 1322 *cs++ = MI_LOAD_REGISTER_REG; 1323 1323 *cs++ = i915_mmio_reg_offset(RING_NOPID(ce->engine->mmio_base)); 1324 - *cs++ = i915_mmio_reg_offset(GEN12_CULLBIT1); 1324 + *cs++ = i915_mmio_reg_offset(XEHP_CULLBIT1); 1325 1325 1326 1326 *cs++ = MI_LOAD_REGISTER_REG; 1327 1327 *cs++ = i915_mmio_reg_offset(RING_NOPID(ce->engine->mmio_base)); 1328 - *cs++ = i915_mmio_reg_offset(GEN12_CULLBIT2); 1328 + *cs++ = i915_mmio_reg_offset(XEHP_CULLBIT2); 1329 1329 1330 1330 return cs; 1331 1331 }
+107 -65
drivers/gpu/drm/i915/gt/intel_workarounds.c
··· 30 30 * creation to have a "primed golden context", i.e. a context image that 31 31 * already contains the changes needed to all the registers. 32 32 * 33 + * Context workarounds should be implemented in the *_ctx_workarounds_init() 34 + * variants respective to the targeted platforms. 35 + * 33 36 * - Engine workarounds: the list of these WAs is applied whenever the specific 34 37 * engine is reset. It's also possible that a set of engine classes share a 35 38 * common power domain and they are reset together. This happens on some ··· 45 42 * saves/restores their values before/after the reset takes place. See 46 43 * ``drivers/gpu/drm/i915/gt/uc/intel_guc_ads.c`` for reference. 47 44 * 45 + * Workarounds for registers specific to RCS and CCS should be implemented in 46 + * rcs_engine_wa_init() and ccs_engine_wa_init(), respectively; those for 47 + * registers belonging to BCS, VCS or VECS should be implemented in 48 + * xcs_engine_wa_init(). Workarounds for registers not belonging to a specific 49 + * engine's MMIO range but that are part of of the common RCS/CCS reset domain 50 + * should be implemented in general_render_compute_wa_init(). 51 + * 48 52 * - GT workarounds: the list of these WAs is applied whenever these registers 49 53 * revert to their default values: on GPU reset, suspend/resume [1]_, etc. 54 + * 55 + * GT workarounds should be implemented in the *_gt_workarounds_init() 56 + * variants respective to the targeted platforms. 50 57 * 51 58 * - Register whitelist: some workarounds need to be implemented in userspace, 52 59 * but need to touch privileged registers. The whitelist in the kernel 53 60 * instructs the hardware to allow the access to happen. From the kernel side, 54 61 * this is just a special case of a MMIO workaround (as we write the list of 55 62 * these to/be-whitelisted registers to some special HW registers). 63 + * 64 + * Register whitelisting should be done in the *_whitelist_build() variants 65 + * respective to the targeted platforms. 56 66 * 57 67 * - Workaround batchbuffers: buffers that get executed automatically by the 58 68 * hardware on every HW context restore. These buffers are created and ··· 793 777 /* Wa_18018764978:dg2 */ 794 778 if (IS_DG2_GRAPHICS_STEP(engine->i915, G10, STEP_C0, STEP_FOREVER) || 795 779 IS_DG2_G11(engine->i915) || IS_DG2_G12(engine->i915)) 796 - wa_masked_en(wal, PSS_MODE2, SCOREBOARD_STALL_FLUSH_CONTROL); 780 + wa_mcr_masked_en(wal, XEHP_PSS_MODE2, SCOREBOARD_STALL_FLUSH_CONTROL); 797 781 798 782 /* Wa_15010599737:dg2 */ 799 783 wa_mcr_masked_en(wal, CHICKEN_RASTER_1, DIS_SF_ROUND_NEAREST_EVEN); ··· 821 805 wa_mcr_masked_en(wal, VFLSKPD, VF_PREFETCH_TLB_DIS); 822 806 823 807 /* Wa_18018764978 */ 824 - wa_masked_en(wal, PSS_MODE2, SCOREBOARD_STALL_FLUSH_CONTROL); 808 + wa_mcr_masked_en(wal, XEHP_PSS_MODE2, SCOREBOARD_STALL_FLUSH_CONTROL); 825 809 } 826 810 827 811 /* Wa_18019271663 */ ··· 1559 1543 1560 1544 /* Wa_14011060649:xehpsdv */ 1561 1545 wa_14011060649(gt, wal); 1546 + 1547 + /* Wa_14012362059:xehpsdv */ 1548 + wa_mcr_write_or(wal, XEHP_MERT_MOD_CTRL, FORCE_MISS_FTLB); 1549 + 1550 + /* Wa_14014368820:xehpsdv */ 1551 + wa_mcr_write_or(wal, XEHP_GAMCNTRL_CTRL, 1552 + INVALIDATION_BROADCAST_MODE_DIS | GLOBAL_INVALIDATION_MODE); 1562 1553 } 1563 1554 1564 1555 static void ··· 1604 1581 /* Wa_14011006942:dg2 */ 1605 1582 wa_mcr_write_or(wal, GEN11_SUBSLICE_UNIT_LEVEL_CLKGATE, 1606 1583 DSS_ROUTER_CLKGATE_DIS); 1584 + } 1585 + 1586 + if (IS_DG2_GRAPHICS_STEP(gt->i915, G10, STEP_A0, STEP_B0) || 1587 + IS_DG2_GRAPHICS_STEP(gt->i915, G11, STEP_A0, STEP_B0)) { 1588 + /* Wa_14012362059:dg2 */ 1589 + wa_mcr_write_or(wal, XEHP_MERT_MOD_CTRL, FORCE_MISS_FTLB); 1607 1590 } 1608 1591 1609 1592 if (IS_DG2_GRAPHICS_STEP(gt->i915, G10, STEP_A0, STEP_B0)) { ··· 1657 1628 1658 1629 /* Wa_14011028019:dg2_g10 */ 1659 1630 wa_mcr_write_or(wal, SSMCGCTL9530, RTFUNIT_CLKGATE_DIS); 1631 + 1632 + /* Wa_14010680813:dg2_g10 */ 1633 + wa_mcr_write_or(wal, XEHP_GAMSTLB_CTRL, 1634 + CONTROL_BLOCK_CLKGATE_DIS | 1635 + EGRESS_BLOCK_CLKGATE_DIS | 1636 + TAG_BLOCK_CLKGATE_DIS); 1660 1637 } 1661 1638 1662 1639 /* Wa_14014830051:dg2 */ ··· 1677 1642 1678 1643 /* Wa_14015795083 */ 1679 1644 wa_mcr_write_clr(wal, GEN8_MISCCPCTL, GEN12_DOP_CLOCK_GATE_RENDER_ENABLE); 1645 + 1646 + /* Wa_18018781329 */ 1647 + wa_mcr_write_or(wal, RENDER_MOD_CTRL, FORCE_MISS_FTLB); 1648 + wa_mcr_write_or(wal, COMP_MOD_CTRL, FORCE_MISS_FTLB); 1649 + wa_mcr_write_or(wal, XEHP_VDBX_MOD_CTRL, FORCE_MISS_FTLB); 1650 + wa_mcr_write_or(wal, XEHP_VEBX_MOD_CTRL, FORCE_MISS_FTLB); 1651 + 1652 + /* Wa_1509235366:dg2 */ 1653 + wa_mcr_write_or(wal, XEHP_GAMCNTRL_CTRL, 1654 + INVALIDATION_BROADCAST_MODE_DIS | GLOBAL_INVALIDATION_MODE); 1680 1655 } 1681 1656 1682 1657 static void ··· 1696 1651 1697 1652 /* Wa_14015795083 */ 1698 1653 wa_mcr_write_clr(wal, GEN8_MISCCPCTL, GEN12_DOP_CLOCK_GATE_RENDER_ENABLE); 1654 + 1655 + /* Wa_18018781329 */ 1656 + wa_mcr_write_or(wal, RENDER_MOD_CTRL, FORCE_MISS_FTLB); 1657 + wa_mcr_write_or(wal, COMP_MOD_CTRL, FORCE_MISS_FTLB); 1658 + wa_mcr_write_or(wal, XEHP_VDBX_MOD_CTRL, FORCE_MISS_FTLB); 1659 + wa_mcr_write_or(wal, XEHP_VEBX_MOD_CTRL, FORCE_MISS_FTLB); 1699 1660 } 1700 1661 1701 1662 static void 1702 1663 xelpg_gt_workarounds_init(struct intel_gt *gt, struct i915_wa_list *wal) 1703 1664 { 1704 - /* Wa_14014830051 */ 1705 1665 if (IS_MTL_GRAPHICS_STEP(gt->i915, M, STEP_A0, STEP_B0) || 1706 - IS_MTL_GRAPHICS_STEP(gt->i915, P, STEP_A0, STEP_B0)) 1666 + IS_MTL_GRAPHICS_STEP(gt->i915, P, STEP_A0, STEP_B0)) { 1667 + /* Wa_14014830051 */ 1707 1668 wa_mcr_write_clr(wal, SARB_CHICKEN1, COMP_CKN_IN); 1669 + 1670 + /* Wa_18018781329 */ 1671 + wa_mcr_write_or(wal, RENDER_MOD_CTRL, FORCE_MISS_FTLB); 1672 + wa_mcr_write_or(wal, COMP_MOD_CTRL, FORCE_MISS_FTLB); 1673 + } 1708 1674 1709 1675 /* 1710 1676 * Unlike older platforms, we no longer setup implicit steering here; ··· 1727 1671 static void 1728 1672 xelpmp_gt_workarounds_init(struct intel_gt *gt, struct i915_wa_list *wal) 1729 1673 { 1730 - /* FIXME: Actual workarounds will be added in future patch(es) */ 1674 + if (IS_MTL_MEDIA_STEP(gt->i915, STEP_A0, STEP_B0)) { 1675 + /* 1676 + * Wa_18018781329 1677 + * 1678 + * Note that although these registers are MCR on the primary 1679 + * GT, the media GT's versions are regular singleton registers. 1680 + */ 1681 + wa_write_or(wal, XELPMP_GSC_MOD_CTRL, FORCE_MISS_FTLB); 1682 + wa_write_or(wal, XELPMP_VDBX_MOD_CTRL, FORCE_MISS_FTLB); 1683 + wa_write_or(wal, XELPMP_VEBX_MOD_CTRL, FORCE_MISS_FTLB); 1684 + } 1731 1685 1732 1686 debug_dump_steering(gt); 1733 1687 } ··· 2391 2325 /* Wa_1509727124 */ 2392 2326 wa_mcr_masked_en(wal, GEN10_SAMPLER_MODE, 2393 2327 SC_DISABLE_POWER_OPTIMIZATION_EBB); 2394 - 2395 - /* Wa_22013037850 */ 2396 - wa_mcr_write_or(wal, LSC_CHICKEN_BIT_0_UDW, 2397 - DISABLE_128B_EVICTION_COMMAND_UDW); 2398 2328 } 2399 2329 2400 2330 if (IS_DG2_GRAPHICS_STEP(i915, G10, STEP_B0, STEP_FOREVER) || ··· 2399 2337 /* Wa_22012856258 */ 2400 2338 wa_mcr_masked_en(wal, GEN8_ROW_CHICKEN2, 2401 2339 GEN12_DISABLE_READ_SUPPRESSION); 2402 - } 2403 - 2404 - if (IS_DG2(i915)) { 2405 - /* Wa_1509235366:dg2 */ 2406 - wa_write_or(wal, GEN12_GAMCNTRL_CTRL, INVALIDATION_BROADCAST_MODE_DIS | 2407 - GLOBAL_INVALIDATION_MODE); 2408 2340 } 2409 2341 2410 2342 if (IS_DG2_GRAPHICS_STEP(i915, G11, STEP_A0, STEP_B0)) { ··· 2411 2355 /* Wa_14012419201:dg2 */ 2412 2356 wa_mcr_masked_en(wal, GEN9_ROW_CHICKEN4, 2413 2357 GEN12_DISABLE_HDR_PAST_PAYLOAD_HOLD_FIX); 2414 - } 2415 - 2416 - if (IS_DG2_GRAPHICS_STEP(i915, G10, STEP_B0, STEP_C0) || 2417 - IS_DG2_G11(i915)) { 2418 - /* 2419 - * Wa_22012826095:dg2 2420 - * Wa_22013059131:dg2 2421 - */ 2422 - wa_mcr_write_clr_set(wal, LSC_CHICKEN_BIT_0_UDW, 2423 - MAXREQS_PER_BANK, 2424 - REG_FIELD_PREP(MAXREQS_PER_BANK, 2)); 2425 - 2426 - /* Wa_22013059131:dg2 */ 2427 - wa_mcr_write_or(wal, LSC_CHICKEN_BIT_0, 2428 - FORCE_1_SUB_MESSAGE_PER_FRAGMENT); 2429 2358 } 2430 2359 2431 2360 /* Wa_1308578152:dg2_g10 when first gslice is fused off */ ··· 2437 2396 */ 2438 2397 wa_mcr_masked_en(wal, GEN8_ROW_CHICKEN, 2439 2398 MDQ_ARBITRATION_MODE | UGM_BACKUP_MODE); 2440 - 2441 - /* 2442 - * Wa_14010918519:dg2_g10 2443 - * 2444 - * LSC_CHICKEN_BIT_0 always reads back as 0 is this stepping, 2445 - * so ignoring verification. 2446 - */ 2447 - wa_mcr_add(wal, LSC_CHICKEN_BIT_0_UDW, 0, 2448 - FORCE_SLM_FENCE_SCOPE_TO_TILE | FORCE_UGM_FENCE_SCOPE_TO_TILE, 2449 - 0, false); 2450 2399 } 2451 2400 2452 2401 if (IS_DG2_GRAPHICS_STEP(i915, G10, STEP_A0, STEP_B0)) { ··· 2459 2428 IS_DG2_GRAPHICS_STEP(engine->i915, G11, STEP_A0, STEP_B0)) 2460 2429 wa_mcr_masked_en(wal, GEN9_HALF_SLICE_CHICKEN7, 2461 2430 DG2_DISABLE_ROUND_ENABLE_ALLOW_FOR_SSLA); 2462 - 2463 - if (IS_DG2_GRAPHICS_STEP(engine->i915, G10, STEP_A0, STEP_B0)) { 2464 - /* Wa_14010680813:dg2_g10 */ 2465 - wa_write_or(wal, GEN12_GAMSTLB_CTRL, CONTROL_BLOCK_CLKGATE_DIS | 2466 - EGRESS_BLOCK_CLKGATE_DIS | TAG_BLOCK_CLKGATE_DIS); 2467 - } 2468 - 2469 - if (IS_DG2_GRAPHICS_STEP(engine->i915, G10, STEP_A0, STEP_B0) || 2470 - IS_DG2_GRAPHICS_STEP(engine->i915, G11, STEP_A0, STEP_B0)) { 2471 - /* Wa_14012362059:dg2 */ 2472 - wa_mcr_write_or(wal, XEHP_MERT_MOD_CTRL, FORCE_MISS_FTLB); 2473 - } 2474 2431 2475 2432 if (IS_DG2_GRAPHICS_STEP(i915, G11, STEP_B0, STEP_FOREVER) || 2476 2433 IS_DG2_G10(i915)) { ··· 3011 2992 3012 2993 if (IS_MTL_GRAPHICS_STEP(i915, M, STEP_A0, STEP_B0) || 3013 2994 IS_MTL_GRAPHICS_STEP(i915, P, STEP_A0, STEP_B0) || 2995 + IS_DG2_GRAPHICS_STEP(i915, G10, STEP_B0, STEP_FOREVER) || 2996 + IS_DG2_G11(i915) || IS_DG2_G12(i915)) { 2997 + /* Wa_22013037850 */ 2998 + wa_mcr_write_or(wal, LSC_CHICKEN_BIT_0_UDW, 2999 + DISABLE_128B_EVICTION_COMMAND_UDW); 3000 + } 3001 + 3002 + if (IS_MTL_GRAPHICS_STEP(i915, M, STEP_A0, STEP_B0) || 3003 + IS_MTL_GRAPHICS_STEP(i915, P, STEP_A0, STEP_B0) || 3014 3004 IS_PONTEVECCHIO(i915) || 3015 3005 IS_DG2(i915)) { 3016 - /* Wa_18018781329 */ 3017 - wa_mcr_write_or(wal, RENDER_MOD_CTRL, FORCE_MISS_FTLB); 3018 - wa_mcr_write_or(wal, COMP_MOD_CTRL, FORCE_MISS_FTLB); 3019 - wa_mcr_write_or(wal, VDBX_MOD_CTRL, FORCE_MISS_FTLB); 3020 - wa_mcr_write_or(wal, VEBX_MOD_CTRL, FORCE_MISS_FTLB); 3021 - 3022 3006 /* Wa_22014226127 */ 3023 3007 wa_mcr_write_or(wal, LSC_CHICKEN_BIT_0, DISABLE_D8_D16_COASLESCE); 3024 3008 } ··· 3031 3009 IS_DG2(i915)) { 3032 3010 /* Wa_18017747507 */ 3033 3011 wa_masked_en(wal, VFG_PREEMPTION_CHICKEN, POLYGON_TRIFAN_LINELOOP_DISABLE); 3012 + } 3013 + 3014 + if (IS_DG2_GRAPHICS_STEP(i915, G10, STEP_B0, STEP_C0) || 3015 + IS_DG2_G11(i915)) { 3016 + /* 3017 + * Wa_22012826095:dg2 3018 + * Wa_22013059131:dg2 3019 + */ 3020 + wa_mcr_write_clr_set(wal, LSC_CHICKEN_BIT_0_UDW, 3021 + MAXREQS_PER_BANK, 3022 + REG_FIELD_PREP(MAXREQS_PER_BANK, 2)); 3023 + 3024 + /* Wa_22013059131:dg2 */ 3025 + wa_mcr_write_or(wal, LSC_CHICKEN_BIT_0, 3026 + FORCE_1_SUB_MESSAGE_PER_FRAGMENT); 3027 + } 3028 + 3029 + if (IS_DG2_GRAPHICS_STEP(i915, G10, STEP_A0, STEP_B0)) { 3030 + /* 3031 + * Wa_14010918519:dg2_g10 3032 + * 3033 + * LSC_CHICKEN_BIT_0 always reads back as 0 is this stepping, 3034 + * so ignoring verification. 3035 + */ 3036 + wa_mcr_add(wal, LSC_CHICKEN_BIT_0_UDW, 0, 3037 + FORCE_SLM_FENCE_SCOPE_TO_TILE | FORCE_UGM_FENCE_SCOPE_TO_TILE, 3038 + 0, false); 3034 3039 } 3035 3040 3036 3041 if (IS_PONTEVECCHIO(i915)) { ··· 3088 3039 wa_mcr_masked_dis(wal, MLTICTXCTL, TDONRENDER); 3089 3040 wa_mcr_write_or(wal, L3SQCREG1_CCS0, FLUSHALLNONCOH); 3090 3041 } 3091 - 3092 - /* Wa_14012362059:xehpsdv */ 3093 - wa_mcr_write_or(wal, XEHP_MERT_MOD_CTRL, FORCE_MISS_FTLB); 3094 - 3095 - /* Wa_14014368820:xehpsdv */ 3096 - wa_write_or(wal, GEN12_GAMCNTRL_CTRL, INVALIDATION_BROADCAST_MODE_DIS | 3097 - GLOBAL_INVALIDATION_MODE); 3098 3042 } 3099 3043 3100 3044 if (IS_DG2(i915) || IS_PONTEVECCHIO(i915)) {
+15 -16
drivers/gpu/drm/i915/gt/uc/intel_guc.c
··· 11 11 #include "intel_guc.h" 12 12 #include "intel_guc_ads.h" 13 13 #include "intel_guc_capture.h" 14 + #include "intel_guc_print.h" 14 15 #include "intel_guc_slpc.h" 15 16 #include "intel_guc_submission.h" 16 17 #include "i915_drv.h" ··· 95 94 assert_rpm_wakelock_held(&gt->i915->runtime_pm); 96 95 97 96 spin_lock_irq(gt->irq_lock); 98 - WARN_ON_ONCE(intel_uncore_read(gt->uncore, GEN8_GT_IIR(2)) & 99 - gt->pm_guc_events); 97 + guc_WARN_ON_ONCE(guc, intel_uncore_read(gt->uncore, GEN8_GT_IIR(2)) & 98 + gt->pm_guc_events); 100 99 gen6_gt_pm_enable_irq(gt, gt->pm_guc_events); 101 100 spin_unlock_irq(gt->irq_lock); 102 101 ··· 343 342 params[GUC_CTL_DEVID] = guc_ctl_devid(guc); 344 343 345 344 for (i = 0; i < GUC_CTL_MAX_DWORDS; i++) 346 - DRM_DEBUG_DRIVER("param[%2d] = %#x\n", i, params[i]); 345 + guc_dbg(guc, "param[%2d] = %#x\n", i, params[i]); 347 346 } 348 347 349 348 /* ··· 390 389 391 390 int intel_guc_init(struct intel_guc *guc) 392 391 { 393 - struct intel_gt *gt = guc_to_gt(guc); 394 392 int ret; 395 393 396 394 ret = intel_uc_fw_init(&guc->fw); ··· 451 451 intel_uc_fw_fini(&guc->fw); 452 452 out: 453 453 intel_uc_fw_change_status(&guc->fw, INTEL_UC_FIRMWARE_INIT_FAIL); 454 - i915_probe_error(gt->i915, "failed with %d\n", ret); 454 + guc_probe_error(guc, "failed with %pe\n", ERR_PTR(ret)); 455 455 return ret; 456 456 } 457 457 ··· 480 480 int intel_guc_send_mmio(struct intel_guc *guc, const u32 *request, u32 len, 481 481 u32 *response_buf, u32 response_buf_size) 482 482 { 483 - struct drm_i915_private *i915 = guc_to_gt(guc)->i915; 484 483 struct intel_uncore *uncore = guc_to_gt(guc)->uncore; 485 484 u32 header; 486 485 int i; ··· 514 515 10, 10, &header); 515 516 if (unlikely(ret)) { 516 517 timeout: 517 - drm_err(&i915->drm, "mmio request %#x: no reply %x\n", 518 + guc_err(guc, "mmio request %#x: no reply %x\n", 518 519 request[0], header); 519 520 goto out; 520 521 } ··· 536 537 if (FIELD_GET(GUC_HXG_MSG_0_TYPE, header) == GUC_HXG_TYPE_NO_RESPONSE_RETRY) { 537 538 u32 reason = FIELD_GET(GUC_HXG_RETRY_MSG_0_REASON, header); 538 539 539 - drm_dbg(&i915->drm, "mmio request %#x: retrying, reason %u\n", 540 + guc_dbg(guc, "mmio request %#x: retrying, reason %u\n", 540 541 request[0], reason); 541 542 goto retry; 542 543 } ··· 545 546 u32 hint = FIELD_GET(GUC_HXG_FAILURE_MSG_0_HINT, header); 546 547 u32 error = FIELD_GET(GUC_HXG_FAILURE_MSG_0_ERROR, header); 547 548 548 - drm_err(&i915->drm, "mmio request %#x: failure %x/%u\n", 549 + guc_err(guc, "mmio request %#x: failure %x/%u\n", 549 550 request[0], error, hint); 550 551 ret = -ENXIO; 551 552 goto out; ··· 553 554 554 555 if (FIELD_GET(GUC_HXG_MSG_0_TYPE, header) != GUC_HXG_TYPE_RESPONSE_SUCCESS) { 555 556 proto: 556 - drm_err(&i915->drm, "mmio request %#x: unexpected reply %#x\n", 557 + guc_err(guc, "mmio request %#x: unexpected reply %#x\n", 557 558 request[0], header); 558 559 ret = -EPROTO; 559 560 goto out; ··· 596 597 msg = payload[0] & guc->msg_enabled_mask; 597 598 598 599 if (msg & INTEL_GUC_RECV_MSG_CRASH_DUMP_POSTED) 599 - drm_err(&guc_to_gt(guc)->i915->drm, "Received early GuC crash dump notification!\n"); 600 + guc_err(guc, "Received early crash dump notification!\n"); 600 601 if (msg & INTEL_GUC_RECV_MSG_EXCEPTION) 601 - drm_err(&guc_to_gt(guc)->i915->drm, "Received early GuC exception notification!\n"); 602 + guc_err(guc, "Received early exception notification!\n"); 602 603 603 604 return 0; 604 605 } ··· 652 653 */ 653 654 ret = intel_guc_send_mmio(guc, action, ARRAY_SIZE(action), NULL, 0); 654 655 if (ret) 655 - DRM_ERROR("GuC suspend: RESET_CLIENT action failed with error %d!\n", ret); 656 + guc_err(guc, "suspend: RESET_CLIENT action failed with %pe\n", 657 + ERR_PTR(ret)); 656 658 } 657 659 658 660 /* Signal that the GuC isn't running. */ ··· 828 828 829 829 static int __guc_self_cfg(struct intel_guc *guc, u16 key, u16 len, u64 value) 830 830 { 831 - struct drm_i915_private *i915 = guc_to_gt(guc)->i915; 832 831 int err = __guc_action_self_cfg(guc, key, len, value); 833 832 834 833 if (unlikely(err)) 835 - i915_probe_error(i915, "Unsuccessful self-config (%pe) key %#hx value %#llx\n", 836 - ERR_PTR(err), key, value); 834 + guc_probe_error(guc, "Unsuccessful self-config (%pe) key %#hx value %#llx\n", 835 + ERR_PTR(err), key, value); 837 836 return err; 838 837 } 839 838
+4 -4
drivers/gpu/drm/i915/gt/uc/intel_guc_ads.c
··· 15 15 #include "intel_guc_ads.h" 16 16 #include "intel_guc_capture.h" 17 17 #include "intel_guc_fwif.h" 18 + #include "intel_guc_print.h" 18 19 #include "intel_uc.h" 19 20 #include "i915_drv.h" 20 21 ··· 428 427 429 428 guc->ads_regset = temp_set.storage; 430 429 431 - drm_dbg(&guc_to_gt(guc)->i915->drm, "Used %zu KB for temporary ADS regset\n", 430 + guc_dbg(guc, "Used %zu KB for temporary ADS regset\n", 432 431 (temp_set.storage_max * sizeof(struct guc_mmio_reg)) >> 10); 433 432 434 433 return total * sizeof(struct guc_mmio_reg); ··· 622 621 623 622 engine = find_engine_state(gt, engine_class); 624 623 if (!engine) { 625 - drm_err(&gt->i915->drm, "No engine state recorded for class %d!\n", 624 + guc_err(guc, "No engine state recorded for class %d!\n", 626 625 engine_class); 627 626 ads_blob_write(guc, ads.eng_state_size[guc_class], 0); 628 627 ads_blob_write(guc, ads.golden_context_lrca[guc_class], 0); ··· 647 646 guc_capture_prep_lists(struct intel_guc *guc) 648 647 { 649 648 struct intel_gt *gt = guc_to_gt(guc); 650 - struct drm_i915_private *i915 = guc_to_gt(guc)->i915; 651 649 u32 ads_ggtt, capture_offset, null_ggtt, total_size = 0; 652 650 struct guc_gt_system_info local_info; 653 651 struct iosys_map info_map; ··· 751 751 } 752 752 753 753 if (guc->ads_capture_size && guc->ads_capture_size != PAGE_ALIGN(total_size)) 754 - drm_warn(&i915->drm, "GuC->ADS->Capture alloc size changed from %d to %d\n", 754 + guc_warn(guc, "ADS capture alloc size changed from %d to %d\n", 755 755 guc->ads_capture_size, PAGE_ALIGN(total_size)); 756 756 757 757 return PAGE_ALIGN(total_size);
+4 -4
drivers/gpu/drm/i915/gt/uc/intel_guc_capture.c
··· 1506 1506 1507 1507 if (!ebuf || !ee) 1508 1508 return -EINVAL; 1509 - cap = ee->capture; 1509 + cap = ee->guc_capture; 1510 1510 if (!cap || !ee->engine) 1511 1511 return -ENODEV; 1512 1512 ··· 1576 1576 if (!ee || !ee->guc_capture_node) 1577 1577 return; 1578 1578 1579 - guc_capture_add_node_to_cachelist(ee->capture, ee->guc_capture_node); 1580 - ee->capture = NULL; 1579 + guc_capture_add_node_to_cachelist(ee->guc_capture, ee->guc_capture_node); 1580 + ee->guc_capture = NULL; 1581 1581 ee->guc_capture_node = NULL; 1582 1582 } 1583 1583 ··· 1611 1611 (ce->lrc.lrca & CTX_GTT_ADDRESS_MASK)) { 1612 1612 list_del(&n->link); 1613 1613 ee->guc_capture_node = n; 1614 - ee->capture = guc->capture; 1614 + ee->guc_capture = guc->capture; 1615 1615 return; 1616 1616 } 1617 1617 }
+4 -19
drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c
··· 11 11 12 12 #include "i915_drv.h" 13 13 #include "intel_guc_ct.h" 14 - #include "gt/intel_gt.h" 14 + #include "intel_guc_print.h" 15 15 16 16 static inline struct intel_guc *ct_to_guc(struct intel_guc_ct *ct) 17 17 { 18 18 return container_of(ct, struct intel_guc, ct); 19 19 } 20 20 21 - static inline struct intel_gt *ct_to_gt(struct intel_guc_ct *ct) 22 - { 23 - return guc_to_gt(ct_to_guc(ct)); 24 - } 25 - 26 - static inline struct drm_i915_private *ct_to_i915(struct intel_guc_ct *ct) 27 - { 28 - return ct_to_gt(ct)->i915; 29 - } 30 - 31 - static inline struct drm_device *ct_to_drm(struct intel_guc_ct *ct) 32 - { 33 - return &ct_to_i915(ct)->drm; 34 - } 35 - 36 21 #define CT_ERROR(_ct, _fmt, ...) \ 37 - drm_err(ct_to_drm(_ct), "CT: " _fmt, ##__VA_ARGS__) 22 + guc_err(ct_to_guc(_ct), "CT: " _fmt, ##__VA_ARGS__) 38 23 #ifdef CONFIG_DRM_I915_DEBUG_GUC 39 24 #define CT_DEBUG(_ct, _fmt, ...) \ 40 - drm_dbg(ct_to_drm(_ct), "CT: " _fmt, ##__VA_ARGS__) 25 + guc_dbg(ct_to_guc(_ct), "CT: " _fmt, ##__VA_ARGS__) 41 26 #else 42 27 #define CT_DEBUG(...) do { } while (0) 43 28 #endif 44 29 #define CT_PROBE_ERROR(_ct, _fmt, ...) \ 45 - i915_probe_error(ct_to_i915(ct), "CT: " _fmt, ##__VA_ARGS__) 30 + guc_probe_error(ct_to_guc(ct), "CT: " _fmt, ##__VA_ARGS__) 46 31 47 32 /** 48 33 * DOC: CTB Blob
+9 -8
drivers/gpu/drm/i915/gt/uc/intel_guc_fw.c
··· 13 13 #include "gt/intel_gt_mcr.h" 14 14 #include "gt/intel_gt_regs.h" 15 15 #include "intel_guc_fw.h" 16 + #include "intel_guc_print.h" 16 17 #include "i915_drv.h" 17 18 18 19 static void guc_prepare_xfer(struct intel_gt *gt) ··· 104 103 return uk_val == INTEL_GUC_LOAD_STATUS_READY; 105 104 } 106 105 107 - static int guc_wait_ucode(struct intel_uncore *uncore) 106 + static int guc_wait_ucode(struct intel_guc *guc) 108 107 { 108 + struct intel_gt *gt = guc_to_gt(guc); 109 + struct intel_uncore *uncore = gt->uncore; 109 110 u32 status; 110 111 int ret; 111 112 ··· 130 127 */ 131 128 ret = wait_for(guc_ready(uncore, &status), 200); 132 129 if (ret) { 133 - struct drm_device *drm = &uncore->i915->drm; 134 - 135 - drm_info(drm, "GuC load failed: status = 0x%08X\n", status); 136 - drm_info(drm, "GuC load failed: status: Reset = %d, " 130 + guc_info(guc, "load failed: status = 0x%08X\n", status); 131 + guc_info(guc, "load failed: status: Reset = %d, " 137 132 "BootROM = 0x%02X, UKernel = 0x%02X, " 138 133 "MIA = 0x%02X, Auth = 0x%02X\n", 139 134 REG_FIELD_GET(GS_MIA_IN_RESET, status), ··· 141 140 REG_FIELD_GET(GS_AUTH_STATUS_MASK, status)); 142 141 143 142 if ((status & GS_BOOTROM_MASK) == GS_BOOTROM_RSA_FAILED) { 144 - drm_info(drm, "GuC firmware signature verification failed\n"); 143 + guc_info(guc, "firmware signature verification failed\n"); 145 144 ret = -ENOEXEC; 146 145 } 147 146 148 147 if (REG_FIELD_GET(GS_UKERNEL_MASK, status) == INTEL_GUC_LOAD_STATUS_EXCEPTION) { 149 - drm_info(drm, "GuC firmware exception. EIP: %#x\n", 148 + guc_info(guc, "firmware exception. EIP: %#x\n", 150 149 intel_uncore_read(uncore, SOFT_SCRATCH(13))); 151 150 ret = -ENXIO; 152 151 } ··· 195 194 if (ret) 196 195 goto out; 197 196 198 - ret = guc_wait_ucode(uncore); 197 + ret = guc_wait_ucode(guc); 199 198 if (ret) 200 199 goto out; 201 200
+19 -19
drivers/gpu/drm/i915/gt/uc/intel_guc_log.c
··· 12 12 #include "i915_memcpy.h" 13 13 #include "intel_guc_capture.h" 14 14 #include "intel_guc_log.h" 15 + #include "intel_guc_print.h" 15 16 16 17 #if defined(CONFIG_DRM_I915_DEBUG_GUC) 17 18 #define GUC_LOG_DEFAULT_CRASH_BUFFER_SIZE SZ_2M ··· 40 39 static void _guc_log_init_sizes(struct intel_guc_log *log) 41 40 { 42 41 struct intel_guc *guc = log_to_guc(log); 43 - struct drm_i915_private *i915 = guc_to_gt(guc)->i915; 44 42 static const struct guc_log_section sections[GUC_LOG_SECTIONS_LIMIT] = { 45 43 { 46 44 GUC_LOG_CRASH_MASK >> GUC_LOG_CRASH_SHIFT, ··· 82 82 } 83 83 84 84 if (!IS_ALIGNED(log->sizes[i].bytes, log->sizes[i].units)) 85 - drm_err(&i915->drm, "Mis-aligned GuC log %s size: 0x%X vs 0x%X!", 85 + guc_err(guc, "Mis-aligned log %s size: 0x%X vs 0x%X!\n", 86 86 sections[i].name, log->sizes[i].bytes, log->sizes[i].units); 87 87 log->sizes[i].count = log->sizes[i].bytes / log->sizes[i].units; 88 88 89 89 if (!log->sizes[i].count) { 90 - drm_err(&i915->drm, "Zero GuC log %s size!", sections[i].name); 90 + guc_err(guc, "Zero log %s size!\n", sections[i].name); 91 91 } else { 92 92 /* Size is +1 unit */ 93 93 log->sizes[i].count--; ··· 95 95 96 96 /* Clip to field size */ 97 97 if (log->sizes[i].count > sections[i].max) { 98 - drm_err(&i915->drm, "GuC log %s size too large: %d vs %d!", 98 + guc_err(guc, "log %s size too large: %d vs %d!\n", 99 99 sections[i].name, log->sizes[i].count + 1, sections[i].max + 1); 100 100 log->sizes[i].count = sections[i].max; 101 101 } 102 102 } 103 103 104 104 if (log->sizes[GUC_LOG_SECTIONS_CRASH].units != log->sizes[GUC_LOG_SECTIONS_DEBUG].units) { 105 - drm_err(&i915->drm, "Unit mis-match for GuC log crash and debug sections: %d vs %d!", 105 + guc_err(guc, "Unit mismatch for crash and debug sections: %d vs %d!\n", 106 106 log->sizes[GUC_LOG_SECTIONS_CRASH].units, 107 107 log->sizes[GUC_LOG_SECTIONS_DEBUG].units); 108 108 log->sizes[GUC_LOG_SECTIONS_CRASH].units = log->sizes[GUC_LOG_SECTIONS_DEBUG].units; ··· 374 374 375 375 static void _guc_log_copy_debuglogs_for_relay(struct intel_guc_log *log) 376 376 { 377 + struct intel_guc *guc = log_to_guc(log); 377 378 unsigned int buffer_size, read_offset, write_offset, bytes_to_copy, full_cnt; 378 379 struct guc_log_buffer_state *log_buf_state, *log_buf_snapshot_state; 379 380 struct guc_log_buffer_state log_buf_state_local; ··· 384 383 385 384 mutex_lock(&log->relay.lock); 386 385 387 - if (WARN_ON(!intel_guc_log_relay_created(log))) 386 + if (guc_WARN_ON(guc, !intel_guc_log_relay_created(log))) 388 387 goto out_unlock; 389 388 390 389 /* Get the pointer to shared GuC log buffer */ ··· 399 398 * Used rate limited to avoid deluge of messages, logs might be 400 399 * getting consumed by User at a slow rate. 401 400 */ 402 - DRM_ERROR_RATELIMITED("no sub-buffer to copy general logs\n"); 401 + guc_err_ratelimited(guc, "no sub-buffer to copy general logs\n"); 403 402 log->relay.full_count++; 404 403 405 404 goto out_unlock; ··· 452 451 write_offset = buffer_size; 453 452 } else if (unlikely((read_offset > buffer_size) || 454 453 (write_offset > buffer_size))) { 455 - DRM_ERROR("invalid log buffer state\n"); 454 + guc_err(guc, "invalid log buffer state\n"); 456 455 /* copy whole buffer as offsets are unreliable */ 457 456 read_offset = 0; 458 457 write_offset = buffer_size; ··· 548 547 subbuf_size, n_subbufs, 549 548 &relay_callbacks, dev_priv); 550 549 if (!guc_log_relay_chan) { 551 - DRM_ERROR("Couldn't create relay chan for GuC logging\n"); 550 + guc_err(guc, "Couldn't create relay channel for logging\n"); 552 551 553 552 ret = -ENOMEM; 554 553 return ret; ··· 597 596 } 598 597 599 598 if (i915->params.guc_log_level > GUC_LOG_LEVEL_MAX) { 600 - DRM_WARN("Incompatible option detected: %s=%d, %s!\n", 601 - "guc_log_level", i915->params.guc_log_level, 602 - "verbosity too high"); 599 + guc_warn(guc, "Log verbosity param out of range: %d > %d!\n", 600 + i915->params.guc_log_level, GUC_LOG_LEVEL_MAX); 603 601 return (IS_ENABLED(CONFIG_DRM_I915_DEBUG) || 604 602 IS_ENABLED(CONFIG_DRM_I915_DEBUG_GEM)) ? 605 603 GUC_LOG_LEVEL_MAX : GUC_LOG_LEVEL_DISABLED; ··· 641 641 log->buf_addr = vaddr; 642 642 643 643 log->level = __get_default_log_level(log); 644 - DRM_DEBUG_DRIVER("guc_log_level=%d (%s, verbose:%s, verbosity:%d)\n", 645 - log->level, str_enabled_disabled(log->level), 646 - str_yes_no(GUC_LOG_LEVEL_IS_VERBOSE(log->level)), 647 - GUC_LOG_LEVEL_TO_VERBOSITY(log->level)); 644 + guc_dbg(guc, "guc_log_level=%d (%s, verbose:%s, verbosity:%d)\n", 645 + log->level, str_enabled_disabled(log->level), 646 + str_yes_no(GUC_LOG_LEVEL_IS_VERBOSE(log->level)), 647 + GUC_LOG_LEVEL_TO_VERBOSITY(log->level)); 648 648 649 649 return 0; 650 650 651 651 err: 652 - DRM_ERROR("Failed to allocate or map GuC log buffer. %d\n", ret); 652 + guc_err(guc, "Failed to allocate or map log buffer %pe\n", ERR_PTR(ret)); 653 653 return ret; 654 654 } 655 655 ··· 687 687 GUC_LOG_LEVEL_IS_ENABLED(level), 688 688 GUC_LOG_LEVEL_TO_VERBOSITY(level)); 689 689 if (ret) { 690 - DRM_DEBUG_DRIVER("guc_log_control action failed %d\n", ret); 690 + guc_dbg(guc, "guc_log_control action failed %pe\n", ERR_PTR(ret)); 691 691 goto out_unlock; 692 692 } 693 693 ··· 905 905 906 906 map = i915_gem_object_pin_map_unlocked(obj, I915_MAP_WC); 907 907 if (IS_ERR(map)) { 908 - DRM_DEBUG("Failed to pin object\n"); 908 + guc_dbg(guc, "Failed to pin log object: %pe\n", map); 909 909 drm_puts(p, "(log data unaccessible)\n"); 910 910 free_page((unsigned long)page); 911 911 return PTR_ERR(map);
+48
drivers/gpu/drm/i915/gt/uc/intel_guc_print.h
··· 1 + /* SPDX-License-Identifier: MIT */ 2 + /* 3 + * Copyright © 2023 Intel Corporation 4 + */ 5 + 6 + #ifndef __INTEL_GUC_PRINT__ 7 + #define __INTEL_GUC_PRINT__ 8 + 9 + #include "gt/intel_gt.h" 10 + #include "gt/intel_gt_print.h" 11 + 12 + #define guc_printk(_guc, _level, _fmt, ...) \ 13 + gt_##_level(guc_to_gt(_guc), "GUC: " _fmt, ##__VA_ARGS__) 14 + 15 + #define guc_err(_guc, _fmt, ...) \ 16 + guc_printk((_guc), err, _fmt, ##__VA_ARGS__) 17 + 18 + #define guc_warn(_guc, _fmt, ...) \ 19 + guc_printk((_guc), warn, _fmt, ##__VA_ARGS__) 20 + 21 + #define guc_notice(_guc, _fmt, ...) \ 22 + guc_printk((_guc), notice, _fmt, ##__VA_ARGS__) 23 + 24 + #define guc_info(_guc, _fmt, ...) \ 25 + guc_printk((_guc), info, _fmt, ##__VA_ARGS__) 26 + 27 + #define guc_dbg(_guc, _fmt, ...) \ 28 + guc_printk((_guc), dbg, _fmt, ##__VA_ARGS__) 29 + 30 + #define guc_err_ratelimited(_guc, _fmt, ...) \ 31 + guc_printk((_guc), err_ratelimited, _fmt, ##__VA_ARGS__) 32 + 33 + #define guc_probe_error(_guc, _fmt, ...) \ 34 + guc_printk((_guc), probe_error, _fmt, ##__VA_ARGS__) 35 + 36 + #define guc_WARN(_guc, _cond, _fmt, ...) \ 37 + gt_WARN(guc_to_gt(_guc), _cond, "GUC: " _fmt, ##__VA_ARGS__) 38 + 39 + #define guc_WARN_ONCE(_guc, _cond, _fmt, ...) \ 40 + gt_WARN_ONCE(guc_to_gt(_guc), _cond, "GUC: " _fmt, ##__VA_ARGS__) 41 + 42 + #define guc_WARN_ON(_guc, _cond) \ 43 + gt_WARN(guc_to_gt(_guc), _cond, "%s(%s)", "guc_WARN_ON", __stringify(_cond)) 44 + 45 + #define guc_WARN_ON_ONCE(_guc, _cond) \ 46 + gt_WARN_ONCE(guc_to_gt(_guc), _cond, "%s(%s)", "guc_WARN_ON_ONCE", __stringify(_cond)) 47 + 48 + #endif /* __INTEL_GUC_PRINT__ */
+58 -38
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c
··· 27 27 28 28 #include "intel_guc_ads.h" 29 29 #include "intel_guc_capture.h" 30 + #include "intel_guc_print.h" 30 31 #include "intel_guc_submission.h" 31 32 32 33 #include "i915_drv.h" ··· 1444 1443 int ret = guc_action_enable_usage_stats(guc); 1445 1444 1446 1445 if (ret) 1447 - drm_err(&gt->i915->drm, 1448 - "Failed to enable usage stats: %d!\n", ret); 1446 + guc_err(guc, "Failed to enable usage stats: %pe\n", ERR_PTR(ret)); 1449 1447 } 1450 1448 } 1451 1449 ··· 1702 1702 goto next_context; 1703 1703 1704 1704 guilty = false; 1705 - rq = intel_context_find_active_request(ce); 1705 + rq = intel_context_get_active_request(ce); 1706 1706 if (!rq) { 1707 1707 head = ce->ring->tail; 1708 1708 goto out_replay; ··· 1715 1715 head = intel_ring_wrap(ce->ring, rq->head); 1716 1716 1717 1717 __i915_request_reset(rq, guilty); 1718 + i915_request_put(rq); 1718 1719 out_replay: 1719 1720 guc_reset_state(ce, head, guilty); 1720 1721 next_context: ··· 3586 3585 intel_context_sched_disable_unpin(ce); 3587 3586 else if (intel_context_is_closed(ce)) 3588 3587 if (wait_for(context_close_done(ce), 1500)) 3589 - drm_warn(&guc_to_gt(guc)->i915->drm, 3590 - "timed out waiting on context sched close before realloc\n"); 3588 + guc_warn(guc, "timed out waiting on context sched close before realloc\n"); 3591 3589 /* 3592 3590 * Call pin_guc_id here rather than in the pinning step as with 3593 3591 * dma_resv, contexts can be repeatedly pinned / unpinned trashing the ··· 4349 4349 4350 4350 ret = intel_guc_send(guc, (u32 *)&policy->h2g, 4351 4351 __guc_scheduling_policy_action_size(policy)); 4352 - if (ret < 0) 4352 + if (ret < 0) { 4353 + guc_probe_error(guc, "Failed to configure global scheduling policies: %pe!\n", 4354 + ERR_PTR(ret)); 4353 4355 return ret; 4356 + } 4354 4357 4355 4358 if (ret != policy->count) { 4356 - drm_warn(&guc_to_gt(guc)->i915->drm, "GuC global scheduler policy processed %d of %d KLVs!", 4359 + guc_warn(guc, "global scheduler policy processed %d of %d KLVs!", 4357 4360 ret, policy->count); 4358 4361 if (ret > policy->count) 4359 4362 return -EPROTO; ··· 4370 4367 struct scheduling_policy policy; 4371 4368 struct intel_gt *gt = guc_to_gt(guc); 4372 4369 intel_wakeref_t wakeref; 4373 - int ret = 0; 4370 + int ret; 4374 4371 4375 4372 if (GUC_SUBMIT_VER(guc) < MAKE_GUC_VER(1, 1, 0)) 4376 4373 return 0; ··· 4388 4385 yield, ARRAY_SIZE(yield)); 4389 4386 4390 4387 ret = __guc_action_set_scheduling_policies(guc, &policy); 4391 - if (ret) 4392 - i915_probe_error(gt->i915, 4393 - "Failed to configure global scheduling policies: %pe!\n", 4394 - ERR_PTR(ret)); 4395 4388 } 4396 4389 4397 4390 return ret; ··· 4486 4487 struct intel_context *ce; 4487 4488 4488 4489 if (unlikely(ctx_id >= GUC_MAX_CONTEXT_ID)) { 4489 - drm_err(&guc_to_gt(guc)->i915->drm, 4490 - "Invalid ctx_id %u\n", ctx_id); 4490 + guc_err(guc, "Invalid ctx_id %u\n", ctx_id); 4491 4491 return NULL; 4492 4492 } 4493 4493 4494 4494 ce = __get_context(guc, ctx_id); 4495 4495 if (unlikely(!ce)) { 4496 - drm_err(&guc_to_gt(guc)->i915->drm, 4497 - "Context is NULL, ctx_id %u\n", ctx_id); 4496 + guc_err(guc, "Context is NULL, ctx_id %u\n", ctx_id); 4498 4497 return NULL; 4499 4498 } 4500 4499 4501 4500 if (unlikely(intel_context_is_child(ce))) { 4502 - drm_err(&guc_to_gt(guc)->i915->drm, 4503 - "Context is child, ctx_id %u\n", ctx_id); 4501 + guc_err(guc, "Context is child, ctx_id %u\n", ctx_id); 4504 4502 return NULL; 4505 4503 } 4506 4504 ··· 4512 4516 u32 ctx_id; 4513 4517 4514 4518 if (unlikely(len < 1)) { 4515 - drm_err(&guc_to_gt(guc)->i915->drm, "Invalid length %u\n", len); 4519 + guc_err(guc, "Invalid length %u\n", len); 4516 4520 return -EPROTO; 4517 4521 } 4518 4522 ctx_id = msg[0]; ··· 4564 4568 u32 ctx_id; 4565 4569 4566 4570 if (unlikely(len < 2)) { 4567 - drm_err(&guc_to_gt(guc)->i915->drm, "Invalid length %u\n", len); 4571 + guc_err(guc, "Invalid length %u\n", len); 4568 4572 return -EPROTO; 4569 4573 } 4570 4574 ctx_id = msg[0]; ··· 4576 4580 if (unlikely(context_destroyed(ce) || 4577 4581 (!context_pending_enable(ce) && 4578 4582 !context_pending_disable(ce)))) { 4579 - drm_err(&guc_to_gt(guc)->i915->drm, 4580 - "Bad context sched_state 0x%x, ctx_id %u\n", 4583 + guc_err(guc, "Bad context sched_state 0x%x, ctx_id %u\n", 4581 4584 ce->guc_state.sched_state, ctx_id); 4582 4585 return -EPROTO; 4583 4586 } ··· 4660 4665 { 4661 4666 trace_intel_context_reset(ce); 4662 4667 4668 + drm_dbg(&guc_to_gt(guc)->i915->drm, "Got GuC reset of 0x%04X, exiting = %d, banned = %d\n", 4669 + ce->guc_id.id, test_bit(CONTEXT_EXITING, &ce->flags), 4670 + test_bit(CONTEXT_BANNED, &ce->flags)); 4671 + 4663 4672 if (likely(intel_context_is_schedulable(ce))) { 4664 4673 capture_error_state(guc, ce); 4665 4674 guc_context_replay(ce); 4666 4675 } else { 4667 - drm_info(&guc_to_gt(guc)->i915->drm, 4668 - "Ignoring context reset notification of exiting context 0x%04X on %s", 4676 + guc_info(guc, "Ignoring context reset notification of exiting context 0x%04X on %s", 4669 4677 ce->guc_id.id, ce->engine->name); 4670 4678 } 4671 4679 } ··· 4681 4683 int ctx_id; 4682 4684 4683 4685 if (unlikely(len != 1)) { 4684 - drm_err(&guc_to_gt(guc)->i915->drm, "Invalid length %u", len); 4686 + guc_err(guc, "Invalid length %u", len); 4685 4687 return -EPROTO; 4686 4688 } 4687 4689 ··· 4714 4716 u32 status; 4715 4717 4716 4718 if (unlikely(len != 1)) { 4717 - drm_dbg(&guc_to_gt(guc)->i915->drm, "Invalid length %u", len); 4719 + guc_dbg(guc, "Invalid length %u", len); 4718 4720 return -EPROTO; 4719 4721 } 4720 4722 4721 4723 status = msg[0] & INTEL_GUC_STATE_CAPTURE_EVENT_STATUS_MASK; 4722 4724 if (status == INTEL_GUC_STATE_CAPTURE_EVENT_STATUS_NOSPACE) 4723 - drm_warn(&guc_to_gt(guc)->i915->drm, "G2H-Error capture no space"); 4725 + guc_warn(guc, "No space for error capture"); 4724 4726 4725 4727 intel_guc_capture_process(guc); 4726 4728 ··· 4752 4754 guc->submission_state.reset_fail_mask = 0; 4753 4755 spin_unlock_irqrestore(&guc->submission_state.lock, flags); 4754 4756 4755 - if (likely(reset_fail_mask)) 4757 + if (likely(reset_fail_mask)) { 4758 + struct intel_engine_cs *engine; 4759 + enum intel_engine_id id; 4760 + 4761 + /* 4762 + * GuC is toast at this point - it dead loops after sending the failed 4763 + * reset notification. So need to manually determine the guilty context. 4764 + * Note that it should be reliable to do this here because the GuC is 4765 + * toast and will not be scheduling behind the KMD's back. 4766 + */ 4767 + for_each_engine_masked(engine, gt, reset_fail_mask, id) 4768 + intel_guc_find_hung_context(engine); 4769 + 4756 4770 intel_gt_handle_error(gt, reset_fail_mask, 4757 4771 I915_ERROR_CAPTURE, 4758 - "GuC failed to reset engine mask=0x%x\n", 4772 + "GuC failed to reset engine mask=0x%x", 4759 4773 reset_fail_mask); 4774 + } 4760 4775 } 4761 4776 4762 4777 int intel_guc_engine_failure_process_msg(struct intel_guc *guc, 4763 4778 const u32 *msg, u32 len) 4764 4779 { 4765 4780 struct intel_engine_cs *engine; 4766 - struct intel_gt *gt = guc_to_gt(guc); 4767 4781 u8 guc_class, instance; 4768 4782 u32 reason; 4769 4783 unsigned long flags; 4770 4784 4771 4785 if (unlikely(len != 3)) { 4772 - drm_err(&gt->i915->drm, "Invalid length %u", len); 4786 + guc_err(guc, "Invalid length %u", len); 4773 4787 return -EPROTO; 4774 4788 } 4775 4789 ··· 4791 4781 4792 4782 engine = intel_guc_lookup_engine(guc, guc_class, instance); 4793 4783 if (unlikely(!engine)) { 4794 - drm_err(&gt->i915->drm, 4795 - "Invalid engine %d:%d", guc_class, instance); 4784 + guc_err(guc, "Invalid engine %d:%d", guc_class, instance); 4796 4785 return -EPROTO; 4797 4786 } 4798 4787 ··· 4799 4790 * This is an unexpected failure of a hardware feature. So, log a real 4800 4791 * error message not just the informational that comes with the reset. 4801 4792 */ 4802 - drm_err(&gt->i915->drm, "GuC engine reset request failed on %d:%d (%s) because 0x%08X", 4793 + guc_err(guc, "Engine reset failed on %d:%d (%s) because 0x%08X", 4803 4794 guc_class, instance, engine->name, reason); 4804 4795 4805 4796 spin_lock_irqsave(&guc->submission_state.lock, flags); ··· 4829 4820 4830 4821 xa_lock_irqsave(&guc->context_lookup, flags); 4831 4822 xa_for_each(&guc->context_lookup, index, ce) { 4823 + bool found; 4824 + 4832 4825 if (!kref_get_unless_zero(&ce->ref)) 4833 4826 continue; 4834 4827 ··· 4847 4836 goto next; 4848 4837 } 4849 4838 4839 + found = false; 4840 + spin_lock(&ce->guc_state.lock); 4850 4841 list_for_each_entry(rq, &ce->guc_state.requests, sched.link) { 4851 4842 if (i915_test_request_state(rq) != I915_REQUEST_ACTIVE) 4852 4843 continue; 4853 4844 4845 + found = true; 4846 + break; 4847 + } 4848 + spin_unlock(&ce->guc_state.lock); 4849 + 4850 + if (found) { 4854 4851 intel_engine_set_hung_context(engine, ce); 4855 4852 4856 4853 /* Can only cope with one hang at a time... */ ··· 4866 4847 xa_lock(&guc->context_lookup); 4867 4848 goto done; 4868 4849 } 4850 + 4869 4851 next: 4870 4852 intel_context_put(ce); 4871 4853 xa_lock(&guc->context_lookup); ··· 5362 5342 5363 5343 GEM_BUG_ON(!is_power_of_2(sibling->mask)); 5364 5344 if (sibling->mask & ve->base.mask) { 5365 - DRM_DEBUG("duplicate %s entry in load balancer\n", 5366 - sibling->name); 5345 + guc_dbg(guc, "duplicate %s entry in load balancer\n", 5346 + sibling->name); 5367 5347 err = -EINVAL; 5368 5348 goto err_put; 5369 5349 } ··· 5372 5352 ve->base.logical_mask |= sibling->logical_mask; 5373 5353 5374 5354 if (n != 0 && ve->base.class != sibling->class) { 5375 - DRM_DEBUG("invalid mixing of engine class, sibling %d, already %d\n", 5376 - sibling->class, ve->base.class); 5355 + guc_dbg(guc, "invalid mixing of engine class, sibling %d, already %d\n", 5356 + sibling->class, ve->base.class); 5377 5357 err = -EINVAL; 5378 5358 goto err_put; 5379 5359 } else if (n == 0) {
+39 -41
drivers/gpu/drm/i915/gt/uc/intel_uc.c
··· 6 6 #include <linux/string_helpers.h> 7 7 8 8 #include "gt/intel_gt.h" 9 + #include "gt/intel_gt_print.h" 9 10 #include "gt/intel_reset.h" 10 11 #include "intel_gsc_fw.h" 11 12 #include "intel_gsc_uc.h" 12 13 #include "intel_guc.h" 13 14 #include "intel_guc_ads.h" 15 + #include "intel_guc_print.h" 14 16 #include "intel_guc_submission.h" 15 17 #include "gt/intel_rps.h" 16 18 #include "intel_uc.h" ··· 69 67 70 68 ret = intel_reset_guc(gt); 71 69 if (ret) { 72 - DRM_ERROR("Failed to reset GuC, ret = %d\n", ret); 70 + gt_err(gt, "Failed to reset GuC, ret = %d\n", ret); 73 71 return ret; 74 72 } 75 73 76 74 guc_status = intel_uncore_read(gt->uncore, GUC_STATUS); 77 - WARN(!(guc_status & GS_MIA_IN_RESET), 78 - "GuC status: 0x%x, MIA core expected to be in reset\n", 79 - guc_status); 75 + gt_WARN(gt, !(guc_status & GS_MIA_IN_RESET), 76 + "GuC status: 0x%x, MIA core expected to be in reset\n", 77 + guc_status); 80 78 81 79 return ret; 82 80 } ··· 254 252 intel_guc_ct_event_handler(&guc->ct); 255 253 spin_unlock_irq(gt->irq_lock); 256 254 257 - drm_dbg(&i915->drm, "GuC communication enabled\n"); 255 + guc_dbg(guc, "communication enabled\n"); 258 256 259 257 return 0; 260 258 } 261 259 262 260 static void guc_disable_communication(struct intel_guc *guc) 263 261 { 264 - struct drm_i915_private *i915 = guc_to_gt(guc)->i915; 265 - 266 262 /* 267 263 * Events generated during or after CT disable are logged by guc in 268 264 * via mmio. Make sure the register is clear before disabling CT since ··· 280 280 */ 281 281 guc_get_mmio_msg(guc); 282 282 283 - drm_dbg(&i915->drm, "GuC communication disabled\n"); 283 + guc_dbg(guc, "communication disabled\n"); 284 284 } 285 285 286 286 static void __uc_fetch_firmwares(struct intel_uc *uc) 287 287 { 288 + struct intel_gt *gt = uc_to_gt(uc); 288 289 int err; 289 290 290 291 GEM_BUG_ON(!intel_uc_wants_guc(uc)); ··· 294 293 if (err) { 295 294 /* Make sure we transition out of transient "SELECTED" state */ 296 295 if (intel_uc_wants_huc(uc)) { 297 - drm_dbg(&uc_to_gt(uc)->i915->drm, 298 - "Failed to fetch GuC: %d disabling HuC\n", err); 296 + gt_dbg(gt, "Failed to fetch GuC fw (%pe) disabling HuC\n", ERR_PTR(err)); 299 297 intel_uc_fw_change_status(&uc->huc.fw, 300 298 INTEL_UC_FIRMWARE_ERROR); 301 299 } 302 300 303 301 if (intel_uc_wants_gsc_uc(uc)) { 304 - drm_dbg(&uc_to_gt(uc)->i915->drm, 305 - "Failed to fetch GuC: %d disabling GSC\n", err); 302 + gt_dbg(gt, "Failed to fetch GuC fw (%pe) disabling GSC\n", ERR_PTR(err)); 306 303 intel_uc_fw_change_status(&uc->gsc.fw, 307 304 INTEL_UC_FIRMWARE_ERROR); 308 305 } ··· 381 382 int err; 382 383 383 384 if (unlikely(!base || !size)) { 384 - i915_probe_error(gt->i915, "Unsuccessful WOPCM partitioning\n"); 385 + gt_probe_error(gt, "Unsuccessful WOPCM partitioning\n"); 385 386 return -E2BIG; 386 387 } 387 388 ··· 412 413 return 0; 413 414 414 415 err_out: 415 - i915_probe_error(gt->i915, "Failed to init uC WOPCM registers!\n"); 416 - i915_probe_error(gt->i915, "%s(%#x)=%#x\n", "DMA_GUC_WOPCM_OFFSET", 417 - i915_mmio_reg_offset(DMA_GUC_WOPCM_OFFSET), 418 - intel_uncore_read(uncore, DMA_GUC_WOPCM_OFFSET)); 419 - i915_probe_error(gt->i915, "%s(%#x)=%#x\n", "GUC_WOPCM_SIZE", 420 - i915_mmio_reg_offset(GUC_WOPCM_SIZE), 421 - intel_uncore_read(uncore, GUC_WOPCM_SIZE)); 416 + gt_probe_error(gt, "Failed to init uC WOPCM registers!\n"); 417 + gt_probe_error(gt, "%s(%#x)=%#x\n", "DMA_GUC_WOPCM_OFFSET", 418 + i915_mmio_reg_offset(DMA_GUC_WOPCM_OFFSET), 419 + intel_uncore_read(uncore, DMA_GUC_WOPCM_OFFSET)); 420 + gt_probe_error(gt, "%s(%#x)=%#x\n", "GUC_WOPCM_SIZE", 421 + i915_mmio_reg_offset(GUC_WOPCM_SIZE), 422 + intel_uncore_read(uncore, GUC_WOPCM_SIZE)); 422 423 423 424 return err; 424 425 } ··· 448 449 return 0; 449 450 } 450 451 451 - static void print_fw_ver(struct intel_uc *uc, struct intel_uc_fw *fw) 452 + static void print_fw_ver(struct intel_gt *gt, struct intel_uc_fw *fw) 452 453 { 453 - struct drm_i915_private *i915 = uc_to_gt(uc)->i915; 454 - 455 - drm_info(&i915->drm, "%s firmware %s version %u.%u.%u\n", 456 - intel_uc_fw_type_repr(fw->type), fw->file_selected.path, 457 - fw->file_selected.ver.major, 458 - fw->file_selected.ver.minor, 459 - fw->file_selected.ver.patch); 454 + gt_info(gt, "%s firmware %s version %u.%u.%u\n", 455 + intel_uc_fw_type_repr(fw->type), fw->file_selected.path, 456 + fw->file_selected.ver.major, 457 + fw->file_selected.ver.minor, 458 + fw->file_selected.ver.patch); 460 459 } 461 460 462 461 static int __uc_init_hw(struct intel_uc *uc) 463 462 { 464 - struct drm_i915_private *i915 = uc_to_gt(uc)->i915; 463 + struct intel_gt *gt = uc_to_gt(uc); 464 + struct drm_i915_private *i915 = gt->i915; 465 465 struct intel_guc *guc = &uc->guc; 466 466 struct intel_huc *huc = &uc->huc; 467 467 int ret, attempts; ··· 468 470 GEM_BUG_ON(!intel_uc_supports_guc(uc)); 469 471 GEM_BUG_ON(!intel_uc_wants_guc(uc)); 470 472 471 - print_fw_ver(uc, &guc->fw); 473 + print_fw_ver(gt, &guc->fw); 472 474 473 475 if (intel_uc_uses_huc(uc)) 474 - print_fw_ver(uc, &huc->fw); 476 + print_fw_ver(gt, &huc->fw); 475 477 476 478 if (!intel_uc_fw_is_loadable(&guc->fw)) { 477 479 ret = __uc_check_hw(uc) || ··· 512 514 if (ret == 0) 513 515 break; 514 516 515 - DRM_DEBUG_DRIVER("GuC fw load failed: %d; will reset and " 516 - "retry %d more time(s)\n", ret, attempts); 517 + gt_dbg(gt, "GuC fw load failed (%pe) will reset and retry %d more time(s)\n", 518 + ERR_PTR(ret), attempts); 517 519 } 518 520 519 521 /* Did we succeded or run out of retries? */ ··· 549 551 550 552 intel_gsc_uc_load_start(&uc->gsc); 551 553 552 - drm_info(&i915->drm, "GuC submission %s\n", 553 - str_enabled_disabled(intel_uc_uses_guc_submission(uc))); 554 - drm_info(&i915->drm, "GuC SLPC %s\n", 555 - str_enabled_disabled(intel_uc_uses_guc_slpc(uc))); 554 + gt_info(gt, "GuC submission %s\n", 555 + str_enabled_disabled(intel_uc_uses_guc_submission(uc))); 556 + gt_info(gt, "GuC SLPC %s\n", 557 + str_enabled_disabled(intel_uc_uses_guc_slpc(uc))); 556 558 557 559 return 0; 558 560 ··· 570 572 __uc_sanitize(uc); 571 573 572 574 if (!ret) { 573 - drm_notice(&i915->drm, "GuC is uninitialized\n"); 575 + gt_notice(gt, "GuC is uninitialized\n"); 574 576 /* We want to run without GuC submission */ 575 577 return 0; 576 578 } 577 579 578 - i915_probe_error(i915, "GuC initialization failed %d\n", ret); 580 + gt_probe_error(gt, "GuC initialization failed %pe\n", ERR_PTR(ret)); 579 581 580 582 /* We want to keep KMS alive */ 581 583 return -EIO; ··· 688 690 with_intel_runtime_pm(&uc_to_gt(uc)->i915->runtime_pm, wakeref) { 689 691 err = intel_guc_suspend(guc); 690 692 if (err) 691 - DRM_DEBUG_DRIVER("Failed to suspend GuC, err=%d", err); 693 + guc_dbg(guc, "Failed to suspend, %pe", ERR_PTR(err)); 692 694 } 693 695 } 694 696 ··· 716 718 717 719 err = intel_guc_resume(guc); 718 720 if (err) { 719 - DRM_DEBUG_DRIVER("Failed to resume GuC, err=%d", err); 721 + guc_dbg(guc, "Failed to resume, %pe", ERR_PTR(err)); 720 722 return err; 721 723 } 722 724
+4
drivers/gpu/drm/i915/i915_drv.h
··· 696 696 (IS_METEORLAKE(__i915) && \ 697 697 IS_DISPLAY_STEP(__i915, since, until)) 698 698 699 + #define IS_MTL_MEDIA_STEP(__i915, since, until) \ 700 + (IS_METEORLAKE(__i915) && \ 701 + IS_MEDIA_STEP(__i915, since, until)) 702 + 699 703 /* 700 704 * DG2 hardware steppings are a bit unusual. The hardware design was forked to 701 705 * create three variants (G10, G11, and G12) which each have distinct
+47 -45
drivers/gpu/drm/i915/i915_gpu_error.c
··· 1370 1370 } 1371 1371 1372 1372 static bool record_context(struct i915_gem_context_coredump *e, 1373 - const struct i915_request *rq) 1373 + struct intel_context *ce) 1374 1374 { 1375 1375 struct i915_gem_context *ctx; 1376 1376 struct task_struct *task; 1377 1377 bool simulated; 1378 1378 1379 1379 rcu_read_lock(); 1380 - ctx = rcu_dereference(rq->context->gem_context); 1380 + ctx = rcu_dereference(ce->gem_context); 1381 1381 if (ctx && !kref_get_unless_zero(&ctx->ref)) 1382 1382 ctx = NULL; 1383 1383 rcu_read_unlock(); ··· 1396 1396 e->guilty = atomic_read(&ctx->guilty_count); 1397 1397 e->active = atomic_read(&ctx->active_count); 1398 1398 1399 - e->total_runtime = intel_context_get_total_runtime_ns(rq->context); 1400 - e->avg_runtime = intel_context_get_avg_runtime_ns(rq->context); 1399 + e->total_runtime = intel_context_get_total_runtime_ns(ce); 1400 + e->avg_runtime = intel_context_get_avg_runtime_ns(ce); 1401 1401 1402 1402 simulated = i915_gem_context_no_error_capture(ctx); 1403 1403 ··· 1532 1532 return ee; 1533 1533 } 1534 1534 1535 + static struct intel_engine_capture_vma * 1536 + engine_coredump_add_context(struct intel_engine_coredump *ee, 1537 + struct intel_context *ce, 1538 + gfp_t gfp) 1539 + { 1540 + struct intel_engine_capture_vma *vma = NULL; 1541 + 1542 + ee->simulated |= record_context(&ee->context, ce); 1543 + if (ee->simulated) 1544 + return NULL; 1545 + 1546 + /* 1547 + * We need to copy these to an anonymous buffer 1548 + * as the simplest method to avoid being overwritten 1549 + * by userspace. 1550 + */ 1551 + vma = capture_vma(vma, ce->ring->vma, "ring", gfp); 1552 + vma = capture_vma(vma, ce->state, "HW context", gfp); 1553 + 1554 + return vma; 1555 + } 1556 + 1535 1557 struct intel_engine_capture_vma * 1536 1558 intel_engine_coredump_add_request(struct intel_engine_coredump *ee, 1537 1559 struct i915_request *rq, 1538 1560 gfp_t gfp) 1539 1561 { 1540 - struct intel_engine_capture_vma *vma = NULL; 1562 + struct intel_engine_capture_vma *vma; 1541 1563 1542 - ee->simulated |= record_context(&ee->context, rq); 1543 - if (ee->simulated) 1564 + vma = engine_coredump_add_context(ee, rq->context, gfp); 1565 + if (!vma) 1544 1566 return NULL; 1545 1567 1546 1568 /* ··· 1572 1550 */ 1573 1551 vma = capture_vma_snapshot(vma, rq->batch_res, gfp, "batch"); 1574 1552 vma = capture_user(vma, rq, gfp); 1575 - vma = capture_vma(vma, rq->ring->vma, "ring", gfp); 1576 - vma = capture_vma(vma, rq->context->state, "HW context", gfp); 1577 1553 1578 1554 ee->rq_head = rq->head; 1579 1555 ee->rq_post = rq->postfix; ··· 1616 1596 { 1617 1597 struct intel_engine_capture_vma *capture = NULL; 1618 1598 struct intel_engine_coredump *ee; 1619 - struct intel_context *ce; 1599 + struct intel_context *ce = NULL; 1620 1600 struct i915_request *rq = NULL; 1621 - unsigned long flags; 1622 1601 1623 1602 ee = intel_engine_coredump_alloc(engine, ALLOW_FAIL, dump_flags); 1624 1603 if (!ee) 1625 1604 return NULL; 1626 1605 1627 - ce = intel_engine_get_hung_context(engine); 1628 - if (ce) { 1629 - intel_engine_clear_hung_context(engine); 1630 - rq = intel_context_find_active_request(ce); 1631 - if (!rq || !i915_request_started(rq)) 1632 - goto no_request_capture; 1633 - } else { 1634 - /* 1635 - * Getting here with GuC enabled means it is a forced error capture 1636 - * with no actual hang. So, no need to attempt the execlist search. 1637 - */ 1638 - if (!intel_uc_uses_guc_submission(&engine->gt->uc)) { 1639 - spin_lock_irqsave(&engine->sched_engine->lock, flags); 1640 - rq = intel_engine_execlist_find_hung_request(engine); 1641 - spin_unlock_irqrestore(&engine->sched_engine->lock, 1642 - flags); 1643 - } 1644 - } 1645 - if (rq) 1646 - rq = i915_request_get_rcu(rq); 1606 + intel_engine_get_hung_entity(engine, &ce, &rq); 1607 + if (rq && !i915_request_started(rq)) 1608 + drm_info(&engine->gt->i915->drm, "Got hung context on %s with active request %lld:%lld [0x%04X] not yet started\n", 1609 + engine->name, rq->fence.context, rq->fence.seqno, ce->guc_id.id); 1647 1610 1648 - if (!rq) 1649 - goto no_request_capture; 1650 - 1651 - capture = intel_engine_coredump_add_request(ee, rq, ATOMIC_MAYFAIL); 1652 - if (!capture) { 1611 + if (rq) { 1612 + capture = intel_engine_coredump_add_request(ee, rq, ATOMIC_MAYFAIL); 1653 1613 i915_request_put(rq); 1654 - goto no_request_capture; 1614 + } else if (ce) { 1615 + capture = engine_coredump_add_context(ee, ce, ATOMIC_MAYFAIL); 1655 1616 } 1656 - if (dump_flags & CORE_DUMP_FLAG_IS_GUC_CAPTURE) 1657 - intel_guc_capture_get_matching_node(engine->gt, ee, ce); 1658 1617 1659 - intel_engine_coredump_add_vma(ee, capture, compress); 1660 - i915_request_put(rq); 1618 + if (capture) { 1619 + intel_engine_coredump_add_vma(ee, capture, compress); 1620 + 1621 + if (dump_flags & CORE_DUMP_FLAG_IS_GUC_CAPTURE) 1622 + intel_guc_capture_get_matching_node(engine->gt, ee, ce); 1623 + } else { 1624 + kfree(ee); 1625 + ee = NULL; 1626 + } 1661 1627 1662 1628 return ee; 1663 - 1664 - no_request_capture: 1665 - kfree(ee); 1666 - return NULL; 1667 1629 } 1668 1630 1669 1631 static void
+1 -1
drivers/gpu/drm/i915/i915_gpu_error.h
··· 94 94 struct intel_instdone instdone; 95 95 96 96 /* GuC matched capture-lists info */ 97 - struct intel_guc_state_capture *capture; 97 + struct intel_guc_state_capture *guc_capture; 98 98 struct __guc_capture_parsed_output *guc_capture_node; 99 99 100 100 struct i915_gem_context_coredump {
-4
drivers/gpu/drm/i915/i915_reg.h
··· 8114 8114 #define CLKGATE_DIS_MISC _MMIO(0x46534) 8115 8115 #define CLKGATE_DIS_MISC_DMASC_GATING_DIS REG_BIT(21) 8116 8116 8117 - #define GEN12_CULLBIT1 _MMIO(0x6100) 8118 - #define GEN12_CULLBIT2 _MMIO(0x7030) 8119 - #define GEN12_STATE_ACK_DEBUG _MMIO(0x20BC) 8120 - 8121 8117 #define _MTL_CLKGATE_DIS_TRANS_A 0x604E8 8122 8118 #define _MTL_CLKGATE_DIS_TRANS_B 0x614E8 8123 8119 #define MTL_CLKGATE_DIS_TRANS(trans) _MMIO_TRANS2(trans, _MTL_CLKGATE_DIS_TRANS_A)
+17 -11
drivers/gpu/drm/i915/selftests/igt_flush_test.c
··· 14 14 15 15 int igt_flush_test(struct drm_i915_private *i915) 16 16 { 17 - struct intel_gt *gt = to_gt(i915); 18 - int ret = intel_gt_is_wedged(gt) ? -EIO : 0; 17 + struct intel_gt *gt; 18 + unsigned int i; 19 + int ret = 0; 19 20 20 - cond_resched(); 21 + for_each_gt(gt, i915, i) { 22 + if (intel_gt_is_wedged(gt)) 23 + ret = -EIO; 21 24 22 - if (intel_gt_wait_for_idle(gt, HZ * 3) == -ETIME) { 23 - pr_err("%pS timed out, cancelling all further testing.\n", 24 - __builtin_return_address(0)); 25 + cond_resched(); 25 26 26 - GEM_TRACE("%pS timed out.\n", 27 - __builtin_return_address(0)); 28 - GEM_TRACE_DUMP(); 27 + if (intel_gt_wait_for_idle(gt, HZ * 3) == -ETIME) { 28 + pr_err("%pS timed out, cancelling all further testing.\n", 29 + __builtin_return_address(0)); 29 30 30 - intel_gt_set_wedged(gt); 31 - ret = -EIO; 31 + GEM_TRACE("%pS timed out.\n", 32 + __builtin_return_address(0)); 33 + GEM_TRACE_DUMP(); 34 + 35 + intel_gt_set_wedged(gt); 36 + ret = -EIO; 37 + } 32 38 } 33 39 34 40 return ret;