Skip to contentSkip to conversation

drm/amdgpu: PRT support for gfx9 (v2)

PATCH Superseded Junwei Zhang 2 participants 5 messages Apr 19, 2017 – Apr 20, 2017 4 messages not in the archive

Subsystems (2)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 drm/amdgpu: PRT support for gfx9 (v2)

v2: unify PRT bit for all ASICs

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 5 +++++
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h | 3 ++-
 2 files changed, 7 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +5 -0
index f804d38..f4087c4 100644
@@ -1473,6 +1473,11 @@ int amdgpu_vm_bo_update(struct amdgpu_device *adev,
 	spin_unlock(&vm->status_lock);
 
 	list_for_each_entry(mapping, &bo_va->invalids, list) {
+		if (mapping->flags & AMDGPU_PTE_PRT) {
+			flags |= AMDGPU_PTE_PRT;
+			flags &= ~AMDGPU_PTE_VALID;
+		}
+
 		r = amdgpu_vm_bo_split_mapping(adev, exclusive,
 					       gtt_flags, pages_addr, vm,
 					       mapping, flags, mem,
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h +2 -1
index 0f547c6..8eba2d3 100644
@@ -65,7 +65,8 @@
 
 #define AMDGPU_PTE_FRAG(x)	((x & 0x1fULL) << 7)
 
-#define AMDGPU_PTE_PRT		(1ULL << 63)
+/* TILED for VEGA10, reserved for older ASICs  */
+#define AMDGPU_PTE_PRT		(1ULL << 51)
 
 /* VEGA10 only */
 #define AMDGPU_PTE_MTYPE(a)    ((uint64_t)a << 57)
Signature · 6 lines
1.9.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#2 lore raw
In reply to a message not in the archive

Am 19.04.2017 um 03:53 schrieb Junwei Zhang:

Quoted 15 lines

v2: unify PRT bit for all ASICs

---
  drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 5 +++++
  drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h | 3 ++-
  2 files changed, 7 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +0 -0
index f804d38..f4087c4 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c int amdgpu_vm_bo_update(struct amdgpu_device *adev, · line 1479

Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +4 -0
@@ -1473,6 +1473,11 @@ int amdgpu_vm_bo_update(struct amdgpu_device *adev,
  	spin_unlock(&vm->status_lock);
 
  	list_for_each_entry(mapping, &bo_va->invalids, list) {
+		if (mapping->flags & AMDGPU_PTE_PRT) {
+			flags |= AMDGPU_PTE_PRT;
+			flags &= ~AMDGPU_PTE_VALID;
+		}

Please move that into amdgpu_vm_bo_split_mapping() where we apply the other flags as well.

Additional to that we need a check like "&& adev->asic_type >= CHIP_VEGA10" here.

Not nice to have that ASIC specifc code here, but we can clean that up later on.

Regards,
Christian.

Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +1 -0
+
  		r = amdgpu_vm_bo_split_mapping(adev, exclusive,
  					       gtt_flags, pages_addr, vm,
  					       mapping, flags, mem,
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h +0 -0
index 0f547c6..8eba2d3 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h line 72

Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h +2 -1
@@ -65,7 +65,8 @@
 
  #define AMDGPU_PTE_FRAG(x)	((x & 0x1fULL) << 7)
 
-#define AMDGPU_PTE_PRT		(1ULL << 63)
+/* TILED for VEGA10, reserved for older ASICs  */
+#define AMDGPU_PTE_PRT		(1ULL << 51)
 
  /* VEGA10 only */
  #define AMDGPU_PTE_MTYPE(a)    ((uint64_t)a << 57)

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

#4 lore raw
In reply to a message not in the archive
Quoted 11 lines · Christian König

Am 19.04.2017 um 03:53 schrieb Junwei Zhang:

Quoted 10 lines

v2: unify PRT bit for all ASICs

---
  drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 5 +++++
  drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h | 3 ++-
  2 files changed, 7 insertions(+), 1 deletion(-)
Quoted 15 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c int amdgpu_vm_bo_update(struct amdgpu_device *adev, · line 1478

Quoted 12 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +4 -0
index f804d38..f4087c4 100644
@@ -1473,6 +1473,11 @@ int amdgpu_vm_bo_update(struct amdgpu_device *adev,
      spin_unlock(&vm->status_lock);
      list_for_each_entry(mapping, &bo_va->invalids, list) {
+        if (mapping->flags & AMDGPU_PTE_PRT) {
+            flags |= AMDGPU_PTE_PRT;
+            flags &= ~AMDGPU_PTE_VALID;
+        }

Please move that into amdgpu_vm_bo_split_mapping() where we apply the other flags as well.

Actually I tried this way at first.
But it invalidates the CLEAR op and any calling amdgpu_vm_clear_freed(), as the input flags 0 cannot clear the PTE TILED bit.

Quoted 4 lines

Additional to that we need a check like "&& adev->asic_type >= CHIP_VEGA10" here.

Not nice to have that ASIC specifc code here, but we can clean that up later on.

although that's reserved bit for older ASIC, it sounds reasonable.

Jerry

Quoted 4 lines

Regards,
Christian.

Quoted 18 lines
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +1 -0
+
          r = amdgpu_vm_bo_split_mapping(adev, exclusive,
                             gtt_flags, pages_addr, vm,
                             mapping, flags, mem,
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h +0 -0
index 0f547c6..8eba2d3 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h line 69

Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h +2 -1
@@ -65,7 +65,8 @@
  #define AMDGPU_PTE_FRAG(x)    ((x & 0x1fULL) << 7)
-#define AMDGPU_PTE_PRT        (1ULL << 63)
+/* TILED for VEGA10, reserved for older ASICs  */
+#define AMDGPU_PTE_PRT        (1ULL << 51)
  /* VEGA10 only */
  #define AMDGPU_PTE_MTYPE(a)    ((uint64_t)a << 57)

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

#6 lore raw
In reply to a message not in the archive

Am 19.04.2017 um 10:10 schrieb Zhang, Jerry (Junwei):

Quoted 29 lines · Christian König
Quoted 11 lines

Am 19.04.2017 um 03:53 schrieb Junwei Zhang:

Quoted 10 lines

v2: unify PRT bit for all ASICs

---
  drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 5 +++++
  drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h | 3 ++-
  2 files changed, 7 insertions(+), 1 deletion(-)
Quoted 16 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c int amdgpu_vm_bo_update(struct amdgpu_device · line 1479

Quoted 13 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +4 -0
index f804d38..f4087c4 100644
@@ -1473,6 +1473,11 @@ int amdgpu_vm_bo_update(struct amdgpu_device 
 *adev,
      spin_unlock(&vm->status_lock);
      list_for_each_entry(mapping, &bo_va->invalids, list) {
+        if (mapping->flags & AMDGPU_PTE_PRT) {
+            flags |= AMDGPU_PTE_PRT;
+            flags &= ~AMDGPU_PTE_VALID;
+        }

Please move that into amdgpu_vm_bo_split_mapping() where we apply the other flags as well.

Quoted 2 lines

Actually I tried this way at first.
But it invalidates the CLEAR op and any calling amdgpu_vm_clear_freed(), as the input flags 0 cannot clear the PTE TILED bit.

Good point, but calling amdgpu_vm_bo_split_mapping() from amdgpu_vm_clear_freed() is nonsense in the first place.

We can clear a whole PT with just a single command, no need for splitting it into smaller operations.

I'm going to send a patch to fix this in a minute.

Christian.

Quoted 32 lines
Quoted 5 lines

Additional to that we need a check like "&& adev->asic_type >= CHIP_VEGA10" here.

Not nice to have that ASIC specifc code here, but we can clean that up later on.

although that's reserved bit for older ASIC, it sounds reasonable.

Jerry

Quoted 22 lines

Regards,
Christian.

Quoted 16 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +1 -0
+
          r = amdgpu_vm_bo_split_mapping(adev, exclusive,
                             gtt_flags, pages_addr, vm,
                             mapping, flags, mem,
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h +2 -1
index 0f547c6..8eba2d3 100644
@@ -65,7 +65,8 @@
  #define AMDGPU_PTE_FRAG(x)    ((x & 0x1fULL) << 7)
-#define AMDGPU_PTE_PRT        (1ULL << 63)
+/* TILED for VEGA10, reserved for older ASICs  */
+#define AMDGPU_PTE_PRT        (1ULL << 51)
  /* VEGA10 only */
  #define AMDGPU_PTE_MTYPE(a)    ((uint64_t)a << 57)

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

#8 lore raw
In reply to a message not in the archive
Quoted 33 lines · Christian König

Am 19.04.2017 um 10:10 schrieb Zhang, Jerry (Junwei):

Quoted 28 lines · Christian König
Quoted 11 lines

Am 19.04.2017 um 03:53 schrieb Junwei Zhang:

Quoted 10 lines

v2: unify PRT bit for all ASICs

---
  drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 5 +++++
  drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h | 3 ++-
  2 files changed, 7 insertions(+), 1 deletion(-)
Quoted 15 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c int amdgpu_vm_bo_update(struct amdgpu_device *adev, · line 1478

Quoted 12 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +4 -0
index f804d38..f4087c4 100644
@@ -1473,6 +1473,11 @@ int amdgpu_vm_bo_update(struct amdgpu_device *adev,
      spin_unlock(&vm->status_lock);
      list_for_each_entry(mapping, &bo_va->invalids, list) {
+        if (mapping->flags & AMDGPU_PTE_PRT) {
+            flags |= AMDGPU_PTE_PRT;
+            flags &= ~AMDGPU_PTE_VALID;
+        }

Please move that into amdgpu_vm_bo_split_mapping() where we apply the other flags as well.

Quoted 3 lines

Actually I tried this way at first.
But it invalidates the CLEAR op and any calling amdgpu_vm_clear_freed(), as the input flags 0 cannot clear the PTE TILED bit.

Quoted 7 lines

Good point, but calling amdgpu_vm_bo_split_mapping() from amdgpu_vm_clear_freed() is nonsense in the first place.

We can clear a whole PT with just a single command, no need for splitting it into smaller operations.

I'm going to send a patch to fix this in a minute.

Thanks for your patch.
Based on that, I prepare the patch v3, it works on my side. Please help to check it.

Jerry

Quoted 38 lines

Christian.

Quoted 34 lines
Quoted 7 lines

Additional to that we need a check like "&& adev->asic_type >= CHIP_VEGA10" here.

Not nice to have that ASIC specifc code here, but we can clean that up later on.

although that's reserved bit for older ASIC, it sounds reasonable.

Jerry

Quoted 22 lines

Regards,
Christian.

Quoted 16 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +1 -0
+
          r = amdgpu_vm_bo_split_mapping(adev, exclusive,
                             gtt_flags, pages_addr, vm,
                             mapping, flags, mem,
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h +2 -1
index 0f547c6..8eba2d3 100644
@@ -65,7 +65,8 @@
  #define AMDGPU_PTE_FRAG(x)    ((x & 0x1fULL) << 7)
-#define AMDGPU_PTE_PRT        (1ULL << 63)
+/* TILED for VEGA10, reserved for older ASICs  */
+#define AMDGPU_PTE_PRT        (1ULL << 51)
  /* VEGA10 only */
  #define AMDGPU_PTE_MTYPE(a)    ((uint64_t)a << 57)

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