From patchwork Sat Jan 28 01:44:14 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilia Mirkin X-Patchwork-Id: 9542925 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 87A1360415 for ; Sat, 28 Jan 2017 01:44:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6CAD5271BC for ; Sat, 28 Jan 2017 01:44:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5DB7527F9F; Sat, 28 Jan 2017 01:44:26 +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.1 required=2.0 tests=BAYES_00,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 085D1271BC for ; Sat, 28 Jan 2017 01:44:25 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5316F6E016; Sat, 28 Jan 2017 01:44:22 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-qt0-x241.google.com (mail-qt0-x241.google.com [IPv6:2607:f8b0:400d:c0d::241]) by gabe.freedesktop.org (Postfix) with ESMTPS id 2D53C6E016; Sat, 28 Jan 2017 01:44:21 +0000 (UTC) Received: by mail-qt0-x241.google.com with SMTP id n13so49327547qtc.0; Fri, 27 Jan 2017 17:44:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id; bh=PhkuJSDtOX8Z5lHSvIUr3j4v/TdD3p0RdcsJvmRYPFs=; b=Wo9vynBiB+tGZePF8oLYmwAF5q41beX3oaABt1h+y1okeT7Tx203+IwRZL/mkweUZH P1uq/QTdrfup14es7yAoyEHOOn8o5m/z7RROhJfxjVcNZBeJbkkXWWtAXzkCbePow6Nm br/J7x7kORkcSWU8JVBM/Uem/0G4frsNGBph11ewifrRfdAeNHMQw+cYwRDMpX9Dmpn3 qM26Elz6NVkedpUnlvZ8qIo86ygGRCa9Gk8znvdGDKlpNndFjqjYjGDccLFti8q7OX8Q 4V8p/HdZIteTcz+LRCYXcUIcHP08XdUMkgq43uxv0hzZ+eKF1llYI3EFYUAQzdmc0jSw ulhA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id; bh=PhkuJSDtOX8Z5lHSvIUr3j4v/TdD3p0RdcsJvmRYPFs=; b=i1A/BhBvAhhr/CHLC4zpoeZGaveLQZhoOP6vjDv4H8dJmywiZEp6DZS/pGiAd3KADM DsQXOWiS2/uZ4w2Furm42Fpy69tq6wz9l/nIpybAePKv5Xh1J+74PUVe2swyFR+LRBGa /cz0Qk436ih0pkxUGndthChhY8hFTmLFaLDnoK7IRnoZctpOVzeGWb2HqR4DWwJCWEa9 LN3oWz3jpYvAcHVgMdneTsZtr/XpQ6No/RZ+XSysO92RqPlrGwpM68QkxeAulaGHYwAL ducJan0MnAi6SoVstmJXZL9KP0mkjst2edMEZ0vgxn4hf0kuw7yxjqiATyKe/41joqsz uKmA== X-Gm-Message-State: AIkVDXIw/XM640nNGouvjDjBRhYvFERoN2MPG1JAGxYAKgUFLGnOn9iZEJ41yUovN6I+eQ== X-Received: by 10.200.46.241 with SMTP id i46mr10863304qta.17.1485567860392; Fri, 27 Jan 2017 17:44:20 -0800 (PST) Received: from localhost.localdomain ([2604:2000:ef19:c100:2e0:4cff:fec1:7745]) by smtp.gmail.com with ESMTPSA id 140sm5621784qkj.19.2017.01.27.17.44.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 27 Jan 2017 17:44:19 -0800 (PST) From: Ilia Mirkin To: Alexandre Courbot , Ben Skeggs Subject: [PATCH] drm/nouveau/devinit/gf100-: try to avoid double-running vbios scripts Date: Fri, 27 Jan 2017 20:44:14 -0500 Message-Id: <20170128014414.18691-1-imirkin@alum.mit.edu> X-Mailer: git-send-email 2.10.2 Cc: nouveau@lists.freedesktop.org, dri-devel@lists.freedesktop.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Turns out some VBIOSes don't actually set the bit in question in 2240c. Use the nv50-style detection to try avoiding running the vbios twice. Fixes: a6a0f67ca7aa ("drm/nouveau/devinit/gf100-: detect if BIOS invoked devinit") Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=97620 Cc: stable@vger.kernel.org # v4.6+ Signed-off-by: Ilia Mirkin --- Not sure if this is safe to do esp on GM20x+ boards? drivers/gpu/drm/nouveau/nvkm/subdev/devinit/gf100.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/devinit/gf100.c b/drivers/gpu/drm/nouveau/nvkm/subdev/devinit/gf100.c index 8b1b34c..a568bbf 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/devinit/gf100.c +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/devinit/gf100.c @@ -102,6 +102,25 @@ gf100_devinit_preinit(struct nvkm_devinit *base) * can use it as a reliable way to know whether we should run devinit. */ base->post = ((nvkm_rd32(device, 0x2240c) & BIT(1)) == 0); + + /* + * However some VBIOS init sequences miss this bit. So fall back to + * the nv50 method of checking if the bit is not set. Running the + * VBIOS multiple times may have detrimental effects. + */ + if (base->post) { + u64 disable = nvkm_devinit_disable(base); + /* magic to detect whether or not x86 vbios code has + * executed the devinit scripts to initialise the + * board. only works if there's a display engine. + */ + if (!(disable & (1ULL << NVKM_ENGINE_DISP))) { + if (nvkm_rdvgac(device, 0, 0x00) || + nvkm_rdvgac(device, 0, 0x1a)) { + base->post = false; + } + } + } } static const struct nvkm_devinit_func