drm/amdgpu: Set the correct value for PDEs/PTEs of ATC memory
Subsystems (2)
PATCH 1/1 drm/amdgpu: Set the correct value for PDEs/PTEs of ATC memory
From: Yong Zhao <[email protected]>
Without the additional bits set in PDEs/PTEs, the ATC memory access would have failed.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +15 -3
@@ -33,6 +33,8 @@#include "amdgpu.h" #include "amdgpu_trace.h" +#include "vega10/vega10_enum.h" +/* * PASID manager *
@@ -108,6 +110,13 @@ INTERVAL_TREE_DEFINE(struct amdgpu_bo_va_mapping, rb, uint64_t, __subtree_last,#undef START#undef LAST +#define AMDGPU_PTE_DEFAULT_ATC (AMDGPU_PTE_SYSTEM \ + | AMDGPU_PTE_SNOOPED \ + | AMDGPU_PTE_EXECUTABLE \ + | AMDGPU_PTE_READABLE \ + | AMDGPU_PTE_WRITEABLE \ + | AMDGPU_PTE_MTYPE(MTYPE_CC)) +/* Local structure. Encapsulate some VM table update parameters to reduce * the number of function parameters */
@@ -328,9 +337,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 +2027,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,
@@ -2627,7 +2637,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 &
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): 1506468642-7706-1-git-send-email-yong.zhao-5C7GfCeVMHo@public.gmane.org
Alex Deucher
Acked-byQuoted 7 lines · Yong Zhao
From: Yong Zhao <[email protected]>
Without the additional bits set in PDEs/PTEs, the ATC memory access would have failed.
Change-Id I28429ef6d39cdb01dc6f17fea4264ee22d7121d4Signed-off-by Yong Zhao <[email protected]>
Glad we finally got this sorted.
Quoted 66 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +15
-4@@ -33,6 +33,8 @@#include "amdgpu.h" #include "amdgpu_trace.h" +#include "vega10/vega10_enum.h" +/* * PASID manager * @@ -108,6 +110,13 @@ INTERVAL_TREE_DEFINE(struct amdgpu_bo_va_mapping, rb, uint64_t, __subtree_last,#undef START#undef LAST +#define AMDGPU_PTE_DEFAULT_ATC (AMDGPU_PTE_SYSTEM \ + | AMDGPU_PTE_SNOOPED \ + | AMDGPU_PTE_EXECUTABLE \ + | AMDGPU_PTE_READABLE \ + | AMDGPU_PTE_WRITEABLE \ + | AMDGPU_PTE_MTYPE(MTYPE_CC)) +/* Local structure. Encapsulate some VM table update parameters to reduce * the number of function parameters */ @@ -328,9 +337,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 +2027,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,@@ -2627,7 +2637,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 & --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
A message that is not in the archive (sent off-list or not yet received): CADnq5_OQwYR-5q677ghaZGM_BqhFV2yi=JxJzBbSromOtqXsvg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org
Hi Christian,
Do you have a minute to review this change?
Yong
Quoted 77 lines · Alex Deucher
Quoted 7 lines · Yong Zhao
From: Yong Zhao <[email protected]>
Without the additional bits set in PDEs/PTEs, the ATC memory access would have failed.
Change-Id I28429ef6d39cdb01dc6f17fea4264ee22d7121d4Signed-off-by Yong Zhao <[email protected]>Glad we finally got this sorted.
Acked-by Alex Deucher <[email protected]>Quoted 66 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +15
-4@@ -33,6 +33,8 @@#include "amdgpu.h" #include "amdgpu_trace.h" +#include "vega10/vega10_enum.h" +/* * PASID manager * @@ -108,6 +110,13 @@ INTERVAL_TREE_DEFINE(struct amdgpu_bo_va_mapping, rb, uint64_t, __subtree_last,#undef START#undef LAST +#define AMDGPU_PTE_DEFAULT_ATC (AMDGPU_PTE_SYSTEM \ + | AMDGPU_PTE_SNOOPED \ + | AMDGPU_PTE_EXECUTABLE \ + | AMDGPU_PTE_READABLE \ + | AMDGPU_PTE_WRITEABLE \ + | AMDGPU_PTE_MTYPE(MTYPE_CC)) +/* Local structure. Encapsulate some VM table update parameters to reduce * the number of function parameters */ @@ -328,9 +337,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 +2027,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,@@ -2627,7 +2637,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 & --2.7.4
Quoted 4 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
Am 27.09.2017 um 01:30 schrieb Yong Zhao:
Quoted 16 lines
From: Yong Zhao <[email protected]>
Without the additional bits set in PDEs/PTEs, the ATC memory access would have failed.
Change-Id I28429ef6d39cdb01dc6f17fea4264ee22d7121d4Signed-off-by Yong Zhao <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +0
-0
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c line 37
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +2
-0@@ -33,6 +33,8 @@#include "amdgpu.h" #include "amdgpu_trace.h" +#include "vega10/vega10_enum.h" +
Don't include IP specifc headers into the common code.
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c INTERVAL_TREE_DEFINE(struct amdgpu_bo_va_mapping, rb, uint64_t, __subtree_last, · line 118
Quoted 13 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +6
-0/* * PASID manager * @@ -108,6 +110,13 @@ INTERVAL_TREE_DEFINE(struct amdgpu_bo_va_mapping, rb, uint64_t, __subtree_last,#undef START#undef LAST +#define AMDGPU_PTE_DEFAULT_ATC (AMDGPU_PTE_SYSTEM \ + | AMDGPU_PTE_SNOOPED \ + | AMDGPU_PTE_EXECUTABLE \ + | AMDGPU_PTE_READABLE \ + | AMDGPU_PTE_WRITEABLE \ + | AMDGPU_PTE_MTYPE(MTYPE_CC))
Please put that into amdgpu_vm.h and hard code the MTYPE if you have to.
Apart from that looks good to me,
Christian.
Quoted 26 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +4
-2+/* Local structure. Encapsulate some VM table update parameters to reduce * the number of function parameters */ @@ -328,9 +337,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 +2027,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,
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm, · line 2645
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +3
-1@@ -2627,7 +2637,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 &
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx