All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Jones <drjones@redhat.com>
To: kvm@vger.kernel.org
Cc: pbonzini@redhat.com, rkrcmar@redhat.com
Subject: [PATCH kvm-unit-tests] arm64: timer: a few test improvements
Date: Mon,  3 Jun 2019 11:09:33 +0200	[thread overview]
Message-ID: <20190603090933.20312-1-drjones@redhat.com> (raw)

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();
 }
-- 
2.20.1


             reply	other threads:[~2019-06-03  9:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-03  9:09 Andrew Jones [this message]
2019-06-06 12:28 ` [PATCH kvm-unit-tests] arm64: timer: a few test improvements Paolo Bonzini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190603090933.20312-1-drjones@redhat.com \
    --to=drjones@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=rkrcmar@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.