diff options
author | Igor Mammedov <imammedo@redhat.com> | 2025-08-14 18:05:56 +0200 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2025-08-29 12:48:14 +0200 |
commit | a453bf0354412592362139bdf4df0d4900ec0686 (patch) | |
tree | 72889db86337868cc69a76b98be7813294d2420b | |
parent | 7defb58bafac8dcb23c06be5e4f2d1a33d8392fd (diff) | |
download | qemu-a453bf0354412592362139bdf4df0d4900ec0686.zip qemu-a453bf0354412592362139bdf4df0d4900ec0686.tar.gz qemu-a453bf0354412592362139bdf4df0d4900ec0686.tar.bz2 |
hpet: move out main counter read into a separate block
Follow up patche will switch main counter read to
lock-less mode. As preparation for that move relevant
branch into a separate top level block to make followup
patch cleaner/simplier by reducing contextual noise
when lock-less read is introduced.
no functional changes.
Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Peter Xu <peterx@redhat.com>
Link: https://lore.kernel.org/r/20250814160600.2327672-5-imammedo@redhat.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-rw-r--r-- | hw/timer/hpet.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/hw/timer/hpet.c b/hw/timer/hpet.c index ab5aa59..c776afc 100644 --- a/hw/timer/hpet.c +++ b/hw/timer/hpet.c @@ -431,6 +431,16 @@ static uint64_t hpet_ram_read(void *opaque, hwaddr addr, addr &= ~4; QEMU_LOCK_GUARD(&s->lock); + if (addr == HPET_COUNTER) { + if (hpet_enabled(s)) { + cur_tick = hpet_get_ticks(s); + } else { + cur_tick = s->hpet_counter; + } + trace_hpet_ram_read_reading_counter(addr & 4, cur_tick); + return cur_tick >> shift; + } + /*address range of all global regs*/ if (addr <= 0xff) { switch (addr) { @@ -438,14 +448,6 @@ static uint64_t hpet_ram_read(void *opaque, hwaddr addr, return s->capability >> shift; case HPET_CFG: return s->config >> shift; - case HPET_COUNTER: - if (hpet_enabled(s)) { - cur_tick = hpet_get_ticks(s); - } else { - cur_tick = s->hpet_counter; - } - trace_hpet_ram_read_reading_counter(addr & 4, cur_tick); - return cur_tick >> shift; case HPET_STATUS: return s->isr >> shift; default: |