amdgpu: Propogate user flags to amdgpu_bo_va_op_raw
PATCH 1/3 amdgpu: Propogate user flags to amdgpu_bo_va_op_raw
Signed-off-by Andrey Grodzovsky <[email protected]>
--- amdgpu/amdgpu_bo.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
amdgpu/amdgpu_bo.c +3 -2
@@ -736,7 +736,7 @@ drm_public int amdgpu_bo_va_op(amdgpu_bo_handle bo,uint64_t offset, uint64_t size, uint64_t addr, - uint64_t flags, + uint64_t extra_flags, uint32_t ops) { amdgpu_device_handle dev = bo->dev;
@@ -746,7 +746,8 @@ drm_public int amdgpu_bo_va_op(amdgpu_bo_handle bo,return amdgpu_bo_va_op_raw (dev, bo, offset, size, addr,AMDGPU_VM_PAGE_READABLE |AMDGPU_VM_PAGE_WRITEABLE | -AMDGPU_VM_PAGE_EXECUTABLE , ops); +AMDGPU_VM_PAGE_EXECUTABLE | + extra_flags, ops); } drm_public int amdgpu_bo_va_op_raw(amdgpu_device_handle dev,
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 2/3 amdgpu/test: Allow flags to be passed to amdgpu_bo_va_op
Signed-off-by Andrey Grodzovsky <[email protected]>
--- tests/amdgpu/amdgpu_test.h | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-)
tests/amdgpu/amdgpu_test.h +17 -7
@@ -280,7 +280,7 @@ static inline int gpu_mem_free(amdgpu_bo_handle bo,static inline int amdgpu_bo_alloc_wrap (amdgpu_device_handle dev,unsigned size, -unsigned alignment,unsigned heap,uint64_t flags, +unsigned alignment,unsigned heap,uint64_t alloc_flags,amdgpu_bo_handle *bo) {struct amdgpu_bo_alloc_request request = {};
@@ -290,7 +290,7 @@ amdgpu_bo_alloc_wrap(amdgpu_device_handle dev, unsigned size, request.alloc_size = size; request.phys_alignment = alignment; request.preferred_heap = heap; - request.flags = flags; + request.flags = alloc_flags; r =amdgpu_bo_alloc (dev, &request, &buf_handle);if (r)
@@ -302,9 +302,9 @@ amdgpu_bo_alloc_wrap(amdgpu_device_handle dev, unsigned size, }static inline int -amdgpu_bo_alloc_and_map (amdgpu_device_handle dev,unsigned size, -unsigned alignment,unsigned heap,uint64_t flags, -amdgpu_bo_handle *bo,void **cpu,uint64_t *mc_address, +amdgpu_bo_alloc_and_map_raw (amdgpu_device_handle dev,unsigned size, +unsigned alignment,unsigned heap,uint64_t alloc_flags, +uint64_t mapping_flags,amdgpu_bo_handle *bo,void **cpu,uint64_t *mc_address,amdgpu_va_handle *va_handle) {struct amdgpu_bo_alloc_request request = {};
@@ -316,7 +316,7 @@ amdgpu_bo_alloc_and_map(amdgpu_device_handle dev, unsigned size, request.alloc_size = size; request.phys_alignment = alignment; request.preferred_heap = heap; - request.flags = flags; + request.flags = alloc_flags; r =amdgpu_bo_alloc (dev, &request, &buf_handle);if (r)
@@ -329,7 +329,7 @@ amdgpu_bo_alloc_and_map(amdgpu_device_handle dev, unsigned size,if (r) goto error_va_alloc; - r =amdgpu_bo_va_op (buf_handle,0 , size, vmc_addr,0 ,AMDGPU_VA_OP_MAP ); + r =amdgpu_bo_va_op (buf_handle,0 , size, vmc_addr, mapping_flags,AMDGPU_VA_OP_MAP );if (r) goto error_va_map;
@@ -355,6 +355,16 @@ error_va_alloc: }static inline int +amdgpu_bo_alloc_and_map (amdgpu_device_handle dev,unsigned size, +unsigned alignment,unsigned heap,uint64_t alloc_flags, +amdgpu_bo_handle *bo,void **cpu,uint64_t *mc_address, +amdgpu_va_handle *va_handle) +{ +return amdgpu_bo_alloc_and_map_raw (dev, size, alignment, heap, + alloc_flags,0 , bo, cpu, mc_address, va_handle); +} + +static inline int amdgpu_bo_unmap_and_free (amdgpu_bo_handle bo,amdgpu_va_handle va_handle,uint64_t mc_addr,uint64_t size) {
Signature · 6 lines
2.7.4 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 3/3 amdgpu/test: Fix deadlock tests for AI and RV.
In reply to Andrey GrodzovskySeems like AI and RV requires uncashed memory mapping to be able to pickup value written to memory by CPU.
Enable the test for AI and RV.
Signed-off-by Andrey Grodzovsky <[email protected]>
--- tests/amdgpu/deadlock_tests.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)
tests/amdgpu/deadlock_tests.c +8 -5
@@ -80,6 +80,8 @@ static uint32_t minor_version;static pthread_t stress_thread;static uint32_t *ptr; +int use_uc_mtype =0 ; +static void amdgpu_deadlock_helper (unsigned ip_type);static void amdgpu_deadlock_gfx (void );static void amdgpu_deadlock_compute (void );
@@ -92,13 +94,14 @@ CU_BOOL suite_deadlock_tests_enable(void) &minor_version, &device_handle))return CU_FALSE ; -if (device_handle->info.family_id ==AMDGPU_FAMILY_AI || - device_handle->info.family_id ==AMDGPU_FAMILY_SI || - device_handle->info.family_id ==AMDGPU_FAMILY_RV ) { +if (device_handle->info.family_id ==AMDGPU_FAMILY_SI ) {printf ("\n\nCurrently hangs the CP on this ASIC, deadlock suite disabled\n" ); enable =CU_FALSE ; } +if (device_handle->info.family_id >=AMDGPU_FAMILY_AI ) + use_uc_mtype =1 ; +if (amdgpu_device_deinitialize (device_handle))return CU_FALSE ;
@@ -183,8 +186,8 @@ static void amdgpu_deadlock_helper(unsigned ip_type) r =amdgpu_cs_ctx_create (device_handle, &context_handle);CU_ASSERT_EQUAL (r,0 ); - r =amdgpu_bo_alloc_and_map (device_handle,4096 ,4096 , -AMDGPU_GEM_DOMAIN_GTT ,0 , + r =amdgpu_bo_alloc_and_map_raw (device_handle,4096 ,4096 , +AMDGPU_GEM_DOMAIN_GTT ,0 , use_uc_mtype ?AMDGPU_VM_MTYPE_UC :0 , &ib_result_handle, &ib_result_cpu, &ib_result_mc_address, &va_handle);CU_ASSERT_EQUAL (r,0 );
Signature · 6 lines
2.7.4 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
This will break old UMDs that didn't set the flags correctly. Instead, UMDs should stop using amdgpu_bo_va_op if they want to set the flags.
Marek
Quoted 32 lines · Andrey Grodzovsky
Signed-off-by Andrey Grodzovsky <[email protected]>--- amdgpu/amdgpu_bo.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)amdgpu/amdgpu_bo.c +3
-3@@ -736,7 +736,7 @@ drm_public int amdgpu_bo_va_op(amdgpu_bo_handle bo,uint64_t offset, uint64_t size, uint64_t addr, - uint64_t flags, + uint64_t extra_flags, uint32_t ops) { amdgpu_device_handle dev = bo->dev;@@ -746,7 +746,8 @@ drm_public int amdgpu_bo_va_op(amdgpu_bo_handle bo,return amdgpu_bo_va_op_raw (dev, bo, offset, size, addr,AMDGPU_VM_PAGE_READABLE |AMDGPU_VM_PAGE_WRITEABLE | -AMDGPU_VM_PAGE_EXECUTABLE , ops); +AMDGPU_VM_PAGE_EXECUTABLE | + extra_flags, ops); } drm_public int amdgpu_bo_va_op_raw(amdgpu_device_handle dev, --2.7.4
Quoted 4 lines
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel