summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorManish Pandey <manish.pandey2@arm.com>2023-02-27 15:21:26 +0000
committerManish Pandey <manish.pandey2@arm.com>2023-06-15 09:10:29 +0100
commite62b67b7d9fb2b97d4a03b83584c1c39aa162b27 (patch)
treefb24fc1edd46fefff023ad7cba875e8a58104362
parent2b47c60206a6d33784c334956d5e6e72432fcc8f (diff)
feat(ras): introduce RAS KFH support test
Introduce a test to verify Kernel first handling of RAS errors. Error is injected and handled in tftf, there is no EL3 involvement. Signed-off-by: Manish Pandey <manish.pandey2@arm.com> Change-Id: Iaf93247647bf8b749cba5ea42fd819dee675b04b
-rw-r--r--tftf/tests/misc_tests/test_ras_kfh.c52
-rw-r--r--tftf/tests/tests-ras-kfh.mk10
-rw-r--r--tftf/tests/tests-ras-kfh.xml13
3 files changed, 75 insertions, 0 deletions
diff --git a/tftf/tests/misc_tests/test_ras_kfh.c b/tftf/tests/misc_tests/test_ras_kfh.c
new file mode 100644
index 0000000..b38d6c4
--- /dev/null
+++ b/tftf/tests/misc_tests/test_ras_kfh.c
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2023, Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+
+#include <arch_helpers.h>
+#include <serror.h>
+#include <tftf_lib.h>
+
+#ifdef __aarch64__
+static volatile uint64_t serror_triggered;
+extern void inject_unrecoverable_ras_error(void);
+
+static bool serror_handler(void)
+{
+ serror_triggered = 1;
+ return true;
+}
+
+/*
+ * Test Kernel First handling paradigm of RAS errors.
+ *
+ * Register a custom serror handler in tftf, inject a RAS error and wait
+ * for finite time to ensure that SError triggered and handled.
+ */
+test_result_t test_ras_kfh(void)
+{
+ register_custom_serror_handler(serror_handler);
+ inject_unrecoverable_ras_error();
+
+ /* Give reasonable time for SError to be triggered/handled */
+ waitms(500);
+
+ unregister_custom_serror_handler();
+
+ if (serror_triggered == false) {
+ tftf_testcase_printf("SError is not triggered\n");
+ return TEST_RESULT_FAIL;
+ }
+
+ return TEST_RESULT_SUCCESS;
+}
+#else
+test_result_t test_ras_kfh(void)
+{
+ tftf_testcase_printf("Not supported on AArch32.\n");
+ return TEST_RESULT_SKIPPED;
+}
+
+#endif
diff --git a/tftf/tests/tests-ras-kfh.mk b/tftf/tests/tests-ras-kfh.mk
new file mode 100644
index 0000000..e79db93
--- /dev/null
+++ b/tftf/tests/tests-ras-kfh.mk
@@ -0,0 +1,10 @@
+#
+# Copyright (c) 2023, Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+
+TESTS_SOURCES += $(addprefix tftf/tests/misc_tests/, \
+ inject_ras_error.S \
+ test_ras_kfh.c \
+)
diff --git a/tftf/tests/tests-ras-kfh.xml b/tftf/tests/tests-ras-kfh.xml
new file mode 100644
index 0000000..3cfed49
--- /dev/null
+++ b/tftf/tests/tests-ras-kfh.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!--
+ Copyright (c) 2023, Arm Limited. All rights reserved.
+
+ SPDX-License-Identifier: BSD-3-Clause
+-->
+
+<testsuites>
+ <testsuite name="RAS KFH" description="RAS errors handled through Kernel First handling">
+ <testcase name="Inject RAS error and wait for it being handled" function="test_ras_kfh" />
+ </testsuite>
+</testsuites>