[PATCH] drm/amdgpu: limit the number of enabled gfx queues

Lang Yu Lang.Yu at amd.com
Thu Jul 14 07:06:45 UTC 2022


The driver can only support AMDGPU_MAX_GFX_RINGS gfx queues
at the moment. Once enabled gfx queues exceed the limit,
we will run into problems when setting up gfx rings in
gfx_xxx_sw_init().

Signed-off-by: Lang Yu <Lang.Yu at amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
index 222d3d7ea076..ae3fe1d0df04 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
@@ -229,8 +229,9 @@ void amdgpu_gfx_graphics_queue_acquire(struct amdgpu_device *adev)
 {
 	int i, queue, pipe;
 	bool multipipe_policy = amdgpu_gfx_is_graphics_multipipe_capable(adev);
-	int max_queues_per_me = adev->gfx.me.num_pipe_per_me *
-					adev->gfx.me.num_queue_per_pipe;
+	int max_queues_per_me = min(adev->gfx.me.num_pipe_per_me *
+				    adev->gfx.me.num_queue_per_pipe,
+				    adev->gfx.num_gfx_rings);
 
 	if (multipipe_policy) {
 		/* policy: amdgpu owns the first queue per pipe at this stage
-- 
2.25.1



More information about the amd-gfx mailing list