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

drm/i915/gt: Be paranoid and reset the GPU before release

Just in the very unlikely case we have not stopped the GPU before we
return the pages being used by the GPU to the system, force a reset.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Matthew Auld <matthew.auld@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200117180309.3249427-1-chris@chris-wilson.co.uk

+16
+16
drivers/gpu/drm/i915/gt/intel_engine_cs.c
··· 35 35 #include "intel_engine_user.h" 36 36 #include "intel_gt.h" 37 37 #include "intel_gt_requests.h" 38 + #include "intel_gt_pm.h" 38 39 #include "intel_lrc.h" 39 40 #include "intel_reset.h" 40 41 #include "intel_ring.h" ··· 393 392 struct intel_engine_cs *engine; 394 393 enum intel_engine_id id; 395 394 395 + /* 396 + * Before we release the resources held by engine, we must be certain 397 + * that the HW is no longer accessing them -- having the GPU scribble 398 + * to or read from a page being used for something else causes no end 399 + * of fun. 400 + * 401 + * The GPU should be reset by this point, but assume the worst just 402 + * in case we aborted before completely initialising the engines. 403 + */ 404 + GEM_BUG_ON(intel_gt_pm_is_awake(gt)); 405 + if (!INTEL_INFO(gt->i915)->gpu_reset_clobbers_display) 406 + __intel_gt_reset(gt, ALL_ENGINES); 407 + 396 408 /* Decouple the backend; but keep the layout for late GPU resets */ 397 409 for_each_engine(engine, gt, id) { 410 + GEM_BUG_ON(intel_engine_pm_is_awake(engine)); 411 + 398 412 if (!engine->release) 399 413 continue; 400 414