From patchwork Tue Sep 19 17:41:58 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: sagar.a.kamble@intel.com X-Patchwork-Id: 9959859 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id D619C601E9 for ; Tue, 19 Sep 2017 17:39:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C1B4E27F4B for ; Tue, 19 Sep 2017 17:39:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B6B3E28985; Tue, 19 Sep 2017 17:39:42 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 7433527F4B for ; Tue, 19 Sep 2017 17:39:42 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7D7136E60F; Tue, 19 Sep 2017 17:39:28 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by gabe.freedesktop.org (Postfix) with ESMTPS id 1A0946E640 for ; Tue, 19 Sep 2017 17:39:26 +0000 (UTC) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 19 Sep 2017 10:39:23 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos; i="5.42,418,1500966000"; d="scan'208"; a="1016261008" Received: from sakamble-desktop.iind.intel.com ([10.223.26.118]) by orsmga003.jf.intel.com with ESMTP; 19 Sep 2017 10:39:21 -0700 From: Sagar Arun Kamble To: intel-gfx@lists.freedesktop.org Date: Tue, 19 Sep 2017 23:11:58 +0530 Message-Id: <1505842927-13327-23-git-send-email-sagar.a.kamble@intel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1505842927-13327-1-git-send-email-sagar.a.kamble@intel.com> References: <1505842927-13327-1-git-send-email-sagar.a.kamble@intel.com> Cc: Tom O'Rourke Subject: [Intel-gfx] [PATCH 22/31] drm/i915/slpc: Send SHUTDOWN event X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP From: Tom O'Rourke 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 Signed-off-by: Sagar Arun Kamble --- 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; }