Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp1161888ybi; Fri, 2 Aug 2019 10:18:20 -0700 (PDT) X-Google-Smtp-Source: APXvYqzclFzan+Xv6klpjFLdVX2MbPVjJYB6KOK2w7EeYfDxLxWl3bmey6oCOLvgd4Dq1TjNda/v X-Received: by 2002:a17:902:e281:: with SMTP id cf1mr128170749plb.271.1564766299947; Fri, 02 Aug 2019 10:18:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564766299; cv=none; d=google.com; s=arc-20160816; b=XoKJ31AZ8Ciw3pk6FKfQntC24gMUxaCA8qUU3V3/scU2WqdVqM05827uHZNU+4d8ba rjHAVz7cXV3aILbT81kPyjUKRSB7wYFDGQRXm4TL6KqwnG5blWv4FsdBImP6qUvbdlDu rp3E0WOXXXvw7Yw3KKbXGAu4No3yeLlQph9MhKdYspRLejfuqX/SeteKleKM57n5vQzD mZBq8u0OlwKnPZTjvYcNF0wg/7Ztz7MWzClAJSaNzvkM+ibmIDMk9K0OzMaiP9EMiVeH lD+lrnmDSzyXSbOEKM0QE8HJkY+Nf7/RutXNhfKXyXL8xO4S7tmL13U1jEOGNChZtFEq YUNg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ZJ0pF7Ram2rwxdecb3SWfR8O31u1o5s7qRLe0cpVobA=; b=NAoHi8R8lv220/8mdIqyYsohAm/s3xqR882YcpatOuLRgof685IqrEMXTgWTbh+f2L RD19QyJKoa3GGE3kw7SQksTfxznB1ag0fHA4b4h+ZbBxEhRGNmBkFc7qEL1GiD0V7xXi ZfnYWvqanqhAtPM5423S4EGPkvOUR3XYMohB7S21bYbL5/sOH8Bx/T0e9xZ5hYuwnfKh fFDbvi5sm9+wBXdc0bwZ9FQZj8/21TT12B791cbSDfTjHD7vx27t+QmgtckeZtVi0/ms 3ttoR4tn7FisvWWwqWMaLGC9rzUfd2XJz2CjXsSxxakgq0cNhiVeW0HgWiSo9Qeae0e7 8xIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=yszODwNo; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d9si4836879pgq.119.2019.08.02.10.17.54; Fri, 02 Aug 2019 10:18:19 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=yszODwNo; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2405435AbfHBJpZ (ORCPT + 99 others); Fri, 2 Aug 2019 05:45:25 -0400 Received: from mail.kernel.org ([198.145.29.99]:49076 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2405424AbfHBJpW (ORCPT ); Fri, 2 Aug 2019 05:45:22 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 077592086A; Fri, 2 Aug 2019 09:45:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1564739121; bh=C3mhXCl2ZWYBLwyb38j1K9FbAQ3C3952L957kgeENwA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yszODwNow/TFRm4BxiJJLxhZz2/xUndyjiwjIQnfT+wfxftU16O23XIMzlb89VhaL ycMNAfSUhG1vWBdU5BvZxiCATa+IrLbrNs1R55f80RexOWyqO3rgk2sdfztKPtsTAv VUsqrXUvGV0swybYs0WVogsNJ3Ac0PYMIo9CbGes= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lyude Paul , Marc Meledandri , Ben Skeggs Subject: [PATCH 4.9 097/223] drm/nouveau/i2c: Enable i2c pads & busses during preinit Date: Fri, 2 Aug 2019 11:35:22 +0200 Message-Id: <20190802092245.461973137@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190802092238.692035242@linuxfoundation.org> References: <20190802092238.692035242@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Lyude Paul commit 7cb95eeea6706c790571042a06782e378b2561ea upstream. It turns out that while disabling i2c bus access from software when the GPU is suspended was a step in the right direction with: commit 342406e4fbba ("drm/nouveau/i2c: Disable i2c bus access after ->fini()") We also ended up accidentally breaking the vbios init scripts on some older Tesla GPUs, as apparently said scripts can actually use the i2c bus. Since these scripts are executed before initializing any subdevices, we end up failing to acquire access to the i2c bus which has left a number of cards with their fan controllers uninitialized. Luckily this doesn't break hardware - it just means the fan gets stuck at 100%. This also means that we've always been using our i2c busses before initializing them during the init scripts for older GPUs, we just didn't notice it until we started preventing them from being used until init. It's pretty impressive this never caused us any issues before! So, fix this by initializing our i2c pad and busses during subdev pre-init. We skip initializing aux busses during pre-init, as those are guaranteed to only ever be used by nouveau for DP aux transactions. Signed-off-by: Lyude Paul Tested-by: Marc Meledandri Fixes: 342406e4fbba ("drm/nouveau/i2c: Disable i2c bus access after ->fini()") Cc: stable@vger.kernel.org Signed-off-by: Ben Skeggs Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/nouveau/nvkm/subdev/i2c/base.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) --- a/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/base.c +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/base.c @@ -185,6 +185,25 @@ nvkm_i2c_fini(struct nvkm_subdev *subdev } static int +nvkm_i2c_preinit(struct nvkm_subdev *subdev) +{ + struct nvkm_i2c *i2c = nvkm_i2c(subdev); + struct nvkm_i2c_bus *bus; + struct nvkm_i2c_pad *pad; + + /* + * We init our i2c busses as early as possible, since they may be + * needed by the vbios init scripts on some cards + */ + list_for_each_entry(pad, &i2c->pad, head) + nvkm_i2c_pad_init(pad); + list_for_each_entry(bus, &i2c->bus, head) + nvkm_i2c_bus_init(bus); + + return 0; +} + +static int nvkm_i2c_init(struct nvkm_subdev *subdev) { struct nvkm_i2c *i2c = nvkm_i2c(subdev); @@ -238,6 +257,7 @@ nvkm_i2c_dtor(struct nvkm_subdev *subdev static const struct nvkm_subdev_func nvkm_i2c = { .dtor = nvkm_i2c_dtor, + .preinit = nvkm_i2c_preinit, .init = nvkm_i2c_init, .fini = nvkm_i2c_fini, .intr = nvkm_i2c_intr,