Skip to contentSkip to conversation

drm/amdgpu: Set the correct value for PDEs/PTEs of ATC memory on Raven

PATCH In review Yong Zhao 3 participants 4 messages Oct 6, 2017 – Oct 9, 2017 2 messages not in the archive

Subsystems (2)
lore
Share & tools
lore

Yong Zhao

author
#0 lore raw

PATCH 1/1 drm/amdgpu: Set the correct value for PDEs/PTEs of ATC memory on Raven

From: Yong Zhao <[email protected]>

Without the additional bits set in PDEs/PTEs, the ATC memory access would have failed on Raven.

Change-Id I28429ef6d39cdb01dc6f17fea4264ee22d7121d4
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c |  9 ++++++---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h | 10 ++++++++++
 2 files changed, 16 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +6 -3
index bca9eeb..d98d58a 100644
@@ -328,9 +328,10 @@ static int amdgpu_vm_alloc_levels(struct amdgpu_device *adev,
 				AMDGPU_GEM_CREATE_SHADOW);
 
 	if (vm->pte_support_ats) {
-		init_value = AMDGPU_PTE_SYSTEM;
+		init_value = AMDGPU_PTE_DEFAULT_ATC;
 		if (level != adev->vm_manager.num_level - 1)
 			init_value |= AMDGPU_PDE_PTE;
+
 	}
 
 	/* walk over the address space and allocate the page tables */
@@ -2017,7 +2018,7 @@ int amdgpu_vm_clear_freed(struct amdgpu_device *adev,
 		list_del(&mapping->list);
 
 		if (vm->pte_support_ats)
-			init_pte_value = AMDGPU_PTE_SYSTEM;
+			init_pte_value = AMDGPU_PTE_DEFAULT_ATC;
 
 		r = amdgpu_vm_bo_update_mapping(adev, NULL, NULL, vm,
 						mapping->start, mapping->last,
@@ -2629,7 +2630,9 @@ int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm,
 
 		if (adev->asic_type == CHIP_RAVEN) {
 			vm->pte_support_ats = true;
-			init_pde_value = AMDGPU_PTE_SYSTEM | AMDGPU_PDE_PTE;
+			init_pde_value = AMDGPU_PTE_DEFAULT_ATC
+					| AMDGPU_PDE_PTE;
+
 		}
 	} else
 		vm->use_cpu_for_update = !!(adev->vm_manager.vm_update_mode &
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h +10 -0
index 66efbc2..5d0cfc9 100644
@@ -73,6 +73,16 @@ struct amdgpu_bo_list_entry;
 #define AMDGPU_PTE_MTYPE(a)    ((uint64_t)a << 57)
 #define AMDGPU_PTE_MTYPE_MASK	AMDGPU_PTE_MTYPE(3ULL)
 
+/* For Raven */
+#define AMDGPU_MTYPE_CC 2
+
+#define AMDGPU_PTE_DEFAULT_ATC  (AMDGPU_PTE_SYSTEM      \
+                                | AMDGPU_PTE_SNOOPED    \
+                                | AMDGPU_PTE_EXECUTABLE \
+                                | AMDGPU_PTE_READABLE   \
+                                | AMDGPU_PTE_WRITEABLE  \
+                                | AMDGPU_PTE_MTYPE(AMDGPU_MTYPE_CC))
+
 /* How to programm VM fault handling */
 #define AMDGPU_VM_FAULT_STOP_NEVER	0
 #define AMDGPU_VM_FAULT_STOP_FIRST	1
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): 1507304133-21510-1-git-send-email-yong.zhao-5C7GfCeVMHo@public.gmane.org

#2 lore raw

Am 06.10.2017 um 17:35 schrieb Yong Zhao:

Quoted 8 lines

From: Yong Zhao <[email protected]>

Without the additional bits set in PDEs/PTEs, the ATC memory access would have failed on Raven.

Change-Id I28429ef6d39cdb01dc6f17fea4264ee22d7121d4

Nice solution for the define. Patch is Reviewed-by: Christian König <[email protected]>.

Quoted 52 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c |  9 ++++++---
  drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h | 10 ++++++++++
  2 files changed, 16 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +6 -3
index bca9eeb..d98d58a 100644
@@ -328,9 +328,10 @@ static int amdgpu_vm_alloc_levels(struct amdgpu_device *adev,
  				AMDGPU_GEM_CREATE_SHADOW);
 
  	if (vm->pte_support_ats) {
-		init_value = AMDGPU_PTE_SYSTEM;
+		init_value = AMDGPU_PTE_DEFAULT_ATC;
  		if (level != adev->vm_manager.num_level - 1)
  			init_value |= AMDGPU_PDE_PTE;
+
  	}
 
  	/* walk over the address space and allocate the page tables */
