Received: by 2002:a05:7412:3b8b:b0:fc:a2b0:25d7 with SMTP id nd11csp2774856rdb; Mon, 12 Feb 2024 16:56:58 -0800 (PST) X-Google-Smtp-Source: AGHT+IH+2ChCyOBJqWlig1YJP0XCo06gi3gC4s/z94VuJ8DDFWk0fMRB6ahqUl7OWW4WvwI58jON X-Received: by 2002:a05:6512:313c:b0:511:751d:429c with SMTP id p28-20020a056512313c00b00511751d429cmr5219402lfd.8.1707785817846; Mon, 12 Feb 2024 16:56:57 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707785817; cv=pass; d=google.com; s=arc-20160816; b=DEJO64QidGQOV7+S45G/8+6ccxgB3M01Y4TJl04i6id08CgI6uH0/2jQZvTYD142Qh 5T05/w+Cuvs+wJncm+aj9oU95dXF7vsThJZQGw3CShX+N24LS6yEAfh3vSAN4MtrQMFX WMGBAAMQ8At9jPWT8gd2VW82Jqr9Xz9w2X6AW7ceNnnkWZ7iVM4SEMEBE7SfHzyKh97Z HiBNI7t+EYsShOjo2Dt7aQf3PeO5q+oYXw5eTZFmpsgG2g+LZhQb40AIA3Z2J91Na9rg jMFJcM9INv09tQX6NowqjgSEx+uMEZFI9ZwjIQPcKoVPtBGuUBzjmW1yYUDsBMaeq09u T32A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=/BL41BhPUV4y2fgXKIPq7jTkdXOjJlKvL6vf6ahwbn4=; fh=pOeW99RnTDrWkdiZLSQtOUq/HennIz+0yNlVSmJrI0w=; b=s892cbWNZT8VGi59Ml4UxjbBSJGUm7RiFOLszMEP+++SVc2J4TLFuFyzWWda9Bd4xG 8SIOQEUlx4f95j98lwYQOnJ4a/noA/BzVmZCtxGmS/Rfko3MMsLFHPSV4FcAwm6+anu+ VUWIY8O3JhhUXhQz2byXlD2lM9kXcF6Mki+t0tyiHTS2/wZ/Os0I0UkNBPLOdNZj+zqG cYDLIpacXLaWOQ3jM7Bau4jYrh3U32kNHCnEVIlz/mfnDLtgb5gkghAPvj92ivGeKfpk chG7iyG00VAQ6/9WhiIyt6FrBnPYQqTTSiqAHInmo+E/LPoYethoOhR7VSWphTzP3IGV +V3A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=cevW7IBc; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-62708-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-62708-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org X-Forwarded-Encrypted: i=2; AJvYcCXEDSZjNViQM1wCZcSBwOw5AYWaQVMjQ+Uz4rwCYU32o1ayIOI8IeXcaFXjgnIHrUFbIoOb/VirXgCKYXypYtfHiFHE7TWYTY0Ur3aybg== Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id p15-20020a1709060dcf00b00a3863a05958si663078eji.587.2024.02.12.16.56.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Feb 2024 16:56:57 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-62708-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=cevW7IBc; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-62708-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-62708-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 912D91F21D2A for ; Tue, 13 Feb 2024 00:56:57 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0723581755; Tue, 13 Feb 2024 00:23:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="cevW7IBc" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 231C7839E2; Tue, 13 Feb 2024 00:23:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707783796; cv=none; b=O/Mv/d/A5JDcSJMAKAqDtdqA8pn/a7xd+aBkzJ/K84ZTNTB1wS3S1y5LOEzH5xqcgJiJUzgC5e3Us/TIUL3c36tpu+y8HdKjdBA7JUjgvJu5c/91XEAZ8X+3TlDhoxCRCFRVu1OsobEMpCVCUgOfRc9VftX7ea5YoqOHbGT/XzA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707783796; c=relaxed/simple; bh=dyYuoQO6LL8LOppQkKkh22dO/q0dhL/RGV1YgeuYVDo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=OIIUYsD+B3Ogd328NPUew6QztKUoHIgQIXLnvPVEw4s8kE/RgsrRTDP9siTF2jHAggzrLS8DZGtdey+9Lz71/X+lCjp5LqrsIgjGGm+uAWzhMPWAnCMy/55Ydnc5ZxNqz7BX99O7LuVYtzL4Hp2aLnPfutuoKWOEKRWTyC9wHVA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=cevW7IBc; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 72A7CC433F1; Tue, 13 Feb 2024 00:23:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1707783796; bh=dyYuoQO6LL8LOppQkKkh22dO/q0dhL/RGV1YgeuYVDo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cevW7IBcdSX19+TWVvjsmKYDTBdjZYNUrNLvPBKOqHUYY5Jg8CJKOk9pbY8xaWGKd RqkYwxpIhVX3qBP59Q4Yy8iVhN5KpLGjxqc/PzrYFVdilY/QG3KOby45rAPbHkJt27 yE9VmC8p5Gx+e4a3HBTi1Su8WT/uRckP7X1PkvYoBlv4UKQU9J0OoDFifaWAbG/oOp oSZk6zaFbM6rgdpjKrEnUaocjyTj6tzALDx5YREI0shuIhYjWVX6LI2ck/ardRwO86 xJ5xseouyQMFMov/mNph2xaqfTR47U0dQ8DL99IMw0+unE0BlcoECBH5BOvj6byqyA pw0bO/1XxptDg== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Prike Liang , Alex Deucher , Sasha Levin , christian.koenig@amd.com, Xinhui.Pan@amd.com, airlied@gmail.com, daniel@ffwll.ch, lijo.lazar@amd.com, Hawking.Zhang@amd.com, mario.limonciello@amd.com, le.ma@amd.com, andrealmeid@igalia.com, maarten.lankhorst@linux.intel.com, srinivasan.shanmugam@amd.com, James.Zhu@amd.com, aurabindo.pillai@amd.com, Jiadong.Zhu@amd.com, guchun.chen@amd.com, jesse.zhang@amd.com, amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org Subject: [PATCH AUTOSEL 6.1 24/28] drm/amdgpu: skip to program GFXDEC registers for suspend abort Date: Mon, 12 Feb 2024 19:22:22 -0500 Message-ID: <20240213002235.671934-24-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240213002235.671934-1-sashal@kernel.org> References: <20240213002235.671934-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore X-stable-base: Linux 6.1.77 Content-Transfer-Encoding: 8bit From: Prike Liang [ Upstream commit 93bafa32a6918154aa0caf9f66679a32c2431357 ] In the suspend abort cases, the gfx power rail doesn't turn off so some GFXDEC registers/CSB can't reset to default value and at this moment reinitialize GFXDEC/CSB will result in an unexpected error. So let skip those program sequence for the suspend abort case. Signed-off-by: Prike Liang Reviewed-by: Alex Deucher Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin --- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 2 ++ drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 2 ++ drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 8 ++++++++ 3 files changed, 12 insertions(+) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h index c46c6fbd235e..e636c7850f77 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h @@ -999,6 +999,8 @@ struct amdgpu_device { bool in_s3; bool in_s4; bool in_s0ix; + /* indicate amdgpu suspension status */ + bool suspend_complete; enum pp_mp1_state mp1_state; struct amdgpu_doorbell_index doorbell_index; diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c index b9983ca99eb7..f24c3a20e901 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c @@ -2414,6 +2414,7 @@ static int amdgpu_pmops_suspend(struct device *dev) struct drm_device *drm_dev = dev_get_drvdata(dev); struct amdgpu_device *adev = drm_to_adev(drm_dev); + adev->suspend_complete = false; if (amdgpu_acpi_is_s0ix_active(adev)) adev->in_s0ix = true; else if (amdgpu_acpi_is_s3_active(adev)) @@ -2428,6 +2429,7 @@ static int amdgpu_pmops_suspend_noirq(struct device *dev) struct drm_device *drm_dev = dev_get_drvdata(dev); struct amdgpu_device *adev = drm_to_adev(drm_dev); + adev->suspend_complete = true; if (amdgpu_acpi_should_gpu_reset(adev)) return amdgpu_asic_reset(adev); diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c index 84ca601f7d5f..195b29892354 100644 --- a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c @@ -3064,6 +3064,14 @@ static int gfx_v9_0_cp_gfx_start(struct amdgpu_device *adev) gfx_v9_0_cp_gfx_enable(adev, true); + /* Now only limit the quirk on the APU gfx9 series and already + * confirmed that the APU gfx10/gfx11 needn't such update. + */ + if (adev->flags & AMD_IS_APU && + adev->in_s3 && !adev->suspend_complete) { + DRM_INFO(" Will skip the CSB packet resubmit\n"); + return 0; + } r = amdgpu_ring_alloc(ring, gfx_v9_0_get_csb_size(adev) + 4 + 3); if (r) { DRM_ERROR("amdgpu: cp failed to lock ring (%d).\n", r); -- 2.43.0