drm/i915/selftests: Force a preemption hang
Inject a failure into preemption completion to pretend as if the HW didn't successfully handle preemption and we are forced to do a reset in the middle. v2: Wait for preemption, to force testing with the missed preemption. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20180716132154.12539-1-chris@chris-wilson.co.uk
This commit is contained in:
@@ -193,6 +193,11 @@ struct i915_priolist {
|
||||
int priority;
|
||||
};
|
||||
|
||||
struct st_preempt_hang {
|
||||
struct completion completion;
|
||||
bool inject_hang;
|
||||
};
|
||||
|
||||
/**
|
||||
* struct intel_engine_execlists - execlist submission queue and port state
|
||||
*
|
||||
@@ -333,6 +338,8 @@ struct intel_engine_execlists {
|
||||
* @csb_head: context status buffer head
|
||||
*/
|
||||
u8 csb_head;
|
||||
|
||||
I915_SELFTEST_DECLARE(struct st_preempt_hang preempt_hang;)
|
||||
};
|
||||
|
||||
#define INTEL_ENGINE_CS_MAX_NAME 8
|
||||
@@ -1155,4 +1162,24 @@ void intel_disable_engine_stats(struct intel_engine_cs *engine);
|
||||
|
||||
ktime_t intel_engine_get_busy_time(struct intel_engine_cs *engine);
|
||||
|
||||
#if IS_ENABLED(CONFIG_DRM_I915_SELFTEST)
|
||||
|
||||
static inline bool inject_preempt_hang(struct intel_engine_execlists *execlists)
|
||||
{
|
||||
if (!execlists->preempt_hang.inject_hang)
|
||||
return false;
|
||||
|
||||
complete(&execlists->preempt_hang.completion);
|
||||
return true;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
static inline bool inject_preempt_hang(struct intel_engine_execlists *execlists)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* _INTEL_RINGBUFFER_H_ */
|
||||
|
Reference in New Issue
Block a user