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: 844370 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-tegra-owner@vger.kernel.org; receiver=) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3yrDD44wLtz9sNw for ; Tue, 5 Dec 2017 05:38:41 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752282AbdLDSij (ORCPT ); Mon, 4 Dec 2017 13:38:39 -0500 Received: from bhuna.collabora.co.uk ([46.235.227.227]:52800 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752218AbdLDSii (ORCPT ); Mon, 4 Dec 2017 13:38:38 -0500 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 Cc: dri-devel@lists.freedesktop.org, linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Guillaume Tucker , Ben Skeggs 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 Sender: linux-tegra-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-tegra@vger.kernel.org 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