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>
This commit is contained in:
parent
7defb58baf
commit
a453bf0354
1 changed files with 10 additions and 8 deletions
|
|
@ -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:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue