From patchwork Sun Nov 5 13:39:39 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: sagar.a.kamble@intel.com X-Patchwork-Id: 10042151 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 CCE576032D for ; Sun, 5 Nov 2017 13:36:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B6FB4291D6 for ; Sun, 5 Nov 2017 13:36:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A8E6A2957D; Sun, 5 Nov 2017 13:36:15 +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 22DE2291D6 for ; Sun, 5 Nov 2017 13:36:14 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A48076E0D6; Sun, 5 Nov 2017 13:36:13 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by gabe.freedesktop.org (Postfix) with ESMTPS id 90D6F6E0D6 for ; Sun, 5 Nov 2017 13:36:12 +0000 (UTC) Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 05 Nov 2017 05:36:11 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.44,347,1505804400"; d="scan'208";a="171707941" Received: from sakamble-desktop.iind.intel.com ([10.223.26.118]) by fmsmga005.fm.intel.com with ESMTP; 05 Nov 2017 05:36:09 -0800 From: Sagar Arun Kamble To: intel-gfx@lists.freedesktop.org Date: Sun, 5 Nov 2017 19:09:39 +0530 Message-Id: <1509889183-2094-1-git-send-email-sagar.a.kamble@intel.com> X-Mailer: git-send-email 1.9.1 MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH 1/5] drm/i915/guc: Separate GuC doorbell destroy function into doorbell unit and GuC task 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: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP Releasing GuC doorbell involves stopping the doorbell unit snooping and executing doorbell deallocation flow in GuC firmware. When GuC is in sane state, both steps will be necessary to release doorbell. If GuC is hung (possibly leading to i915 reset), only doorbell unit snooping is to be stopped. destroy_doorbell will be called in suspend and reset flows differently in upcoming patches. Signed-off-by: Sagar Arun Kamble Cc: Chris Wilson Cc: MichaƂ Winiarski Cc: Michel Thierry Cc: Michal Wajdeczko Cc: Arkadiusz Hiler Cc: Joonas Lahtinen --- drivers/gpu/drm/i915/i915_guc_submission.c | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_guc_submission.c b/drivers/gpu/drm/i915/i915_guc_submission.c index d14c134..b6486dc 100644 --- a/drivers/gpu/drm/i915/i915_guc_submission.c +++ b/drivers/gpu/drm/i915/i915_guc_submission.c @@ -207,7 +207,7 @@ static int __create_doorbell(struct i915_guc_client *client) return err; } -static int __destroy_doorbell(struct i915_guc_client *client) +static int __destroy_doorbell(struct i915_guc_client *client, bool notify_guc) { struct drm_i915_private *dev_priv = guc_to_i915(client->guc); struct guc_doorbell_info *doorbell; @@ -225,7 +225,10 @@ static int __destroy_doorbell(struct i915_guc_client *client) if (wait_for_us(!(I915_READ(GEN8_DRBREGL(db_id)) & GEN8_DRB_VALID), 10)) WARN_ONCE(true, "Doorbell never became invalid after disable\n"); - return __guc_deallocate_doorbell(client->guc, client->stage_id); + if (notify_guc) + return __guc_deallocate_doorbell(client->guc, client->stage_id); + + return 0; } static int create_doorbell(struct i915_guc_client *client) @@ -250,7 +253,11 @@ static int create_doorbell(struct i915_guc_client *client) return ret; } -static int destroy_doorbell(struct i915_guc_client *client) +/* + * This function deactivates doorbell monitoring through doorbell unit and + * optionally notifies GuC to deallocate the doorbell. + */ +static int destroy_doorbell(struct i915_guc_client *client, bool notify_guc) { int err; @@ -259,7 +266,7 @@ static int destroy_doorbell(struct i915_guc_client *client) /* XXX: wait for any interrupts */ /* XXX: wait for workqueue to drain */ - err = __destroy_doorbell(client); + err = __destroy_doorbell(client, notify_guc); if (err) return err; @@ -873,7 +880,7 @@ static int __reset_doorbell(struct i915_guc_client* client, u16 db_id) __update_doorbell_desc(client, db_id); err = __create_doorbell(client); if (!err) - err = __destroy_doorbell(client); + err = __destroy_doorbell(client, true); return err; } @@ -899,7 +906,7 @@ static int guc_init_doorbell_hw(struct intel_guc *guc) if (has_doorbell(client)) { /* Borrow execbuf_client (we will recreate it later) */ - destroy_doorbell(client); + destroy_doorbell(client, true); recreate_first_client = true; } @@ -925,7 +932,7 @@ static int guc_init_doorbell_hw(struct intel_guc *guc) ret = __create_doorbell(guc->preempt_client); if (ret) { - __destroy_doorbell(guc->execbuf_client); + __destroy_doorbell(guc->execbuf_client, true); return ret; } @@ -1043,7 +1050,7 @@ static void guc_client_free(struct i915_guc_client *client) /* FIXME: in many cases, by the time we get here the GuC has been * reset, so we cannot destroy the doorbell properly. Ignore the * error message for now */ - destroy_doorbell(client); + destroy_doorbell(client, true); guc_stage_desc_fini(client->guc, client); i915_gem_object_unpin_map(client->vma->obj); i915_vma_unpin_and_release(&client->vma);