qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 2/3] arm_mptimer: Fix ONE-SHOT -> PERIODIC mode chan


From: Dmitry Osipenko
Subject: [Qemu-devel] [PATCH 2/3] arm_mptimer: Fix ONE-SHOT -> PERIODIC mode change
Date: Fri, 3 Jul 2015 01:52:10 +0300

Timer won't start periodic ticking if ONE-SHOT -> PERIODIC mode change happened
after one-shot tick was completed. Fix it by starting ticking only if timer was
disabled previously and isn't ticking right now.

Signed-off-by: Dmitry Osipenko <address@hidden>
---
 hw/timer/arm_mptimer.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/hw/timer/arm_mptimer.c b/hw/timer/arm_mptimer.c
index e230063..58e17c4 100644
--- a/hw/timer/arm_mptimer.c
+++ b/hw/timer/arm_mptimer.c
@@ -122,11 +122,16 @@ static void timerblock_write(void *opaque, hwaddr addr,
     case 8: /* Control.  */
         old = tb->control;
         tb->control = value;
-        if ((old & 1) == (value & 1)) {
+        /* Don't do anything if timer already disabled.  */
+        if (((old & 1) == 0) && ((value & 1) == 0)) {
             break;
         }
         if (value & 1) {
-            if (tb->count == 0 && (tb->control & 2)) {
+            /* Don't do anything if timer already ticking.  */
+            if (((old & 1) != 0) && (tb->count != 0)) {
+                break;
+            }
+            if (tb->control & 2) {
                 tb->count = tb->load;
             }
             timerblock_reload(tb, 1);
-- 
2.4.4




reply via email to

[Prev in Thread] Current Thread [Next in Thread]