Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3642273pxb; Mon, 24 Jan 2022 14:13:21 -0800 (PST) X-Google-Smtp-Source: ABdhPJwWc8bBNYjKwpK26/TLidUWKi/H29SA9i3T/J29HfryLIkCSfxavy55da6vGvDHr92r5xHi X-Received: by 2002:a17:902:7786:b0:14a:bb95:6a36 with SMTP id o6-20020a170902778600b0014abb956a36mr16168684pll.136.1643062401120; Mon, 24 Jan 2022 14:13:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643062401; cv=none; d=google.com; s=arc-20160816; b=FhMimOclcoaVUnTBDMHhSsizrD+ioM/Z1bvfjIw37+usj3v3W+ElXV862GrIsGIOcS PUPgjcKLNIB2RUHdBYi/RpB82Hnuew26wr7qr9UguAiYZQEe/t0MaCEfO0hrfk8YmyAq gq10l8NRMyihEbfggd9xDt/lFk7I2FeB3MBDAIUdXT+dYG1RbrD+3gnywB7H27LHEMiU uYsCbo5RJjEy1+9Dvz15MrUJjEZBiuIAWNTN6FyylXPT2eyHL8yayGMcy2WV21uY7bKb YOApAx7Cgc1V6Prg0GBK+avygi/oMwW06OK8nud4d4z82st5mY6kosHq373v/iStbh1i r3ug== 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=JsiHwFx+T5M3UtGCawWG7tY4qsH0Rt0tH1533lm5qzE=; b=MuJ1z/bbvPuc2Ek7AHl7pHNrOHY2Fbg9dRyO46PGANex1Y/lb4Th8tqZhw/3rSivH/ JFrEF3n+KITv9P//Ra429LcnqJ92fQ5Xf8RU45ewxT7X6eAvtblHPPPmeF8LZktWSpij Hc9h5oKINeWxCbpR5KX4hnp1D6ru6tCbTerQX5KHteYGoERiVIk4UXwPmImkVHWzeRHD rrV5elFJI8NzAE8MHAcfWiT3EDbLHQnn9YTwZpZnaAIKH315SmUv0l8dJNUMVt3ffpwb aLcbQG1uC9ek+LiVhZbtrq6tHRHqY9x73BoOy6vjpZ2OtpYjqu2dNW39A1fLZP3JSc6u xBug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=fQes7rLV; 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 m19si452412pjl.114.2022.01.24.14.13.09; Mon, 24 Jan 2022 14:13:21 -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=fQes7rLV; 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 S1577224AbiAXV7h (ORCPT + 99 others); Mon, 24 Jan 2022 16:59:37 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:40022 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1451296AbiAXVWi (ORCPT ); Mon, 24 Jan 2022 16:22:38 -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 549F8B81057; Mon, 24 Jan 2022 21:22:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7EC2DC340E4; Mon, 24 Jan 2022 21:22:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059356; bh=0tDVZXKr9K09AvgqRFA/1j1lSWqb13QUoRj3scev9K0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fQes7rLVPvskQzRFnLtBj6EddaUpBzBfm/CxRRUzro4/nD41MiZy49xxHITSNlidY yt5vh/stooPVZYj6DC4tN1H9EeoiBsW815IorIuEQL8KYZpZ+8DE/gliG743bXqz9d n3LaAuQu09BsC1fxlXHRbuHNkEyR+nFpvJ2qUKlo= 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.16 0555/1039] drm/nouveau/pmu/gm200-: avoid touching PMU outside of DEVINIT/PREOS/ACR Date: Mon, 24 Jan 2022 19:39:04 +0100 Message-Id: <20220124184143.960634757@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@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 24382875fb4f3..455e95a89259f 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/base.c +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/base.c @@ -94,20 +94,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) @@ -118,25 +111,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 void * -- 2.34.1