From: "Alex Bennée" <alex.bennee@linaro.org>
To: pbonzini@redhat.com
Cc: kvm@vger.kernel.org, maz@kernel.org, christoffer.dall@arm.com,
"Alex Bennée" <alex.bennee@linaro.org>,
kvmarm@lists.cs.columbia.edu,
linux-arm-kernel@lists.infradead.org
Subject: [kvm-unit-tests PATCH] arm: expand the timer tests
Date: Fri, 10 Jan 2020 16:05:11 +0000 [thread overview]
Message-ID: <20200110160511.17821-1-alex.bennee@linaro.org> (raw)
This was an attempt to replicate a QEMU bug. However to trigger the
bug you need to have an offset set in EL2 which kvm-unit-tests is
unable to do. However it does exercise some more corner cases.
Bug: https://bugs.launchpad.net/bugs/1859021
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
arm/timer.c | 27 ++++++++++++++++++++++++++-
1 file changed, 26 insertions(+), 1 deletion(-)
diff --git a/arm/timer.c b/arm/timer.c
index f390e8e..ae1d299 100644
--- a/arm/timer.c
+++ b/arm/timer.c
@@ -214,21 +214,46 @@ static void test_timer(struct timer_info *info)
* still read the pending state even if it's disabled. */
set_timer_irq_enabled(info, false);
+ /* Verify count goes up */
+ report(info->read_counter() >= now, "counter increments");
+
/* Enable the timer, but schedule it for much later */
info->write_cval(later);
info->write_ctl(ARCH_TIMER_CTL_ENABLE);
isb();
- report(!gic_timer_pending(info), "not pending before");
+ report(!gic_timer_pending(info), "not pending before 10s");
+
+ /* Check with a maximum possible cval */
+ info->write_cval(UINT64_MAX);
+ isb();
+ report(!gic_timer_pending(info), "not pending before UINT64_MAX");
+
+ /* also by setting tval */
+ info->write_tval(time_10s);
+ isb();
+ report(!gic_timer_pending(info), "not pending before 10s (via tval)");
+ report_info("TVAL is %d (delta CVAL %ld) ticks",
+ info->read_tval(), info->read_cval() - info->read_counter());
+ /* check pending once cval is before now */
info->write_cval(now - 1);
isb();
report(gic_timer_pending(info), "interrupt signal pending");
+ report_info("TVAL is %d ticks", info->read_tval());
/* Disable the timer again and prepare to take interrupts */
info->write_ctl(0);
set_timer_irq_enabled(info, true);
report(!gic_timer_pending(info), "interrupt signal no longer pending");
+ /* QEMU bug when cntvoff_el2 > 0
+ * https://bugs.launchpad.net/bugs/1859021 */
+ info->write_ctl(ARCH_TIMER_CTL_ENABLE);
+ info->write_cval(UINT64_MAX);
+ isb();
+ report(!gic_timer_pending(info), "not pending before UINT64_MAX (irqs on)");
+ info->write_ctl(0);
+
report(test_cval_10msec(info), "latency within 10 ms");
report(info->irq_received, "interrupt received");
--
2.20.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next reply other threads:[~2020-01-10 16:05 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-10 16:05 Alex Bennée [this message]
2020-01-13 13:48 ` [kvm-unit-tests PATCH] arm: expand the timer tests Alexandru Elisei
2020-01-13 14:07 ` Alexandru Elisei
2020-01-13 17:38 ` Alex Bennée
2020-01-27 15:20 ` Alexandru Elisei
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=20200110160511.17821-1-alex.bennee@linaro.org \
--to=alex.bennee@linaro.org \
--cc=christoffer.dall@arm.com \
--cc=kvm@vger.kernel.org \
--cc=kvmarm@lists.cs.columbia.edu \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=maz@kernel.org \
--cc=pbonzini@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).