Message ID | 20190603090933.20312-1-drjones@redhat.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [kvm-unit-tests] arm64: timer: a few test improvements | expand |
On 03/06/19 11:09, Andrew Jones wrote: > 1) Ensure set_timer_irq_enabled() clears the pending interrupt > from the gic before proceeding with the next test. > 2) Inform user we're about to wait for an interrupt - just in > case we never come back... > 3) Allow the user to choose just vtimer or just ptimer tests, > or to reverse their order with -append 'ptimer vtimer'. > > Signed-off-by: Andrew Jones <drjones@redhat.com> > --- > arm/timer.c | 17 +++++++++++++++-- > 1 file changed, 15 insertions(+), 2 deletions(-) > > diff --git a/arm/timer.c b/arm/timer.c > index 275d0494083d..6f2ad1d76ab2 100644 > --- a/arm/timer.c > +++ b/arm/timer.c > @@ -231,6 +231,7 @@ static void test_timer(struct timer_info *info) > /* Disable the timer again and prepare to take interrupts */ > info->write_ctl(0); > set_timer_irq_enabled(info, true); > + report("interrupt signal no longer pending", !gic_timer_pending(info)); > > report("latency within 10 ms", test_cval_10msec(info)); > report("interrupt received", info->irq_received); > @@ -242,6 +243,7 @@ static void test_timer(struct timer_info *info) > info->irq_received = false; > info->write_tval(read_sysreg(cntfrq_el0) / 100); /* 10 ms */ > info->write_ctl(ARCH_TIMER_CTL_ENABLE); > + report_info("waiting for interrupt..."); > wfi(); > left = info->read_tval(); > report("interrupt received after TVAL/WFI", info->irq_received); > @@ -328,12 +330,23 @@ static void print_timer_info(void) > > int main(int argc, char **argv) > { > + int i; > + > test_init(); > > print_timer_info(); > > - test_vtimer(); > - test_ptimer(); > + if (argc == 1) { > + test_vtimer(); > + test_ptimer(); > + } > + > + for (i = 1; i < argc; ++i) { > + if (strcmp(argv[i], "vtimer") == 0) > + test_vtimer(); > + if (strcmp(argv[i], "ptimer") == 0) > + test_ptimer(); > + } > > return report_summary(); > } > Queued, thanks. Paolo
diff --git a/arm/timer.c b/arm/timer.c index 275d0494083d..6f2ad1d76ab2 100644 --- a/arm/timer.c +++ b/arm/timer.c @@ -231,6 +231,7 @@ static void test_timer(struct timer_info *info) /* Disable the timer again and prepare to take interrupts */ info->write_ctl(0); set_timer_irq_enabled(info, true); + report("interrupt signal no longer pending", !gic_timer_pending(info)); report("latency within 10 ms", test_cval_10msec(info)); report("interrupt received", info->irq_received); @@ -242,6 +243,7 @@ static void test_timer(struct timer_info *info) info->irq_received = false; info->write_tval(read_sysreg(cntfrq_el0) / 100); /* 10 ms */ info->write_ctl(ARCH_TIMER_CTL_ENABLE); + report_info("waiting for interrupt..."); wfi(); left = info->read_tval(); report("interrupt received after TVAL/WFI", info->irq_received); @@ -328,12 +330,23 @@ static void print_timer_info(void) int main(int argc, char **argv) { + int i; + test_init(); print_timer_info(); - test_vtimer(); - test_ptimer(); + if (argc == 1) { + test_vtimer(); + test_ptimer(); + } + + for (i = 1; i < argc; ++i) { + if (strcmp(argv[i], "vtimer") == 0) + test_vtimer(); + if (strcmp(argv[i], "ptimer") == 0) + test_ptimer(); + } return report_summary(); }
1) Ensure set_timer_irq_enabled() clears the pending interrupt from the gic before proceeding with the next test. 2) Inform user we're about to wait for an interrupt - just in case we never come back... 3) Allow the user to choose just vtimer or just ptimer tests, or to reverse their order with -append 'ptimer vtimer'. Signed-off-by: Andrew Jones <drjones@redhat.com> --- arm/timer.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-)