drm/amdgpu: free up the first paging queue v2
authorChristian König <christian.koenig@amd.com>
Wed, 5 Dec 2018 13:24:21 +0000 (14:24 +0100)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 21 Mar 2019 04:39:47 +0000 (23:39 -0500)
We need the first paging queue to handle page faults.

v2: handle any number of SDMA instances gracefully

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c

index 756f3c60ae6ab803c12305e3ae382eea4d37dbd5..1430d1cbc4067fa3bea966dbdee657fe1e6fbf78 100644 (file)
@@ -2265,8 +2265,8 @@ static const struct amdgpu_buffer_funcs sdma_v4_0_buffer_funcs = {
 static void sdma_v4_0_set_buffer_funcs(struct amdgpu_device *adev)
 {
        adev->mman.buffer_funcs = &sdma_v4_0_buffer_funcs;
-       if (adev->sdma.has_page_queue)
-               adev->mman.buffer_funcs_ring = &adev->sdma.instance[0].page;
+       if (adev->sdma.has_page_queue && adev->sdma.num_instances > 1)
+               adev->mman.buffer_funcs_ring = &adev->sdma.instance[1].page;
        else
                adev->mman.buffer_funcs_ring = &adev->sdma.instance[0].ring;
 }
@@ -2285,15 +2285,21 @@ static void sdma_v4_0_set_vm_pte_funcs(struct amdgpu_device *adev)
        unsigned i;
 
        adev->vm_manager.vm_pte_funcs = &sdma_v4_0_vm_pte_funcs;
-       for (i = 0; i < adev->sdma.num_instances; i++) {
-               if (adev->sdma.has_page_queue)
+       if (adev->sdma.has_page_queue && adev->sdma.num_instances > 1) {
+               for (i = 1; i < adev->sdma.num_instances; i++) {
                        sched = &adev->sdma.instance[i].page.sched;
-               else
+                       adev->vm_manager.vm_pte_rqs[i - 1] =
+                               &sched->sched_rq[DRM_SCHED_PRIORITY_KERNEL];
+               }
+               adev->vm_manager.vm_pte_num_rqs = adev->sdma.num_instances - 1;
+       } else {
+               for (i = 0; i < adev->sdma.num_instances; i++) {
                        sched = &adev->sdma.instance[i].ring.sched;
-               adev->vm_manager.vm_pte_rqs[i] =
-                       &sched->sched_rq[DRM_SCHED_PRIORITY_KERNEL];
+                       adev->vm_manager.vm_pte_rqs[i] =
+                               &sched->sched_rq[DRM_SCHED_PRIORITY_KERNEL];
+               }
+               adev->vm_manager.vm_pte_num_rqs = adev->sdma.num_instances;
        }
-       adev->vm_manager.vm_pte_num_rqs = adev->sdma.num_instances;
 }
 
 const struct amdgpu_ip_block_version sdma_v4_0_ip_block = {