Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9129731pxu; Mon, 28 Dec 2020 07:20:50 -0800 (PST) X-Google-Smtp-Source: ABdhPJwxAl1PC0Ly+r7CvZ7cFaolydcs+KYoOjunsfdm9xii/t3W7WcAhrKqYEacFo/hCdJWraE1 X-Received: by 2002:aa7:d608:: with SMTP id c8mr41636222edr.260.1609168850145; Mon, 28 Dec 2020 07:20:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609168850; cv=none; d=google.com; s=arc-20160816; b=LWcsUNRvgYz3UsQMyjKzBhwIMO8oOSU1SAXTQW8f41K40+fXa+fKCR4UpedJNxS1hs nCIvn2HTiNVeEeN1iZEl35ssC8PtqMgpJvzfVpwxGRFP2zO8qQC/O9dNuuuG0E2ND/Fz K4TIeuhLFAXc2HPsQi4OQQXg5bN6MztA6kJEBzG+OXI+dDaXMjbUvGvBOg//hkznadAg TuuzzaTctam8u8YbvTSNoctQ24Q9FYvdyLNVwV4EkihIJSXy97Hui4+cJdgrRYNGgV02 rbQdoMNtY18vPf7tEw9eMcHdjfvUwRSiDbZcCAzFD/LbIUuMtp5vJ8YkbZHDn7EaWkgY yESg== 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=5HjhHDf7irCw6I1Xi8GFV2WevIDbB+Wqv9zvLDkwYA4=; b=TjqYuFvJW003+9FKCPCRUpEoTqmpZlCRfP9A8EwdfDyTv2gtS0vOoTPUBL8x0A2Nic fu39ZWFVfp/4gXCsbUoy9nciyfCAx0rLUYhrZa2hZPwObThqtNXzrVJ+zsQAukqSoCDE qdXi6fakUVkSb2mbt34Y43yYHfUtUKHU86bXA3gmOMVRaZbozPW+0ojet4VuWK8XQMT3 gXUdTrdOzEKoNEXWeMpVYvE3WxakPgB6FtXeP3A33aus2y8RZUpZir2SVrPrubHiqm1Q 2RpIso2o3vpaV3iwO+CB2v5Z/5ytYeUfqK14L4fZr44XY2NegvmGSrQQGG8G0e0+aY0W WAJA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=KROQTshX; 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 h26si18850346ejq.399.2020.12.28.07.20.27; Mon, 28 Dec 2020 07:20: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=KROQTshX; 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 S2439358AbgL1PSv (ORCPT + 99 others); Mon, 28 Dec 2020 10:18:51 -0500 Received: from mail.kernel.org ([198.145.29.99]:36296 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2437060AbgL1ODE (ORCPT ); Mon, 28 Dec 2020 09:03:04 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 5E5B3205CB; Mon, 28 Dec 2020 14:02:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609164168; bh=50xODR39V2ws8Z3tk3CUEKjrZRMbyLflUJDarGx0Wko=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KROQTshXMWo5CaZqymDSGJ6x4zALKDzJA1R0gkd6wd0Zi//LMLN/nv25Cv8FVuy/Z +CplwtMa98+qXi5ynryfeiqlBKyKUa52vsAI4j+xQh+U319Ayvg1uaduxFeRzL8KqJ 4ylbvBJSvZVdhp9tqboGQMcmGb/qW0DHqX94I74g= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Rob Clark , Sasha Levin Subject: [PATCH 5.10 086/717] drm/msm/a6xx: Clear shadow on suspend Date: Mon, 28 Dec 2020 13:41:24 +0100 Message-Id: <20201228125025.107792556@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228125020.963311703@linuxfoundation.org> References: <20201228125020.963311703@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: Rob Clark [ Upstream commit e8b0b994c3a5881f0648d53f90435120089c56ad ] Clear the shadow rptr on suspend. Otherwise, when we resume, we can have a stale value until CP_WHERE_AM_I executes. If we suspend near the ringbuffer wraparound point, this can lead to a chicken/egg situation where we are waiting for ringbuffer space to write the CP_WHERE_AM_I (or CP_INIT) packet, because we mistakenly believe that the ringbuffer is full (due to stale rptr value in the shadow). Fixes errors like: [drm:adreno_wait_ring [msm]] *ERROR* timeout waiting for space in ringbuffer 0 in the resume path. Fixes: d3a569fccfa0 ("drm/msm: a6xx: Use WHERE_AM_I for eligible targets") Signed-off-by: Rob Clark Signed-off-by: Sasha Levin --- drivers/gpu/drm/msm/adreno/a6xx_gpu.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c index 948f3656c20ca..420ca4a0eb5f7 100644 --- a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c +++ b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c @@ -1045,12 +1045,21 @@ static int a6xx_pm_suspend(struct msm_gpu *gpu) { struct adreno_gpu *adreno_gpu = to_adreno_gpu(gpu); struct a6xx_gpu *a6xx_gpu = to_a6xx_gpu(adreno_gpu); + int i, ret; trace_msm_gpu_suspend(0); devfreq_suspend_device(gpu->devfreq.devfreq); - return a6xx_gmu_stop(a6xx_gpu); + ret = a6xx_gmu_stop(a6xx_gpu); + if (ret) + return ret; + + if (adreno_gpu->base.hw_apriv || a6xx_gpu->has_whereami) + for (i = 0; i < gpu->nr_rings; i++) + a6xx_gpu->shadow[i] = 0; + + return 0; } static int a6xx_get_timestamp(struct msm_gpu *gpu, uint64_t *value) -- 2.27.0