[PATCH] drm/amdgpu: Add support for page queue scheduling

Jesse.zhang@amd.com jesse.zhang at amd.com
Tue Feb 11 09:02:03 UTC 2025


This patch updates the sdma engine to support scheduling for
the page queue. The main changes include:

- Introduce a new variable `page` to handle the page queue if it exists.
- Update the scheduling logic to conditionally set the `sched.ready` flag for
  both the sdma gfx queue and the page queue based on the provided mask.
- Ensure that the scheduling flags are updated correctly for both queues when
  the mask is applied.

The patch ensures that the SDMA engine can handle scheduling for both the sdma gfx
queue and the page queue,

Signed-off-by: Jesse Zhang <jesse.zhang at amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c
index 6ba785798a4a..e82ded95540c 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c
@@ -358,7 +358,7 @@ static int amdgpu_debugfs_sdma_sched_mask_set(void *data, u64 val)
 	struct amdgpu_device *adev = (struct amdgpu_device *)data;
 	u32 i;
 	u64 mask = 0;
-	struct amdgpu_ring *ring;
+	struct amdgpu_ring *ring, *page;
 
 	if (!adev)
 		return -ENODEV;
@@ -369,10 +369,18 @@ static int amdgpu_debugfs_sdma_sched_mask_set(void *data, u64 val)
 
 	for (i = 0; i < adev->sdma.num_instances; ++i) {
 		ring = &adev->sdma.instance[i].ring;
-		if (val & BIT_ULL(i))
+		if (adev->sdma.has_page_queue)
+			page = &adev->sdma.instance[i].page;
+		if (val & BIT_ULL(i)) {
 			ring->sched.ready = true;
-		else
+			if (adev->sdma.has_page_queue)
+				page->sched.ready = true;
+		} else {
 			ring->sched.ready = false;
+			if (adev->sdma.has_page_queue)
+				page->sched.ready = false;
+		}
+
 	}
 	/* publish sched.ready flag update effective immediately across smp */
 	smp_rmb();
-- 
2.25.1



More information about the amd-gfx mailing list