From patchwork Tue Jun 25 23:08:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Wilson X-Patchwork-Id: 11016563 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 29ADB1398 for ; Tue, 25 Jun 2019 23:08:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1B1B128498 for ; Tue, 25 Jun 2019 23:08:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0D5E4285C4; Tue, 25 Jun 2019 23:08:41 +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=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, 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 BC54E28498 for ; Tue, 25 Jun 2019 23:08:40 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 586976E1BB; Tue, 25 Jun 2019 23:08:40 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from fireflyinternet.com (mail.fireflyinternet.com [109.228.58.192]) by gabe.freedesktop.org (Postfix) with ESMTPS id E91E76E1BB for ; Tue, 25 Jun 2019 23:08:35 +0000 (UTC) X-Default-Received-SPF: pass (skip=forwardok (res=PASS)) x-ip-name=78.156.65.138; Received: from haswell.alporthouse.com (unverified [78.156.65.138]) by fireflyinternet.com (Firefly Internet (M1)) with ESMTP id 17024273-1500050 for multiple; Wed, 26 Jun 2019 00:08:20 +0100 From: Chris Wilson To: intel-gfx@lists.freedesktop.org Date: Wed, 26 Jun 2019 00:08:15 +0100 Message-Id: <20190625230815.32244-1-chris@chris-wilson.co.uk> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH] drm/i915: Fail harder if GPU reset fails outright X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.23 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 If we request a reset and the GPU fails to respond, abandon all hope. If the request is still stuck when we attempt to do another, fail early and avoid requesting multiple possibly conflicting domains be reset simultaneously. We should never see this in practice, and if we do, it is already too late. References: https://bugs.freedesktop.org/show_bug.cgi?id=110998 Signed-off-by: Chris Wilson Cc: Mika Kuoppala --- drivers/gpu/drm/i915/gt/intel_reset.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/i915/gt/intel_reset.c b/drivers/gpu/drm/i915/gt/intel_reset.c index 72002c0f9698..56c43f8cbc17 100644 --- a/drivers/gpu/drm/i915/gt/intel_reset.c +++ b/drivers/gpu/drm/i915/gt/intel_reset.c @@ -301,8 +301,16 @@ static int gen6_hw_domain_reset(struct drm_i915_private *i915, u32 hw_domain_mask) { struct intel_uncore *uncore = &i915->uncore; + u32 status; int err; + /* + * Check that all previous reset requests have been flushed so + * that we don't simultaneously try to reset 2 overlapping domains. + */ + if (intel_uncore_read_fw(uncore, GEN6_GDRST)) + return -EIO; + /* * GEN6_GDRST is not in the gt power well, no need to check * for fifo space for the write or forcewake the chip for @@ -314,10 +322,11 @@ static int gen6_hw_domain_reset(struct drm_i915_private *i915, err = __intel_wait_for_register_fw(uncore, GEN6_GDRST, hw_domain_mask, 0, 500, 0, - NULL); + &status); + intel_uncore_write_fw(uncore, GEN6_GDRST, 0); if (err) - DRM_DEBUG_DRIVER("Wait for 0x%08x engines reset failed\n", - hw_domain_mask); + DRM_DEBUG_DRIVER("Wait for 0x%08x [HW] engines reset failed: %08x\n", + hw_domain_mask, status); return err; }