Patchwork [v4,06/13] hpet: Start/stop timer when HPET_TN_ENABLE is modified

login
register
mail settings
Submitter Jan Kiszka
Date June 13, 2010, 12:15 p.m.
Message ID <b1c88d98195e0938131aeac7345e226d92c54d19.1276431335.git.jan.kiszka@web.de>
Download mbox | patch
Permalink /patch/55415/
State New
Headers show

Comments

Jan Kiszka - June 13, 2010, 12:15 p.m.
From: Jan Kiszka <jan.kiszka@siemens.com>

We have to update the qemu timer when the per-timer enable bit is
toggled, just like for HPET_CFG_ENABLE changes.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
 hw/hpet.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

Patch

diff --git a/hw/hpet.c b/hw/hpet.c
index 6974935..041dd84 100644
--- a/hw/hpet.c
+++ b/hw/hpet.c
@@ -430,6 +430,11 @@  static void hpet_ram_writel(void *opaque, target_phys_addr_t addr,
                 printf("qemu: level-triggered hpet not supported\n");
                 exit (-1);
             }
+            if (activating_bit(old_val, new_val, HPET_TN_ENABLE)) {
+                hpet_set_timer(timer);
+            } else if (deactivating_bit(old_val, new_val, HPET_TN_ENABLE)) {
+                hpet_del_timer(timer);
+            }
             break;
         case HPET_TN_CFG + 4: // Interrupt capabilities
             DPRINTF("qemu: invalid HPET_TN_CFG+4 write\n");