Skip to contentSkip to conversation

m48t59: use rtc_clock for alarm timer

PATCH Applied Paolo Bonzini 3 participants 4 messages Jan 20, 2012 – Jan 30, 2012

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 m48t59: use rtc_clock for alarm timer

This lets the RTC get adjustments from the host NTP client. The watchdog still uses the vm_clock. The previous behavior is available with "-rtc clock=vm".

Cc Andreas Färber <[email protected]>
---
 hw/m48t59.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
hw/m48t59.c +2 -2
index c043996..fd5dc00 100644
@@ -126,7 +126,7 @@ static void alarm_cb (void *opaque)
         /* Repeat once a second */
         next_time = 1;
     }
-    qemu_mod_timer(NVRAM->alrm_timer, qemu_get_clock_ns(vm_clock) +
+    qemu_mod_timer(NVRAM->alrm_timer, qemu_get_clock_ns(rtc_clock) +
                     next_time * 1000);
     qemu_set_irq(NVRAM->IRQ, 0);
 }
@@ -687,7 +687,7 @@ static void m48t59_init_common(M48t59State *s)
 {
     s->buffer = g_malloc0(s->size);
     if (s->type == 59) {
-        s->alrm_timer = qemu_new_timer_ns(vm_clock, &alarm_cb, s);
+        s->alrm_timer = qemu_new_timer_ns(rtc_clock, &alarm_cb, s);
         s->wd_timer = qemu_new_timer_ns(vm_clock, &watchdog_cb, s);
     }
     qemu_get_timedate(&s->alarm, 0);
Signature · 1 line
1.7.7.1
Reviewed-by on v1 1/1
#1 lore raw

Am 20.01.2012 13:05, schrieb Paolo Bonzini:

Quoted 6 lines

This lets the RTC get adjustments from the host NTP client. The watchdog still uses the vm_clock. The previous behavior is available with "-rtc clock=vm".

Andreas

Quoted 26 lines
---
 hw/m48t59.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
hw/m48t59.c +2 -2
index c043996..fd5dc00 100644
@@ -126,7 +126,7 @@ static void alarm_cb (void *opaque)
         /* Repeat once a second */
         next_time = 1;
     }
-    qemu_mod_timer(NVRAM->alrm_timer, qemu_get_clock_ns(vm_clock) +
+    qemu_mod_timer(NVRAM->alrm_timer, qemu_get_clock_ns(rtc_clock) +
                     next_time * 1000);
     qemu_set_irq(NVRAM->IRQ, 0);
 }
@@ -687,7 +687,7 @@ static void m48t59_init_common(M48t59State *s)
 {
     s->buffer = g_malloc0(s->size);
     if (s->type == 59) {
-        s->alrm_timer = qemu_new_timer_ns(vm_clock, &alarm_cb, s);
+        s->alrm_timer = qemu_new_timer_ns(rtc_clock, &alarm_cb, s);
         s->wd_timer = qemu_new_timer_ns(vm_clock, &watchdog_cb, s);
     }
     qemu_get_timedate(&s->alarm, 0);
Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
#2 lore raw
In reply to Paolo Bonzini
Quoted 24 lines · Paolo Bonzini

This lets the RTC get adjustments from the host NTP client. The watchdog still uses the vm_clock. The previous behavior is available with "-rtc clock=vm".

Cc Andreas Färber<[email protected]>
---
  hw/m48t59.c |    4 ++--
  1 files changed, 2 insertions(+), 2 deletions(-)
hw/m48t59.c +1 -1
index c043996..fd5dc00 100644
@@ -126,7 +126,7 @@ static void alarm_cb (void *opaque)
          /* Repeat once a second */
          next_time = 1;
      }
-    qemu_mod_timer(NVRAM->alrm_timer, qemu_get_clock_ns(vm_clock) +
+    qemu_mod_timer(NVRAM->alrm_timer, qemu_get_clock_ns(rtc_clock) +
                      next_time * 1000);
      qemu_set_irq(NVRAM->IRQ, 0);
  }

hw/m48t59.c static void m48t59_init_common(M48t59State *s) · line 693

Quoted 8 lines
hw/m48t59.c +1 -1
@@ -687,7 +687,7 @@ static void m48t59_init_common(M48t59State *s)
  {
      s->buffer = g_malloc0(s->size);
      if (s->type == 59) {
-        s->alrm_timer = qemu_new_timer_ns(vm_clock,&alarm_cb, s);
+        s->alrm_timer = qemu_new_timer_ns(rtc_clock,&alarm_cb, s);
          s->wd_timer = qemu_new_timer_ns(vm_clock,&watchdog_cb, s);
      }
      qemu_get_timedate(&s->alarm, 0);

Ping.

Paolo

Applied
#3 lore raw
In reply to Paolo Bonzini

Thanks, applied.

Quoted 36 lines · Paolo Bonzini

This lets the RTC get adjustments from the host NTP client. The watchdog still uses the vm_clock.  The previous behavior is available with "-rtc clock=vm".

Cc Andreas Färber <[email protected]>

---
 hw/m48t59.c |    4 ++--

 1 files changed, 2 insertions(+), 2 deletions(-)
hw/m48t59.c +2 -3
index c043996..fd5dc00 100644
@@ -126,7 +126,7 @@ static void alarm_cb (void *opaque)
         /* Repeat once a second */
         next_time = 1;
     }
-    qemu_mod_timer(NVRAM->alrm_timer, qemu_get_clock_ns(vm_clock) +
+    qemu_mod_timer(NVRAM->alrm_timer, qemu_get_clock_ns(rtc_clock) +
                     next_time * 1000);
     qemu_set_irq(NVRAM->IRQ, 0);
  }
@@ -687,7 +687,7 @@ static void m48t59_init_common(M48t59State *s)
  {
     s->buffer = g_malloc0(s->size);
     if (s->type == 59) {
-        s->alrm_timer = qemu_new_timer_ns(vm_clock, &alarm_cb, s);
+        s->alrm_timer = qemu_new_timer_ns(rtc_clock, &alarm_cb, s);
         s->wd_timer = qemu_new_timer_ns(vm_clock, &watchdog_cb, s);
     }
     qemu_get_timedate(&s->alarm, 0);
--

1.7.7.1