Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3558836pxb; Mon, 24 Jan 2022 12:11:57 -0800 (PST) X-Google-Smtp-Source: ABdhPJxS0Mm6nCVn5LqWxCy03Hrmrgzi7JAZ2Nr8ScqnQzz8BsZAsiuyBBOi/49NeVCW/N4isHhe X-Received: by 2002:a17:90a:f413:: with SMTP id ch19mr3493806pjb.15.1643055117419; Mon, 24 Jan 2022 12:11:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643055117; cv=none; d=google.com; s=arc-20160816; b=UeTDwZHzNrNC5GTdW+Qxj1/+6p9oT5ByQm7jFqSIRfZUuGgIFCxp3pGiJARJPjeRzn E1uDCxYzsawPL45cOFGOBZYIn38pq4dNrY/t1zX385Qrm3OmUI7SprowP5GfvdpKA5KF Tf/8UjthvUYouGP3EbhJQWpFalBWilfPYX/wlpWeA/k5uittdW7nlflZTqVBBr3LoJFj 0lnsdB3AAIh2BahQcAsEly1LFEOvsl+TYl/yeyJJUQkPdSm8hZamrElQGuOdlG/dSspX 2f+fzy9RMU8EhBNCmYsiohKBeqYipa0czeOM41ZSJkMQCT/2GLlkXxBFzw7ANYDlc6RY 1dVQ== 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=XgkNTLfwU9DIwNkg2LNiXMuI3/vSPXLQsZgcjuxfwPKFjm2i7UMpmwbNx3UXjBZe8f RbwQ7yP65t4O6AvPVx1HMHjoM5mH+MFG0+/0LwW6/Sqn6tOEkqi9IaiecGAa9AYNDeQe t7E8vEh3z7QvJEyUucfhxp/7b2RuJdgHB04JLrUTQftX2cqsEqBMP2Fg+qJER84PPEpS FB4Oo104l4RXJAsLIDJDfDzHlOBtWbvSy1bACxvg46Er5xF9WBQAEw1qkPzApQGgSipJ N3josNIIM70K5ExH/SVCY7qpUuiEm7ypqd2PP+uKFlbNI/Y8mk9PIGVIQBNpsBSNzbDU zR6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=wpM3MHDS; 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 o23si259136pjt.117.2022.01.24.12.11.43; Mon, 24 Jan 2022 12:11:57 -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=wpM3MHDS; 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 S1348355AbiAXTPP (ORCPT + 99 others); Mon, 24 Jan 2022 14:15:15 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:34886 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346525AbiAXTGu (ORCPT ); Mon, 24 Jan 2022 14:06:50 -0500 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 519C7B81223; Mon, 24 Jan 2022 19:06:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4F79FC340E5; Mon, 24 Jan 2022 19:06:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643051207; bh=42cKnB73ycwsYbytnMtn+m7ZqxOi3VaJu09BCcgAuRU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wpM3MHDSerx+bG50nPouyS1ujTJUn8ngJh3dNOSQPJwv5he7GkubCvUWWKszCgp5U N+W9wJR/JSk+rsJ+Amcv05Hz5uSg/Xq/dvVB6ICumLeS05EPk/+wRpE5tTsmT8IFni 0Gjed0wJ+1RSsH6c2ZVR6AC/HHnKgigaiQ5ZmGng= 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.14 089/186] drm/nouveau/pmu/gm200-: avoid touching PMU outside of DEVINIT/PREOS/ACR Date: Mon, 24 Jan 2022 19:42:44 +0100 Message-Id: <20220124183939.974811877@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183937.101330125@linuxfoundation.org> References: <20220124183937.101330125@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