From patchwork Fri Jun 30 17:41:49 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michel Thierry X-Patchwork-Id: 9820187 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 92C4160224 for ; Fri, 30 Jun 2017 17:41:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7E48B286CA for ; Fri, 30 Jun 2017 17:41:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 73184286CB; Fri, 30 Jun 2017 17:41:53 +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 DD473286DC for ; Fri, 30 Jun 2017 17:41:52 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C1D6B6E840; Fri, 30 Jun 2017 17:41:51 +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 828856E840 for ; Fri, 30 Jun 2017 17:41:50 +0000 (UTC) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 30 Jun 2017 10:41:49 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.40,287,1496127600"; d="scan'208";a="987320194" Received: from relo-linux-11.sc.intel.com ([10.3.160.214]) by orsmga003.jf.intel.com with ESMTP; 30 Jun 2017 10:41:49 -0700 From: Michel Thierry To: intel-gfx@lists.freedesktop.org Date: Fri, 30 Jun 2017 10:41:49 -0700 Message-Id: <20170630174149.11202-1-michel.thierry@intel.com> X-Mailer: git-send-email 2.11.0 Subject: [Intel-gfx] [PATCH] drm/i915/guc: Prevent ggtt->invalidate assert during GuC reload 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 The driver reloads the GuC firmware after full gpu reset or suspend/resume, but it never disables the GuC beforehand. This leads us to hit the assert inside i915_ggtt_enable_guc added by commit 04f7b24eccdf ("drm/i915/guc: Assert that we switch between known ggtt->invalidate functions"). As a workaround, don't call i915_ggtt_enable_guc if there is a GuC execbuf_client; because if there isn't one we are either loading in a fresh system or we called intel_uc_fini_hw. I'm inclined to this approach because even if intel_uc_fini_hw could be added to the suspend path, we will still need to keep this for the full gpu reset case. Cc: Chris Wilson Cc: Michal Winiarski Cc: Michal Wajdeczko Cc: Daniele Ceraolo Spurio Signed-off-by: Michel Thierry --- drivers/gpu/drm/i915/intel_uc.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_uc.c b/drivers/gpu/drm/i915/intel_uc.c index a8930f2feacf..564b0d2b8842 100644 --- a/drivers/gpu/drm/i915/intel_uc.c +++ b/drivers/gpu/drm/i915/intel_uc.c @@ -339,8 +339,14 @@ int intel_uc_init_hw(struct drm_i915_private *dev_priv) guc_disable_communication(guc); gen9_reset_guc_interrupts(dev_priv); - /* We need to notify the guc whenever we change the GGTT */ - i915_ggtt_enable_guc(dev_priv); + /* + * We need to notify the guc whenever we change the GGTT; but if we + * are reloading the firmware (after full gpu reset or suspend/resume), + * we should skip this since gtt->invalidate was already set (or we hit + * an assert). + */ + if (!dev_priv->guc.execbuf_client) + i915_ggtt_enable_guc(dev_priv); if (i915.enable_guc_submission) { /*