Skip to contentSkip to conversation

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

PATCH New Alex Deucher 2 participants 2 messages Nov 19

Subsystems (2)
lore
Share & tools
lore

Alex Deucher

author maintainer
#0 lore raw

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

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")
---
 drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c +10 -4
index 570f0f3a2ea5e..16b211174c8dd 100644
@@ -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;
@@ -5322,10 +5323,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);
 	}
Signature · 1 line
2.56.1
#1 lore raw
Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [Low] drm/amdgpu/gfx11: dead tmz_enabled check in gfx_v11_0_early_init() --

Thank you for your contribution! Sashiko AI review found 1 potential issue to consider:
- [Low] drm/amdgpu/gfx11: dead tmz_enabled check in gfx_v11_0_early_init()
--

commit 7adeab4007af8d1d45d18ee604343d9e2fa08024
Author: Alex Deucher <[email protected]>

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

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

Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c +0 -0
index 5d068a9d9c72c..d4ea4769efa0b 100644

[ ... ]

Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c +1 -3
@@ -5302,10 +5303,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;

drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c static int gfx_v11_0_early_init(struct amdgpu_ip_block *ip_block) · line 5317

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c +7 -0
+		} 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);
 	}

[Severity: Low]
Can adev->gmc.tmz_enabled ever be true in gfx_v11_0_early_init()?

In amdgpu_device_init(), amdgpu_device_ip_early_init() runs before amdgpu_gmc_tmz_set() initializes adev->gmc.tmz_enabled:

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c:amdgpu_device_init() {
	...
	/* early init functions */
	r = amdgpu_device_ip_early_init(adev);
	if (r)
		return r;
	...
	/* Enable TMZ based on IP_VERSION */
	amdgpu_gmc_tmz_set(adev);
	...
}

Because adev->gmc.tmz_enabled is still false here, gfx_v11_0_early_init() always sets adev->gfx.num_gfx_rings to GFX11_NUM_GFX_RINGS and gfx_v11_0_set_ring_funcs() populates gfx_ring[1].funcs before gfx_v11_0_sw_init() later clamps num_pipe_per_me and num_gfx_rings back to 1.

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1