Skip to contentSkip to conversation

arm64: timer: a few test improvements

PATCH Applied Andrew Jones 2 participants 2 messages Jun 3, 2019 – Jun 6, 2019 KVM

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 arm64: timer: a few test improvements

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'.

---
 arm/timer.c | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)
arm/timer.c +15 -2
index 275d0494083d..6f2ad1d76ab2 100644
@@ -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();
 }
Signature · 1 line
2.20.1
maintainer Applied
#1 lore raw
Quoted 49 lines · Andrew Jones

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'.

---
 arm/timer.c | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)
arm/timer.c +8 -2
index 275d0494083d..6f2ad1d76ab2 100644
@@ -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();
+	}

arm/timer.c static void print_timer_info(void) · line 352

Quoted 10 lines
arm/timer.c +7 -0
+
+	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