Skip to contentSkip to conversation

hpet: do not overwrite properties on post_load

PATCH Superseded Paolo Bonzini 2 participants 3 messages Dec 5, 2024 – Jan 24, 2025

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hpet: do not overwrite properties on post_load

Migration relies on having the same device configuration on the source and destination. Therefore, there is no need to modify flags, timer capabilities and the fw_cfg HPET block id on migration; it was set to exactly the same values by realize.

---
 hw/timer/hpet.c | 10 ----------
 1 file changed, 10 deletions(-)
hw/timer/hpet.c +0 -10
index 5399f1b2a3f..18c8ce26e0d 100644
@@ -275,16 +275,6 @@ static int hpet_post_load(void *opaque, int version_id)
                         - qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL);
     }
 
-    /* Push number of timers into capability returned via HPET_ID */
-    s->capability &= ~HPET_ID_NUM_TIM_MASK;
-    s->capability |= (s->num_timers - 1) << HPET_ID_NUM_TIM_SHIFT;
-    hpet_cfg.hpet[s->hpet_id].event_timer_block_id = (uint32_t)s->capability;
-
-    /* Derive HPET_MSI_SUPPORT from the capability of the first timer. */
-    s->flags &= ~(1 << HPET_MSI_SUPPORT);
-    if (s->timer[0].config & HPET_TN_FSB_CAP) {
-        s->flags |= 1 << HPET_MSI_SUPPORT;
-    }
     return 0;
 }
 
Signature · 1 line
2.47.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 10 lines · Paolo Bonzini

Date: Thu, 5 Dec 2024 21:37:21 +0100
From: Paolo Bonzini <[email protected]>
Subject: [PATCH] hpet: do not overwrite properties on post_load
X-Mailer: git-send-email 2.47.1

Migration relies on having the same device configuration on the source and destination. Therefore, there is no need to modify flags, timer capabilities and the fw_cfg HPET block id on migration; it was set to exactly the same values by realize.

Quoted 4 lines
---
 hw/timer/hpet.c | 10 ----------
 1 file changed, 10 deletions(-)

Indeed, thanks!

Quoted 7 lines
hw/timer/hpet.c +0 -0
index 5399f1b2a3f..18c8ce26e0d 100644
@@ -275,16 +275,6 @@ static int hpet_post_load(void *opaque, int version_id)
                         - qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL);
     }

hw/timer/hpet.c static int hpet_post_load(void *opaque, int version_id) · line 286

Quoted 10 lines
hw/timer/hpet.c +0 -9
 
-    /* Push number of timers into capability returned via HPET_ID */
-    s->capability &= ~HPET_ID_NUM_TIM_MASK;
-    s->capability |= (s->num_timers - 1) << HPET_ID_NUM_TIM_SHIFT;
-    hpet_cfg.hpet[s->hpet_id].event_timer_block_id = (uint32_t)s->capability;
-
-    /* Derive HPET_MSI_SUPPORT from the capability of the first timer. */
-    s->flags &= ~(1 << HPET_MSI_SUPPORT);
-    if (s->timer[0].config & HPET_TN_FSB_CAP) {
-        s->flags |= 1 << HPET_MSI_SUPPORT;

About the MSI (FSB) support, I haven't seen it being used anywhere. Is it the dead code?

Quoted 7 lines
hw/timer/hpet.c +0 -1
-    }
     return 0;
 }
 
Signature · 1 line
2.47.1
#2 lore raw

This patch was missed :-) which could free HPETState.flags from a BqlCell.

Quoted 10 lines

hw/timer/hpet.c static int hpet_post_load(void *opaque, int version_id) · line 286

Quoted 9 lines
hw/timer/hpet.c +0 -9
-    /* Push number of timers into capability returned via HPET_ID */
-    s->capability &= ~HPET_ID_NUM_TIM_MASK;
-    s->capability |= (s->num_timers - 1) << HPET_ID_NUM_TIM_SHIFT;
-    hpet_cfg.hpet[s->hpet_id].event_timer_block_id = (uint32_t)s->capability;
-
-    /* Derive HPET_MSI_SUPPORT from the capability of the first timer. */
-    s->flags &= ~(1 << HPET_MSI_SUPPORT);
-    if (s->timer[0].config & HPET_TN_FSB_CAP) {
-        s->flags |= 1 << HPET_MSI_SUPPORT;
Quoted 3 lines

About the MSI (FSB) support, I haven't seen it being used anywhere. Is it the dead code?

I have this question since I find it seems no way to set "msi" and "timers" properties by user, and no code sets them.

DEFINE_PROP_UINT8("timers", HPETState, num_timers, HPET_MIN_TIMERS), DEFINE_PROP_BIT("msi", HPETState, flags, HPET_MSI_SUPPORT, false),

Thanks,
Zhao