Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3729206pxb; Mon, 24 Jan 2022 16:31:50 -0800 (PST) X-Google-Smtp-Source: ABdhPJzrvRoZjv2a6RD0iua1p39hx/DWQfXFQaU1R+WceADEWm9P4f2ePD5GOQYjFbX9AmB0mtIe X-Received: by 2002:a17:902:b08b:b0:149:ee23:8907 with SMTP id p11-20020a170902b08b00b00149ee238907mr16831940plr.59.1643070710529; Mon, 24 Jan 2022 16:31:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643070710; cv=none; d=google.com; s=arc-20160816; b=L9re7uVaJ9q0GR+N8nfJWx7tXcXw1HlAVjoSF+371hGi/k7yakhcsObqo0SCL1Hnfo 0wZmdE/1D9UTOH8gGwY+F8HaI5iMRDljNT+a26pSHnabAUC3dsz1HMsMNGbA+N1li1M6 KZzemsFdV+45U6prywjM1aEzEA7C9EPt0uaLtcI6cElw51RrSPo1liziavdaLZDUt1Ft VDFVlZK4zg4J/t4AM7Bfo95c4Enu51wsodO85VSfn9xSQQQTUYq3YBJKaYyleT01e2Nd cCbPA7WZREmDGiFAJOjde2CmKHiJjxxmqDndZYdCkuNDb631XoHfOHNDxU89HIZs4jht lB+A== 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=buhDqZOTDCGpkbcJERNf2ltY8SryFTR7lzQEbX8rhFlSIgis3G4t1FBbAGt7ZQxzIm D762TpabSx2PTt4uOyYMOccTiJrs682qASgdT0b1vgPdmKr283rjpuh8dCgGQ1UtxV+B zhHo0apu4LuH69lMYs13hd2BGNfCk7uc3iDig929I8Or6E7nohV5OwullgiVAkwyKFe0 hgKlK2zh7YezdLu0gxyrdyYYc8Maaz1GQ4O3XEHCTEugcbI0YrT4716SeqLgVNCXc0jW iI6DV1hCz2VG6BgzrUyjq8DgTt25aZLLLzgFdSzqQaBVXDZQSARDira/Odyl0NWbUmKi L14A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Il6nmK+t; 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 j27si14361555pgm.475.2022.01.24.16.31.36; Mon, 24 Jan 2022 16:31:50 -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=Il6nmK+t; 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 S3409430AbiAYA0F (ORCPT + 99 others); Mon, 24 Jan 2022 19:26:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58522 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1449681AbiAXVyz (ORCPT ); Mon, 24 Jan 2022 16:54:55 -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 D847AC08ED7F; Mon, 24 Jan 2022 12:34:57 -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 512ECB80FA1; Mon, 24 Jan 2022 20:34:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 864A4C340E5; Mon, 24 Jan 2022 20:34:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643056495; bh=0tDVZXKr9K09AvgqRFA/1j1lSWqb13QUoRj3scev9K0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Il6nmK+tgJ9Q8HRYc4b5jpz+c331C9d20wseQcX4Qgn3IzAWSs9pa6gnyTjpU9SpG UC9yUC2XfHEYAhOO0KD3eMue97u4x7NLbPMbOIgVSJsNuMePSeO4s90qKB50Vd+dzX RDcfnqnK/WW98Lv51fqjHM3erglDpEm9CB5fRAP8= 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.15 471/846] drm/nouveau/pmu/gm200-: avoid touching PMU outside of DEVINIT/PREOS/ACR Date: Mon, 24 Jan 2022 19:39:48 +0100 Message-Id: <20220124184117.255847140@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184100.867127425@linuxfoundation.org> References: <20220124184100.867127425@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