* [Qemu-devel] [PATCH] Revert "hw/ptimer: Perform counter wrap around if timer already expired"
@ 2016-07-08 13:22 Dmitry Osipenko
2016-07-11 17:41 ` Peter Maydell
0 siblings, 1 reply; 2+ messages in thread
From: Dmitry Osipenko @ 2016-07-08 13:22 UTC (permalink / raw)
To: QEMU Developers; +Cc: Peter Crosthwaite, Peter Maydell, Mark Cave-Ayland
Software should see timer counter wraparound only after IRQ being triggered.
This fixes regression introduced by the commit 5a50307 ("hw/ptimer: Perform
counter wrap around if timer already expired"), resulting in monotonic timer
jumping backwards on SPARC emulated machine running NetBSD guest OS, as
reported by Mark Cave-Ayland.
Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
---
hw/core/ptimer.c | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/hw/core/ptimer.c b/hw/core/ptimer.c
index 05b0c27..30829ee 100644
--- a/hw/core/ptimer.c
+++ b/hw/core/ptimer.c
@@ -93,7 +93,7 @@ uint64_t ptimer_get_count(ptimer_state *s)
bool oneshot = (s->enabled == 2);
/* Figure out the current counter value. */
- if (s->period == 0 || (expired && (oneshot || use_icount))) {
+ if (expired) {
/* Prevent timer underflowing if it should already have
triggered. */
counter = 0;
@@ -120,7 +120,7 @@ uint64_t ptimer_get_count(ptimer_state *s)
backwards.
*/
- rem = expired ? now - next : next - now;
+ rem = next - now;
div = period;
clz1 = clz64(rem);
@@ -140,11 +140,6 @@ uint64_t ptimer_get_count(ptimer_state *s)
div += 1;
}
counter = rem / div;
-
- if (expired && counter != 0) {
- /* Wrap around periodic counter. */
- counter = s->limit - (counter - 1) % s->limit;
- }
}
} else {
counter = s->delta;
--
2.9.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Qemu-devel] [PATCH] Revert "hw/ptimer: Perform counter wrap around if timer already expired"
2016-07-08 13:22 [Qemu-devel] [PATCH] Revert "hw/ptimer: Perform counter wrap around if timer already expired" Dmitry Osipenko
@ 2016-07-11 17:41 ` Peter Maydell
0 siblings, 0 replies; 2+ messages in thread
From: Peter Maydell @ 2016-07-11 17:41 UTC (permalink / raw)
To: Dmitry Osipenko; +Cc: QEMU Developers, Peter Crosthwaite, Mark Cave-Ayland
On 8 July 2016 at 14:22, Dmitry Osipenko <digetx@gmail.com> wrote:
> Software should see timer counter wraparound only after IRQ being triggered.
> This fixes regression introduced by the commit 5a50307 ("hw/ptimer: Perform
> counter wrap around if timer already expired"), resulting in monotonic timer
> jumping backwards on SPARC emulated machine running NetBSD guest OS, as
> reported by Mark Cave-Ayland.
>
> Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
> ---
> hw/core/ptimer.c | 9 ++-------
> 1 file changed, 2 insertions(+), 7 deletions(-)
>
Applied to target-arm.next, thanks.
-- PMM
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-07-11 17:42 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-08 13:22 [Qemu-devel] [PATCH] Revert "hw/ptimer: Perform counter wrap around if timer already expired" Dmitry Osipenko
2016-07-11 17:41 ` Peter Maydell
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.