Merge changes from topic "jh/hikey960"
* changes:
hikey960: Fake only 1 core
hikey960: Enable SGI
hikey960: Enable MMU
Hikey960 port: initial commit
diff --git a/include/common/aarch64/asm_macros.S b/include/common/aarch64/asm_macros.S
index ad47290..5298ae0 100644
--- a/include/common/aarch64/asm_macros.S
+++ b/include/common/aarch64/asm_macros.S
@@ -61,20 +61,21 @@
*/
.macro vector_entry label
.section .vectors, "ax"
+ .cfi_sections .debug_frame
.align 7, 0
+ .type \label, %function
+ .cfi_startproc
\label:
.endm
/*
- * This macro verifies that the a given vector doesn't exceed the
- * architectural limit of 32 instructions. This is meant to be placed
- * immedately after the last instruction in the vector. It takes the
- * vector entry as the parameter
+ * Add the bytes until fill the full exception vector, whose size is always
+ * 32 instructions. If there are more than 32 instructions in the
+ * exception vector then an error is emitted.
*/
- .macro check_vector_size since
- .if (. - \since) > (32 * 4)
- .error "Vector exceeds 32 instructions"
- .endif
+ .macro end_vector_entry label
+ .cfi_endproc
+ .fill \label + (32 * 4) - .
.endm
/*
diff --git a/include/common/debug.h b/include/common/debug.h
index 216c53d..53eebf7 100644
--- a/include/common/debug.h
+++ b/include/common/debug.h
@@ -66,23 +66,13 @@
#endif
/*
- * For the moment this Panic function is very basic, Report an error and
+ * For the moment this panic function is very basic: report an error and
* spin. This can be expanded in the future to provide more information.
*/
-#if DEBUG
void __attribute__((__noreturn__)) do_panic(const char *file, int line);
#define panic() do_panic(__FILE__, __LINE__)
void __attribute__((__noreturn__)) do_bug_unreachable(const char *file, int line);
#define bug_unreachable() do_bug_unreachable(__FILE__, __LINE__)
-#else
-void __attribute__((__noreturn__)) do_panic(void);
-#define panic() do_panic()
-
-void __attribute__((__noreturn__)) do_bug_unreachable(void);
-#define bug_unreachable() do_bug_unreachable()
-
-#endif
-
#endif /* __DEBUG_H__ */
diff --git a/lib/aarch64/exception_stubs.S b/lib/aarch64/exception_stubs.S
index 0508fe5..d418451 100644
--- a/lib/aarch64/exception_stubs.S
+++ b/lib/aarch64/exception_stubs.S
@@ -6,41 +6,32 @@
#include <asm_macros.S>
+ .global exception_stubs
+
/*
* Simplistic exceptions vector table.
* All entries spin, which means all types of exceptions are unrecoverable.
*/
- .global exception_stubs
+ .macro vector_entry_spin name
+ vector_entry \name
+ b \name
+ end_vector_entry \name
+ .endm
+
vector_base exception_stubs
-vector_entry SynchronousExceptionSP0
- b .
-vector_entry IrqSP0
- b .
-vector_entry FiqSP0
- b .
-vector_entry SErrorSP0
- b .
-vector_entry SynchronousExceptionSPx
- b .
-vector_entry IrqSPx
- b .
-vector_entry FiqSPx
- b .
-vector_entry SErrorSPx
- b .
-vector_entry SynchronousExceptionA64
- b .
-vector_entry IrqA64
- b .
-vector_entry FiqA64
- b .
-vector_entry SErrorA64
- b .
-vector_entry SynchronousExceptionA32
- b .
-vector_entry IrqA32
- b .
-vector_entry FiqA32
- b .
-vector_entry SErrorA32
- b .
+vector_entry_spin SynchronousExceptionSP0
+vector_entry_spin IrqSP0
+vector_entry_spin FiqSP0
+vector_entry_spin SErrorSP0
+vector_entry_spin SynchronousExceptionSPx
+vector_entry_spin IrqSPx
+vector_entry_spin FiqSPx
+vector_entry_spin SErrorSPx
+vector_entry_spin SynchronousExceptionA64
+vector_entry_spin IrqA64
+vector_entry_spin FiqA64
+vector_entry_spin SErrorA64
+vector_entry_spin SynchronousExceptionA32
+vector_entry_spin IrqA32
+vector_entry_spin FiqA32
+vector_entry_spin SErrorA32
diff --git a/lib/stdlib/assert.c b/lib/stdlib/assert.c
index 39f30d1..4b53d1e 100644
--- a/lib/stdlib/assert.c
+++ b/lib/stdlib/assert.c
@@ -4,7 +4,7 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <debug.h>
+#include <stdio.h>
/*
* This is a basic implementation. This could be improved.
@@ -12,6 +12,8 @@
void __assert (const char *function, const char *file, unsigned int line,
const char *assertion)
{
- mp_printf("ASSERT: %s <%d> : %s\n", function, line, assertion);
- while (1);
+ printf("ASSERT: %s <%d> : %s\n", function, line, assertion);
+
+ while (1)
+ ;
}
diff --git a/tftf/framework/aarch64/exceptions.S b/tftf/framework/aarch64/exceptions.S
index 08bef46..6014b12 100644
--- a/tftf/framework/aarch64/exceptions.S
+++ b/tftf/framework/aarch64/exceptions.S
@@ -9,95 +9,88 @@
.globl tftf_vector
vector_base tftf_vector
- //-----------------------------------------------------
- // Current EL with SP0 : 0x0 - 0x180
- //-----------------------------------------------------
+
+ /*
+ * Current EL with SP0 : 0x0 - 0x200.
+ */
vector_entry SynchronousExceptionSP0
b SynchronousExceptionSP0
- check_vector_size SynchronousExceptionSP0
+end_vector_entry SynchronousExceptionSP0
vector_entry IrqSP0
b IrqSP0
- check_vector_size IrqSP0
+end_vector_entry IrqSP0
vector_entry FiqSP0
b FiqSP0
- check_vector_size FiqSP0
+end_vector_entry FiqSP0
vector_entry SErrorSP0
b SErrorSP0
- check_vector_size SErrorSP0
+end_vector_entry SErrorSP0
- //-----------------------------------------------------
- // Current EL with SPx: 0x200 - 0x380
- //-----------------------------------------------------
+ /*
+ * Current EL with SPx : 0x200 - 0x400.
+ */
vector_entry SynchronousExceptionSPx
b SynchronousExceptionSPx
- check_vector_size SynchronousExceptionSPx
+end_vector_entry SynchronousExceptionSPx
vector_entry IrqSPx
- /*
- * TODO: Investigate whether the Trusted Firmware-A code for context
- * save/restore could be reused
- */
- stp x29, x30, [sp, #-0x10]!
- bl save_regs
- bl tftf_irq_handler_dispatcher
- bl restore_regs
- ldp x29, x30, [sp], #0x10
- eret
- check_vector_size IrqSPx
+ b irq_vector_entry
+end_vector_entry IrqSPx
vector_entry FiqSPx
b FiqSPx
- check_vector_size FiqSPx
+end_vector_entry FiqSPx
vector_entry SErrorSPx
b SErrorSPx
- check_vector_size SErrorSPx
+end_vector_entry SErrorSPx
- //-----------------------------------------------------
- // Lower EL using AArch64 : 0x400 - 0x580
- //-----------------------------------------------------
+ /*
+ * Lower EL using AArch64 : 0x400 - 0x600.
+ */
vector_entry SynchronousExceptionA64
b SynchronousExceptionA64
- check_vector_size SynchronousExceptionA64
+end_vector_entry SynchronousExceptionA64
vector_entry IrqA64
b IrqA64
- check_vector_size IrqA64
+end_vector_entry IrqA64
vector_entry FiqA64
b FiqA64
- check_vector_size FiqA64
+end_vector_entry FiqA64
vector_entry SErrorA64
b SErrorA64
- check_vector_size SErrorA64
+end_vector_entry SErrorA64
- //-----------------------------------------------------
- // Lower EL using AArch32 : 0x0 - 0x180
- //-----------------------------------------------------
+ /*
+ * Lower EL using AArch32 : 0x600 - 0x800.
+ */
vector_entry SynchronousExceptionA32
b SynchronousExceptionA32
- check_vector_size SynchronousExceptionA32
+end_vector_entry SynchronousExceptionA32
vector_entry IrqA32
b IrqA32
- check_vector_size IrqA32
+end_vector_entry IrqA32
vector_entry FiqA32
b FiqA32
- check_vector_size FiqA32
+end_vector_entry FiqA32
vector_entry SErrorA32
b SErrorA32
- check_vector_size SErrorA32
+end_vector_entry SErrorA32
-
-// Note: Exceptions will always be from the same EL, so no need to save spsr
-func save_regs
- sub sp, sp, #0x100
+/*
+ * Exceptions will always be from the same exception level so no need to save
+ * and restore SPSR.
+ */
+.macro save_gp_regs
stp x0, x1, [sp, #0x0]
stp x2, x3, [sp, #0x10]
stp x4, x5, [sp, #0x20]
@@ -112,18 +105,15 @@
stp x22, x23, [sp, #0xb0]
stp x24, x25, [sp, #0xc0]
stp x26, x27, [sp, #0xd0]
+ stp x28, x29, [sp, #0xe0]
mrs x0, sp_el0
- stp x28, x0, [sp, #0xe0]
- str x0, [sp, #0xf0]
- ret
-endfunc save_regs
+ stp x30, x0, [sp, #0xf0]
+.endm
-
-// Note: Exceptions will always be from the same EL, so no need to restore spsr
-func restore_regs
- ldr x9, [sp, #0xf0]
- ldp x28, x9, [sp, #0xe0]
- msr sp_el0, x9
+.macro restore_gp_regs
+ ldp x30, x0, [sp, #0xf0]
+ msr sp_el0, x0
+ ldp x28, x29, [sp, #0xe0]
ldp x26, x27, [sp, #0xd0]
ldp x24, x25, [sp, #0xc0]
ldp x22, x23, [sp, #0xb0]
@@ -138,6 +128,13 @@
ldp x4, x5, [sp, #0x20]
ldp x2, x3, [sp, #0x10]
ldp x0, x1, [sp, #0x0]
+.endm
+
+func irq_vector_entry
+ sub sp, sp, #0x100
+ save_gp_regs
+ bl tftf_irq_handler_dispatcher
+ restore_gp_regs
add sp, sp, #0x100
- ret
-endfunc restore_regs
+ eret
+endfunc irq_vector_entry
diff --git a/tftf/framework/debug.c b/tftf/framework/debug.c
index 4b4364d..0927ed4 100644
--- a/tftf/framework/debug.c
+++ b/tftf/framework/debug.c
@@ -7,7 +7,6 @@
#include <console.h>
#include <debug.h>
-#if DEBUG
void __attribute__((__noreturn__)) do_panic(const char *file, int line)
{
printf("PANIC in file: %s line: %d\n", file, line);
@@ -23,21 +22,3 @@
mp_printf("BUG: Unreachable code!\n");
do_panic(file, line);
}
-
-#else
-void __attribute__((__noreturn__)) do_panic(void)
-{
- printf("PANIC\n");
-
- console_flush();
-
- while (1)
- continue;
-}
-
-void __attribute__((__noreturn__)) do_bug_unreachable(void)
-{
- mp_printf("BUG: Unreachable code!\n");
- do_panic();
-}
-#endif
diff --git a/tftf/tests/tests-psci-extensive.xml b/tftf/tests/tests-psci-extensive.xml
index a2c05b2..031bbc7 100644
--- a/tftf/tests/tests-psci-extensive.xml
+++ b/tftf/tests/tests-psci-extensive.xml
@@ -11,9 +11,7 @@
<testsuite name="PSCI CPU ON OFF Stress Tests" description="Stress-test hotplug">
<testcase name="Repeated shutdown of all cores to stress test CPU_ON, CPU_SUSPEND and CPU_OFF"
function="psci_on_off_suspend_coherency_test" />
- <!-- testcase name="Verify PSCI CPU ON race" function="psci_verify_cpu_on_race" / -->
<testcase name="PSCI CPU ON OFF stress test" function="psci_cpu_on_off_stress" />
- <testcase name="PSCI CPU ON OFF SUSPEND stress test" function="psci_cpu_on_off_suspend_stress" />
<testcase name="Repeated hotplug of all cores to stress test CPU_ON and CPU_OFF"
function="psci_hotplug_stress_test" />
<testcase name="Random hotplug cores in a large iteration to stress boot path code"
@@ -22,8 +20,4 @@
function="psci_cluster_hotplug_stress_test" />
</testsuite>
- <testsuite name="PSCI SYSTEM SUSPEND stress tests" description="Stress-test SYSTEM SUSPEND">
- <testcase name="Stress test PSCI_SYSTEM_SUSPEND" function="psci_sys_susp_on_off_stress_test" />
- </testsuite>
-
</testsuites>
diff --git a/tftf/tests/tests-unstable.mk b/tftf/tests/tests-unstable.mk
new file mode 100644
index 0000000..5097ffb
--- /dev/null
+++ b/tftf/tests/tests-unstable.mk
@@ -0,0 +1,10 @@
+#
+# Copyright (c) 2019, Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+
+TESTS_SOURCES += $(addprefix tftf/tests/, \
+ runtime_services/standard_service/psci/system_tests/test_psci_on_off_suspend_stress.c \
+ runtime_services/standard_service/psci/system_tests/test_psci_system_suspend_stress.c \
+)
diff --git a/tftf/tests/tests-unstable.xml b/tftf/tests/tests-unstable.xml
new file mode 100644
index 0000000..fb15de3
--- /dev/null
+++ b/tftf/tests/tests-unstable.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!--
+ Copyright (c) 2019, Arm Limited. All rights reserved.
+
+ SPDX-License-Identifier: BSD-3-Clause
+-->
+
+<testsuites>
+
+ <testsuite name="Unstable PSCI tests" description="Need to be fixed">
+ <testcase name="PSCI CPU ON OFF SUSPEND stress test" function="psci_cpu_on_off_suspend_stress" />
+ <testcase name="Verify PSCI CPU ON race" function="psci_verify_cpu_on_race" />
+ </testsuite>
+
+ <testsuite name="Unstable PSCI SYSTEM SUSPEND stress tests" description="Need to be fixed">
+ <testcase name="Stress test PSCI_SYSTEM_SUSPEND" function="psci_sys_susp_on_off_stress_test" />
+ </testsuite>
+
+</testsuites>