Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp2281685ybl; Thu, 19 Dec 2019 10:57:57 -0800 (PST) X-Google-Smtp-Source: APXvYqzabdlg4n7yt+WvlXoHfqL86UCJyRzBnNTybjCdQhQr3wgqrP0iE0Nm3rgcTs93e+HEsZik X-Received: by 2002:a9d:2264:: with SMTP id o91mr10524790ota.328.1576781877537; Thu, 19 Dec 2019 10:57:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576781877; cv=none; d=google.com; s=arc-20160816; b=AKxteSkAe3b5j6z0RGO5x2pX2va1v3dTGCwbrsCPJ9nk4c+VpnKFHSfvO530HRwAEW kA0YBK8n3uAEj0uApvjRs/kHwLIipxMoGx7Q9bu8tLGeoSFYgk+eTAtDykBKcazUBhzb g0ymJWLlQlqcYNGuSrdjsI2TtdLTkaknhJhE1BnMDeGugVm8Ac7YBk71pRSzXR5DvwUJ F+ljkqXLm89x0/+F43UajyeHckuzXdL1tq4EoSIZTZsRjPiO72CSgNCO8YGt1Oz38X1s gCwrNWKWXeu9TSIXoyWHAImd1cKF9tQ0+zm0uMqAfmi/srg0/UM3Vnv/CkiRimZreYWh 6iJw== 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=LeqbWw+StI9uyftbIu3TXxDoPoucHEqtLZozHHAj9Es=; b=OcS/5wr8JECNRb6ksBphq88FmK52tYn3uh19Bfa3zKsDi/gsgEfT173VCutdI9j0ls I2yc3AcnyJY4hh6iLgFh2MxhX555PWBl42bXi2glxXbsx9IdQk6tZ/2mLdqpjDjktovu qDJhQ7t91WzCqS2GA0vWmH6rmmNMIPYA4KqerePldW/RqD1cYvhTH68zmCkhrLwwNj+o alzUzb0ste/kij+GmBeYZkFyXqAMy7+9btqrniYFObVGuI30OLO9WYsE4dYErW5UntId Uzrrb8Ormf4nPz/652xlpf6JmiOLXc+ijMSPFCPIiJskVQcomVYoflgUf4dPBQ/E3Vyn TaTw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="F/RPvFqs"; 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 z1si3910826otq.21.2019.12.19.10.57.46; Thu, 19 Dec 2019 10:57:57 -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="F/RPvFqs"; 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 S1730397AbfLSS4n (ORCPT + 99 others); Thu, 19 Dec 2019 13:56:43 -0500 Received: from mail.kernel.org ([198.145.29.99]:53218 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730836AbfLSS4e (ORCPT ); Thu, 19 Dec 2019 13:56:34 -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 EE99124680; Thu, 19 Dec 2019 18:56:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1576781793; bh=7sY046JbMAysiL9yT1LYPKdCt5/b+zKjlxbI9OJCcas=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=F/RPvFqsgaq5OjPGUKtyO5A+osJ2lvnPeP7xSuQHkTvQZpHRpwKTZCtsaVXleouWh FAA/gm4xyzNOtQFab+xtHPxcSDPjxTTWApEMZWjJ+SL2Rgl9t4yFamLdvLfhJ2wGPn oVL94EpZs/s0NdlL5WP/rz24IXvWMvbszx81q/3Q= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Xiaojie Yuan , Jack Xiao , Alex Deucher Subject: [PATCH 5.4 76/80] drm/amdgpu/gfx10: explicitly wait for cp idle after halt/unhalt Date: Thu, 19 Dec 2019 19:35:08 +0100 Message-Id: <20191219183146.311627973@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 1e902a6d32d73e4a6b3bc9d7cd43d4ee2b242dea upstream. 50us is not enough to wait for cp ready after gpu reset on some navi asics. Signed-off-by: Xiaojie Yuan Suggested-by: Jack Xiao Acked-by: Alex Deucher 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 | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) --- a/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c @@ -2400,7 +2400,7 @@ static int gfx_v10_0_wait_for_rlc_autolo return 0; } -static void gfx_v10_0_cp_gfx_enable(struct amdgpu_device *adev, bool enable) +static int gfx_v10_0_cp_gfx_enable(struct amdgpu_device *adev, bool enable) { int i; u32 tmp = RREG32_SOC15(GC, 0, mmCP_ME_CNTL); @@ -2413,7 +2413,17 @@ static void gfx_v10_0_cp_gfx_enable(stru adev->gfx.gfx_ring[i].sched.ready = false; } WREG32_SOC15(GC, 0, mmCP_ME_CNTL, tmp); - udelay(50); + + for (i = 0; i < adev->usec_timeout; i++) { + if (RREG32_SOC15(GC, 0, mmCP_STAT) == 0) + break; + udelay(1); + } + + if (i >= adev->usec_timeout) + DRM_ERROR("failed to %s cp gfx\n", enable ? "unhalt" : "halt"); + + return 0; } static int gfx_v10_0_cp_gfx_load_pfp_microcode(struct amdgpu_device *adev)