* [PATCH v2] hw/timer/hpet: Remove HPETState::hpet_offset_saved field
@ 2026-03-06 9:31 Thomas Huth
2026-03-09 13:58 ` Zhao Liu
2026-03-09 14:06 ` Paolo Bonzini
0 siblings, 2 replies; 3+ messages in thread
From: Thomas Huth @ 2026-03-06 9:31 UTC (permalink / raw)
To: Paolo Bonzini, qemu-devel; +Cc: Michael S. Tsirkin, qemu-rust
From: Philippe Mathieu-Daudé <philmd@linaro.org>
The HPETState::hpet_offset_saved boolean was only set in the
hw_compat_2_11[] array, via the 'hpet-offset-saved=false'
property. We removed all machines using that array, let's remove
that property and all the code around it.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20250501230129.2596-6-philmd@linaro.org>
[thuth: Adapted the rust part to the current master branch]
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
hw/timer/hpet.c | 9 +--------
rust/hw/timer/hpet/src/device.rs | 9 +--------
2 files changed, 2 insertions(+), 16 deletions(-)
diff --git a/hw/timer/hpet.c b/hw/timer/hpet.c
index 0d7b8e0c7a3..767093c431a 100644
--- a/hw/timer/hpet.c
+++ b/hw/timer/hpet.c
@@ -75,7 +75,6 @@ struct HPETState {
QemuMutex lock;
MemoryRegion iomem;
uint64_t hpet_offset;
- bool hpet_offset_saved;
QemuSeqLock state_version;
qemu_irq irqs[HPET_NUM_IRQ_ROUTES];
uint32_t flags;
@@ -272,11 +271,6 @@ static int hpet_post_load(void *opaque, int version_id)
t->cmp64 = hpet_calculate_cmp64(t, s->hpet_counter, t->cmp);
t->last = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) - NANOSECONDS_PER_SECOND;
}
- /* Recalculate the offset between the main counter and guest time */
- if (!s->hpet_offset_saved) {
- s->hpet_offset = ticks_to_ns(s->hpet_counter)
- - qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL);
- }
return 0;
}
@@ -285,7 +279,7 @@ static bool hpet_offset_needed(void *opaque)
{
HPETState *s = opaque;
- return hpet_enabled(s) && s->hpet_offset_saved;
+ return hpet_enabled(s);
}
static bool hpet_rtc_irq_level_needed(void *opaque)
@@ -766,7 +760,6 @@ static const Property hpet_device_properties[] = {
DEFINE_PROP_UINT8("timers", HPETState, num_timers, HPET_MIN_TIMERS),
DEFINE_PROP_BIT("msi", HPETState, flags, HPET_MSI_SUPPORT, false),
DEFINE_PROP_UINT32(HPET_INTCAP, HPETState, intcap, 0),
- DEFINE_PROP_BOOL("hpet-offset-saved", HPETState, hpet_offset_saved, true),
};
static void hpet_device_class_init(ObjectClass *klass, const void *data)
diff --git a/rust/hw/timer/hpet/src/device.rs b/rust/hw/timer/hpet/src/device.rs
index ebf715d3995..0a5c131819b 100644
--- a/rust/hw/timer/hpet/src/device.rs
+++ b/rust/hw/timer/hpet/src/device.rs
@@ -627,8 +627,6 @@ pub struct HPETState {
flags: u32,
hpet_offset_migration: BqlCell<u64>,
- #[property(rename = "hpet-offset-saved", default = true)]
- hpet_offset_saved: bool,
irqs: [InterruptSource; HPET_NUM_IRQ_ROUTES],
rtc_irq_level: BqlCell<u32>,
@@ -947,11 +945,6 @@ fn post_load(&self, _version_id: u8) -> Result<(), migration::Infallible> {
tn_regs.last = CLOCK_VIRTUAL.get_ns() - NANOSECONDS_PER_SECOND;
}
- // Recalculate the offset between the main counter and guest time
- if !self.hpet_offset_saved {
- self.hpet_offset_migration
- .set(ticks_to_ns(regs.counter) - CLOCK_VIRTUAL.get_ns());
- }
regs.hpet_offset = self.hpet_offset_migration.get();
Ok(())
@@ -962,7 +955,7 @@ fn is_rtc_irq_level_needed(&self) -> bool {
}
fn is_offset_needed(&self) -> bool {
- self.regs.borrow().is_hpet_enabled() && self.hpet_offset_saved
+ self.regs.borrow().is_hpet_enabled()
}
fn validate_num_timers(&self, _version_id: u8) -> bool {
--
2.53.0
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH v2] hw/timer/hpet: Remove HPETState::hpet_offset_saved field
2026-03-06 9:31 [PATCH v2] hw/timer/hpet: Remove HPETState::hpet_offset_saved field Thomas Huth
@ 2026-03-09 13:58 ` Zhao Liu
2026-03-09 14:06 ` Paolo Bonzini
1 sibling, 0 replies; 3+ messages in thread
From: Zhao Liu @ 2026-03-09 13:58 UTC (permalink / raw)
To: Thomas Huth; +Cc: Paolo Bonzini, qemu-devel, Michael S. Tsirkin, qemu-rust
On Fri, Mar 06, 2026 at 10:31:34AM +0100, Thomas Huth wrote:
> Date: Fri, 6 Mar 2026 10:31:34 +0100
> From: Thomas Huth <thuth@redhat.com>
> Subject: [PATCH v2] hw/timer/hpet: Remove HPETState::hpet_offset_saved field
>
> From: Philippe Mathieu-Daudé <philmd@linaro.org>
>
> The HPETState::hpet_offset_saved boolean was only set in the
> hw_compat_2_11[] array, via the 'hpet-offset-saved=false'
> property. We removed all machines using that array, let's remove
> that property and all the code around it.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> Message-ID: <20250501230129.2596-6-philmd@linaro.org>
> [thuth: Adapted the rust part to the current master branch]
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
> hw/timer/hpet.c | 9 +--------
> rust/hw/timer/hpet/src/device.rs | 9 +--------
> 2 files changed, 2 insertions(+), 16 deletions(-)
Reviewed-by: Zhao Liu <zhao1.liu@intel.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] hw/timer/hpet: Remove HPETState::hpet_offset_saved field
2026-03-06 9:31 [PATCH v2] hw/timer/hpet: Remove HPETState::hpet_offset_saved field Thomas Huth
2026-03-09 13:58 ` Zhao Liu
@ 2026-03-09 14:06 ` Paolo Bonzini
1 sibling, 0 replies; 3+ messages in thread
From: Paolo Bonzini @ 2026-03-09 14:06 UTC (permalink / raw)
To: Thomas Huth; +Cc: qemu-devel, Michael S . Tsirkin, qemu-rust
Queued, thanks.
Paolo
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-03-09 14:06 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-06 9:31 [PATCH v2] hw/timer/hpet: Remove HPETState::hpet_offset_saved field Thomas Huth
2026-03-09 13:58 ` Zhao Liu
2026-03-09 14:06 ` Paolo Bonzini
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox