Skip to contentSkip to conversation

drm/amdgpu: PRT support for gfx9

PATCH Superseded Junwei Zhang 3 participants 7 messages Apr 17, 2017 – Apr 19, 2017 5 messages not in the archive

Subsystems (2)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/amdgpu: PRT support for gfx9

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 5 +++++
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h | 1 +
 drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c  | 2 +-
 3 files changed, 7 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +5 -0
index 9ff445c..51aedf9 100644
@@ -1269,6 +1269,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_TILED) {
+			flags |= AMDGPU_PTE_TILED;
+			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 +1 -0
index 4904740..8d25914 100644
@@ -70,6 +70,7 @@
 /* VEGA10 only */
 #define AMDGPU_PTE_MTYPE(a)    ((uint64_t)a << 57)
 #define AMDGPU_PTE_MTYPE_MASK	AMDGPU_PTE_MTYPE(3ULL)
+#define AMDGPU_PTE_TILED	(1ULL << 51)
 
 /* How to programm VM fault handling */
 #define AMDGPU_VM_FAULT_STOP_NEVER	0
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +1 -1
index 51a1919..6d033ae 100644
@@ -324,7 +324,7 @@ static uint64_t gmc_v9_0_get_vm_pte_flags(struct amdgpu_device *adev,
 	}
 
 	if (flags & AMDGPU_VM_PAGE_PRT)
-		pte_flag |= AMDGPU_PTE_PRT;
+		pte_flag |= AMDGPU_PTE_TILED;
 
 	return pte_flag;
 }
Signature · 6 lines
1.9.1

_______________________________________________
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): 1492419870-2901-1-git-send-email-Jerry.Zhang-5C7GfCeVMHo@public.gmane.org

#2 lore raw

Anyone could help to review it?

Quoted 41 lines · Junwei Zhang
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 5 +++++
  drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h | 1 +
  drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c  | 2 +-
  3 files changed, 7 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +5 -0
index 9ff445c..51aedf9 100644
@@ -1269,6 +1269,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_TILED) {
+			flags |= AMDGPU_PTE_TILED;
+			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 +1 -0
index 4904740..8d25914 100644
@@ -70,6 +70,7 @@
  /* VEGA10 only */
  #define AMDGPU_PTE_MTYPE(a)    ((uint64_t)a << 57)
  #define AMDGPU_PTE_MTYPE_MASK	AMDGPU_PTE_MTYPE(3ULL)
+#define AMDGPU_PTE_TILED	(1ULL << 51)
 
  /* How to programm VM fault handling */
  #define AMDGPU_VM_FAULT_STOP_NEVER	0
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +0 -0
index 51a1919..6d033ae 100644

drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c static uint64_t gmc_v9_0_get_vm_pte_flags(struct amdgpu_device *adev, · line 330

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +1 -1
@@ -324,7 +324,7 @@ static uint64_t gmc_v9_0_get_vm_pte_flags(struct amdgpu_device *adev,
  	}
 
  	if (flags & AMDGPU_VM_PAGE_PRT)
-		pte_flag |= AMDGPU_PTE_PRT;
+		pte_flag |= AMDGPU_PTE_TILED;
 
  	return pte_flag;
  }

_______________________________________________
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): [email protected]

#4 lore raw
Quoted 19 lines · Jerry (Junwei)

Anyone could help to review it?

Quoted 15 lines · Junwei Zhang
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 5 +++++
  drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h | 1 +
  drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c  | 2 +-
  3 files changed, 7 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +0 -0
index 9ff445c..51aedf9 100644
@@ -1269,6 +1269,11 @@ int amdgpu_vm_bo_update(struct amdgpu_device 
 *adev,
      spin_unlock(&vm->status_lock);
 
Quoted 6 lines

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

Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +5 -0
      list_for_each_entry(mapping, &bo_va->invalids, list) {
+        if (mapping->flags & AMDGPU_PTE_TILED) {
+            flags |= AMDGPU_PTE_TILED;
+            flags &= ~AMDGPU_PTE_VALID;
+        }
+

How about clear operation?

Quoted 23 lines
Quoted 23 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +0 -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 +1 -0
index 4904740..8d25914 100644
@@ -70,6 +70,7 @@
  /* VEGA10 only */
  #define AMDGPU_PTE_MTYPE(a)    ((uint64_t)a << 57)
  #define AMDGPU_PTE_MTYPE_MASK    AMDGPU_PTE_MTYPE(3ULL)
+#define AMDGPU_PTE_TILED    (1ULL << 51)
 
  /* How to programm VM fault handling */
  #define AMDGPU_VM_FAULT_STOP_NEVER    0
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +0 -0
index 51a1919..6d033ae 100644
@@ -324,7 +324,7 @@ static uint64_t gmc_v9_0_get_vm_pte_flags(struct 
 amdgpu_device *adev,
      }
 
Quoted 3 lines

drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c static uint64_t gmc_v9_0_get_vm_pte_flags(struct amdgpu_device *adev, · line 327

Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +1 -1
      if (flags & AMDGPU_VM_PAGE_PRT)
-        pte_flag |= AMDGPU_PTE_PRT;
+        pte_flag |= AMDGPU_PTE_TILED;

PTE_PRT name doesn't make sense?

Regards,
David Zhou

Quoted 8 lines

drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c static uint64_t gmc_v9_0_get_vm_pte_flags(struct amdgpu_device *adev, · line 330

Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +0 -0
      return pte_flag;
  }

_______________________________________________
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

A message that is not in the archive (sent off-list or not yet received): [email protected]

#6 lore raw
Quoted 22 lines · On 04/18/2017 10:47 AM, zhoucm1 wrote:
Quoted 19 lines · Jerry (Junwei)

Anyone could help to review it?

Quoted 15 lines · Junwei Zhang
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 5 +++++
  drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h | 1 +
  drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c  | 2 +-
  3 files changed, 7 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +0 -0
index 9ff445c..51aedf9 100644
@@ -1269,6 +1269,11 @@ int amdgpu_vm_bo_update(struct amdgpu_device *adev,
      spin_unlock(&vm->status_lock);
 
Quoted 7 lines
Quoted 6 lines

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

Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +5 -0
      list_for_each_entry(mapping, &bo_va->invalids, list) {
+        if (mapping->flags & AMDGPU_PTE_TILED) {
+            flags |= AMDGPU_PTE_TILED;
+            flags &= ~AMDGPU_PTE_VALID;
+        }
+

How about clear operation?

CLEAR op will clear all mapping with flag=0, put into free list, and then clear them by amdgpu_vm_clear_freed().

When amdgpu_vm_bo_update() is performed, the mapping's flag is 0 now.

Quoted 26 lines
Quoted 26 lines
Quoted 26 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +0 -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 +1 -0
index 4904740..8d25914 100644
@@ -70,6 +70,7 @@
  /* VEGA10 only */
  #define AMDGPU_PTE_MTYPE(a)    ((uint64_t)a << 57)
  #define AMDGPU_PTE_MTYPE_MASK    AMDGPU_PTE_MTYPE(3ULL)
+#define AMDGPU_PTE_TILED    (1ULL << 51)
 
  /* How to programm VM fault handling */
  #define AMDGPU_VM_FAULT_STOP_NEVER    0
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +0 -0
index 51a1919..6d033ae 100644
@@ -324,7 +324,7 @@ static uint64_t gmc_v9_0_get_vm_pte_flags(struct
 amdgpu_device *adev,
      }
 
Quoted 4 lines
Quoted 3 lines

drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c static uint64_t gmc_v9_0_get_vm_pte_flags(struct amdgpu_device *adev, · line 327

Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +1 -1
      if (flags & AMDGPU_VM_PAGE_PRT)
-        pte_flag |= AMDGPU_PTE_PRT;
+        pte_flag |= AMDGPU_PTE_TILED;

PTE_PRT name doesn't make sense?

This naming is tricky for PRT feature, as there is not PRT bit on PTE for pre-gfx9. So PTE_PRT is used in reserve bit of PTE.
But for gfx9, there is a actual bit for PTE, it's better to use the real one.

BTW, all ASICs will use the general flag in UMD now. But different handling inside PTE.

Jerry

Quoted 12 lines

Regards,
David Zhou

Quoted 8 lines

drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c static uint64_t gmc_v9_0_get_vm_pte_flags(struct amdgpu_device *adev, · line 330

Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +0 -0
      return pte_flag;
  }

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

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

A message that is not in the archive (sent off-list or not yet received): [email protected]

#8 lore raw
Quoted 32 lines · Jerry (Junwei)
Quoted 23 lines · On 04/18/2017 10:47 AM, zhoucm1 wrote:
Quoted 20 lines · Jerry (Junwei)

Anyone could help to review it?

Quoted 16 lines · Junwei Zhang
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 5 +++++
  drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h | 1 +
  drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c  | 2 +-
  3 files changed, 7 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +0 -0
index 9ff445c..51aedf9 100644
@@ -1269,6 +1269,11 @@ int amdgpu_vm_bo_update(struct amdgpu_device 
 *adev,
      spin_unlock(&vm->status_lock);
 
Quoted 7 lines
Quoted 6 lines

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

Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +5 -0
      list_for_each_entry(mapping, &bo_va->invalids, list) {
+        if (mapping->flags & AMDGPU_PTE_TILED) {
+            flags |= AMDGPU_PTE_TILED;
+            flags &= ~AMDGPU_PTE_VALID;
+        }
+

How about clear operation?

Quoted 1 line

CLEAR op will clear all mapping with flag=0, put into free list, and then clear them by amdgpu_vm_clear_freed().

Yes, I looked into wrong function amdgpu_vm_clear_invalids by low mistake. Sorry for that.

Quoted 34 lines

When amdgpu_vm_bo_update() is performed, the mapping's flag is 0 now.

Quoted 26 lines
Quoted 26 lines
Quoted 26 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +0 -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 +1 -0
index 4904740..8d25914 100644
@@ -70,6 +70,7 @@
  /* VEGA10 only */
  #define AMDGPU_PTE_MTYPE(a)    ((uint64_t)a << 57)
  #define AMDGPU_PTE_MTYPE_MASK    AMDGPU_PTE_MTYPE(3ULL)
+#define AMDGPU_PTE_TILED    (1ULL << 51)
 
  /* How to programm VM fault handling */
  #define AMDGPU_VM_FAULT_STOP_NEVER    0
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +0 -0
index 51a1919..6d033ae 100644
@@ -324,7 +324,7 @@ static uint64_t gmc_v9_0_get_vm_pte_flags(struct
 amdgpu_device *adev,
      }
 
Quoted 4 lines
Quoted 3 lines

drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c static uint64_t gmc_v9_0_get_vm_pte_flags(struct · line 328

Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +1 -1
      if (flags & AMDGPU_VM_PAGE_PRT)
-        pte_flag |= AMDGPU_PTE_PRT;
+        pte_flag |= AMDGPU_PTE_TILED;

PTE_PRT name doesn't make sense?

Quoted 6 lines

This naming is tricky for PRT feature, as there is not PRT bit on PTE for pre-gfx9. So PTE_PRT is used in reserve bit of PTE.
But for gfx9, there is a actual bit for PTE, it's better to use the real one.

BTW, all ASICs will use the general flag in UMD now. But different handling inside PTE.

Hmm, the alternative is ok to me, but you need to confirm with the author of name. So Acked-by: Chunming Zhou <[email protected]>

Regards,
David Zhou

Quoted 15 lines

Jerry

Quoted 12 lines

Regards,
David Zhou

Quoted 8 lines

drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c static uint64_t gmc_v9_0_get_vm_pte_flags(struct · line 330

Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +0 -0
      return pte_flag;
  }

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

Quoted 8 lines
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

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

#9 lore raw
In reply to a message not in the archive
Quoted 24 lines · Jerry (Junwei)
Quoted 23 lines · On 04/18/2017 10:47 AM, zhoucm1 wrote:
Quoted 20 lines · Jerry (Junwei)

Anyone could help to review it?

Quoted 16 lines · Junwei Zhang
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 5 +++++
  drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h | 1 +
  drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c  | 2 +-
  3 files changed, 7 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +0 -0
index 9ff445c..51aedf9 100644
@@ -1269,6 +1269,11 @@ int amdgpu_vm_bo_update(struct amdgpu_device
 *adev,
      spin_unlock(&vm->status_lock);
 
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

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

Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +3 -0
      list_for_each_entry(mapping, &bo_va->invalids, list) {
+        if (mapping->flags & AMDGPU_PTE_TILED) {
+            flags |= AMDGPU_PTE_TILED;
+            flags &= ~AMDGPU_PTE_VALID;

Why do you need to explicitly clear the VALID bit here? I'd expect whoever creates the mapping to already ensure that the VALID bit is cleared.

Quoted 40 lines
Quoted 3 lines
Quoted 2 lines

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

Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +2 -0
+        }
+

How about clear operation?

CLEAR op will clear all mapping with flag=0, put into free list, and then clear them by amdgpu_vm_clear_freed().

When amdgpu_vm_bo_update() is performed, the mapping's flag is 0 now.

Quoted 26 lines
Quoted 26 lines
Quoted 26 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +0 -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 +1 -0
index 4904740..8d25914 100644
@@ -70,6 +70,7 @@
  /* VEGA10 only */
  #define AMDGPU_PTE_MTYPE(a)    ((uint64_t)a << 57)
  #define AMDGPU_PTE_MTYPE_MASK    AMDGPU_PTE_MTYPE(3ULL)
+#define AMDGPU_PTE_TILED    (1ULL << 51)
 
  /* How to programm VM fault handling */
  #define AMDGPU_VM_FAULT_STOP_NEVER    0
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +0 -0
index 51a1919..6d033ae 100644
@@ -324,7 +324,7 @@ static uint64_t gmc_v9_0_get_vm_pte_flags(struct
 amdgpu_device *adev,
      }
 
Quoted 4 lines
Quoted 3 lines

drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c static uint64_t gmc_v9_0_get_vm_pte_flags(struct · line 328

Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +1 -1
      if (flags & AMDGPU_VM_PAGE_PRT)
-        pte_flag |= AMDGPU_PTE_PRT;
+        pte_flag |= AMDGPU_PTE_TILED;

PTE_PRT name doesn't make sense?

Quoted 5 lines

This naming is tricky for PRT feature, as there is not PRT bit on PTE for pre-gfx9.
So PTE_PRT is used in reserve bit of PTE.
But for gfx9, there is a actual bit for PTE, it's better to use the real one.

Wouldn't it be better to keep the AMDGPU_PTE_PRT name, and just make sure that the bit isn't set on older ASICs (unless the bit is simply ignored on older ASICs, in which case we don't have to bother either way)?

Cheers,
Nicolai

Quoted 26 lines

BTW, all ASICs will use the general flag in UMD now. But different handling inside PTE.

Jerry

Quoted 12 lines

Regards,
David Zhou

Quoted 8 lines

drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c static uint64_t gmc_v9_0_get_vm_pte_flags(struct · line 330

Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +0 -0
      return pte_flag;
  }

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

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

Signature · 6 lines
Lerne, wie die Welt wirklich ist,
Aber vergiss niemals, wie sie sein sollte.
_______________________________________________
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): ee145d04-5a08-db82-6406-41bb208b81ca-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org

#11 lore raw
Quoted 25 lines · Nicolai Hähnle
Quoted 24 lines · Jerry (Junwei)
Quoted 23 lines · On 04/18/2017 10:47 AM, zhoucm1 wrote:
Quoted 20 lines · Jerry (Junwei)

Anyone could help to review it?

Quoted 16 lines · Junwei Zhang
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 5 +++++
  drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h | 1 +
  drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c  | 2 +-
  3 files changed, 7 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +0 -0
index 9ff445c..51aedf9 100644
@@ -1269,6 +1269,11 @@ int amdgpu_vm_bo_update(struct amdgpu_device
 *adev,
      spin_unlock(&vm->status_lock);
 
Quoted 7 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

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

Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +3 -0
      list_for_each_entry(mapping, &bo_va->invalids, list) {
+        if (mapping->flags & AMDGPU_PTE_TILED) {
+            flags |= AMDGPU_PTE_TILED;
+            flags &= ~AMDGPU_PTE_VALID;

Why do you need to explicitly clear the VALID bit here? I'd expect whoever creates the mapping to already ensure that the VALID bit is cleared.

Yes, the VALID bit is clear actually.
Here clearing it explicitly is to notice that TILED bit should work with V=0. Just double confirm and reminder to the reader.

Quoted 48 lines
Quoted 42 lines
Quoted 5 lines
Quoted 4 lines

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

Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +2 -0
+        }
+

How about clear operation?

CLEAR op will clear all mapping with flag=0, put into free list, and then clear them by amdgpu_vm_clear_freed().

When amdgpu_vm_bo_update() is performed, the mapping's flag is 0 now.

Quoted 26 lines
Quoted 26 lines
Quoted 26 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +0 -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 +1 -0
index 4904740..8d25914 100644
@@ -70,6 +70,7 @@
  /* VEGA10 only */
  #define AMDGPU_PTE_MTYPE(a)    ((uint64_t)a << 57)
  #define AMDGPU_PTE_MTYPE_MASK    AMDGPU_PTE_MTYPE(3ULL)
+#define AMDGPU_PTE_TILED    (1ULL << 51)
 
  /* How to programm VM fault handling */
  #define AMDGPU_VM_FAULT_STOP_NEVER    0
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +0 -0
index 51a1919..6d033ae 100644
@@ -324,7 +324,7 @@ static uint64_t gmc_v9_0_get_vm_pte_flags(struct
 amdgpu_device *adev,
      }
 
Quoted 4 lines
Quoted 3 lines

drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c static uint64_t gmc_v9_0_get_vm_pte_flags(struct · line 328

Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +1 -1
      if (flags & AMDGPU_VM_PAGE_PRT)
-        pte_flag |= AMDGPU_PTE_PRT;
+        pte_flag |= AMDGPU_PTE_TILED;

PTE_PRT name doesn't make sense?

Quoted 5 lines

This naming is tricky for PRT feature, as there is not PRT bit on PTE for pre-gfx9.
So PTE_PRT is used in reserve bit of PTE.
But for gfx9, there is a actual bit for PTE, it's better to use the real one.

Quoted 3 lines

Wouldn't it be better to keep the AMDGPU_PTE_PRT name, and just make sure that the bit isn't set on older ASICs (unless the bit is simply ignored on older ASICs, in which case we don't have to bother either way)?

Thanks for you advice.
It's a way to unify the PRT bit in PTE and it doesn't bother older ASIC as reserved bit. I will revise the patch.

BTW, actually I have discussed it with Christian before.
Then we thinked AMDGPU_PTE_PRT was a little hacking to set dummy bit in PTE and consider to clear it next. Actually TILED bit is the real one for gfx9 PRT.

Jerry

Quoted 33 lines

Cheers,
Nicolai

Quoted 26 lines

BTW, all ASICs will use the general flag in UMD now. But different handling inside PTE.

Jerry

Quoted 12 lines

Regards,
David Zhou

Quoted 8 lines

drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c static uint64_t gmc_v9_0_get_vm_pte_flags(struct · line 330

Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +0 -0
      return pte_flag;
  }

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

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

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