Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3593853pxb; Mon, 24 Jan 2022 13:04:34 -0800 (PST) X-Google-Smtp-Source: ABdhPJx6x6JBwnHUJpFA0bEYhi82xBRBg1BFGDsQ+BZX0zSA7su82bY/D3GSBNznIcInb1+r1h8D X-Received: by 2002:a65:68d7:: with SMTP id k23mr3473074pgt.596.1643058273998; Mon, 24 Jan 2022 13:04:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643058273; cv=none; d=google.com; s=arc-20160816; b=FyTTZgdgZVEqU9GQzDDNqWVNQG7MMSJYZdjD/IJVgxiXQVvOYbyQ2SWsaeOiObN2KO YUA6y0lVj+2WhSGDJkAJ6WyYygJGuGMIktvfXqkvUgzRBKkeO42Ule/bsRGgM4kXHzND Z2hM3DGnQbBbpmn94nHyAM+V4WKLPKKMYLLKg2YBlCO50BCNnXJr3HGaCsCuXaDkyFFM anU5mOOs0Tf18+0tQJP5/hBOJSCXor8hylyaiB2Ur3GPyeU6oHTmfMxUufDc9F1iqkcM y8vW2EUfPlpfrroI8F8jDfKWKVxQFq51bQ6cDrVrMbjPvXGQRng7OrKWePoxVPpfZ6dC sZjQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=a2DnfuVlf/rzv7TKD+dCTa90xXxENLBIzbI6A+Tuz9E=; b=vDN0R/1nBOw6oaXloMX4ikW52lFRKk905RtJ0sQa4rPqfl57R0v+ufyhxD7UOOOSFN LEMrk3mBb2JVraMsD4W0YQ1PPsAe8JV9M3UIzKoS4M7ACYYC9vd6sbIPasp0eKqtciAo y0ntWpE09q4x9Lgvl2NnbCPDtJmlQVaeSZvyooV36QLFZvvYVnVFk4ec9CQKbSRWJkb8 z1h8PcIk+3tMSZVIhdSnUIPJaPkxmF5bu9eKJHIsouLOUfKWb/34CSB6uZsdGpmAQpA5 uwgxGK23dKPxIdFYVpLDdcyXeC686RUYqCtQAGW8qi2PkQkwKKunFCiM8D6Y0kohJl6X OyIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=jgpEGF8B; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id my5si371200pjb.172.2022.01.24.13.04.19; Mon, 24 Jan 2022 13:04:33 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=jgpEGF8B; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1384045AbiAXU2r (ORCPT + 99 others); Mon, 24 Jan 2022 15:28:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60964 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378304AbiAXUGs (ORCPT ); Mon, 24 Jan 2022 15:06:48 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EA72FC02B759; Mon, 24 Jan 2022 11:32:17 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id B2600B81240; Mon, 24 Jan 2022 19:32:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C4861C340E5; Mon, 24 Jan 2022 19:32:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052735; bh=1VvY1q6ys+z/nxaqazZx6mlkGoBLdE1pBlUsSpD+yXA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jgpEGF8B5K7niHfmpMJtlmEnW4kfCpow/+RAdupqzyiDBOO9H8ePCj6QzMjDjvDs+ FwI/zjm1ohjZuto9djlNoeXPWGK6rgrj8YNxzT5rf0VXXtVW9g4o9bVr432LVymCg6 rQD6qdkOLNtgz7ZZXVvBMBmbkjaRy0tCEmrngOM0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Diego Viola , Ben Skeggs , Karol Herbst , Sasha Levin Subject: [PATCH 5.4 157/320] drm/nouveau/pmu/gm200-: avoid touching PMU outside of DEVINIT/PREOS/ACR Date: Mon, 24 Jan 2022 19:42:21 +0100 Message-Id: <20220124183958.969793377@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ben Skeggs [ Upstream commit 1d2271d2fb85e54bfc9630a6c30ac0feb9ffb983 ] There have been reports of the WFI timing out on some boards, and a patch was proposed to just remove it. This stuff is rather fragile, and I believe the WFI might be needed with our FW prior to GM200. However, we probably should not be touching PMU during init on GPUs where we depend on NVIDIA FW, outside of limited circumstances, so this should be a somewhat safer change that achieves the desired result. Reported-by: Diego Viola Signed-off-by: Ben Skeggs Reviewed-by: Karol Herbst Signed-off-by: Karol Herbst Link: https://gitlab.freedesktop.org/drm/nouveau/-/merge_requests/10 Signed-off-by: Sasha Levin --- .../gpu/drm/nouveau/nvkm/subdev/pmu/base.c | 37 +++++++++++-------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/base.c b/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/base.c index ea2e11771bca5..105b4be467a3e 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/base.c +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/base.c @@ -88,20 +88,13 @@ nvkm_pmu_fini(struct nvkm_subdev *subdev, bool suspend) return 0; } -static int +static void nvkm_pmu_reset(struct nvkm_pmu *pmu) { struct nvkm_device *device = pmu->subdev.device; if (!pmu->func->enabled(pmu)) - return 0; - - /* Inhibit interrupts, and wait for idle. */ - nvkm_wr32(device, 0x10a014, 0x0000ffff); - nvkm_msec(device, 2000, - if (!nvkm_rd32(device, 0x10a04c)) - break; - ); + return; /* Reset. */ if (pmu->func->reset) @@ -112,25 +105,37 @@ nvkm_pmu_reset(struct nvkm_pmu *pmu) if (!(nvkm_rd32(device, 0x10a10c) & 0x00000006)) break; ); - - return 0; } static int nvkm_pmu_preinit(struct nvkm_subdev *subdev) { struct nvkm_pmu *pmu = nvkm_pmu(subdev); - return nvkm_pmu_reset(pmu); + nvkm_pmu_reset(pmu); + return 0; } static int nvkm_pmu_init(struct nvkm_subdev *subdev) { struct nvkm_pmu *pmu = nvkm_pmu(subdev); - int ret = nvkm_pmu_reset(pmu); - if (ret == 0 && pmu->func->init) - ret = pmu->func->init(pmu); - return ret; + struct nvkm_device *device = pmu->subdev.device; + + if (!pmu->func->init) + return 0; + + if (pmu->func->enabled(pmu)) { + /* Inhibit interrupts, and wait for idle. */ + nvkm_wr32(device, 0x10a014, 0x0000ffff); + nvkm_msec(device, 2000, + if (!nvkm_rd32(device, 0x10a04c)) + break; + ); + + nvkm_pmu_reset(pmu); + } + + return pmu->func->init(pmu); } static int -- 2.34.1