2015-04-20 10:15:23 -06:00
|
|
|
/*
|
|
|
|
* Copyright 2014 Advanced Micro Devices, Inc.
|
|
|
|
*
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
|
|
|
* copy of this software and associated documentation files (the "Software"),
|
|
|
|
* to deal in the Software without restriction, including without limitation
|
|
|
|
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
|
|
* and/or sell copies of the Software, and to permit persons to whom the
|
|
|
|
* Software is furnished to do so, subject to the following conditions:
|
|
|
|
*
|
|
|
|
* The above copyright notice and this permission notice shall be included in
|
|
|
|
* all copies or substantial portions of the Software.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
|
|
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
|
|
|
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
|
|
|
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
|
|
* OTHER DEALINGS IN THE SOFTWARE.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _AMDGPU_TEST_H_
|
|
|
|
#define _AMDGPU_TEST_H_
|
|
|
|
|
|
|
|
#include "amdgpu.h"
|
2015-07-13 06:57:44 -06:00
|
|
|
#include "amdgpu_drm.h"
|
2015-04-20 10:15:23 -06:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Define max. number of card in system which we are able to handle
|
|
|
|
*/
|
2018-04-19 07:50:49 -06:00
|
|
|
#define MAX_CARDS_SUPPORTED 128
|
2015-04-20 10:15:23 -06:00
|
|
|
|
|
|
|
/* Forward reference for array to keep "drm" handles */
|
|
|
|
extern int drm_amdgpu[MAX_CARDS_SUPPORTED];
|
|
|
|
|
2017-01-24 15:29:52 -07:00
|
|
|
/* Global variables */
|
|
|
|
extern int open_render_node;
|
|
|
|
|
2015-04-20 10:15:23 -06:00
|
|
|
/************************* Basic test suite ********************************/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Define basic test suite to serve as the starting point for future testing
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Initialize basic test suite
|
|
|
|
*/
|
|
|
|
int suite_basic_tests_init();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Deinitialize basic test suite
|
|
|
|
*/
|
|
|
|
int suite_basic_tests_clean();
|
|
|
|
|
2019-03-04 03:27:48 -07:00
|
|
|
/**
|
|
|
|
* Decide if the suite is enabled by default or not.
|
|
|
|
*/
|
|
|
|
CU_BOOL suite_basic_tests_enable(void);
|
|
|
|
|
2015-04-20 10:15:23 -06:00
|
|
|
/**
|
|
|
|
* Tests in basic test suite
|
|
|
|
*/
|
|
|
|
extern CU_TestInfo basic_tests[];
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Initialize bo test suite
|
|
|
|
*/
|
|
|
|
int suite_bo_tests_init();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Deinitialize bo test suite
|
|
|
|
*/
|
|
|
|
int suite_bo_tests_clean();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Tests in bo test suite
|
|
|
|
*/
|
|
|
|
extern CU_TestInfo bo_tests[];
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Initialize cs test suite
|
|
|
|
*/
|
|
|
|
int suite_cs_tests_init();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Deinitialize cs test suite
|
|
|
|
*/
|
|
|
|
int suite_cs_tests_clean();
|
|
|
|
|
2017-11-24 13:50:51 -07:00
|
|
|
/**
|
|
|
|
* Decide if the suite is enabled by default or not.
|
|
|
|
*/
|
|
|
|
CU_BOOL suite_cs_tests_enable(void);
|
|
|
|
|
2015-04-20 10:15:23 -06:00
|
|
|
/**
|
|
|
|
* Tests in cs test suite
|
|
|
|
*/
|
|
|
|
extern CU_TestInfo cs_tests[];
|
|
|
|
|
2015-05-19 10:51:15 -06:00
|
|
|
/**
|
|
|
|
* Initialize vce test suite
|
|
|
|
*/
|
|
|
|
int suite_vce_tests_init();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Deinitialize vce test suite
|
|
|
|
*/
|
|
|
|
int suite_vce_tests_clean();
|
|
|
|
|
2017-11-09 21:30:01 -07:00
|
|
|
/**
|
|
|
|
* Decide if the suite is enabled by default or not.
|
|
|
|
*/
|
|
|
|
CU_BOOL suite_vce_tests_enable(void);
|
|
|
|
|
2015-05-19 10:51:15 -06:00
|
|
|
/**
|
|
|
|
* Tests in vce test suite
|
|
|
|
*/
|
|
|
|
extern CU_TestInfo vce_tests[];
|
|
|
|
|
2017-04-03 13:52:31 -06:00
|
|
|
/**
|
|
|
|
+ * Initialize vcn test suite
|
|
|
|
+ */
|
|
|
|
int suite_vcn_tests_init();
|
|
|
|
|
|
|
|
/**
|
|
|
|
+ * Deinitialize vcn test suite
|
|
|
|
+ */
|
|
|
|
int suite_vcn_tests_clean();
|
|
|
|
|
2017-11-09 21:30:01 -07:00
|
|
|
/**
|
|
|
|
* Decide if the suite is enabled by default or not.
|
|
|
|
*/
|
|
|
|
CU_BOOL suite_vcn_tests_enable(void);
|
|
|
|
|
2017-04-03 13:52:31 -06:00
|
|
|
/**
|
|
|
|
+ * Tests in vcn test suite
|
|
|
|
+ */
|
|
|
|
extern CU_TestInfo vcn_tests[];
|
|
|
|
|
2021-12-08 16:35:03 -07:00
|
|
|
/**
|
|
|
|
+ * Initialize jpeg test suite
|
|
|
|
+ */
|
|
|
|
int suite_jpeg_tests_init();
|
|
|
|
|
|
|
|
/**
|
|
|
|
+ * Deinitialize jpeg test suite
|
|
|
|
+ */
|
|
|
|
int suite_jpeg_tests_clean();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Decide if the suite is enabled by default or not.
|
|
|
|
*/
|
|
|
|
CU_BOOL suite_jpeg_tests_enable(void);
|
|
|
|
|
|
|
|
/**
|
|
|
|
+ * Tests in vcn test suite
|
|
|
|
+ */
|
|
|
|
extern CU_TestInfo jpeg_tests[];
|
|
|
|
|
2017-08-15 09:33:43 -06:00
|
|
|
/**
|
|
|
|
* Initialize uvd enc test suite
|
|
|
|
*/
|
|
|
|
int suite_uvd_enc_tests_init();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Deinitialize uvd enc test suite
|
|
|
|
*/
|
|
|
|
int suite_uvd_enc_tests_clean();
|
|
|
|
|
2017-11-09 21:30:01 -07:00
|
|
|
/**
|
|
|
|
* Decide if the suite is enabled by default or not.
|
|
|
|
*/
|
|
|
|
CU_BOOL suite_uvd_enc_tests_enable(void);
|
|
|
|
|
2017-08-15 09:33:43 -06:00
|
|
|
/**
|
|
|
|
* Tests in uvd enc test suite
|
|
|
|
*/
|
|
|
|
extern CU_TestInfo uvd_enc_tests[];
|
|
|
|
|
2017-10-02 12:07:48 -06:00
|
|
|
/**
|
|
|
|
* Initialize deadlock test suite
|
|
|
|
*/
|
|
|
|
int suite_deadlock_tests_init();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Deinitialize deadlock test suite
|
|
|
|
*/
|
|
|
|
int suite_deadlock_tests_clean();
|
|
|
|
|
2017-11-14 07:02:48 -07:00
|
|
|
/**
|
|
|
|
* Decide if the suite is enabled by default or not.
|
|
|
|
*/
|
|
|
|
CU_BOOL suite_deadlock_tests_enable(void);
|
|
|
|
|
2017-10-02 12:07:48 -06:00
|
|
|
/**
|
|
|
|
* Tests in uvd enc test suite
|
|
|
|
*/
|
|
|
|
extern CU_TestInfo deadlock_tests[];
|
|
|
|
|
2017-10-27 09:09:11 -06:00
|
|
|
/**
|
|
|
|
* Initialize vm test suite
|
|
|
|
*/
|
|
|
|
int suite_vm_tests_init();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Deinitialize deadlock test suite
|
|
|
|
*/
|
|
|
|
int suite_vm_tests_clean();
|
|
|
|
|
2018-01-16 08:49:45 -07:00
|
|
|
/**
|
|
|
|
* Decide if the suite is enabled by default or not.
|
|
|
|
*/
|
|
|
|
CU_BOOL suite_vm_tests_enable(void);
|
|
|
|
|
2017-10-27 09:09:11 -06:00
|
|
|
/**
|
|
|
|
* Tests in vm test suite
|
|
|
|
*/
|
|
|
|
extern CU_TestInfo vm_tests[];
|
|
|
|
|
2019-01-31 20:48:11 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Initialize ras test suite
|
|
|
|
*/
|
|
|
|
int suite_ras_tests_init();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Deinitialize deadlock test suite
|
|
|
|
*/
|
|
|
|
int suite_ras_tests_clean();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Decide if the suite is enabled by default or not.
|
|
|
|
*/
|
|
|
|
CU_BOOL suite_ras_tests_enable(void);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Tests in ras test suite
|
|
|
|
*/
|
|
|
|
extern CU_TestInfo ras_tests[];
|
|
|
|
|
|
|
|
|
2019-05-16 02:07:14 -06:00
|
|
|
/**
|
|
|
|
* Initialize syncobj timeline test suite
|
|
|
|
*/
|
|
|
|
int suite_syncobj_timeline_tests_init();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Deinitialize syncobj timeline test suite
|
|
|
|
*/
|
|
|
|
int suite_syncobj_timeline_tests_clean();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Decide if the suite is enabled by default or not.
|
|
|
|
*/
|
|
|
|
CU_BOOL suite_syncobj_timeline_tests_enable(void);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Tests in syncobj timeline test suite
|
|
|
|
*/
|
|
|
|
extern CU_TestInfo syncobj_timeline_tests[];
|
|
|
|
|
2022-03-09 08:05:04 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Initialize cp dma test suite
|
|
|
|
*/
|
|
|
|
int suite_cp_dma_tests_init();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Deinitialize cp dma test suite
|
|
|
|
*/
|
|
|
|
int suite_cp_dma_tests_clean();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Decide if the suite is enabled by default or not.
|
|
|
|
*/
|
|
|
|
CU_BOOL suite_cp_dma_tests_enable(void);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Tests in cp dma test suite
|
|
|
|
*/
|
|
|
|
extern CU_TestInfo cp_dma_tests[];
|
|
|
|
|
2019-08-11 07:23:24 -06:00
|
|
|
/**
|
|
|
|
* Initialize security test suite
|
|
|
|
*/
|
|
|
|
int suite_security_tests_init();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Deinitialize security test suite
|
|
|
|
*/
|
|
|
|
int suite_security_tests_clean();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Decide if the suite is enabled by default or not.
|
|
|
|
*/
|
|
|
|
CU_BOOL suite_security_tests_enable(void);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Tests in security test suite
|
|
|
|
*/
|
|
|
|
extern CU_TestInfo security_tests[];
|
|
|
|
|
2019-08-16 03:07:07 -06:00
|
|
|
extern void
|
2019-08-16 05:02:51 -06:00
|
|
|
amdgpu_command_submission_write_linear_helper_with_secure(amdgpu_device_handle
|
|
|
|
device,
|
|
|
|
unsigned ip_type,
|
2019-08-16 03:07:07 -06:00
|
|
|
bool secure);
|
2019-08-11 07:23:24 -06:00
|
|
|
|
2022-07-07 06:48:19 -06:00
|
|
|
extern void amdgpu_test_dispatch_helper(amdgpu_device_handle device_handle, unsigned ip);
|
|
|
|
extern void amdgpu_test_dispatch_hang_helper(amdgpu_device_handle device_handle, uint32_t ip);
|
|
|
|
extern void amdgpu_test_dispatch_hang_slow_helper(amdgpu_device_handle device_handle, uint32_t ip);
|
|
|
|
extern void amdgpu_test_draw_helper(amdgpu_device_handle device_handle);
|
|
|
|
extern void amdgpu_test_draw_hang_helper(amdgpu_device_handle device_handle);
|
|
|
|
extern void amdgpu_test_draw_hang_slow_helper(amdgpu_device_handle device_handle);
|
2021-05-26 13:15:33 -06:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Initialize hotunplug test suite
|
|
|
|
*/
|
|
|
|
int suite_hotunplug_tests_init();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Deinitialize hotunplug test suite
|
|
|
|
*/
|
|
|
|
int suite_hotunplug_tests_clean();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Decide if the suite is enabled by default or not.
|
|
|
|
*/
|
|
|
|
CU_BOOL suite_hotunplug_tests_enable(void);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Tests in uvd enc test suite
|
|
|
|
*/
|
|
|
|
extern CU_TestInfo hotunplug_tests[];
|
|
|
|
|
|
|
|
|
2015-04-20 10:15:23 -06:00
|
|
|
/**
|
|
|
|
* Helper functions
|
|
|
|
*/
|
|
|
|
static inline amdgpu_bo_handle gpu_mem_alloc(
|
|
|
|
amdgpu_device_handle device_handle,
|
|
|
|
uint64_t size,
|
|
|
|
uint64_t alignment,
|
|
|
|
uint32_t type,
|
|
|
|
uint64_t flags,
|
2015-07-13 06:57:44 -06:00
|
|
|
uint64_t *vmc_addr,
|
|
|
|
amdgpu_va_handle *va_handle)
|
2015-04-20 10:15:23 -06:00
|
|
|
{
|
|
|
|
struct amdgpu_bo_alloc_request req = {0};
|
2018-09-14 07:08:06 -06:00
|
|
|
amdgpu_bo_handle buf_handle = NULL;
|
2015-04-20 10:15:23 -06:00
|
|
|
int r;
|
|
|
|
|
|
|
|
req.alloc_size = size;
|
|
|
|
req.phys_alignment = alignment;
|
|
|
|
req.preferred_heap = type;
|
|
|
|
req.flags = flags;
|
|
|
|
|
2015-07-13 06:57:44 -06:00
|
|
|
r = amdgpu_bo_alloc(device_handle, &req, &buf_handle);
|
2015-04-20 10:15:23 -06:00
|
|
|
CU_ASSERT_EQUAL(r, 0);
|
2018-09-14 07:04:38 -06:00
|
|
|
if (r)
|
|
|
|
return NULL;
|
2015-04-20 10:15:23 -06:00
|
|
|
|
2018-09-14 07:08:06 -06:00
|
|
|
if (vmc_addr && va_handle) {
|
|
|
|
r = amdgpu_va_range_alloc(device_handle,
|
|
|
|
amdgpu_gpu_va_range_general,
|
|
|
|
size, alignment, 0, vmc_addr,
|
|
|
|
va_handle, 0);
|
|
|
|
CU_ASSERT_EQUAL(r, 0);
|
|
|
|
if (r)
|
|
|
|
goto error_free_bo;
|
|
|
|
|
|
|
|
r = amdgpu_bo_va_op(buf_handle, 0, size, *vmc_addr, 0,
|
|
|
|
AMDGPU_VA_OP_MAP);
|
|
|
|
CU_ASSERT_EQUAL(r, 0);
|
|
|
|
if (r)
|
|
|
|
goto error_free_va;
|
|
|
|
}
|
2015-07-13 06:57:44 -06:00
|
|
|
|
|
|
|
return buf_handle;
|
2018-09-14 07:04:38 -06:00
|
|
|
|
|
|
|
error_free_va:
|
|
|
|
r = amdgpu_va_range_free(*va_handle);
|
|
|
|
CU_ASSERT_EQUAL(r, 0);
|
|
|
|
|
|
|
|
error_free_bo:
|
|
|
|
r = amdgpu_bo_free(buf_handle);
|
|
|
|
CU_ASSERT_EQUAL(r, 0);
|
|
|
|
|
|
|
|
return NULL;
|
2015-07-13 06:57:44 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline int gpu_mem_free(amdgpu_bo_handle bo,
|
|
|
|
amdgpu_va_handle va_handle,
|
|
|
|
uint64_t vmc_addr,
|
|
|
|
uint64_t size)
|
|
|
|
{
|
|
|
|
int r;
|
|
|
|
|
2018-09-14 07:04:38 -06:00
|
|
|
if (!bo)
|
|
|
|
return 0;
|
|
|
|
|
2018-09-14 07:08:06 -06:00
|
|
|
if (va_handle) {
|
|
|
|
r = amdgpu_bo_va_op(bo, 0, size, vmc_addr, 0,
|
|
|
|
AMDGPU_VA_OP_UNMAP);
|
|
|
|
CU_ASSERT_EQUAL(r, 0);
|
|
|
|
if (r)
|
|
|
|
return r;
|
|
|
|
|
|
|
|
r = amdgpu_va_range_free(va_handle);
|
|
|
|
CU_ASSERT_EQUAL(r, 0);
|
|
|
|
if (r)
|
|
|
|
return r;
|
|
|
|
}
|
2015-07-13 06:57:44 -06:00
|
|
|
|
|
|
|
r = amdgpu_bo_free(bo);
|
|
|
|
CU_ASSERT_EQUAL(r, 0);
|
|
|
|
|
2018-09-14 07:04:38 -06:00
|
|
|
return r;
|
2015-04-20 10:15:23 -06:00
|
|
|
}
|
|
|
|
|
2018-02-08 00:03:01 -07:00
|
|
|
static inline int
|
|
|
|
amdgpu_bo_alloc_wrap(amdgpu_device_handle dev, unsigned size,
|
|
|
|
unsigned alignment, unsigned heap, uint64_t flags,
|
|
|
|
amdgpu_bo_handle *bo)
|
|
|
|
{
|
|
|
|
struct amdgpu_bo_alloc_request request = {};
|
|
|
|
amdgpu_bo_handle buf_handle;
|
|
|
|
int r;
|
|
|
|
|
|
|
|
request.alloc_size = size;
|
|
|
|
request.phys_alignment = alignment;
|
|
|
|
request.preferred_heap = heap;
|
|
|
|
request.flags = flags;
|
|
|
|
|
|
|
|
r = amdgpu_bo_alloc(dev, &request, &buf_handle);
|
|
|
|
if (r)
|
|
|
|
return r;
|
|
|
|
|
|
|
|
*bo = buf_handle;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2018-09-27 11:10:55 -06:00
|
|
|
int 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);
|
|
|
|
|
2015-06-01 06:12:10 -06:00
|
|
|
static inline int
|
|
|
|
amdgpu_bo_alloc_and_map(amdgpu_device_handle dev, unsigned size,
|
2018-09-27 11:10:55 -06:00
|
|
|
unsigned alignment, unsigned heap, uint64_t alloc_flags,
|
2015-07-13 06:57:44 -06:00
|
|
|
amdgpu_bo_handle *bo, void **cpu, uint64_t *mc_address,
|
|
|
|
amdgpu_va_handle *va_handle)
|
2015-06-01 06:12:10 -06:00
|
|
|
{
|
2018-09-27 11:10:55 -06:00
|
|
|
return amdgpu_bo_alloc_and_map_raw(dev, size, alignment, heap,
|
|
|
|
alloc_flags, 0, bo, cpu, mc_address, va_handle);
|
2015-07-13 06:57:44 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline int
|
|
|
|
amdgpu_bo_unmap_and_free(amdgpu_bo_handle bo, amdgpu_va_handle va_handle,
|
|
|
|
uint64_t mc_addr, uint64_t size)
|
|
|
|
{
|
|
|
|
amdgpu_bo_cpu_unmap(bo);
|
|
|
|
amdgpu_bo_va_op(bo, 0, size, mc_addr, 0, AMDGPU_VA_OP_UNMAP);
|
|
|
|
amdgpu_va_range_free(va_handle);
|
|
|
|
amdgpu_bo_free(bo);
|
2015-06-01 06:12:10 -06:00
|
|
|
|
|
|
|
return 0;
|
2015-07-13 06:57:44 -06:00
|
|
|
|
2015-06-01 06:12:10 -06:00
|
|
|
}
|
|
|
|
|
2015-06-02 05:05:41 -06:00
|
|
|
static inline int
|
|
|
|
amdgpu_get_bo_list(amdgpu_device_handle dev, amdgpu_bo_handle bo1,
|
|
|
|
amdgpu_bo_handle bo2, amdgpu_bo_list_handle *list)
|
|
|
|
{
|
|
|
|
amdgpu_bo_handle resources[] = {bo1, bo2};
|
|
|
|
|
|
|
|
return amdgpu_bo_list_create(dev, bo2 ? 2 : 1, resources, NULL, list);
|
|
|
|
}
|
|
|
|
|
2017-11-09 21:30:00 -07:00
|
|
|
|
2018-03-01 03:15:42 -07:00
|
|
|
static inline CU_ErrorCode amdgpu_set_suite_active(const char *suite_name,
|
2017-11-09 21:30:00 -07:00
|
|
|
CU_BOOL active)
|
|
|
|
{
|
2018-03-01 03:15:42 -07:00
|
|
|
CU_ErrorCode r = CU_set_suite_active(CU_get_suite(suite_name), active);
|
2017-11-09 21:30:00 -07:00
|
|
|
|
|
|
|
if (r != CUE_SUCCESS)
|
2018-03-01 03:15:42 -07:00
|
|
|
fprintf(stderr, "Failed to obtain suite %s\n", suite_name);
|
2017-11-09 21:30:00 -07:00
|
|
|
|
|
|
|
return r;
|
|
|
|
}
|
|
|
|
|
2018-03-01 03:15:42 -07:00
|
|
|
static inline CU_ErrorCode amdgpu_set_test_active(const char *suite_name,
|
2017-11-09 21:30:00 -07:00
|
|
|
const char *test_name, CU_BOOL active)
|
|
|
|
{
|
|
|
|
CU_ErrorCode r;
|
2018-03-01 03:15:42 -07:00
|
|
|
CU_pSuite pSuite = CU_get_suite(suite_name);
|
2017-11-09 21:30:00 -07:00
|
|
|
|
|
|
|
if (!pSuite) {
|
|
|
|
fprintf(stderr, "Failed to obtain suite %s\n",
|
2018-03-01 03:15:42 -07:00
|
|
|
suite_name);
|
2017-11-09 21:30:00 -07:00
|
|
|
return CUE_NOSUITE;
|
|
|
|
}
|
|
|
|
|
|
|
|
r = CU_set_test_active(CU_get_test(pSuite, test_name), active);
|
|
|
|
if (r != CUE_SUCCESS)
|
|
|
|
fprintf(stderr, "Failed to obtain test %s\n", test_name);
|
|
|
|
|
|
|
|
return r;
|
|
|
|
}
|
|
|
|
|
2020-11-25 02:20:33 -07:00
|
|
|
|
|
|
|
static inline bool asic_is_gfx_pipe_removed(uint32_t family_id, uint32_t chip_id, uint32_t chip_rev)
|
2019-07-24 01:42:24 -06:00
|
|
|
{
|
2020-11-25 02:20:33 -07:00
|
|
|
|
|
|
|
if (family_id != AMDGPU_FAMILY_AI)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
switch (chip_id - chip_rev) {
|
|
|
|
/* Arcturus */
|
|
|
|
case 0x32:
|
|
|
|
/* Aldebaran */
|
|
|
|
case 0x3c:
|
2019-07-24 01:42:24 -06:00
|
|
|
return true;
|
|
|
|
default:
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-02-05 17:40:46 -07:00
|
|
|
void amdgpu_test_exec_cs_helper_raw(amdgpu_device_handle device_handle,
|
|
|
|
amdgpu_context_handle context_handle,
|
|
|
|
unsigned ip_type, int instance, int pm4_dw,
|
|
|
|
uint32_t *pm4_src, int res_cnt,
|
|
|
|
amdgpu_bo_handle *resources,
|
|
|
|
struct amdgpu_cs_ib_info *ib_info,
|
|
|
|
struct amdgpu_cs_request *ibs_request,
|
|
|
|
bool secure);
|
2019-08-16 03:07:07 -06:00
|
|
|
|
2021-05-31 09:11:58 -06:00
|
|
|
void amdgpu_close_devices();
|
|
|
|
int amdgpu_open_device_on_test_index(int render_node);
|
|
|
|
char *amdgpu_get_device_from_fd(int fd);
|
|
|
|
|
2015-04-20 10:15:23 -06:00
|
|
|
#endif /* #ifdef _AMDGPU_TEST_H_ */
|