@@ -2017,7 +2018,7 @@ int amdgpu_vm_clear_freed(struct amdgpu_device *adev,
  		list_del(&mapping->list);
 
  		if (vm->pte_support_ats)
-			init_pte_value = AMDGPU_PTE_SYSTEM;
+			init_pte_value = AMDGPU_PTE_DEFAULT_ATC;
 
  		r = amdgpu_vm_bo_update_mapping(adev, NULL, NULL, vm,
  						mapping->start, mapping->last,
@@ -2629,7 +2630,9 @@ int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm,
 
  		if (adev->asic_type == CHIP_RAVEN) {
  			vm->pte_support_ats = true;
-			init_pde_value = AMDGPU_PTE_SYSTEM | AMDGPU_PDE_PTE;
+			init_pde_value = AMDGPU_PTE_DEFAULT_ATC
+					| AMDGPU_PDE_PTE;
+
  		}
  	} else
  		vm->use_cpu_for_update = !!(adev->vm_manager.vm_update_mode &
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h +3 -0
index 66efbc2..5d0cfc9 100644
@@ -73,6 +73,16 @@ struct amdgpu_bo_list_entry;
  #define AMDGPU_PTE_MTYPE(a)    ((uint64_t)a << 57)
  #define AMDGPU_PTE_MTYPE_MASK	AMDGPU_PTE_MTYPE(3ULL)
 
+/* For Raven */
+#define AMDGPU_MTYPE_CC 2
+

drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h struct amdgpu_bo_list_entry; · line 88

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h +7 -0
+#define AMDGPU_PTE_DEFAULT_ATC  (AMDGPU_PTE_SYSTEM      \
+                                | AMDGPU_PTE_SNOOPED    \
+                                | AMDGPU_PTE_EXECUTABLE \
+                                | AMDGPU_PTE_READABLE   \
+                                | AMDGPU_PTE_WRITEABLE  \
+                                | AMDGPU_PTE_MTYPE(AMDGPU_MTYPE_CC))
+
  /* How to programm VM fault handling */
  #define AMDGPU_VM_FAULT_STOP_NEVER	0
  #define AMDGPU_VM_FAULT_STOP_FIRST	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): ff321dde-dac3-9f51-266a-bca5ada11e5c-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org

author
#4 lore raw

Thanks. Pushed.

Yong

________________________________
From: Christian König <[email protected]>
Sent: Friday, October 6, 2017 1:16:36 PM
To: Zhao, Yong; [email protected]
Subject: Re: [PATCH] drm/amdgpu: Set the correct value for PDEs/PTEs of ATC memory on Raven

Am 06.10.2017 um 17:35 schrieb Yong Zhao:

Quoted 8 lines

From: Yong Zhao <[email protected]>

Without the additional bits set in PDEs/PTEs, the ATC memory access would have failed on Raven.

Change-Id I28429ef6d39cdb01dc6f17fea4264ee22d7121d4

Nice solution for the define. Patch is Reviewed-by: Christian König <[email protected]>.

Quoted 52 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c |  9 ++++++---
  drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h | 10 ++++++++++
  2 files changed, 16 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +6 -3
index bca9eeb..d98d58a 100644
@@ -328,9 +328,10 @@ static int amdgpu_vm_alloc_levels(struct amdgpu_device *adev,
                               AMDGPU_GEM_CREATE_SHADOW);
 
       if (vm->pte_support_ats) {
-             init_value = AMDGPU_PTE_SYSTEM;
+             init_value = AMDGPU_PTE_DEFAULT_ATC;
               if (level != adev->vm_manager.num_level - 1)
                       init_value |= AMDGPU_PDE_PTE;
+
       }
 
       /* walk over the address space and allocate the page tables */
@@ -2017,7 +2018,7 @@ int amdgpu_vm_clear_freed(struct amdgpu_device *adev,
               list_del(&mapping->list);
 
               if (vm->pte_support_ats)
-                     init_pte_value = AMDGPU_PTE_SYSTEM;
+                     init_pte_value = AMDGPU_PTE_DEFAULT_ATC;
 
               r = amdgpu_vm_bo_update_mapping(adev, NULL, NULL, vm,
                                               mapping->start, mapping->last,
@@ -2629,7 +2630,9 @@ int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm,
 
               if (adev->asic_type == CHIP_RAVEN) {
                       vm->pte_support_ats = true;
-                     init_pde_value = AMDGPU_PTE_SYSTEM | AMDGPU_PDE_PTE;
+                     init_pde_value = AMDGPU_PTE_DEFAULT_ATC
+                                     | AMDGPU_PDE_PTE;
+
               }
       } else
               vm->use_cpu_for_update = !!(adev->vm_manager.vm_update_mode &
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h +3 -0
index 66efbc2..5d0cfc9 100644
@@ -73,6 +73,16 @@ struct amdgpu_bo_list_entry;
  #define AMDGPU_PTE_MTYPE(a)    ((uint64_t)a << 57)
  #define AMDGPU_PTE_MTYPE_MASK       AMDGPU_PTE_MTYPE(3ULL)
 
+/* For Raven */
+#define AMDGPU_MTYPE_CC 2
+

drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h struct amdgpu_bo_list_entry; · line 88

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h +7 -0
+#define AMDGPU_PTE_DEFAULT_ATC  (AMDGPU_PTE_SYSTEM      \
+                                | AMDGPU_PTE_SNOOPED    \
+                                | AMDGPU_PTE_EXECUTABLE \
+                                | AMDGPU_PTE_READABLE   \
+                                | AMDGPU_PTE_WRITEABLE  \
+                                | AMDGPU_PTE_MTYPE(AMDGPU_MTYPE_CC))
+
  /* How to programm VM fault handling */
  #define AMDGPU_VM_FAULT_STOP_NEVER  0
  #define AMDGPU_VM_FAULT_STOP_FIRST  1

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

#5 lore raw
In reply to a message not in the archive
Quoted 54 lines · Yong Zhao

From: Yong Zhao <[email protected]>

Without the additional bits set in PDEs/PTEs, the ATC memory access would have failed on Raven.

Change-Id I28429ef6d39cdb01dc6f17fea4264ee22d7121d4
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c |  9 ++++++---
  drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h | 10 ++++++++++
  2 files changed, 16 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +6 -3
index bca9eeb..d98d58a 100644
@@ -328,9 +328,10 @@ static int amdgpu_vm_alloc_levels(struct amdgpu_device *adev,
  				AMDGPU_GEM_CREATE_SHADOW);
 
  	if (vm->pte_support_ats) {
-		init_value = AMDGPU_PTE_SYSTEM;
+		init_value = AMDGPU_PTE_DEFAULT_ATC;
  		if (level != adev->vm_manager.num_level - 1)
  			init_value |= AMDGPU_PDE_PTE;
+
  	}
 
  	/* walk over the address space and allocate the page tables */
@@ -2017,7 +2018,7 @@ int amdgpu_vm_clear_freed(struct amdgpu_device *adev,
  		list_del(&mapping->list);
 
  		if (vm->pte_support_ats)
-			init_pte_value = AMDGPU_PTE_SYSTEM;
+			init_pte_value = AMDGPU_PTE_DEFAULT_ATC;
 
  		r = amdgpu_vm_bo_update_mapping(adev, NULL, NULL, vm,
  						mapping->start, mapping->last,
@@ -2629,7 +2630,9 @@ int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm,
 
  		if (adev->asic_type == CHIP_RAVEN) {
  			vm->pte_support_ats = true;
-			init_pde_value = AMDGPU_PTE_SYSTEM | AMDGPU_PDE_PTE;
+			init_pde_value = AMDGPU_PTE_DEFAULT_ATC
+					| AMDGPU_PDE_PTE;
+
  		}
  	} else
  		vm->use_cpu_for_update = !!(adev->vm_manager.vm_update_mode &
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h +0 -0
index 66efbc2..5d0cfc9 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h struct amdgpu_bo_list_entry; · line 77

Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h +2 -0
@@ -73,6 +73,16 @@ struct amdgpu_bo_list_entry;
  #define AMDGPU_PTE_MTYPE(a)    ((uint64_t)a << 57)
  #define AMDGPU_PTE_MTYPE_MASK	AMDGPU_PTE_MTYPE(3ULL)
 
+/* For Raven */
+#define AMDGPU_MTYPE_CC 2

We may use MTYPE_CC directly.

Jerry

drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h struct amdgpu_bo_list_entry; · line 88

Quoted 12 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h +8 -0
+
+#define AMDGPU_PTE_DEFAULT_ATC  (AMDGPU_PTE_SYSTEM      \
+                                | AMDGPU_PTE_SNOOPED    \
+                                | AMDGPU_PTE_EXECUTABLE \
+                                | AMDGPU_PTE_READABLE   \
+                                | AMDGPU_PTE_WRITEABLE  \
+                                | AMDGPU_PTE_MTYPE(AMDGPU_MTYPE_CC))
+
  /* How to programm VM fault handling */
  #define AMDGPU_VM_FAULT_STOP_NEVER	0
  #define AMDGPU_VM_FAULT_STOP_FIRST	1

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