AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] drm/amdgpu: move tmz init into early_init()
@ 2026-11-19 19:36 Alex Deucher
  2026-11-19 19:36 ` [PATCH 2/2] drm/amdgpu/gfx11: don't enable gfx on pipe1 with tmz Alex Deucher
  0 siblings, 1 reply; 3+ messages in thread
From: Alex Deucher @ 2026-11-19 19:36 UTC (permalink / raw)
  To: amd-gfx; +Cc: Alex Deucher

We will need the tmz status in early init for gfx11 in
the next patch.

Fixes: fec62b5e1425 ("drm/amdgpu/gfx11: enable gfx pipe1 hardware support")
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index 09a54b8ebe8c2..b892ae1ee54d6 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
@@ -2116,6 +2116,9 @@ static int amdgpu_device_ip_early_init(struct amdgpu_device *adev)
 	if (adev->firmware.load_type == AMDGPU_FW_LOAD_PSP)
 		amdgpu_psp_init_fw_variant(adev);
 
+	/* Enable TMZ based on IP_VERSION */
+	amdgpu_gmc_tmz_set(adev);
+
 	total = true;
 	for (i = 0; i < adev->num_ip_blocks; i++) {
 		ip_block = &adev->ip_blocks[i];
@@ -4058,9 +4061,6 @@ int amdgpu_device_init(struct amdgpu_device *adev,
 			return r;
 	}
 
-	/* Enable TMZ based on IP_VERSION */
-	amdgpu_gmc_tmz_set(adev);
-
 	if (amdgpu_sriov_vf(adev) &&
 	    amdgpu_ip_version(adev, GC_HWIP, 0) >= IP_VERSION(10, 3, 0))
 		/* VF MMIO access (except mailbox range) from CPU
-- 
2.56.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/2] drm/amdgpu/gfx11: don't enable gfx on pipe1 with tmz
  2026-11-19 19:36 [PATCH 1/2] drm/amdgpu: move tmz init into early_init() Alex Deucher
@ 2026-11-19 19:36 ` Alex Deucher
  2026-11-19 19:47   ` sashiko-bot
  0 siblings, 1 reply; 3+ messages in thread
From: Alex Deucher @ 2026-11-19 19:36 UTC (permalink / raw)
  To: amd-gfx; +Cc: Alex Deucher

FW doesn't support tmz on pipe one.  Only use pipe 0 if
tmz is enabled.

v2: add check for num_pipe as well

Fixes: fec62b5e1425 ("drm/amdgpu/gfx11: enable gfx pipe1 hardware support")
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c
index 6283adec811a3..ab55789b51059 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c
@@ -1692,7 +1692,8 @@ static int gfx_v11_0_sw_init(struct amdgpu_ip_block *ip_block)
 	case IP_VERSION(11, 7, 0):
 	case IP_VERSION(11, 7, 1):
 		adev->gfx.me.num_me = 1;
-		if (adev->gfx.rs64_enable)
+		if (adev->gfx.rs64_enable ||
+		    adev->gmc.tmz_enabled)
 			adev->gfx.me.num_pipe_per_me = 1;
 		else
 			adev->gfx.me.num_pipe_per_me = 2;
@@ -5334,10 +5335,15 @@ static int gfx_v11_0_early_init(struct amdgpu_ip_block *ip_block)
 		adev->gfx.num_compute_rings = 0;
 	} else {
 		/* rs64 only supports one gfx pipe */
-		if (adev->gfx.rs64_enable)
+		if (adev->gfx.rs64_enable) {
 			adev->gfx.num_gfx_rings = 1;
-		else
-			adev->gfx.num_gfx_rings = GFX11_NUM_GFX_RINGS;
+		} else {
+			/* FW doesn't support TMZ on gfx pipe1 */
+			if (adev->gmc.tmz_enabled)
+				adev->gfx.num_gfx_rings = 1;
+			else
+				adev->gfx.num_gfx_rings = GFX11_NUM_GFX_RINGS;
+		}
 		adev->gfx.num_compute_rings = min(amdgpu_gfx_get_num_kcq(adev),
 						  AMDGPU_MAX_COMPUTE_RINGS);
 	}
-- 
2.56.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 2/2] drm/amdgpu/gfx11: don't enable gfx on pipe1 with tmz
  2026-11-19 19:36 ` [PATCH 2/2] drm/amdgpu/gfx11: don't enable gfx on pipe1 with tmz Alex Deucher
@ 2026-11-19 19:47   ` sashiko-bot
  0 siblings, 0 replies; 3+ messages in thread
From: sashiko-bot @ 2026-11-19 19:47 UTC (permalink / raw)
  To: Alex Deucher, amd-gfx

Thank you for your contribution! Sashiko AI review found no new issues
in this patch, but noticed 1 related pre-existing issue it does not
introduce:
- [High] drm/amdgpu/gfx11: NULL pointer dereference in
  amdgpu_ring_init() [1]
--

commit 0a934348cc9c64c8c23b8255a5b64447ad24179d
Author: Alex Deucher <alexander.deucher@amd.com>

drm/amdgpu/gfx11: don't enable gfx on pipe1 with tmz

This commit limits GFX11 devices to a single GFX pipe and ring when TMZ
is enabled, as the firmware does not support TMZ on pipe 1.

> diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c
> index 570f0f3a2ea5e..16b211174c8dd 100644
> --- a/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c
> @@ -1690,7 +1690,8 @@ static int gfx_v11_0_sw_init(struct amdgpu_ip_block *ip_block)
>  	case IP_VERSION(11, 7, 0):
>  	case IP_VERSION(11, 7, 1):
>  		adev->gfx.me.num_me = 1;
> -		if (adev->gfx.rs64_enable)
> +		if (adev->gfx.rs64_enable ||
> +		    adev->gmc.tmz_enabled)
>  			adev->gfx.me.num_pipe_per_me = 1;
>  		else
>  			adev->gfx.me.num_pipe_per_me = 2;

[Severity: High]
This problem wasn't introduced by this patch, but should this condition
also check adev->gfx.disable_kq [1]?

When amdgpu.user_queue=2 sets adev->gfx.disable_kq, gfx_v11_0_early_init()
sets adev->gfx.num_gfx_rings = 1, so gfx_v11_0_set_ring_funcs() only
populates adev->gfx.gfx_ring[0].funcs and leaves gfx_ring[1].funcs NULL.

If adev->gfx.me.num_pipe_per_me is set to 2 here, gfx_v11_0_me_init() ->
amdgpu_gfx_graphics_queue_acquire() enables queues on both pipes and
overwrites adev->gfx.num_gfx_rings to 2.  gfx_v11_0_sw_init() then calls
gfx_v11_0_gfx_ring_init() for gfx_ring[1], causing amdgpu_ring_init() to
dereference the NULL ring->funcs pointer.

[1] https://sashiko.dev/#/bug/linux-cb8251e2-db73-484e-81c4-7d48aaa6e13f

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261119193620.217718-1-alexander.deucher@amd.com?part=2

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-11-19 19:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-19 19:36 [PATCH 1/2] drm/amdgpu: move tmz init into early_init() Alex Deucher
2026-11-19 19:36 ` [PATCH 2/2] drm/amdgpu/gfx11: don't enable gfx on pipe1 with tmz Alex Deucher
2026-11-19 19:47   ` sashiko-bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox