Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions test_pool/power_wakeup/u001.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/** @file
* Copyright (c) 2016-2019, 2021-2025, Arm Limited or its affiliates. All rights reserved.
* Copyright (c) 2016-2019, 2021-2026, Arm Limited or its affiliates. All rights reserved.
* SPDX-License-Identifier : Apache-2.0

* Licensed under the Apache License, Version 2.0 (the "License");
Expand Down Expand Up @@ -48,8 +48,9 @@ payload1()
{
uint32_t intid;
uint32_t index = val_pe_get_index_mpid(val_pe_get_mpid());
uint64_t delay_loop = val_get_counter_frequency() * g_wakeup_timeout;
uint64_t timer_expire_val = val_get_counter_frequency() * g_wakeup_timeout;
uint32_t delay_loop = MAX_SPIN_LOOPS;
uint32_t timer_expire_val =
(uint32_t)((uint64_t)val_get_safe_timeout_ticks() * g_wakeup_timeout);

intid = val_timer_get_info(TIMER_INFO_PHY_EL1_INTID, 0);
if (val_gic_install_isr(intid, isr1)) {
Expand All @@ -63,6 +64,10 @@ payload1()

/* Add a delay loop after WFI called in case PE needs some time to enter WFI state
* exit if test int comes
*
* This delay loop is a bounded spin wait used only to wait for the
* interrupt to arrive. It is not time-based and does not represent
* system counter ticks.
*/
while (delay_loop && (g_el1phy_int_received == 0)) {
delay_loop--;
Expand Down
13 changes: 9 additions & 4 deletions test_pool/power_wakeup/u002.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/** @file
* Copyright (c) 2016-2019, 2021-2025, Arm Limited or its affiliates. All rights reserved.
* Copyright (c) 2016-2019, 2021-2026, Arm Limited or its affiliates. All rights reserved.
* SPDX-License-Identifier : Apache-2.0

* Licensed under the Apache License, Version 2.0 (the "License");
Expand Down Expand Up @@ -48,7 +48,8 @@ void
wakeup_set_failsafe()
{
uint32_t intid;
uint64_t timer_expire_val = val_get_counter_frequency() * (g_wakeup_timeout + 1);
uint32_t timer_expire_val =
(uint32_t)((uint64_t)val_get_safe_timeout_ticks() * (g_wakeup_timeout + 1));
intid = val_timer_get_info(TIMER_INFO_PHY_EL1_INTID, 0);
val_gic_install_isr(intid, isr_failsafe);
val_timer_set_phy_el1(timer_expire_val);
Expand Down Expand Up @@ -83,8 +84,8 @@ payload2()
{
uint32_t intid;
uint32_t index = val_pe_get_index_mpid(val_pe_get_mpid());
uint64_t delay_loop = val_get_counter_frequency() * g_wakeup_timeout;
uint64_t timer_expire_val = val_get_counter_frequency() * g_wakeup_timeout;
uint32_t delay_loop = MAX_SPIN_LOOPS;
uint32_t timer_expire_val = (uint32_t)((uint64_t)val_get_safe_timeout_ticks() * g_wakeup_timeout);

intid = val_timer_get_info(TIMER_INFO_VIR_EL1_INTID, 0);
if (val_gic_install_isr(intid, isr2)) {
Expand All @@ -101,6 +102,10 @@ payload2()

/* Add a delay loop after WFI called in case PE needs some time to enter WFI state
* exit in case test or failsafe int is received
*
* This delay loop is a bounded spin wait used only to wait for the
* interrupt to arrive. It is not time-based and does not represent
* system counter ticks.
*/
while (delay_loop && (g_el1vir_int_received == 0) && (g_failsafe_int_rcvd == 0)) {
delay_loop--;
Expand Down
13 changes: 9 additions & 4 deletions test_pool/power_wakeup/u003.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/** @file
* Copyright (c) 2016-2019, 2021-2025, Arm Limited or its affiliates. All rights reserved.
* Copyright (c) 2016-2019, 2021-2026, Arm Limited or its affiliates. All rights reserved.
* SPDX-License-Identifier : Apache-2.0

* Licensed under the Apache License, Version 2.0 (the "License");
Expand Down Expand Up @@ -64,7 +64,8 @@ void
wakeup_set_failsafe()
{
uint32_t intid;
uint64_t timer_expire_val = val_get_counter_frequency() * (g_wakeup_timeout + 1);
uint32_t timer_expire_val =
(uint32_t)((uint64_t)val_get_safe_timeout_ticks() * (g_wakeup_timeout + 1));

intid = val_timer_get_info(TIMER_INFO_PHY_EL1_INTID, 0);
val_gic_install_isr(intid, isr_failsafe);
Expand All @@ -84,8 +85,8 @@ payload3()
{
uint32_t intid;
uint32_t index = val_pe_get_index_mpid(val_pe_get_mpid());
uint64_t delay_loop = val_get_counter_frequency() * g_wakeup_timeout;
uint64_t timer_expire_val = val_get_counter_frequency() * g_wakeup_timeout;
uint32_t delay_loop = MAX_SPIN_LOOPS;
uint32_t timer_expire_val = (uint32_t)((uint64_t)val_get_safe_timeout_ticks() * g_wakeup_timeout);

intid = val_timer_get_info(TIMER_INFO_PHY_EL2_INTID, 0);
if (val_gic_install_isr(intid, isr3)) {
Expand All @@ -102,6 +103,10 @@ payload3()

/* Add a delay loop after WFI called in case PE needs some time to enter WFI state
* exit in case test or failsafe int is received
*
* This delay loop is a bounded spin wait used only to wait for the
* interrupt to arrive. It is not time-based and does not represent
* system counter ticks.
*/
while (delay_loop && (g_el2phy_int_rcvd == 0) && (g_failsafe_int_rcvd == 0)) {
delay_loop--;
Expand Down
13 changes: 8 additions & 5 deletions test_pool/power_wakeup/u004.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/** @file
* Copyright (c) 2016-2019, 2021-2025, Arm Limited or its affiliates. All rights reserved.
* Copyright (c) 2016-2019, 2021-2026, Arm Limited or its affiliates. All rights reserved.
* SPDX-License-Identifier : Apache-2.0

* Licensed under the Apache License, Version 2.0 (the "License");
Expand Down Expand Up @@ -63,7 +63,7 @@ void
wakeup_set_failsafe()
{
uint32_t intid;
uint64_t timer_expire_val = (val_get_counter_frequency() * 3 * g_wakeup_timeout) / 2;
uint64_t timer_expire_val = (uint32_t)((uint64_t)val_get_safe_timeout_ticks() * g_wakeup_timeout);

intid = val_timer_get_info(TIMER_INFO_PHY_EL1_INTID, 0);
val_gic_install_isr(intid, isr_failsafe);
Expand All @@ -84,9 +84,9 @@ payload4()
uint32_t status;
uint32_t ns_wdg = 0;
uint32_t intid;
uint32_t delay_loop;
uint32_t delay_loop = MAX_SPIN_LOOPS;
uint32_t index = val_pe_get_index_mpid(val_pe_get_mpid());
uint64_t timer_expire_val = 1 * g_wakeup_timeout;
uint32_t timer_expire_val = 1 * g_wakeup_timeout;

wd_num = val_wd_get_info(0, WD_INFO_COUNT);

Expand Down Expand Up @@ -129,8 +129,11 @@ payload4()

/* Add a delay loop after WFI called in case PE needs some time to enter WFI state
* exit in case test or failsafe int is received
*
* This delay loop is a bounded spin wait used only to wait for the
* interrupt to arrive. It is not time-based and does not represent
* system counter ticks.
*/
delay_loop = val_get_counter_frequency() * g_wakeup_timeout;
while (delay_loop && (g_wd_int_received == 0) && (g_failsafe_int_received == 0)) {
delay_loop--;
}
Expand Down
14 changes: 9 additions & 5 deletions test_pool/power_wakeup/u005.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/** @file
* Copyright (c) 2016-2019, 2021-2025, Arm Limited or its affiliates. All rights reserved.
* Copyright (c) 2016-2019, 2021-2026, Arm Limited or its affiliates. All rights reserved.
* SPDX-License-Identifier : Apache-2.0

* Licensed under the Apache License, Version 2.0 (the "License");
Expand Down Expand Up @@ -65,7 +65,8 @@ void
wakeup_set_failsafe()
{
uint32_t intid;
uint64_t timer_expire_val = val_get_counter_frequency() * (g_wakeup_timeout + 1);
uint32_t timer_expire_val =
(uint32_t)((uint64_t)val_get_safe_timeout_ticks() * (g_wakeup_timeout + 1));

intid = val_timer_get_info(TIMER_INFO_PHY_EL1_INTID, 0);
val_gic_install_isr(intid, isr_failsafe);
Expand All @@ -87,9 +88,9 @@ payload5()
uint32_t ns_timer = 0;
uint32_t index = val_pe_get_index_mpid(val_pe_get_mpid());
uint32_t intid;
uint64_t delay_loop;
uint32_t delay_loop = MAX_SPIN_LOOPS;
uint64_t cnt_base_n;
uint64_t timer_expire_val = val_get_counter_frequency() * g_wakeup_timeout;
uint32_t timer_expire_val = (uint32_t)((uint64_t)val_get_safe_timeout_ticks() * g_wakeup_timeout);

timer_num = val_timer_get_info(TIMER_INFO_NUM_PLATFORM_TIMERS, 0);
if (!timer_num) {
Expand Down Expand Up @@ -128,8 +129,11 @@ payload5()

/* Add a delay loop after WFI called in case PE needs some time to enter WFI state
* exit in case test or failsafe int is received
*
* This delay loop is a bounded spin wait used only to wait for the
* interrupt to arrive. It is not time-based and does not represent
* system counter ticks.
*/
delay_loop = val_get_counter_frequency() * g_wakeup_timeout;
while (delay_loop && (g_timer_int_rcvd == 0) && (g_failsafe_int_rcvd == 0)) {
delay_loop--;
}
Expand Down
9 changes: 6 additions & 3 deletions test_pool/power_wakeup/u006.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/** @file
* Copyright (c) 2016-2018,2021,2024-2025, Arm Limited or its affiliates. All rights reserved.
* Copyright (c) 2016-2018,2021,2024-2026, Arm Limited or its affiliates. All rights reserved.
* SPDX-License-Identifier : Apache-2.0

* Licensed under the Apache License, Version 2.0 (the "License");
Expand Down Expand Up @@ -121,10 +121,13 @@ static
void
payload()
{
uint64_t timeout = TIMEOUT_SMALL;
uint32_t timeout = TIMEOUT_SMALL;
uint32_t index = val_pe_get_index_mpid(val_pe_get_mpid());
uint32_t target_pe, status;
uint64_t timer_expire_ticks = TIMEOUT_SMALL;
uint64_t timer_expire_ticks;

/* Scale watchdog expiry to ensure it fires before system-timer failsafe */
timer_expire_ticks = TIMEOUT_SMALL * 1024;

// Step1: Choose the index of the target PE
if ((index + 1) >= val_pe_get_num())
Expand Down
21 changes: 18 additions & 3 deletions test_pool/timer/t005.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/** @file
* Copyright (c) 2021, 2023-2025, Arm Limited or its affiliates. All rights reserved.
* Copyright (c) 2021, 2023-2026, Arm Limited or its affiliates. All rights reserved.
* SPDX-License-Identifier : Apache-2.0

* Licensed under the Apache License, Version 2.0 (the "License");
Expand Down Expand Up @@ -52,12 +52,27 @@ void
payload()
{
uint32_t index = val_pe_get_index_mpid(val_pe_get_mpid());
uint64_t sys_timer_ticks = val_get_counter_frequency() * 1;
uint64_t pe_timer_ticks = val_get_counter_frequency() * 2;
uint32_t sys_timer_ticks;
uint32_t pe_timer_ticks;
uint32_t ns_timer = 0;
uint64_t timer_num, timer_cnt;
int32_t status;

uint64_t freq = val_get_counter_frequency();
uint64_t ticks;

/* System timer */
ticks = freq * 1;
if (ticks > 0xFFFFFFFF)
ticks = 0xFFFFFFFF;
sys_timer_ticks = (uint32_t)ticks;

/* PE timer */
ticks = freq * 2;
if (ticks > 0xFFFFFFFF)
ticks = 0xFFFFFFFF;
pe_timer_ticks = (uint32_t)ticks;

timer_num = val_timer_get_info(TIMER_INFO_NUM_PLATFORM_TIMERS, 0);

while (timer_num--) {
Expand Down
9 changes: 5 additions & 4 deletions test_pool/watchdog/w002.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/** @file
* Copyright (c) 2016-2018,2021, 2023-2025, Arm Limited or its affiliates. All rights reserved.
* Copyright (c) 2016-2018,2021, 2023-2026, Arm Limited or its affiliates. All rights reserved.
* SPDX-License-Identifier : Apache-2.0

* Licensed under the Apache License, Version 2.0 (the "License");
Expand Down Expand Up @@ -69,7 +69,8 @@ void
wakeup_set_failsafe()
{
uint32_t intid;
uint64_t timer_expire_val = (val_get_counter_frequency() * 3 * g_wakeup_timeout) / 2;
uint32_t timer_expire_val =
(uint32_t)(((uint64_t)val_get_safe_timeout_ticks() * 3 * g_wakeup_timeout) / 2);

intid = val_timer_get_info(TIMER_INFO_PHY_EL1_INTID, 0);
val_gic_install_isr(intid, isr_failsafe);
Expand All @@ -89,7 +90,7 @@ payload()
{

uint32_t status, ns_wdg = 0;
uint64_t timeout;
uint32_t timeout;
uint64_t timer_expire_ticks = 1 * g_wakeup_timeout;
uint32_t index = val_pe_get_index_mpid(val_pe_get_mpid());
wd_num = val_wd_get_info(0, WD_INFO_COUNT);
Expand Down Expand Up @@ -146,7 +147,7 @@ payload()
}
wakeup_set_failsafe();

timeout = val_get_counter_frequency() * 2 * g_wakeup_timeout;
timeout = (uint32_t)(((uint64_t)val_get_safe_timeout_ticks() * g_wakeup_timeout) / 2);
while (timeout && (g_wd_int_received == 0) && (g_failsafe_int_received == 0)) {
val_data_cache_ops_by_va((addr_t)&g_wd_int_received, INVALIDATE);
val_data_cache_ops_by_va((addr_t)&g_failsafe_int_received, INVALIDATE);
Expand Down
4 changes: 3 additions & 1 deletion val/include/acs_timer.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

/** @file
* Copyright (c) 2016-2018, 2021, 2024-2025, Arm Limited or its affiliates. All rights reserved.
* Copyright (c) 2016-2018, 2021, 2024-2026, Arm Limited or its affiliates. All rights reserved.
* SPDX-License-Identifier : Apache-2.0

* Licensed under the Apache License, Version 2.0 (the "License");
Expand Down Expand Up @@ -39,6 +39,8 @@
#define CNTP_CTL 0x2C
#define COUNTER_ID 0xFD0

#define MAX_WAKEUP_TIMEOUT 5

uint32_t t001_entry(uint32_t num_pe);
uint32_t t002_entry(uint32_t num_pe);
uint32_t t003_entry(uint32_t num_pe);
Expand Down
4 changes: 3 additions & 1 deletion val/include/acs_wakeup.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/** @file
* Copyright (c) 2016-2018,2021,2024-2025, Arm Limited or its affiliates. All rights reserved.
* Copyright (c) 2016-2018,2021,2024-2026, Arm Limited or its affiliates. All rights reserved.
* SPDX-License-Identifier : Apache-2.0

* Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -18,6 +18,8 @@
#ifndef __ACS_WAKEUP_H__
#define __ACS_WAKEUP_H__

#define MAX_SPIN_LOOPS 1000000U

uint32_t u001_entry(uint32_t num_pe);
uint32_t u002_entry(uint32_t num_pe);
uint32_t u003_entry(uint32_t num_pe);
Expand Down
11 changes: 6 additions & 5 deletions val/include/val_interface.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/** @file
* Copyright (c) 2016-2025, Arm Limited or its affiliates. All rights reserved.
* Copyright (c) 2016-2026, Arm Limited or its affiliates. All rights reserved.
* SPDX-License-Identifier : Apache-2.0

* Licensed under the Apache License, Version 2.0 (the "License");
Expand Down Expand Up @@ -220,18 +220,19 @@ typedef enum {
#define BSA_TIMER_FLAG_ALWAYS_ON 0x4
void val_timer_create_info_table(uint64_t *timer_info_table);
void val_timer_free_info_table(void);
void val_timer_set_phy_el1(uint64_t timeout);
void val_timer_set_vir_el1(uint64_t timeout);
void val_timer_set_phy_el1(uint32_t timeout);
void val_timer_set_vir_el1(uint32_t timeout);
void val_platform_timer_get_entry_index(uint64_t instance, uint32_t *block, uint32_t *index);
uint64_t val_timer_get_info(TIMER_INFO_e info_type, uint64_t instance);
uint64_t val_get_phy_el2_timer_count(void);
uint32_t val_bsa_timer_execute_tests(uint32_t num_pe, uint32_t *g_sw_view);
void val_timer_set_phy_el2(uint64_t timeout);
void val_timer_set_vir_el2(uint64_t timeout);
void val_timer_set_phy_el2(uint32_t timeout);
void val_timer_set_vir_el2(uint32_t timeout);
void val_timer_set_system_timer(addr_t cnt_base_n, uint32_t timeout);
void val_timer_disable_system_timer(addr_t cnt_base_n);
uint32_t val_timer_skip_if_cntbase_access_not_allowed(uint64_t index);
uint64_t val_get_phy_el1_timer_count(void);
uint32_t val_get_safe_timeout_ticks(void);

/* Watchdog VAL APIs */
typedef enum {
Expand Down
Loading