Skip to content

Commit a1c5a7b

Browse files
ickle-intelrodrigovivi
authored andcommitted
drm/i915/gt: Serialize TLB invalidates with GT resets
Avoid trying to invalidate the TLB in the middle of performing an engine reset, as this may result in the reset timing out. Currently, the TLB invalidate is only serialised by its own mutex, forgoing the uncore lock, but we can take the uncore->lock as well to serialise the mmio access, thereby serialising with the GDRST. Tested on a NUC5i7RYB, BIOS RYBDWi35.86A.0380.2019.0517.1530 with i915 selftest/hangcheck. Cc: [email protected] # v4.4 and upper Fixes: 7938d61 ("drm/i915: Flush TLBs before releasing backing store") Reported-by: Mauro Carvalho Chehab <[email protected]> Tested-by: Mauro Carvalho Chehab <[email protected]> Reviewed-by: Mauro Carvalho Chehab <[email protected]> Signed-off-by: Chris Wilson <[email protected]> Cc: Tvrtko Ursulin <[email protected]> Reviewed-by: Andi Shyti <[email protected]> Acked-by: Thomas Hellström <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]> Signed-off-by: Rodrigo Vivi <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/1e59a7c45dd919a530256b9ac721ac6ea86c0677.1657639152.git.mchehab@kernel.org (cherry picked from commit 33da978) Signed-off-by: Rodrigo Vivi <[email protected]>
1 parent b24dcf1 commit a1c5a7b

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

drivers/gpu/drm/i915/gt/intel_gt.c

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1209,6 +1209,20 @@ void intel_gt_invalidate_tlbs(struct intel_gt *gt)
12091209
mutex_lock(&gt->tlb_invalidate_lock);
12101210
intel_uncore_forcewake_get(uncore, FORCEWAKE_ALL);
12111211

1212+
spin_lock_irq(&uncore->lock); /* serialise invalidate with GT reset */
1213+
1214+
for_each_engine(engine, gt, id) {
1215+
struct reg_and_bit rb;
1216+
1217+
rb = get_reg_and_bit(engine, regs == gen8_regs, regs, num);
1218+
if (!i915_mmio_reg_offset(rb.reg))
1219+
continue;
1220+
1221+
intel_uncore_write_fw(uncore, rb.reg, rb.bit);
1222+
}
1223+
1224+
spin_unlock_irq(&uncore->lock);
1225+
12121226
for_each_engine(engine, gt, id) {
12131227
/*
12141228
* HW architecture suggest typical invalidation time at 40us,
@@ -1223,7 +1237,6 @@ void intel_gt_invalidate_tlbs(struct intel_gt *gt)
12231237
if (!i915_mmio_reg_offset(rb.reg))
12241238
continue;
12251239

1226-
intel_uncore_write_fw(uncore, rb.reg, rb.bit);
12271240
if (__intel_wait_for_register_fw(uncore,
12281241
rb.reg, rb.bit, 0,
12291242
timeout_us, timeout_ms,

0 commit comments

Comments
 (0)