Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2658949pxa; Mon, 17 Aug 2020 15:46:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzzzU4y2fe+2x73KAZKQKK2wYaEY2XI5chxv4x6z70rzKN1H9gXSw6ZtyTHoJqhlvJFTNli X-Received: by 2002:aa7:d8d8:: with SMTP id k24mr17875072eds.32.1597704374415; Mon, 17 Aug 2020 15:46:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597704374; cv=none; d=google.com; s=arc-20160816; b=FHlRYGvtNt1kGt75RC3I8N1C87UXPEuTg+ceBCi9/oc6e4cyDELmhUlyRK+auzGKHi iTUw2MZ8KIYWXKL0r9dkCgz9YG5EMs68rKiBpVb3ZAlXsRj9r+qrkp4XkKwCDQjGhdVj zrU55tf3TejweCBwK7rdI+eKlK1uSRyZbSLtggU88Rxc/VC77NCXHT0QS/vovLTcmp77 lzVctayPOCJWJp+zY6o/I/T+TXbtGPIRvuVKa8rQqpAZrLnzgY84NorvBmJTwY2r9Uk3 D7ATkzKUW6XCcqenqUdhMimY5JYObxWKSZHdnPSZsl0C/iV11g4Vh/7zkg+tzpsbbodf qYdg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=E0Qu6TM8c1AO2SPpIqufUeH50d1zUEYwOHFAxciKHw0=; b=zYeCEum4uJjnQ7oInEYkSxipT1jJrjekT1mRhKqXuWDkCDyiIzWjpSrmSFD0gcV+WU ijze3aPyUkhYBL4MvSYuOOEYIPnO/kAlFuiCXnK9WHL/cCgamQnsUbWULUXA6sUTc3rU WLWTv0+FAW+xejjfSqzwDz0JM0SdL3SdRS9TDOS9upy9CcvVQeyZt2nwlJCb1d915JTs rvqIeP31caCQaR992VWd68ZDWutHV5w/dDbaDBCcnIgN3qKx1lfTzl37dhScxrLfAKR3 jVhFPglgzWPSDirHLWLuJii2HU7rQaP/A86y5FW57Z6XuZI3Ql5AwPqEPADgRZlV1Thh EOeA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=V0IE37Vm; 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=fail (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 n13si12404284eje.393.2020.08.17.15.45.51; Mon, 17 Aug 2020 15:46:14 -0700 (PDT) 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=@kernel.org header.s=default header.b=V0IE37Vm; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391917AbgHQTDl (ORCPT + 99 others); Mon, 17 Aug 2020 15:03:41 -0400 Received: from mail.kernel.org ([198.145.29.99]:58360 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387413AbgHQPqd (ORCPT ); Mon, 17 Aug 2020 11:46:33 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 22EFD2065D; Mon, 17 Aug 2020 15:46:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597679192; bh=USN0Q1T9sE6yZpQz7cHcvRFMEmyBPpCpKUSkznsy/i4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=V0IE37VmkXM/j3NrMhmueAutY2Vq4iKYk+iEKk/02D/BxEoCRbt8JMtRX9AgIMbdK 5yHNoNQ6R86Dvs7aw+lsjhQKKyB4EgU/FApDVQtZPbZS5eTmr+VQa55pzALgDPE4tf yN/+VXAVCje1IMnsUM3646+CetqBLqomvPVRZH3U= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Matthias Kaehlcke , Akhil P Oommen , Jordan Crouse , Rob Clark , Sasha Levin Subject: [PATCH 5.7 087/393] drm: msm: a6xx: fix gpu failure after system resume Date: Mon, 17 Aug 2020 17:12:17 +0200 Message-Id: <20200817143823.852398092@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200817143819.579311991@linuxfoundation.org> References: <20200817143819.579311991@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Akhil P Oommen [ Upstream commit 57c0bd517c06b088106b0236ed604056c8e06da5 ] On targets where GMU is available, GMU takes over the ownership of GX GDSC during its initialization. So, move the refcount-get on GX PD before we initialize the GMU. This ensures that nobody can collapse the GX GDSC once GMU owns the GX GDSC. This patch fixes some GMU OOB errors seen during GPU wake up during a system resume. Reported-by: Matthias Kaehlcke Signed-off-by: Akhil P Oommen Tested-by: Matthias Kaehlcke Reviewed-by: Jordan Crouse Signed-off-by: Rob Clark Signed-off-by: Sasha Levin --- drivers/gpu/drm/msm/adreno/a6xx_gmu.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gmu.c b/drivers/gpu/drm/msm/adreno/a6xx_gmu.c index 34607a98cc7c8..9a7a18951dc2b 100644 --- a/drivers/gpu/drm/msm/adreno/a6xx_gmu.c +++ b/drivers/gpu/drm/msm/adreno/a6xx_gmu.c @@ -732,10 +732,19 @@ int a6xx_gmu_resume(struct a6xx_gpu *a6xx_gpu) /* Turn on the resources */ pm_runtime_get_sync(gmu->dev); + /* + * "enable" the GX power domain which won't actually do anything but it + * will make sure that the refcounting is correct in case we need to + * bring down the GX after a GMU failure + */ + if (!IS_ERR_OR_NULL(gmu->gxpd)) + pm_runtime_get_sync(gmu->gxpd); + /* Use a known rate to bring up the GMU */ clk_set_rate(gmu->core_clk, 200000000); ret = clk_bulk_prepare_enable(gmu->nr_clocks, gmu->clocks); if (ret) { + pm_runtime_put(gmu->gxpd); pm_runtime_put(gmu->dev); return ret; } @@ -771,19 +780,12 @@ int a6xx_gmu_resume(struct a6xx_gpu *a6xx_gpu) /* Set the GPU to the current freq */ __a6xx_gmu_set_freq(gmu, gmu->current_perf_index); - /* - * "enable" the GX power domain which won't actually do anything but it - * will make sure that the refcounting is correct in case we need to - * bring down the GX after a GMU failure - */ - if (!IS_ERR_OR_NULL(gmu->gxpd)) - pm_runtime_get(gmu->gxpd); - out: /* On failure, shut down the GMU to leave it in a good state */ if (ret) { disable_irq(gmu->gmu_irq); a6xx_rpmh_stop(gmu); + pm_runtime_put(gmu->gxpd); pm_runtime_put(gmu->dev); } -- 2.25.1