From patchwork Wed Mar 22 17:39:51 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: oscar.mateo@intel.com X-Patchwork-Id: 9640333 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 7E47B6020B for ; Thu, 23 Mar 2017 00:39:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6F7CA2842C for ; Thu, 23 Mar 2017 00:39:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 644A7284ED; Thu, 23 Mar 2017 00:39:57 +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=-2.5 required=2.0 tests=BAYES_00, DATE_IN_PAST_06_12, DKIM_SIGNED, RCVD_IN_DNSWL_MED, T_DKIM_INVALID 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 2A2762842C for ; Thu, 23 Mar 2017 00:39:57 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E98136E9DA; Thu, 23 Mar 2017 00:39:55 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by gabe.freedesktop.org (Postfix) with ESMTPS id 413956E9DC for ; Thu, 23 Mar 2017 00:39:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=intel.com; i=@intel.com; q=dns/txt; s=intel; t=1490229594; x=1521765594; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=/ZErGkVmQuXoNdAljgDNAcBGj/ayaYMo632k13tg2yM=; b=uISCyUJFVYLOh/KNF+LQSYjMkjtLECcJhLy86GkOkktkw7KdoTJcONX8 ZQ198cftVxqTHqc/Oxlq4GLTJGFYnA==; Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 22 Mar 2017 17:39:53 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos; i="5.36,207,1486454400"; d="scan'208"; a="1145835212" Received: from omateolo-linux.fm.intel.com ([10.1.27.55]) by fmsmga002.fm.intel.com with ESMTP; 22 Mar 2017 17:39:52 -0700 From: Oscar Mateo To: intel-gfx@lists.freedesktop.org Date: Wed, 22 Mar 2017 10:39:51 -0700 Message-Id: <1490204396-3395-9-git-send-email-oscar.mateo@intel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1490204396-3395-1-git-send-email-oscar.mateo@intel.com> References: <1490204396-3395-1-git-send-email-oscar.mateo@intel.com> Subject: [Intel-gfx] [PATCH v2 08/13] drm/i915/guc: Wait for doorbell to be inactive before deallocating 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 Doorbell release flow requires that we wait for GEN8_DRB_VALID bit to go to zero after updating db_status before we call the GuC to release the doorbell. Kudos to Daniele for finding this out. v2: WARN instead of DRM_ERROR (Joonas) Signed-off-by: Oscar Mateo Reviewed-by: Daniele Ceraolo Spurio Reviewed-by: Joonas Lahtinen --- drivers/gpu/drm/i915/i915_guc_submission.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/gpu/drm/i915/i915_guc_submission.c b/drivers/gpu/drm/i915/i915_guc_submission.c index c02167c..2d4d854 100644 --- a/drivers/gpu/drm/i915/i915_guc_submission.c +++ b/drivers/gpu/drm/i915/i915_guc_submission.c @@ -206,12 +206,22 @@ static int __create_doorbell(struct i915_guc_client *client) static int __destroy_doorbell(struct i915_guc_client *client) { + struct drm_i915_private *dev_priv = guc_to_i915(client->guc); struct guc_doorbell_info *doorbell; + u16 db_id = client->doorbell_id; + + GEM_BUG_ON(db_id >= GUC_DOORBELL_INVALID); doorbell = __get_doorbell(client); doorbell->db_status = GUC_DOORBELL_DISABLED; doorbell->cookie = 0; + /* Doorbell release flow requires that we wait for GEN8_DRB_VALID bit + * to go to zero after updating db_status before we call the GuC to + * release the doorbell */ + 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->ctx_index); }