From b746514b84fef256d7a3ff229864a5440de4e27a Mon Sep 17 00:00:00 2001 From: xayahion Date: Mon, 20 Jul 2026 22:41:07 +0800 Subject: [PATCH 1/2] 1.add CNTP_CVAL_EL02/CNTV_CVAL_EL02 support for ArmArchTimerWriteReg 2.reorder system timer in test_pool/timer/t005.c Signed-off-by: xayahion --- test_pool/timer/t005.c | 4 ++-- val/src/acs_timer.c | 10 ++++++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/test_pool/timer/t005.c b/test_pool/timer/t005.c index 1136f696..b241378b 100644 --- a/test_pool/timer/t005.c +++ b/test_pool/timer/t005.c @@ -101,8 +101,6 @@ payload() return; } - val_timer_set_system_timer((addr_t)cnt_base_n, sys_timer_ticks); - irq_received = 0; intid = val_timer_get_info(TIMER_INFO_SYS_INTID, timer_num); @@ -111,6 +109,8 @@ payload() intid_phy = val_timer_get_info(TIMER_INFO_PHY_EL1_INTID, 0); val_gic_install_isr(intid_phy, isr_phy_el1); + val_timer_set_system_timer((addr_t)cnt_base_n, sys_timer_ticks); + /* Start EL1 PHY timer */ val_timer_set_phy_el1(pe_timer_ticks); diff --git a/val/src/acs_timer.c b/val/src/acs_timer.c index af2eb684..21f64c17 100644 --- a/val/src/acs_timer.c +++ b/val/src/acs_timer.c @@ -237,11 +237,17 @@ ArmArchTimerWriteReg ( break; case CntpCval: - write_cntp_cval_el0(*data_buf); + if (effective_e2h) + write_cntp_cval_el02(*data_buf); + else + write_cntp_cval_el0(*data_buf); break; case CntvCval: - write_cntv_cval_el0(*data_buf); + if (effective_e2h) + write_cntv_cval_el02(*data_buf); + else + write_cntp_cval_el0(*data_buf); break; case CntvOff: From 1e799ab3dabf69e0a993cb04050b1e9932366152 Mon Sep 17 00:00:00 2001 From: Xayahion Date: Wed, 22 Jul 2026 16:14:35 +0800 Subject: [PATCH 2/2] Update acs_timer.c --- val/src/acs_timer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/val/src/acs_timer.c b/val/src/acs_timer.c index 21f64c17..85741c4b 100644 --- a/val/src/acs_timer.c +++ b/val/src/acs_timer.c @@ -247,7 +247,7 @@ ArmArchTimerWriteReg ( if (effective_e2h) write_cntv_cval_el02(*data_buf); else - write_cntp_cval_el0(*data_buf); + write_cntv_cval_el0(*data_buf); break; case CntvOff: