mirror of
https://github.com/torvalds/linux.git
synced 2026-05-31 10:33:41 +02:00
KVM: arm64: selftests: Add arch_timer_edge_cases selftest
Add a new arch_timer_edge_cases selftests that validates: * timers above the max TVAL value * timers in the past * moving counters ahead and behind pending timers * reprograming timers * timers fired multiple times * masking/unmasking using the timer control mask These are intentionally unusual scenarios to stress compliance with the arm architecture. Co-developed-by: Ricardo Koller <ricarkol@google.com> Signed-off-by: Ricardo Koller <ricarkol@google.com> Signed-off-by: Colton Lewis <coltonlewis@google.com> Link: https://lore.kernel.org/r/20240823175836.2798235-3-coltonlewis@google.com Signed-off-by: Marc Zyngier <maz@kernel.org>
This commit is contained in:
parent
ca1a18368d
commit
54306f5644
|
|
@ -152,6 +152,7 @@ TEST_GEN_PROGS_x86_64 += pre_fault_memory_test
|
|||
TEST_GEN_PROGS_EXTENDED_x86_64 += x86_64/nx_huge_pages_test
|
||||
|
||||
TEST_GEN_PROGS_aarch64 += aarch64/aarch32_id_regs
|
||||
TEST_GEN_PROGS_aarch64 += aarch64/arch_timer_edge_cases
|
||||
TEST_GEN_PROGS_aarch64 += aarch64/debug-exceptions
|
||||
TEST_GEN_PROGS_aarch64 += aarch64/hypercalls
|
||||
TEST_GEN_PROGS_aarch64 += aarch64/page_fault_test
|
||||
|
|
|
|||
1062
tools/testing/selftests/kvm/aarch64/arch_timer_edge_cases.c
Normal file
1062
tools/testing/selftests/kvm/aarch64/arch_timer_edge_cases.c
Normal file
File diff suppressed because it is too large
Load Diff
|
|
@ -79,7 +79,7 @@ static inline uint64_t timer_get_cval(enum arch_timer timer)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static inline void timer_set_tval(enum arch_timer timer, uint32_t tval)
|
||||
static inline void timer_set_tval(enum arch_timer timer, int32_t tval)
|
||||
{
|
||||
switch (timer) {
|
||||
case VIRTUAL:
|
||||
|
|
@ -95,6 +95,22 @@ static inline void timer_set_tval(enum arch_timer timer, uint32_t tval)
|
|||
isb();
|
||||
}
|
||||
|
||||
static inline int32_t timer_get_tval(enum arch_timer timer)
|
||||
{
|
||||
isb();
|
||||
switch (timer) {
|
||||
case VIRTUAL:
|
||||
return read_sysreg(cntv_tval_el0);
|
||||
case PHYSICAL:
|
||||
return read_sysreg(cntp_tval_el0);
|
||||
default:
|
||||
GUEST_FAIL("Could not get timer %d\n", timer);
|
||||
}
|
||||
|
||||
/* We should not reach here */
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline void timer_set_ctl(enum arch_timer timer, uint32_t ctl)
|
||||
{
|
||||
switch (timer) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user