Merge changes I5af96887,Ia4f546a0,I90b2b748,I958595b9,I6c01b187
* changes:
fix(ls64): match types when printing
fix(sme): update smcr_el2 after hcr_el2 has taken effect
perf(tftf): reduce the IRQ validation wait
perf(tftf): don't use waitms() for events testing
chore(commitlint): tell editors commit line lengths are 72 characters
diff --git a/.editorconfig b/.editorconfig
index 081365e..de8905d 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2017-2020, Arm Limited and Contributors. All rights reserved.
+# Copyright (c) 2017-2025, Arm Limited and Contributors. All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause
#
@@ -70,3 +70,6 @@
# [PEP8] Maximum Line Length
# "Limit all lines to a maximum of 79 characters."
max_line_length = 79
+
+[.git/COMMIT_EDITMSG]
+max_line_length = 72
diff --git a/lib/power_management/suspend/aarch64/asm_tftf_suspend.S b/lib/power_management/suspend/aarch64/asm_tftf_suspend.S
index 770a1bd..83df3fb 100644
--- a/lib/power_management/suspend/aarch64/asm_tftf_suspend.S
+++ b/lib/power_management/suspend/aarch64/asm_tftf_suspend.S
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018-2024, Arm Limited. All rights reserved.
+ * Copyright (c) 2018-2025, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@@ -125,11 +125,13 @@
ldp x1, x2, [x0, #SUSPEND_CTX_MAIR_OFFSET]
ldp x3, x4, [x0, #SUSPEND_CTX_TTBR0_OFFSET]
ldp x5, x6, [x0, #SUSPEND_CTX_VBAR_OFFSET]
+ ldr x7, [x0, #SUSPEND_CTX_HCR_OFFSET]
msr mair_el2, x1
msr cptr_el2, x2
msr ttbr0_el2, x3
msr tcr_el2, x4
msr vbar_el2, x5
+ msr hcr_el2, x7
/* make sure whatever just got turned on is in effect */
isb
@@ -138,13 +140,9 @@
*/
mrs x2, id_aa64pfr1_el1
tst x2, #(1 << 25)
- bne 3f
- ldr x1, [x0, #SUSPEND_CTX_HCR_OFFSET]
- msr hcr_el2, x1
- b 4f
+ beq 4f
-3: ldp x1, x2, [x0, #SUSPEND_CTX_HCR_OFFSET]
- msr hcr_el2, x1
+ ldr x2, [x0, #SUSPEND_CTX_SMCR_OFFSET]
msr SMCR_EL2, x2
/*
diff --git a/lib/power_management/suspend/suspend_private.h b/lib/power_management/suspend/suspend_private.h
index debd84f..c91153d 100644
--- a/lib/power_management/suspend/suspend_private.h
+++ b/lib/power_management/suspend/suspend_private.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018-2024, Arm Limited. All rights reserved.
+ * Copyright (c) 2018-2025, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@@ -25,6 +25,7 @@
#define SUSPEND_CTX_TTBR0_OFFSET 16
#define SUSPEND_CTX_VBAR_OFFSET 32
#define SUSPEND_CTX_HCR_OFFSET 48
+#define SUSPEND_CTX_SMCR_OFFSET 56
#define SUSPEND_CTX_APIAKEY_OFFSET 64
#define SUSPEND_CTX_SP_OFFSET (8 * NR_CTX_REGS)
diff --git a/tftf/tests/extensions/ls64/test_ls64.c b/tftf/tests/extensions/ls64/test_ls64.c
index 1f2fad7..9b2a203 100644
--- a/tftf/tests/extensions/ls64/test_ls64.c
+++ b/tftf/tests/extensions/ls64/test_ls64.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2024, Arm Limited. All rights reserved.
+ * Copyright (c) 2024-2025, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@@ -54,8 +54,8 @@
ls64_load(store_address, ls64_output_buffer);
for (uint8_t i = 0U; i < LS64_ARRAYSIZE; i++) {
- VERBOSE("Input Buffer[%lld]=%lld\n", i, ls64_input_buffer[i]);
- VERBOSE("Output Buffer[%lld]=%lld\n", i, ls64_output_buffer[i]);
+ VERBOSE("Input Buffer[%d]=%lld\n", i, ls64_input_buffer[i]);
+ VERBOSE("Output Buffer[%d]=%lld\n", i, ls64_output_buffer[i]);
if (ls64_input_buffer[i] != ls64_output_buffer[i]) {
return TEST_RESULT_FAIL;
diff --git a/tftf/tests/framework_validation_tests/test_validation_events.c b/tftf/tests/framework_validation_tests/test_validation_events.c
index e229b17..172c409 100644
--- a/tftf/tests/framework_validation_tests/test_validation_events.c
+++ b/tftf/tests/framework_validation_tests/test_validation_events.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, Arm Limited. All rights reserved.
+ * Copyright (c) 2018-2025, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@@ -17,6 +17,8 @@
static event_t cpu_has_entered_test[PLATFORM_CORE_COUNT];
static event_t test_is_finished;
+volatile bool last_event_ready;
+
static test_result_t non_lead_cpu_fn(void)
{
unsigned int mpid = read_mpidr_el1() & MPID_MASK;
@@ -29,10 +31,10 @@
/*
* Wait for lead CPU's signal before exiting the test.
- * Introduce a delay so that the lead CPU will send the event before the
- * non-lead CPUs wait for it.
+ * Wait for the lead CPU to send the event before the non-lead CPUs wait
+ * for it.
*/
- waitms(500);
+ while (!last_event_ready);
tftf_wait_for_event(&test_is_finished);
return TEST_RESULT_SUCCESS;
@@ -43,7 +45,7 @@
*
* This test exercises the events API.
* - It creates a sequence of events sending and receiving. The order of
- * operations is ensured by inserting delays at strategic points.
+ * operations is ensured by synchronizing at strategic points.
* - It tests the communication in both directions (i.e. from CPUx to CPUy and
* vice versa).
* - It tests that it doesn't matter whether CPUx waits for the event first
@@ -64,6 +66,9 @@
unsigned int cpus_count;
int psci_ret;
+ /* initialise as not ready */
+ last_event_ready = false;
+
lead_cpu = read_mpidr_el1() & MPID_MASK;
/*
@@ -104,19 +109,19 @@
}
/*
- * Introduce a delay so that the non-lead CPUs will wait for this event
- * before the lead CPU sends it.
+ * Send the event to half of the CPUs. Some should already be waiting,
+ * as they signalled entering the test.
*/
- waitms(500);
- /* Send the event to half of the CPUs */
cpus_count = PLATFORM_CORE_COUNT / 2;
tftf_send_event_to(&lead_cpu_event, cpus_count);
- waitms(500);
/* Send the event to the other half of the CPUs */
tftf_send_event_to(&lead_cpu_event, PLATFORM_CORE_COUNT - cpus_count);
/* Signal termination of the test to all CPUs */
tftf_send_event_to_all(&test_is_finished);
+ /* Signal the last event has been sent so secondaries can wait() */
+ last_event_ready = true;
+
return TEST_RESULT_SUCCESS;
}
diff --git a/tftf/tests/framework_validation_tests/test_validation_irq.c b/tftf/tests/framework_validation_tests/test_validation_irq.c
index 67f5c29..fb4645c 100644
--- a/tftf/tests/framework_validation_tests/test_validation_irq.c
+++ b/tftf/tests/framework_validation_tests/test_validation_irq.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, Arm Limited. All rights reserved.
+ * Copyright (c) 2018-2025, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@@ -102,7 +102,7 @@
* Wait for some time so that SGI interrupts the processor, Normally it
* takes a small but finite time for the IRQ to be sent to processor
*/
- waitms(500);
+ waitms(100);
if (counter != 2) {
tftf_testcase_printf(