Skip to contentSkip to conversation

amdgpu: new approach for ras inject test

PATCH In review Guchun Chen 3 participants 7 messages Aug 29, 2019 1 message not in the archive Arm/Amlogic Meson SoC support

lore
Share & tools
lore
#0 lore raw

cover amdgpu: new approach for ras inject test

These patches are to remove additional external lib-jsonc dependence, and to put all test configurations into C code.

Guchun Chen (4):
amdgpu: remove json package dependence
amdgpu: delete test configuration file
amdgpu: add ras inject unit test
amdgpu: add ras feature capability check in inject test

 configure.ac             |  18 ---
 data/amdgpu_ras.json     | 267 ----------------------------------
 meson.build              |   1 -
 tests/amdgpu/Makefile.am |   5 +-
 tests/amdgpu/meson.build |  16 +-
 tests/amdgpu/ras_tests.c | 305 ++++++++++++++-------------------------
 6 files changed, 116 insertions(+), 496 deletions(-)
 delete mode 100644 data/amdgpu_ras.json
Signature · 6 lines
2.17.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): [email protected]

#2 lore raw

PATCH 1/4 amdgpu: remove json package dependence

Except CUnit library, no additional external library should be needed when compiling amdgpu_test. This will keep this binary self containing.

Change-Id Id1935ef4431a0674c69391a67813370a3e9348e6
---
 configure.ac             |  18 -----
 meson.build              |   1 -
 tests/amdgpu/Makefile.am |   5 +-
 tests/amdgpu/meson.build |  16 +---
 tests/amdgpu/ras_tests.c | 165 +--------------------------------------
 5 files changed, 9 insertions(+), 196 deletions(-)
configure.ac +0 -18
index 983b4371..1cf91347 100644
@@ -430,24 +430,10 @@ if test "x$AMDGPU" != xno; then
 			AC_SUBST([CUNIT_CFLAGS])
 		fi
 	fi
-
-	# Detect json-c library
-	PKG_CHECK_MODULES([JSONC], [json-c >= 0.10.1], [have_jsonc=yes], [have_jsonc=no])
-	if test "x${have_jsonc}" = "xno"; then
-		AC_CHECK_LIB([json-c], [json_object_object_get], [have_jsonc=yes], [have_jsonc=no])
-		if test "x${have_jsonc}" = "xyes"; then
-			JSONC_LIBS="-ljson-c"
-			JSONC_CFLAGS=""
-			AC_SUBST([JSONC_LIBS])
-			AC_SUBST([JSONC_CFLAGS])
-		fi
-	fi
 else
 	have_cunit=no
-	have_jsonc=no
 fi
 AM_CONDITIONAL(HAVE_CUNIT, [test "x$have_cunit" != "xno"])
-AM_CONDITIONAL(HAVE_JSONC, [test "x$have_jsonc" != "xno"])
 
 AM_CONDITIONAL(HAVE_AMDGPU, [test "x$AMDGPU" = xyes])
 if test "x$AMDGPU" = xyes; then
@@ -456,10 +442,6 @@ if test "x$AMDGPU" = xyes; then
 	if test "x$have_cunit" = "xno"; then
 		AC_MSG_WARN([Could not find cunit library. Disabling amdgpu tests])
 	fi
-
-	if test "x$have_jsonc" = "xno"; then
-		AC_MSG_WARN([Could not find json-c library. Disabling amdgpu tests])
-	fi
 else
 	AC_DEFINE(HAVE_AMDGPU, 0)
 fi
meson.build +0 -1
index bc5cfc58..e292554a 100644
@@ -217,7 +217,6 @@ libdrm_c_args = warn_c_args + ['-fvisibility=hidden']
 
 dep_pciaccess = dependency('pciaccess', version : '>= 0.10', required : with_intel)
 dep_cunit = dependency('cunit', version : '>= 2.1', required : false)
-dep_json = dependency('json-c', version : '>= 0.10.1', required : false)
 _cairo_tests = get_option('cairo-tests')
 if _cairo_tests != 'false'
   dep_cairo = dependency('cairo', required : _cairo_tests == 'true')
