Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp2282882ybl; Thu, 19 Dec 2019 10:59:18 -0800 (PST) X-Google-Smtp-Source: APXvYqxiN0u0a2eUHfmkVrJHlMIIoXeBZvoH3VhEYYe1aQf9bfA0UYwBLm07Ql15RKlW6341u7S4 X-Received: by 2002:aca:5cc1:: with SMTP id q184mr2629701oib.122.1576781958448; Thu, 19 Dec 2019 10:59:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576781958; cv=none; d=google.com; s=arc-20160816; b=FTDAf3pwTSikG6ExqCeDEtUGWFze1yjJdazIa3x6sxwHc6kl7GmjfLtvUppq90vUFt 7VQ7L35Ttdlktl0Lr+3maMMD6GqBvVTxbOiu/JjJmf5A+prEiPIpyDWrCxPQTFZAB9Oq xn+ZbqieVUgB+nTf9kP8mAIoPsr3waSdWvAeYf0RIu9YJmEQAcn1JM0VT5vbCJ9xh/iJ KWhgQzl1Ca7G3Ycm380fMIlvKsnhUn8NP8QcGRbY36dpvN6aRK8ZA9nf13x/F4Zw0JBX c1ShlCKCqbIiXwQum71hmy1p/CrLPpf8a7BdiVK5TN254Trd81//zlB+H6kWl/RW0J3b B9ew== 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=uSh9O09RoWSoXUUW5MxxscJu2lGah7wIagFpJea867g=; b=jq+BX35TQyGtYAKZHU5iWq11Pq+u7YNd5eg1QFhgEqUsNbLlEwKB1ugUKWuhGgHfcs U6kwJnop04kaxFFsZSQIAggeDZJ17E6TQYJ7iDekz0koCHG7xNTiSEzRbjEPbXG4ugez VIzivmE/WScD+CniAI64B/bPeR9seh5XURKXpgeUtmueO2cgJ5rfH3Y3lbb5YqS8GptC Xwbkzwgvz5tsDX02lSIhDPRYnCmox0rbC2V74ERfCuwWaTV3u1ruDZbXcC/INt3ieuvc STOsTf85wdkVPrBSRZfVkNe6G9V3m4aM2pDe/Hc/dlmB1sSvzkvSBOYeGYt8y6Uo20R1 ADcQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=2HtCluke; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o4si3543588oib.70.2019.12.19.10.59.07; Thu, 19 Dec 2019 10:59:18 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=2HtCluke; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730832AbfLSS5N (ORCPT + 99 others); Thu, 19 Dec 2019 13:57:13 -0500 Received: from mail.kernel.org ([198.145.29.99]:53262 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730626AbfLSS4h (ORCPT ); Thu, 19 Dec 2019 13:56:37 -0500 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 6542624683; Thu, 19 Dec 2019 18:56:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1576781795; bh=Kl+1FOt4ETt7Kp1G9zYfPSSHPb/+By/0Im49Y1+D0PQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2HtCluke4PaxJv4D+AbM/On0ERoq4E46PoCK6+FigXV9rZQvDr0KqaHxpi/kknW0i 9HQsnMv93UF7hrIpO4URuY11tSegSD9KxMw2DZEr8MLR3ss8+5mYkG4RlOmrNnuOcK TdfJuhxY6/CK1TNsNYUAyI6qgWK6lmyo51L/Djx4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Xiaojie Yuan , Hawking Zhang , Alex Deucher Subject: [PATCH 5.4 77/80] drm/amdgpu/gfx10: re-init clear state buffer after gpu reset Date: Thu, 19 Dec 2019 19:35:09 +0100 Message-Id: <20191219183146.949139449@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20191219183031.278083125@linuxfoundation.org> References: <20191219183031.278083125@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: Xiaojie Yuan commit 210b3b3c7563df391bd81d49c51af303b928de4a upstream. This patch fixes 2nd baco reset failure with gfxoff enabled on navi1x. clear state buffer (resides in vram) is corrupted after 1st baco reset, upon gfxoff exit, CPF gets garbage header in CSIB and hangs. Signed-off-by: Xiaojie Yuan Reviewed-by: Hawking Zhang Signed-off-by: Alex Deucher Cc: stable@vger.kernel.org Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 43 ++++++++++++++++++++++++++++----- 1 file changed, 37 insertions(+), 6 deletions(-) --- a/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c @@ -1785,27 +1785,52 @@ static void gfx_v10_0_enable_gui_idle_in WREG32_SOC15(GC, 0, mmCP_INT_CNTL_RING0, tmp); } -static void gfx_v10_0_init_csb(struct amdgpu_device *adev) +static int gfx_v10_0_init_csb(struct amdgpu_device *adev) { + int r; + + if (adev->in_gpu_reset) { + r = amdgpu_bo_reserve(adev->gfx.rlc.clear_state_obj, false); + if (r) + return r; + + r = amdgpu_bo_kmap(adev->gfx.rlc.clear_state_obj, + (void **)&adev->gfx.rlc.cs_ptr); + if (!r) { + adev->gfx.rlc.funcs->get_csb_buffer(adev, + adev->gfx.rlc.cs_ptr); + amdgpu_bo_kunmap(adev->gfx.rlc.clear_state_obj); + } + + amdgpu_bo_unreserve(adev->gfx.rlc.clear_state_obj); + if (r) + return r; + } + /* csib */ WREG32_SOC15(GC, 0, mmRLC_CSIB_ADDR_HI, adev->gfx.rlc.clear_state_gpu_addr >> 32); WREG32_SOC15(GC, 0, mmRLC_CSIB_ADDR_LO, adev->gfx.rlc.clear_state_gpu_addr & 0xfffffffc); WREG32_SOC15(GC, 0, mmRLC_CSIB_LENGTH, adev->gfx.rlc.clear_state_size); + + return 0; } -static void gfx_v10_0_init_pg(struct amdgpu_device *adev) +static int gfx_v10_0_init_pg(struct amdgpu_device *adev) { int i; + int r; - gfx_v10_0_init_csb(adev); + r = gfx_v10_0_init_csb(adev); + if (r) + return r; for (i = 0; i < adev->num_vmhubs; i++) amdgpu_gmc_flush_gpu_tlb(adev, 0, i, 0); /* TODO: init power gating */ - return; + return 0; } void gfx_v10_0_rlc_stop(struct amdgpu_device *adev) @@ -1907,7 +1932,10 @@ static int gfx_v10_0_rlc_resume(struct a r = gfx_v10_0_wait_for_rlc_autoload_complete(adev); if (r) return r; - gfx_v10_0_init_pg(adev); + + r = gfx_v10_0_init_pg(adev); + if (r) + return r; /* enable RLC SRM */ gfx_v10_0_rlc_enable_srm(adev); @@ -1933,7 +1961,10 @@ static int gfx_v10_0_rlc_resume(struct a return r; } - gfx_v10_0_init_pg(adev); + r = gfx_v10_0_init_pg(adev); + if (r) + return r; + adev->gfx.rlc.funcs->start(adev); if (adev->firmware.load_type == AMDGPU_FW_LOAD_RLC_BACKDOOR_AUTO) {