]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
rust: hpet: fix decoding of timer registers
authorPaolo Bonzini <pbonzini@redhat.com>
Fri, 21 Mar 2025 13:17:52 +0000 (14:17 +0100)
committerPaolo Bonzini <pbonzini@redhat.com>
Fri, 21 Mar 2025 18:34:36 +0000 (19:34 +0100)
Due to a missing "& 0x18", timer registers are not decoded correctly.
This breaks the tests/functional/test_x86_64_tuxrun.py functional
test.

Fixes: 519088b7cf6 ("rust: hpet: decode HPET registers into enums", 2025-03-06)
Reported-by: Peter Maydell <peter.maydell@linaro.org>
Tested-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
rust/hw/timer/hpet/src/hpet.rs

index 63c1971f0b5b5f0998812cad81525a97f20a4881..3ae3ec25f17a63b9e480f8cb5e873cfc32fd456b 100644 (file)
@@ -776,7 +776,7 @@ impl HPETState {
             let timer_id: usize = ((addr - 0x100) / 0x20) as usize;
             if timer_id <= self.num_timers.get() {
                 // TODO: Add trace point - trace_hpet_ram_[read|write]_timer_id(timer_id)
-                TimerRegister::try_from(addr)
+                TimerRegister::try_from(addr & 0x18)
                     .map(|reg| HPETRegister::Timer(&self.timers[timer_id], reg))
             } else {
                 // TODO: Add trace point -  trace_hpet_timer_id_out_of_range(timer_id)