tests/amdgpu/Makefile.am +2 -3
index 339bb0a9..920882d0 100644
@@ -7,8 +7,7 @@ AM_CFLAGS = \
 
 LDADD = $(top_builddir)/libdrm.la \
 	$(top_builddir)/amdgpu/libdrm_amdgpu.la \
-	$(CUNIT_LIBS) \
-	$(JSONC_LIBS)
+	$(CUNIT_LIBS)
 
 if HAVE_INSTALL_TESTS
 bin_PROGRAMS = \
@@ -18,7 +17,7 @@ noinst_PROGRAMS = \
 	amdgpu_test
 endif
 
-amdgpu_test_CPPFLAGS = $(CUNIT_CFLAGS) $(JSONC_CFLAGS)
+amdgpu_test_CPPFLAGS = $(CUNIT_CFLAGS)
 
 amdgpu_test_SOURCES = \
 	amdgpu_test.c \
tests/amdgpu/meson.build +3 -13
index 4307295e..1726cb43 100644
@@ -18,7 +18,7 @@
 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 # SOFTWARE.
 
-if dep_cunit.found() and dep_json.found()
+if dep_cunit.found()
   amdgpu_test = executable(
     'amdgpu_test',
     files(
@@ -26,19 +26,9 @@ if dep_cunit.found() and dep_json.found()
       'vce_tests.c', 'uvd_enc_tests.c', 'vcn_tests.c', 'deadlock_tests.c',
       'vm_tests.c', 'ras_tests.c', 'syncobj_tests.c',
     ),
-    dependencies : [dep_cunit, dep_json, dep_threads],
+    dependencies : [dep_cunit, dep_threads],
     include_directories : [inc_root, inc_drm, include_directories('../../amdgpu')],
     link_with : [libdrm, libdrm_amdgpu],
     install : with_install_tests,
   )
-
-  configure_file(input : '../../data/amdgpu_ras.json',
-    output : 'amdgpu_ras.json',
-    configuration : configuration_data())
-
-  install_data(
-    '../../data/amdgpu_ras.json',
-    install_mode : 'rw-r--r--',
-    install_dir : datadir_amdgpu,
-  )
-endif
\ No newline at end of file
+endif
tests/amdgpu/ras_tests.c +4 -161

180 lines not on this page · raw message

Signature · 6 lines
2.17.1

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

PATCH 2/4 amdgpu: delete test configuration file

In reply to a message not in the archive

Json package dependence is removed from amdgpu_test, so this json configuration file is not needed any more.

Change-Id Ibd64c30244c5ae894928d9de5460f1c776408054
---
 data/amdgpu_ras.json | 267 -------------------------------------------
 1 file changed, 267 deletions(-)
 delete mode 100644 data/amdgpu_ras.json
