All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: stable@vger.kernel.org
Cc: "ZhenGuo Yin" <zhenguo.yin@amd.com>,
	"Alex Deucher" <alexander.deucher@amd.com>,
	"Christian König" <christian.koenig@amd.com>,
	"Sasha Levin" <sashal@kernel.org>
Subject: [PATCH 6.6.y 2/3] drm/amdgpu: fix warning of drm_mm_clean
Date: Tue, 22 Sep 2026 21:40:13 -0400	[thread overview]
Message-ID: <20260923014014.880066-2-sashal@kernel.org> (raw)
In-Reply-To: <20260923014014.880066-1-sashal@kernel.org>

From: ZhenGuo Yin <zhenguo.yin@amd.com>

[ Upstream commit e7afa85a0d0eba5bf2c0a446ff622ebdbc9812d6 ]

Kernel doorbell BOs needs to be freed before ttm_fini.

Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/4145
Fixes: 54c30d2a8def ("drm/amdgpu: create kernel doorbell pages")
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: ZhenGuo Yin <zhenguo.yin@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
(cherry picked from commit 39938a8ed979e398faa3791a47e282c82bcc6f04)
Cc: stable@vger.kernel.org

Stable backport adaptation:
The 6.6 tree already allocates kernel doorbell BOs, but has no seq64
teardown. Move the existing doorbell cleanup immediately after the IB
pool cleanup and before the GMC sw_fini callback tears down TTM.

Prepare the local declaration for target 5155002b03b24ba3ef91c5c313b8cf0171b24904,
which removes idx from "int i, idx". Use i for the existing switcheroo
unregistration predicate so it remains used before and after that patch,
without changing the decision or adding any functions.

Stable-dep-of: 5155002b03b2 ("drm/amdgpu: fix rmmio iounmap skipped on device removal")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index 47d6352c2def4..a61573a1c0c40 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
@@ -2930,6 +2930,7 @@ static int amdgpu_device_ip_fini(struct amdgpu_device *adev)
 			amdgpu_device_wb_fini(adev);
 			amdgpu_device_mem_scratch_fini(adev);
 			amdgpu_ib_pool_fini(adev);
+			amdgpu_doorbell_fini(adev);
 		}
 
 		r = adev->ip_blocks[i].version->funcs->sw_fini((void *)adev);
@@ -4146,7 +4147,7 @@ void amdgpu_device_fini_hw(struct amdgpu_device *adev)
 
 void amdgpu_device_fini_sw(struct amdgpu_device *adev)
 {
-	int idx;
+	int i, idx;
 	bool px;
 
 	amdgpu_device_ip_fini(adev);
@@ -4169,7 +4170,8 @@ void amdgpu_device_fini_sw(struct amdgpu_device *adev)
 
 	px = amdgpu_device_supports_px(adev_to_drm(adev));
 
-	if (amdgpu_device_should_register_switcheroo(adev, px))
+	i = amdgpu_device_should_register_switcheroo(adev, px);
+	if (i)
 		vga_switcheroo_unregister_client(adev->pdev);
 
 	if (px)
@@ -4182,7 +4184,6 @@ void amdgpu_device_fini_sw(struct amdgpu_device *adev)
 
 		iounmap(adev->rmmio);
 		adev->rmmio = NULL;
-		amdgpu_doorbell_fini(adev);
 		drm_dev_exit(idx);
 	}
 
-- 
2.53.0


  reply	other threads:[~2026-09-23  1:40 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-22 15:03 FAILED: patch "[PATCH] drm/amdgpu: fix rmmio iounmap skipped on device removal" failed to apply to 6.6-stable tree gregkh
2026-09-23  1:40 ` [PATCH 6.6.y 1/3] drm/amdgpu: set the VM pointer to NULL in amdgpu_job_prepare Sasha Levin
2026-09-23  1:40   ` Sasha Levin [this message]
2026-09-23  1:40   ` [PATCH 6.6.y 3/3] drm/amdgpu: fix rmmio iounmap skipped on device removal Sasha Levin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260923014014.880066-2-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=alexander.deucher@amd.com \
    --cc=christian.koenig@amd.com \
    --cc=stable@vger.kernel.org \
    --cc=zhenguo.yin@amd.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.