Skip to contentSkip to conversation

drm/amdgpu: Properly allocate VM invalidate eng v2

PATCH In review Oak Zeng 3 participants 3 messages Nov 14, 2017 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

Oak Zeng

author
#0 lore raw

PATCH 1/1 drm/amdgpu: Properly allocate VM invalidate eng v2

From: ozeng <[email protected]>

v1: Properly allocate TLB invalidation engine to avoid conflict.
v2: Added comments to codes

Change-Id I9a32cbcb133c07d7efad1a7bd07c6e2098c747e7
---
 drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +12 -3
index 16bba97..b067b46 100644
@@ -392,7 +392,16 @@ static int gmc_v9_0_early_init(void *handle)
 static int gmc_v9_0_late_init(void *handle)
 {
 	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
-	unsigned vm_inv_eng[AMDGPU_MAX_VMHUBS] = { 3, 3 };
+	/*
+	 * The latest engine allocation on gfx9 is:
+	 * Engine 0, 1: idle
+	 * Engine 2, 3: firmware
+	 * Engine 4~13: amdgpu ring, subject to change when ring number changes
+	 * Engine 14~15: idle
+	 * Engine 16: kfd tlb invalidation
+	 * Engine 17: Gart flushes
+	 */
+	unsigned vm_inv_eng[AMDGPU_MAX_VMHUBS] = { 4, 4 };
 	unsigned i;
 
 	for(i = 0; i < adev->num_rings; ++i) {
@@ -405,9 +414,9 @@ static int gmc_v9_0_late_init(void *handle)
 			 ring->funcs->vmhub);
 	}
 
-	/* Engine 17 is used for GART flushes */
+	/* Engine 16 is used for KFD and 17 for GART flushes */
 	for(i = 0; i < AMDGPU_MAX_VMHUBS; ++i)
-		BUG_ON(vm_inv_eng[i] > 17);
+		BUG_ON(vm_inv_eng[i] > 16);
 
 	return amdgpu_irq_get(adev, &adev->mc.vm_fault, 0);
 }
Signature · 6 lines
2.7.4

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 1510672966-6400-1-git-send-email-Oak.Zeng-5C7GfCeVMHo@public.gmane.org

Reviewed-by
#2 lore raw
Quoted 7 lines · Oak Zeng

From: ozeng <[email protected]>

v1: Properly allocate TLB invalidation engine to avoid conflict.
v2: Added comments to codes

Change-Id I9a32cbcb133c07d7efad1a7bd07c6e2098c747e7
Quoted 41 lines
---
 drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +12 -4
index 16bba97..b067b46 100644
@@ -392,7 +392,16 @@ static int gmc_v9_0_early_init(void *handle)
 static int gmc_v9_0_late_init(void *handle)
 {
        struct amdgpu_device *adev = (struct amdgpu_device *)handle;
-       unsigned vm_inv_eng[AMDGPU_MAX_VMHUBS] = { 3, 3 };
+       /*
+        * The latest engine allocation on gfx9 is:
+        * Engine 0, 1: idle
+        * Engine 2, 3: firmware
+        * Engine 4~13: amdgpu ring, subject to change when ring number changes
+        * Engine 14~15: idle
+        * Engine 16: kfd tlb invalidation
+        * Engine 17: Gart flushes
+        */
+       unsigned vm_inv_eng[AMDGPU_MAX_VMHUBS] = { 4, 4 };
        unsigned i;
 
        for(i = 0; i < adev->num_rings; ++i) {
@@ -405,9 +414,9 @@ static int gmc_v9_0_late_init(void *handle)
                         ring->funcs->vmhub);
        }
 
-       /* Engine 17 is used for GART flushes */
+       /* Engine 16 is used for KFD and 17 for GART flushes */
        for(i = 0; i < AMDGPU_MAX_VMHUBS; ++i)
-               BUG_ON(vm_inv_eng[i] > 17);
+               BUG_ON(vm_inv_eng[i] > 16);
 
        return amdgpu_irq_get(adev, &adev->mc.vm_fault, 0);
 }
--

2.7.4

Quoted 4 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

Reviewed-by
#3 lore raw
In reply to a message not in the archive

Am 14.11.2017 um 16:22 schrieb Oak Zeng:

Quoted 7 lines

From: ozeng <[email protected]>

v1: Properly allocate TLB invalidation engine to avoid conflict.
v2: Added comments to codes

Change-Id I9a32cbcb133c07d7efad1a7bd07c6e2098c747e7
Quoted 28 lines
---
  drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 15 ++++++++++++---
  1 file changed, 12 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +10 -1
index 16bba97..b067b46 100644
@@ -392,7 +392,16 @@ static int gmc_v9_0_early_init(void *handle)
  static int gmc_v9_0_late_init(void *handle)
  {
  	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
-	unsigned vm_inv_eng[AMDGPU_MAX_VMHUBS] = { 3, 3 };
+	/*
+	 * The latest engine allocation on gfx9 is:
+	 * Engine 0, 1: idle
+	 * Engine 2, 3: firmware
+	 * Engine 4~13: amdgpu ring, subject to change when ring number changes
+	 * Engine 14~15: idle
+	 * Engine 16: kfd tlb invalidation
+	 * Engine 17: Gart flushes
+	 */
+	unsigned vm_inv_eng[AMDGPU_MAX_VMHUBS] = { 4, 4 };
  	unsigned i;
 
  	for(i = 0; i < adev->num_rings; ++i) {
@@ -405,9 +414,9 @@ static int gmc_v9_0_late_init(void *handle)
  			 ring->funcs->vmhub);

drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c static int gmc_v9_0_late_init(void *handle) · line 422

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +2 -2
  	}
 
-	/* Engine 17 is used for GART flushes */
+	/* Engine 16 is used for KFD and 17 for GART flushes */
  	for(i = 0; i < AMDGPU_MAX_VMHUBS; ++i)
-		BUG_ON(vm_inv_eng[i] > 17);
+		BUG_ON(vm_inv_eng[i] > 16);
 
  	return amdgpu_irq_get(adev, &adev->mc.vm_fault, 0);
  }

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx