diff options
author | Manish Pandey <manish.pandey2@arm.com> | 2023-06-16 10:33:55 +0200 |
---|---|---|
committer | TrustedFirmware Code Review <review@review.trustedfirmware.org> | 2023-06-16 10:33:55 +0200 |
commit | 35d5fe4ad5242d69d8911b57a842a77ec69f0dfa (patch) | |
tree | 46d470e8b6adf18465b291e16d9e2b0c38459784 | |
parent | b5a2b1386ab6eab08a759b9ef21e9ffe686fe7dc (diff) | |
parent | e62b67b7d9fb2b97d4a03b83584c1c39aa162b27 (diff) |
Merge "feat(ras): introduce RAS KFH support test"
-rw-r--r-- | tftf/tests/misc_tests/test_ras_kfh.c | 52 | ||||
-rw-r--r-- | tftf/tests/tests-ras-kfh.mk | 10 | ||||
-rw-r--r-- | tftf/tests/tests-ras-kfh.xml | 13 |
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> |