data/amdgpu_ras.json deleted +0 -267
deleted file mode 100644
index 26fd9465..00000000
@@ -1,267 +0,0 @@
-{
-    "version": "0.0.1",
-    "block": {
-        "umc": {
-            "index": 0
-        },
-        "gfx": {
-            "index": 2,
-            "subblock": {
-                "gfx_cpc_scratch": 0,
-                "gfx_cpc_ucode": 1,
-                "gfx_dc_state_me1": 2,
-                "gfx_dc_csinvoc_me1": 3,
-                "gfx_dc_restore_me1": 4,
-                "gfx_dc_state_me2": 5,
-                "gfx_dc_csinvoc_me2": 6,
-                "gfx_dc_restore_me2": 7,
-                "gfx_cpf_roq_me2": 8,
-                "gfx_cpf_roq_me1": 9,
-                "gfx_cpf_tag": 10,
-                "gfx_cpg_dma_roq": 11,
-                "gfx_cpg_dma_tag": 12,
-                "gfx_cpg_tag": 13,
-                "gfx_gds_mem": 14,
-                "gfx_gds_input_queue": 15,
-                "gfx_gds_oa_phy_cmd_ram_mem": 16,
-                "gfx_gds_oa_phy_data_ram_mem": 17,
-                "gfx_gds_oa_pipe_mem": 18,
-                "gfx_spi_sr_mem": 19,
-                "gfx_sq_sgpr": 20,
-                "gfx_sq_lds_d": 21,
-                "gfx_sq_lds_i": 22,
-                "gfx_sq_vgpr": 23,
-                "gfx_sqc_inst_utcl1_lfifo": 24,
-                "gfx_sqc_data_cu0_write_data_buf": 25,
-                "gfx_sqc_data_cu0_utcl1_lfifo": 26,
-                "gfx_sqc_data_cu1_write_data_buf": 27,
-                "gfx_sqc_data_cu1_utcl1_lfifo": 28,
-                "gfx_sqc_data_cu2_write_data_buf": 29,
-                "gfx_sqc_data_cu2_utcl1_lfifo": 30,
-                "gfx_sqc_inst_banka_tag_ram": 31,
-                "gfx_sqc_inst_banka_utcl1_miss_fifo": 32,
-                "gfx_sqc_inst_banka_miss_fifo": 33,
-                "gfx_sqc_inst_banka_bank_ram": 34,
-                "gfx_sqc_data_banka_tag_ram": 35,
-                "gfx_sqc_data_banka_hit_fifo": 36,
-                "gfx_sqc_data_banka_miss_fifo": 37,
-                "gfx_sqc_data_banka_dirty_bit_ram": 38,
-                "gfx_sqc_data_banka_bank_ram": 39,
-                "gfx_sqc_inst_bankb_tag_ram": 40,
-                "gfx_sqc_inst_bankb_utcl1_miss_fifo": 41,
-                "gfx_sqc_inst_bankb_miss_fifo": 42,
-                "gfx_sqc_inst_bankb_bank_ram": 43,
-                "gfx_sqc_data_bankb_tag_ram": 44,
-                "gfx_sqc_data_bankb_hit_fifo": 45,
-                "gfx_sqc_data_bankb_miss_fifo": 46,
-                "gfx_sqc_data_bankb_dirty_bit_ram": 47,
-                "gfx_sqc_data_bankb_bank_ram": 48,
-                "gfx_ta_fs_dfifo": 49,
-                "gfx_ta_fs_afifo": 50,
-                "gfx_ta_fl_lfifo": 51,
-                "gfx_ta_fx_lfifo": 52,
-                "gfx_ta_fs_cfifo": 53,
-                "gfx_tca_hole_fifo": 54,
-                "gfx_tca_req_fifo": 55,
-                "gfx_tcc_cache_data": 56,
-                "gfx_tcc_cache_data_bank_0_1": 57,
-                "gfx_tcc_cache_data_bank_1_0": 58,
-                "gfx_tcc_cache_data_bank_1_1": 59,
-                "gfx_tcc_cache_dirty_bank_0": 60,
-                "gfx_tcc_cache_dirty_bank_1": 61,
-                "gfx_tcc_high_rate_tag": 62,
-                "gfx_tcc_low_rate_tag": 63,
-                "gfx_tcc_in_use_dec": 64,
-                "gfx_tcc_in_use_transfer": 65,
-                "gfx_tcc_return_data": 66,
-                "gfx_tcc_return_control": 67,
-                "gfx_tcc_uc_atomic_fifo": 68,
-                "gfx_tcc_write_return": 69,
-                "gfx_tcc_write_cache_read": 70,
-                "gfx_tcc_src_fifo": 71,
-                "gfx_tcc_src_fifo_next_ram": 72,
-                "gfx_tcc_cache_tag_probe_fifo": 73,
-                "gfx_tcc_latency_fifo": 74,
-                "gfx_tcc_latency_fifo_next_ram": 75,
-                "gfx_tcc_wrret_tag_write_return": 76,
-                "gfx_tcc_atomic_return_buffer": 77,
-                "gfx_tci_write_ram": 78,
-                "gfx_tcp_cache_ram": 79,
-                "gfx_tcp_lfifo_ram": 80,
-                "gfx_tcp_cmd_fifo": 81,
-                "gfx_tcp_vm_fifo": 82,
-                "gfx_tcp_db_ram": 83,
-                "gfx_tcp_utcl1_lfifo0": 84,
-                "gfx_tcp_utcl1_lfifo1": 85,
-                "gfx_td_ss_fifo_lo": 86,
-                "gfx_td_ss_fifo_hi": 87,
-                "gfx_td_cs_fifo": 88,
-                "gfx_ea_dramrd_cmdmem": 89,
-                "gfx_ea_dramwr_cmdmem": 90,
-                "gfx_ea_dramwr_datamem": 91,
-                "gfx_ea_rret_tagmem": 92,
-                "gfx_ea_wret_tagmem": 93,
-                "gfx_ea_gmird_cmdmem": 94,
-                "gfx_ea_gmiwr_cmdmem": 95,
-                "gfx_ea_gmiwr_datamem": 96,
-                "gfx_ea_dramrd_pagemem": 97,
-                "gfx_ea_dramwr_pagemem": 98,
-                "gfx_ea_iord_cmdmem": 99,
-                "gfx_ea_iowr_cmdmem": 100,
-                "gfx_ea_iowr_datamem": 101,
-                "gfx_ea_gmird_pagemem": 102,
-                "gfx_ea_gmiwr_pagemem": 103,
-                "gfx_ea_mam_d0mem": 104,
-                "gfx_ea_mam_d1mem": 105,
-                "gfx_ea_mam_d2mem": 106,
-                "gfx_ea_mam_d3mem": 107,
-                "utc_vml2_bank_cache": 108,
-                "utc_vml2_walker": 109,
-                "utc_atcl2_cache_2m_bank": 110,
-                "utc_atcl2_cache_4k_bank": 111
-            }
-        },
-    },
-    "type": {
-        "parity": 1,
-        "single_correctable": 2,
-        "multi_uncorrectable": 4,
-        "poison": 8
-    },
-    "tests": [
-        {
-            "name": "ras_umc.1.0",
-            "block": "umc",
-            "type": "single_correctable",
-            "address": 0,
-            "value": 0
-        },
-        {
-            "name": "ras_umc.1.0",
-            "block": "umc",
-            "type": "multi_uncorrectable",
-            "address": 0,
-            "value": 0
-        },
-        {
-            "name": "ras_gfx.2.1",
-            "block": "gfx",
-            "subblock": "gfx_cpc_ucode",
-            "type": "single_correctable",
-            "address": 0,
-            "value": 0
-        },
-        {
-            "name": "ras_gfx.2.10",
-            "block": "gfx",
-            "subblock": "gfx_cpf_tag",
-            "type": "single_correctable",
-            "address": 0,
-            "value": 0
-        },
-        {
-            "name": "ras_gfx.2.13",
-            "block": "gfx",
-            "subblock": "gfx_cpg_tag",
-            "type": "single_correctable",
-            "address": 0,
-            "value": 0
-        },
-        {
-            "name": "ras_gfx.2.21",
-            "block": "gfx",
-            "subblock": "gfx_sq_lds_d",
-            "type": "single_correctable",
-            "address": 0,
-            "value": 0
-        },
-        {
-            "name": "ras_gfx.2.28",
-            "block": "gfx",
-            "subblock": "gfx_sqc_data_cu1_utcl1_lfifo",
-            "type": "single_correctable",
-            "address": 0,
-            "value": 0
-        },
-        {
-            "name": "ras_gfx.2.31",
-            "block": "gfx",
-            "subblock": "gfx_sqc_inst_banka_tag_ram",
-            "type": "single_correctable",
-            "address": 0,
-            "value": 0
-        },
-        {
-            "name": "ras_gfx.2.40",
-            "block": "gfx",
-            "subblock": "gfx_sqc_inst_bankb_tag_ram",
-            "type": "single_correctable",
-            "address": 0,
-            "value": 0
-        },
-        {
-            "name": "ras_gfx.2.49",
-            "block": "gfx",
-            "subblock": "gfx_ta_fs_dfifo",
-            "type": "single_correctable",
-            "address": 0,
-            "value": 0
-        },
-        {
-            "name": "ras_gfx.2.56",
-            "block": "gfx",
-            "subblock": "gfx_tcc_cache_data",
-            "type": "single_correctable",
-            "address": 0,
-            "value": 0
-        },
-        {
-            "name": "ras_gfx.2.57",
-            "block": "gfx",
-            "subblock": "gfx_tcc_cache_data_bank_0_1",
-            "type": "single_correctable",
-            "address": 0,
-            "value": 0
-        },
-        {
-            "name": "ras_gfx.2.58",
-            "block": "gfx",
-            "subblock": "gfx_tcc_cache_data_bank_1_0",
-            "type": "single_correctable",
-            "address": 0,
-            "value": 0
-        },
-        {
-            "name": "ras_gfx.2.59",
-            "block": "gfx",
-            "subblock": "gfx_tcc_cache_data_bank_1_1",
-            "type": "single_correctable",
-            "address": 0,
-            "value": 0
-        },
-        {
-            "name": "ras_gfx.2.79",
-            "block": "gfx",
-            "subblock": "gfx_tcp_cache_ram",
-            "type": "single_correctable",
-            "address": 0,
-            "value": 0
-        },
-        {
-            "name": "ras_gfx.2.86",
-            "block": "gfx",
-            "subblock": "gfx_td_ss_fifo_lo",
-            "type": "single_correctable",
-            "address": 0,
-            "value": 0
-        },
-        {
-            "name": "ras_gfx.2.89",
-            "block": "gfx",
-            "subblock": "gfx_ea_dramrd_cmdmem",
-            "type": "single_correctable",
-            "address": 0,
-            "value": 0
-        },
-    ]
-}
Signature · 6 lines
2.17.1

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

