From: Thomas Huth <thuth@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>, qemu-devel@nongnu.org
Cc: "Michael S. Tsirkin" <mst@redhat.com>, qemu-rust@nongnu.org
Subject: [PATCH v2] hw/timer/hpet: Remove HPETState::hpet_offset_saved field
Date: Fri, 6 Mar 2026 10:31:34 +0100 [thread overview]
Message-ID: <20260306093134.27789-1-thuth@redhat.com> (raw)
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
next reply other threads:[~2026-03-06 9:32 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-06 9:31 Thomas Huth [this message]
2026-03-09 13:58 ` [PATCH v2] hw/timer/hpet: Remove HPETState::hpet_offset_saved field Zhao Liu
2026-03-09 14:06 ` Paolo Bonzini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260306093134.27789-1-thuth@redhat.com \
--to=thuth@redhat.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-rust@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox