Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3624779pxb; Mon, 24 Jan 2022 13:48:04 -0800 (PST) X-Google-Smtp-Source: ABdhPJxnt475Q1x9X4p8stz+9B+YxHw1AAdYmrLYDG0Tfa8RM3GRxsqDtJFaoaaPAZRwMPhDIeeG X-Received: by 2002:a17:903:1d0:b0:14b:416a:a2c0 with SMTP id e16-20020a17090301d000b0014b416aa2c0mr9157050plh.14.1643060785953; Mon, 24 Jan 2022 13:46:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643060785; cv=none; d=google.com; s=arc-20160816; b=ilO94FTs2KCAxMhWvGbUfSCeINfOP7EILvIqhQDsS9KLRngl+ZEVBf3B/wondIQWTi 10jP+6WWMmLl9godhJZrogasRLy8z/grYXroZGpxWsZTGUjB2OmAWOTpKw2Bs9SLKjEU +onmw8Nwtzy1GIP5itDtS71dTgkyVTrKj0rOvwKRQ4+wsEH5gH324CyP7VYiNZrOcrHg h6FHQtTgb939S5btTNWloda36jMw4XRni74OlJGjw7sH/QKI0NGfe3gdHwmPuLVhRoMu nPIctNXKn11K2sC+Si5EUvgYRpKsddo2pY0PprXvLJJ5jsYZezICuJsv591X3Br9sKsv DbCQ== 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=A3SO9prkzhor57fblgCY87jqXHvXueq2P7rqeJcvoxE=; b=zH48X6cg9x77hpXZegIFTX2CT88ubo+Wi0lRN6hGXumMhMs/z2AyXtiw16/UC94hSl t/cEU98G/4/y3kxBB6ToF55u39s6qp04ZdjowEB3hojSoWViz0VHLzCAxAY7t0mhhS7C j5m3s8rTGrENS65lFtrO+k+jd3NaUIUk0qJli5hDCG0XexG4GKvUbqUOxRjilU0I0A/p uO84eVAYLPOxa9S+s+DcfHM0lPVTym5PrXPYhcd7w51qOT3dk99AGdD5PTkmTbbIbS/o Ir78XEyBfYbAvtxYw5iA+WDyjTdEKrlfrTWVo/JpmQG3jbN80xrCSPDJPCPsCnYwuOK7 5puA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=hNQZ5L8C; 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 z134si7907535pgz.325.2022.01.24.13.46.13; Mon, 24 Jan 2022 13:46:25 -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=hNQZ5L8C; 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 S1451959AbiAXVXv (ORCPT + 99 others); Mon, 24 Jan 2022 16:23:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44592 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1443277AbiAXU4g (ORCPT ); Mon, 24 Jan 2022 15:56:36 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6C877C110F30; Mon, 24 Jan 2022 11:18:19 -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 dfw.source.kernel.org (Postfix) with ESMTPS id 09FDF60BB9; Mon, 24 Jan 2022 19:18:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BE8CDC340E5; Mon, 24 Jan 2022 19:18:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643051898; bh=42cKnB73ycwsYbytnMtn+m7ZqxOi3VaJu09BCcgAuRU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hNQZ5L8Cvab0bSwn2+4DzrZsgx/mzTkQghIvGsrGHSQ8Vgq1OUkGNe+Ht3ty6VVZ5 pxU8AjPennwDieHls7XwYGyWCEfLx+4a1PfU0FpPzX5PzNab2W9fQx44lJlZratNCZ 37KDbnX0bdJKsmMauFLWmTIBesDM/5Tcst0sls00= 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 4.19 123/239] drm/nouveau/pmu/gm200-: avoid touching PMU outside of DEVINIT/PREOS/ACR Date: Mon, 24 Jan 2022 19:42:41 +0100 Message-Id: <20220124183947.011511046@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183943.102762895@linuxfoundation.org> References: <20220124183943.102762895@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 ce70a193caa7f..8cf3d1b4662de 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/base.c +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/base.c @@ -70,20 +70,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) @@ -94,25 +87,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