Skip to contentSkip to conversation

hpet: Init capability register only once

PATCH Applied Jan Kiszka 2 participants 2 messages Jun 14, 2010

lore
Share & tools
lore

Jan Kiszka

author
#0 lore raw

PATCH 1/1 hpet: Init capability register only once

From: Jan Kiszka <[email protected]>

The capability register is read-only from guest POV, so we do not need to update it on reset.

---
 hw/hpet.c |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)
hw/hpet.c +5 -4
index 93fc399..e9b585c 100644
@@ -648,10 +648,6 @@ static void hpet_reset(DeviceState *d)
 
     s->hpet_counter = 0ULL;
     s->hpet_offset = 0ULL;
-    /* 64-bit main counter; LegacyReplacementRoute. */
-    s->capability = 0x8086a001ULL;
-    s->capability |= (s->num_timers - 1) << HPET_ID_NUM_TIM_SHIFT;
-    s->capability |= ((HPET_CLK_PERIOD) << 32);
     s->config = 0ULL;
     if (count > 0) {
         /* we don't enable pit when hpet_reset is first called (by hpet_init)
@@ -696,6 +692,11 @@ static int hpet_init(SysBusDevice *dev)
         timer->state = s;
     }
 
+    /* 64-bit main counter; LegacyReplacementRoute. */
+    s->capability = 0x8086a001ULL;
+    s->capability |= (s->num_timers - 1) << HPET_ID_NUM_TIM_SHIFT;
+    s->capability |= ((HPET_CLK_PERIOD) << 32);
+
     isa_reserve_irq(RTC_ISA_IRQ);
     qdev_init_gpio_in(&dev->qdev, hpet_handle_rtc_irq, 1);
 
Signature · 1 line
1.6.0.2
#1 lore raw
Quoted 7 lines · Jan Kiszka

From: Jan Kiszka<[email protected]>

The capability register is read-only from guest POV, so we do not need to update it on reset.

Applied. Thanks.

Regards,

Anthony Liguori

Quoted 32 lines
---
  hw/hpet.c |    9 +++++----
  1 files changed, 5 insertions(+), 4 deletions(-)
hw/hpet.c +5 -4
index 93fc399..e9b585c 100644
@@ -648,10 +648,6 @@ static void hpet_reset(DeviceState *d)
 
      s->hpet_counter = 0ULL;
      s->hpet_offset = 0ULL;
-    /* 64-bit main counter; LegacyReplacementRoute. */
-    s->capability = 0x8086a001ULL;
-    s->capability |= (s->num_timers - 1)<<  HPET_ID_NUM_TIM_SHIFT;
-    s->capability |= ((HPET_CLK_PERIOD)<<  32);
      s->config = 0ULL;
      if (count>  0) {
          /* we don't enable pit when hpet_reset is first called (by hpet_init)
@@ -696,6 +692,11 @@ static int hpet_init(SysBusDevice *dev)
          timer->state = s;
      }
 
+    /* 64-bit main counter; LegacyReplacementRoute. */
+    s->capability = 0x8086a001ULL;
+    s->capability |= (s->num_timers - 1)<<  HPET_ID_NUM_TIM_SHIFT;
+    s->capability |= ((HPET_CLK_PERIOD)<<  32);
+
      isa_reserve_irq(RTC_ISA_IRQ);
      qdev_init_gpio_in(&dev->qdev, hpet_handle_rtc_irq, 1);