PATCH 3/4 amdgpu: add ras inject unit test

In reply to a message not in the archive

Both UMC and GFX ras single_correctable
inject tests are added.

Change-Id I46c29b8761294122fc9acb620441a7aace6509e4
---
 tests/amdgpu/ras_tests.c | 144 +++++++++++++++++++++++++++++----------
 1 file changed, 107 insertions(+), 37 deletions(-)
tests/amdgpu/ras_tests.c +107 -37
index 86b4137b..d510b644 100644
@@ -30,7 +30,8 @@
 #include <fcntl.h>
 #include <stdio.h>
 #include "xf86drm.h"
-#include "stdlib.h"
+
+#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
 
 const char *ras_block_string[] = {
 	"umc",
@@ -311,11 +312,10 @@ enum amdgpu_ras_error_type {
 	AMDGPU_RAS_ERROR__POISON				= 8,
 };
 
-struct ras_test_item {
+struct ras_inject_test_config {
 	char name[64];
-	int block;
+	char block[32];
 	int sub_block;
-	char error_type_str[64];
 	enum amdgpu_ras_error_type type;
 	uint64_t address;
 	uint64_t value;
@@ -390,12 +390,78 @@ struct ras_DID_test_mask{
 	DEFAULT_RAS_BLOCK_MASK_BASIC\
 }
 
+static const struct ras_inject_test_config umc_ras_inject_test[] = {
+	{"ras_umc.1.0", "umc", 0, AMDGPU_RAS_ERROR__SINGLE_CORRECTABLE, 0, 0},
+};
+
+static const struct ras_inject_test_config gfx_ras_inject_test[] = {
+	{"ras_gfx.2.0", "gfx", AMDGPU_RAS_BLOCK__GFX_CPC_UCODE,
+		AMDGPU_RAS_ERROR__SINGLE_CORRECTABLE, 0, 0},
+	{"ras_gfx.2.1", "gfx", AMDGPU_RAS_BLOCK__GFX_CPF_TAG,
+		AMDGPU_RAS_ERROR__SINGLE_CORRECTABLE, 0, 0},
+	{"ras_gfx.2.2", "gfx", AMDGPU_RAS_BLOCK__GFX_CPG_TAG,
+		AMDGPU_RAS_ERROR__SINGLE_CORRECTABLE, 0, 0},
+	{"ras_gfx.2.3", "gfx", AMDGPU_RAS_BLOCK__GFX_SQ_LDS_D,
+		AMDGPU_RAS_ERROR__SINGLE_CORRECTABLE, 0, 0},
+	{"ras_gfx.2.4", "gfx", AMDGPU_RAS_BLOCK__GFX_SQC_DATA_CU1_UTCL1_LFIFO,
+		AMDGPU_RAS_ERROR__SINGLE_CORRECTABLE, 0, 0},
+	{"ras_gfx.2.5", "gfx", AMDGPU_RAS_BLOCK__GFX_SQC_INST_BANKA_TAG_RAM,
+		AMDGPU_RAS_ERROR__SINGLE_CORRECTABLE, 0, 0},
+	{"ras_gfx.2.6", "gfx", AMDGPU_RAS_BLOCK__GFX_SQC_INST_BANKB_TAG_RAM,
+		AMDGPU_RAS_ERROR__SINGLE_CORRECTABLE, 0, 0},
+	{"ras_gfx.2.7", "gfx", AMDGPU_RAS_BLOCK__GFX_TA_FS_DFIFO,
+		AMDGPU_RAS_ERROR__SINGLE_CORRECTABLE, 0, 0},
+	{"ras_gfx.2.8", "gfx", AMDGPU_RAS_BLOCK__GFX_TCC_CACHE_DATA,
+		AMDGPU_RAS_ERROR__SINGLE_CORRECTABLE, 0, 0},
+	{"ras_gfx.2.9", "gfx", AMDGPU_RAS_BLOCK__GFX_TCC_CACHE_DATA_BANK_0_1,
+		AMDGPU_RAS_ERROR__SINGLE_CORRECTABLE, 0, 0},
+	{"ras_gfx.2.10", "gfx", AMDGPU_RAS_BLOCK__GFX_TCC_CACHE_DATA_BANK_1_0,
+		AMDGPU_RAS_ERROR__SINGLE_CORRECTABLE, 0, 0},
+	{"ras_gfx.2.11", "gfx", AMDGPU_RAS_BLOCK__GFX_TCC_CACHE_DATA_BANK_1_1,
+		AMDGPU_RAS_ERROR__SINGLE_CORRECTABLE, 0, 0},
+	{"ras_gfx.2.12", "gfx", AMDGPU_RAS_BLOCK__GFX_TCP_CACHE_RAM,
+		AMDGPU_RAS_ERROR__SINGLE_CORRECTABLE, 0, 0},
+	{"ras_gfx.2.13", "gfx", AMDGPU_RAS_BLOCK__GFX_TD_SS_FIFO_LO,
+		AMDGPU_RAS_ERROR__SINGLE_CORRECTABLE, 0, 0},
+	{"ras_gfx.2.14", "gfx", AMDGPU_RAS_BLOCK__GFX_EA_DRAMRD_CMDMEM,
+		AMDGPU_RAS_ERROR__SINGLE_CORRECTABLE, 0, 0},
+};
+
 static const struct ras_DID_test_mask ras_DID_array[] = {
 	{0x66a1, 0x00, RAS_BLOCK_MASK_ALL},
 	{0x66a1, 0x01, RAS_BLOCK_MASK_ALL},
 	{0x66a1, 0x04, RAS_BLOCK_MASK_ALL},
 };
 
+static uint32_t amdgpu_ras_find_block_id_by_name(const char *name)
+{
+	int i;
+
+	for (i = 0; i < ARRAY_SIZE(ras_block_string); i++) {
+		if (strcmp(name, ras_block_string[i]) == 0)
+			return i;
+	}
+
+	return ARRAY_SIZE(ras_block_string);
+}
+
+static char *amdgpu_ras_get_error_type_id(enum amdgpu_ras_error_type type)
+{
+	switch (type) {
+	case AMDGPU_RAS_ERROR__PARITY:
+		return "parity";
+	case AMDGPU_RAS_ERROR__SINGLE_CORRECTABLE:
+		return "single_correctable";
+	case AMDGPU_RAS_ERROR__MULTI_UNCORRECTABLE:
+		return "multi_uncorrectable";
+	case AMDGPU_RAS_ERROR__POISON:
+		return "poison";
+	case AMDGPU_RAS_ERROR__NONE:
+	default:
+		return NULL;
+	}
+}
+
 static struct ras_test_mask amdgpu_ras_get_test_mask(drmDevicePtr device)
 {
 	int i;
@@ -775,43 +841,36 @@ static void amdgpu_ras_enable_test(void)
 	}
 }
 
-static int amdgpu_ras_get_test_items(struct ras_test_item **pitems, int *size)
+static void __amdgpu_ras_ip_inject_test(const struct ras_inject_test_config *ip_test,
+					uint32_t size)
 {
-	*pitems = NULL;
-	*size = 0;
-
-	return 0;
-}
-
-static void __amdgpu_ras_inject_test(void)
-{
-	struct ras_test_item *items = NULL;
-	int i, size;
-	int ret;
+	int i, ret;
 	unsigned long old_ue, old_ce;
 	unsigned long ue, ce;
+	uint32_t block;
 	int timeout;
 	bool pass;
 
-	ret = amdgpu_ras_get_test_items(&items, &size);
-	CU_ASSERT_EQUAL(ret, 0);
-	if (ret)
-		goto mem_free;
-
-	printf("...\n");
 	for (i = 0; i < size; i++) {
 		timeout = 3;
 		pass = false;
 
-		ret = amdgpu_ras_query_err_count(items[i].block, &old_ue,
-						 &old_ce);
+		block = amdgpu_ras_find_block_id_by_name(ip_test[i].block);
+
+		/* Ensure one valid ip block */
+		if (block == ARRAY_SIZE(ras_block_string))
+			break;
+
+		ret = amdgpu_ras_query_err_count(block, &old_ue, &old_ce);
 		CU_ASSERT_EQUAL(ret, 0);
 		if (ret)
 			break;
 
-		ret = amdgpu_ras_inject(items[i].block, items[i].sub_block,
-					items[i].type, items[i].address,
-					items[i].value);
+		ret = amdgpu_ras_inject(block,
+					ip_test[i].sub_block,
+					ip_test[i].type,
+					ip_test[i].address,
+					ip_test[i].value);
 		CU_ASSERT_EQUAL(ret, 0);
 		if (ret)
 			break;
@@ -819,8 +878,7 @@ static void __amdgpu_ras_inject_test(void)
 		while (timeout > 0) {
 			sleep(5);
 
-			ret = amdgpu_ras_query_err_count(items[i].block, &ue,
-							 &ce);
+			ret = amdgpu_ras_query_err_count(block, &ue, &ce);
 			CU_ASSERT_EQUAL(ret, 0);
 			if (ret)
 				break;
@@ -832,16 +890,28 @@ static void __amdgpu_ras_inject_test(void)
 			}
 			timeout -= 1;
 		}
-		printf("\t Test %s@%s, address %ld, value %ld: %s\n",
-			items[i].name, items[i].error_type_str, items[i].address,
-			items[i].value,	pass ? "Pass" : "Fail");
+		printf("\t Test %s@block %s, subblock %d, error_type %s, address %ld, value %ld: %s\n",
+			ip_test[i].name,
+			ip_test[i].block,
+			ip_test[i].sub_block,
+			amdgpu_ras_get_error_type_id(ip_test[i].type),
+			ip_test[i].address,
+			ip_test[i].value,
+			pass ? "Pass" : "Fail");
 	}
+}
 
-mem_free:
-	if (items) {
-		free(items);
-		items = NULL;
-	}
+static void __amdgpu_ras_inject_test(void)
+{
+	printf("...\n");
+
+	/* run UMC ras inject test */
+	__amdgpu_ras_ip_inject_test(umc_ras_inject_test,
+		ARRAY_SIZE(umc_ras_inject_test));
+
+	/* run GFX ras inject test */
+	__amdgpu_ras_ip_inject_test(gfx_ras_inject_test,
+		ARRAY_SIZE(gfx_ras_inject_test));
 }
 
 static void amdgpu_ras_inject_test(void)
Signature · 6 lines
2.17.1

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

PATCH 4/4 amdgpu: add ras feature capability check in inject test

In reply to a message not in the archive

When running ras inject test, it's needed to be aligned with kernel's ras enablement.

Change-Id I7e69a1a3f6ab7a0053f67f7f1dd3fb9af64f478f
---
 tests/amdgpu/ras_tests.c | 4 ++++
 1 file changed, 4 insertions(+)
tests/amdgpu/ras_tests.c +4 -0
index d510b644..c1c543c1 100644
@@ -861,6 +861,10 @@ static void __amdgpu_ras_ip_inject_test(const struct ras_inject_test_config *ip_
 		if (block == ARRAY_SIZE(ras_block_string))
 			break;
 
+		/* Ensure RAS feature for the IP block is enabled by kernel */
+		if (amdgpu_ras_is_feature_supported(block) <= 0)
+			break;
+
 		ret = amdgpu_ras_query_err_count(block, &old_ue, &old_ce);
 		CU_ASSERT_EQUAL(ret, 0);
 		if (ret)
Signature · 6 lines
2.17.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#6 lore raw
In reply to a message not in the archive

Only skimmed over the patches, but in general looks good to me.

Feel free to add an Acked-by: Christian König <[email protected]> to the whole series.

But somebody with more ras knowledge than I have should probably take a look as well.

Christian.

Am 29.08.19 um 10:59 schrieb Guchun Chen:

Quoted 9 lines

These patches are to remove additional external lib-jsonc dependence, and to put all test configurations into C code.

Guchun Chen (4):
amdgpu: remove json package dependence
amdgpu: delete test configuration file
amdgpu: add ras inject unit test
amdgpu: add ras feature capability check in inject test

Quoted 9 lines
  configure.ac             |  18 ---
  data/amdgpu_ras.json     | 267 ----------------------------------
  meson.build              |   1 -
  tests/amdgpu/Makefile.am |   5 +-
  tests/amdgpu/meson.build |  16 +-
  tests/amdgpu/ras_tests.c | 305 ++++++++++++++-------------------------
  6 files changed, 116 insertions(+), 496 deletions(-)

delete mode 100644 data/amdgpu_ras.json

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

Reviewed-by Tao Zhou
#7 lore raw
In reply to a message not in the archive

The series is:

Quoted 27 lines

-----Original Message-----
From: Guchun Chen <[email protected]>
Sent: 2019年8月29日 16:59
To: [email protected]; Zhang, Hawking <[email protected]>; Li, Dennis <[email protected]>; Koenig, Christian <[email protected]>; Deucher, Alexander <[email protected]>; Zhou1, Tao <[email protected]>
Cc: Li, Candice <[email protected]>; Chen, Guchun <[email protected]>
Subject: [PATCH libdrm 0/4] amdgpu: new approach for ras inject test

These patches are to remove additional external lib-jsonc dependence, and to put all test configurations into C code.

Guchun Chen (4):
amdgpu: remove json package dependence
amdgpu: delete test configuration file
amdgpu: add ras inject unit test
amdgpu: add ras feature capability check in inject test

 configure.ac             |  18 ---
 data/amdgpu_ras.json     | 267 ----------------------------------
 meson.build              |   1 -
 tests/amdgpu/Makefile.am |   5 +-
 tests/amdgpu/meson.build |  16 +-
 tests/amdgpu/ras_tests.c | 305 ++++++++++++++-------------------------
 6 files changed, 116 insertions(+), 496 deletions(-)  delete mode 100644
Quoted 4 lines

data/amdgpu_ras.json

--
2.17.1

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