Make GICv2 spurious interrupt test platform-agnostic
This test was pinned to Juno and was not included for other
platforms. In reality, it only relies on a GICv2 to be present but
does nothing specific to Juno beyond that.
Instead, we now dynamically detect the GIC version inside the test
function and skip it if it is not GICv2. The test is now part of the
generic TSP testsuite.
With the test being available to all platforms, the Juno tests XML
file is now empty, as it only contained this one test. Therefore, we
remove it.
Change-Id: I8b8f0eac905cfff8a87a2305cb2abf4bb9353ef1
Signed-off-by: Sandrine Bailleux <sandrine.bailleux@arm.com>
diff --git a/plat/arm/board/juno/platform.mk b/plat/arm/board/juno/platform.mk
index 97172b5..f75ac43 100644
--- a/plat/arm/board/juno/platform.mk
+++ b/plat/arm/board/juno/platform.mk
@@ -18,8 +18,6 @@
plat/arm/board/juno/juno_mem_prot.c \
plat/arm/board/juno/plat_setup.c
-TESTS_SOURCES += tftf/tests/runtime_services/trusted_os/tsp/test_irq_spurious_gicv2.c
-
# Some tests are not supported on Juno AArch32.
ifeq (${ARCH},aarch32)
PLAT_TESTS_SKIP_LIST := plat/arm/board/juno/juno32_tests_to_skip.txt
diff --git a/plat/arm/board/juno/tests.xml b/plat/arm/board/juno/tests.xml
deleted file mode 100644
index 8e679c3..0000000
--- a/plat/arm/board/juno/tests.xml
+++ /dev/null
@@ -1,40 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-
-<!--
- Copyright (c) 2018, Arm Limited. All rights reserved.
-
- SPDX-License-Identifier: BSD-3-Clause
--->
-
-<!-- External references to all individual tests files. -->
-<!DOCTYPE testsuites [
- <!ENTITY tests-tftf-validation SYSTEM "../../../../tftf/tests/tests-tftf-validation.xml">
- <!ENTITY tests-boot-req SYSTEM "../../../../tftf/tests/tests-boot-req.xml">
- <!ENTITY tests-psci SYSTEM "../../../../tftf/tests/tests-psci.xml">
- <!ENTITY tests-sdei SYSTEM "../../../../tftf/tests/tests-sdei.xml">
- <!ENTITY tests-rt-instr SYSTEM "../../../../tftf/tests/tests-runtime-instrumentation.xml">
- <!ENTITY tests-tsp SYSTEM "../../../../tftf/tests/tests-tsp.xml">
- <!ENTITY tests-el3-pstate SYSTEM "../../../../tftf/tests/tests-el3-power-state.xml">
- <!ENTITY tests-state-switch SYSTEM "../../../../tftf/tests/tests-arm-state-switch.xml">
- <!ENTITY tests-cpu-extensions SYSTEM "../../../../tftf/tests/tests-cpu-extensions.xml">
- <!ENTITY tests-performance SYSTEM "../../../../tftf/tests/tests-performance.xml">
-]>
-
-<testsuites>
-
- &tests-tftf-validation;
- &tests-boot-req;
- &tests-psci;
- &tests-sdei;
- &tests-rt-instr;
- &tests-tsp;
- &tests-el3-pstate;
- &tests-state-switch;
- &tests-cpu-extensions;
- &tests-performance;
-
- <testsuite name="Juno - IRQ support in TSP" description="Test the normal IRQ preemption support in TSP.">
- <testcase name="Juno - Multicore spurious interrupt test" function="test_juno_multicore_spurious_interrupt" />
- </testsuite>
-
-</testsuites>
diff --git a/tftf/tests/runtime_services/trusted_os/tsp/test_irq_spurious_gicv2.c b/tftf/tests/runtime_services/trusted_os/tsp/test_irq_spurious_gicv2.c
index fd6a14a..7674840 100644
--- a/tftf/tests/runtime_services/trusted_os/tsp/test_irq_spurious_gicv2.c
+++ b/tftf/tests/runtime_services/trusted_os/tsp/test_irq_spurious_gicv2.c
@@ -8,6 +8,7 @@
#include <arm_gic.h>
#include <debug.h>
#include <events.h>
+#include <gic_common.h>
#include <gic_v2.h>
#include <irq.h>
#include <plat_topology.h>
@@ -53,8 +54,8 @@
return 0;
}
-/* Helper function for test_juno_multicore_spurious_interrupt. */
-static test_result_t test_juno_multicore_spurious_interrupt_non_lead_fn(void)
+/* Helper function for test_multicore_spurious_interrupt. */
+static test_result_t test_multicore_spurious_interrupt_non_lead_fn(void)
{
test_result_t result = TEST_RESULT_SUCCESS;
u_register_t mpid = read_mpidr_el1() & MPID_MASK;
@@ -134,7 +135,7 @@
*
* Returns SUCCESS if all steps succeed, else failure.
*/
-test_result_t test_juno_multicore_spurious_interrupt(void)
+test_result_t test_multicore_spurious_interrupt(void)
{
int i, j;
u_register_t cpu_mpid;
@@ -148,6 +149,11 @@
SKIP_TEST_IF_TSP_NOT_PRESENT();
+ if (is_gicv3_mode()) {
+ tftf_testcase_printf("Detected GICv3. Need GICv2.\n");
+ return TEST_RESULT_SKIPPED;
+ }
+
ret = tftf_irq_register_handler(GIC_SPURIOUS_INTERRUPT,
test_spurious_handler);
if (ret != 0) {
@@ -178,7 +184,7 @@
continue;
psci_ret = tftf_cpu_on(cpu_mpid,
- (uintptr_t)test_juno_multicore_spurious_interrupt_non_lead_fn, 0);
+ (uintptr_t)test_multicore_spurious_interrupt_non_lead_fn, 0);
if (psci_ret != PSCI_E_SUCCESS) {
tftf_testcase_printf(
"Failed to power on CPU 0x%x (%d)\n",
diff --git a/tftf/tests/tests-tsp.xml b/tftf/tests/tests-tsp.xml
index e98df5f..7e1018e 100644
--- a/tftf/tests/tests-tsp.xml
+++ b/tftf/tests/tests-tsp.xml
@@ -21,6 +21,7 @@
<testcase name="Resume STD SMC from different CPUs" function="test_resume_different_cpu_preempted_std_smc" />
<testcase name="Resume preempted STD SMC after PSCI CPU OFF/ON cycle" function="test_psci_cpu_on_off_preempted_std_smc" />
<testcase name="Resume preempted STD SMC after PSCI SYSTEM SUSPEND" function="test_psci_system_suspend_preempted_std_smc" />
+ <testcase name="Multicore spurious interrupt test" function="test_multicore_spurious_interrupt" />
</testsuite>
<testsuite name="TSP handler standard functions result test" description="Validate TSP SMC standard function call">
diff --git a/tftf/tests/tests.mk b/tftf/tests/tests.mk
index 8ee8cc2..f3b7ab0 100644
--- a/tftf/tests/tests.mk
+++ b/tftf/tests/tests.mk
@@ -71,6 +71,7 @@
runtime_services/standard_service/sdei/system_tests/test_sdei.c \
runtime_services/standard_service/sdei/system_tests/test_sdei_state.c \
runtime_services/trusted_os/tsp/test_irq_preempted_std_smc.c \
+ runtime_services/trusted_os/tsp/test_irq_spurious_gicv2.c \
runtime_services/trusted_os/tsp/test_normal_int_switch.c \
runtime_services/trusted_os/tsp/test_smc_tsp_std_fn_call.c \
runtime_services/trusted_os/tsp/test_tsp_fast_smc.c \