From patchwork Mon Dec 4 18:37:58 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guillaume Tucker X-Patchwork-Id: 10091255 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 DE34F6035E for ; Mon, 4 Dec 2017 18:39:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D330128D5F for ; Mon, 4 Dec 2017 18:39:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C6EBE28D66; Mon, 4 Dec 2017 18:39:05 +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,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 56A0928D5F for ; Mon, 4 Dec 2017 18:39:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=UR73ZfQ0/15mBXdnlm0+sFdXr/pYhysYokMeVYXuAuA=; b=HEn wdqsqfFyG/gKyz9Y3rMWdUQnAu9mET/999J/m1a9v7bchO+wPE7YPDsI5pydScacRSRlqxYy/V9bD BqphYsw6Q1lOzqBSPDVF3SVpg6QsBnnxE2F7gSajycJ/Uxr/sxk8UJWSBl/2oQGo4X8iMOtOhBM1V Mexnr/5Q2V24ffeo50RfKf9ewy3FtXbqd8+QzPF0nmDluc/KNWkAK8gV4g5cDnJTg/XT7Pvyuv55/ Ec77lAvQtjWVQPVQ+bcGRx8S1vOQsQvV465M9IzHJSwdWvALD1uxuHMqvUHjEu2lamvvtG/1i7D0N NiHERdz2/HRNON0W8jedNWhXfOqAYHA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1eLvdv-0002XD-BY; Mon, 04 Dec 2017 18:39:03 +0000 Received: from bhuna.collabora.co.uk ([2a00:1098:0:82:1000:25:2eeb:e3e3]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1eLvds-0001Yl-EB for linux-arm-kernel@lists.infradead.org; Mon, 04 Dec 2017 18:39:02 +0000 Received: from submarine.cbg.collabora.co.uk (unknown [IPv6:2a00:5f00:102:0:d0a5:4565:9830:3aaf]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: gtucker) by bhuna.collabora.co.uk (Postfix) with ESMTPSA id 970EF26ECFB; Mon, 4 Dec 2017 18:38:36 +0000 (GMT) From: Guillaume Tucker To: Jonathan Hunter , David Airlie Subject: [PATCH 1/2] drm/nouveau/bar/gf100: fix hang when calling ->fini() before ->init() Date: Mon, 4 Dec 2017 18:37:58 +0000 Message-Id: X-Mailer: git-send-email 2.11.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171204_103900_677775_F155D6C3 X-CRM114-Status: UNSURE ( 9.33 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Guillaume Tucker , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Ben Skeggs , linux-tegra@vger.kernel.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP If the firmware fails to load then ->fini() will be called before the device has been initialised, causing the kernel to hang while trying to write to a register. Add a test in ->fini() to avoid this issue. This fixes a kernel hang on tegra124. Fixes: b17de35a2ebbe ("drm/nouveau/bar: implement bar1 teardown") Signed-off-by: Guillaume Tucker CC: Ben Skeggs Tested-by: Jon Hunter --- drivers/gpu/drm/nouveau/nvkm/subdev/bar/gf100.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/bar/gf100.c b/drivers/gpu/drm/nouveau/nvkm/subdev/bar/gf100.c index a3ba7f50198b..95e2aba64aad 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/bar/gf100.c +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/bar/gf100.c @@ -43,9 +43,12 @@ gf100_bar_bar1_wait(struct nvkm_bar *base) } void -gf100_bar_bar1_fini(struct nvkm_bar *bar) +gf100_bar_bar1_fini(struct nvkm_bar *base) { - nvkm_mask(bar->subdev.device, 0x001704, 0x80000000, 0x00000000); + struct nvkm_device *device = base->subdev.device; + + if (base->subdev.oneinit) + nvkm_mask(device, 0x001704, 0x80000000, 0x00000000); } void