From: Tom O'Rourke <Tom.O'Rourke@xxxxxxxxx> Send SLPC shutdown event during disable, suspend, and reset operations. Sending shutdown event while already shutdown is OK. v1: Return void instead of ignored error code (Paulo) Removed WARN_ON for checking msb of gtt address of shared gem obj. (ChrisW) Added SLPC state update during disable, suspend and reset. Changed semantics of reset. It is supposed to just disable. (Sagar) v2-v4: Rebase. v5: Updated the input data structure. (Sagar) v6: Rebase. v7: s/i915_ggtt_offset/guc_ggtt_offset. v8: Updated the status check post disabling to wait for 20us. (Sagar) Signed-off-by: Tom O'Rourke <Tom.O'Rourke@xxxxxxxxx> Signed-off-by: Sagar Arun Kamble <sagar.a.kamble@xxxxxxxxx> --- drivers/gpu/drm/i915/intel_slpc.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/drivers/gpu/drm/i915/intel_slpc.c b/drivers/gpu/drm/i915/intel_slpc.c index 57e69d4..b0a17ef 100644 --- a/drivers/gpu/drm/i915/intel_slpc.c +++ b/drivers/gpu/drm/i915/intel_slpc.c @@ -427,6 +427,18 @@ static void host2guc_slpc_query_task_state(struct intel_slpc *slpc) host2guc_slpc(slpc, &data, 4); } +static void host2guc_slpc_shutdown(struct intel_slpc *slpc) +{ + struct slpc_event_input data = {0}; + u32 shared_data_gtt_offset = guc_ggtt_offset(slpc->vma); + + data.header.value = SLPC_EVENT(SLPC_EVENT_SHUTDOWN, 2); + data.args[0] = shared_data_gtt_offset; + data.args[1] = 0; + + host2guc_slpc(slpc, &data, 4); +} + void intel_slpc_query_task_state(struct intel_slpc *slpc) { if (slpc->active) @@ -598,6 +610,21 @@ void intel_slpc_tdr_reset(struct intel_slpc *slpc) slpc->tdr_reset = false; } +static bool intel_slpc_disabled(struct intel_slpc *slpc) +{ + struct slpc_shared_data data; + + intel_slpc_read_shared_data(slpc, &data); + return (data.global_state == SLPC_GLOBAL_STATE_NOT_RUNNING); +} + void intel_slpc_disable(struct intel_slpc *slpc) { + host2guc_slpc_shutdown(slpc); + + /* Ensure SLPC is not running prior to releasing Shared data */ + if (wait_for_us(intel_slpc_disabled(slpc), 20)) + WARN_ONCE(true, "SLPC shutdown failed\n"); + + slpc->active = false; } -- 1.9.1 _______________________________________________ Intel-gfx mailing list Intel-gfx@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/intel-gfx