mirror of
https://github.com/torvalds/linux.git
synced 2026-05-05 06:52:34 -04:00
drm/i915/selftest: Fix workarounds selftest for GuC submission
When GuC submission is enabled, the GuC controls engine resets. Rather than explicitly triggering a reset, the driver must submit a hanging context to GuC and wait for the reset to occur. Signed-off-by: Rahul Kumar Singh <rahul.kumar.singh@intel.com> Signed-off-by: John Harrison <John.C.Harrison@Intel.com> Signed-off-by: Matthew Brost <matthew.brost@intel.com> Cc: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com> Cc: Matthew Brost <matthew.brost@intel.com> Reviewed-by: Matthew Brost <matthew.brost@intel.com> Signed-off-by: John Harrison <John.C.Harrison@Intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20210727002348.97202-28-matthew.brost@intel.com
This commit is contained in:
committed by
John Harrison
parent
3f5dff6c18
commit
3a4bfa091c
75
drivers/gpu/drm/i915/selftests/intel_scheduler_helpers.c
Normal file
75
drivers/gpu/drm/i915/selftests/intel_scheduler_helpers.c
Normal file
@@ -0,0 +1,75 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
/*
|
||||
* Copyright © 2021 Intel Corporation
|
||||
*/
|
||||
|
||||
//#include "gt/intel_engine_user.h"
|
||||
#include "gt/intel_gt.h"
|
||||
#include "i915_drv.h"
|
||||
#include "i915_selftest.h"
|
||||
|
||||
#include "selftests/intel_scheduler_helpers.h"
|
||||
|
||||
#define REDUCED_TIMESLICE 5
|
||||
#define REDUCED_PREEMPT 10
|
||||
#define WAIT_FOR_RESET_TIME 1000
|
||||
|
||||
int intel_selftest_modify_policy(struct intel_engine_cs *engine,
|
||||
struct intel_selftest_saved_policy *saved)
|
||||
|
||||
{
|
||||
int err;
|
||||
|
||||
saved->reset = engine->i915->params.reset;
|
||||
saved->flags = engine->flags;
|
||||
saved->timeslice = engine->props.timeslice_duration_ms;
|
||||
saved->preempt_timeout = engine->props.preempt_timeout_ms;
|
||||
|
||||
/*
|
||||
* Enable force pre-emption on time slice expiration
|
||||
* together with engine reset on pre-emption timeout.
|
||||
* This is required to make the GuC notice and reset
|
||||
* the single hanging context.
|
||||
* Also, reduce the preemption timeout to something
|
||||
* small to speed the test up.
|
||||
*/
|
||||
engine->i915->params.reset = 2;
|
||||
engine->flags |= I915_ENGINE_WANT_FORCED_PREEMPTION;
|
||||
engine->props.timeslice_duration_ms = REDUCED_TIMESLICE;
|
||||
engine->props.preempt_timeout_ms = REDUCED_PREEMPT;
|
||||
|
||||
if (!intel_engine_uses_guc(engine))
|
||||
return 0;
|
||||
|
||||
err = intel_guc_global_policies_update(&engine->gt->uc.guc);
|
||||
if (err)
|
||||
intel_selftest_restore_policy(engine, saved);
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
int intel_selftest_restore_policy(struct intel_engine_cs *engine,
|
||||
struct intel_selftest_saved_policy *saved)
|
||||
{
|
||||
/* Restore the original policies */
|
||||
engine->i915->params.reset = saved->reset;
|
||||
engine->flags = saved->flags;
|
||||
engine->props.timeslice_duration_ms = saved->timeslice;
|
||||
engine->props.preempt_timeout_ms = saved->preempt_timeout;
|
||||
|
||||
if (!intel_engine_uses_guc(engine))
|
||||
return 0;
|
||||
|
||||
return intel_guc_global_policies_update(&engine->gt->uc.guc);
|
||||
}
|
||||
|
||||
int intel_selftest_wait_for_rq(struct i915_request *rq)
|
||||
{
|
||||
long ret;
|
||||
|
||||
ret = i915_request_wait(rq, 0, WAIT_FOR_RESET_TIME);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user