[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 10/20] hpet: fix HPET_TN_SETVAL for high 32-bits of the comparator
From: |
Paolo Bonzini |
Subject: |
[PULL 10/20] hpet: fix HPET_TN_SETVAL for high 32-bits of the comparator |
Date: |
Wed, 17 Jul 2024 07:03:20 +0200 |
Commit 3787324101b ("hpet: Fix emulation of HPET_TN_SETVAL (Jan Kiszka)",
2009-04-17) applied the fix only to the low 32-bits of the comparator, but
it should be done for the high bits as well. Otherwise, the high 32-bits
of the comparator cannot be written and they remain fixed to 0xffffffff.
Co-developed-by: TaiseiIto <taisei1212@outlook.jp>
Signed-off-by: TaiseiIto <taisei1212@outlook.jp>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
hw/timer/hpet.c | 19 ++++++++++++-------
1 file changed, 12 insertions(+), 7 deletions(-)
diff --git a/hw/timer/hpet.c b/hw/timer/hpet.c
index ad881448bf3..4cb5393c0b5 100644
--- a/hw/timer/hpet.c
+++ b/hw/timer/hpet.c
@@ -554,6 +554,10 @@ static void hpet_ram_write(void *opaque, hwaddr addr,
timer->period =
(timer->period & 0xffffffff00000000ULL) | new_val;
}
+ /*
+ * FIXME: on a 64-bit write, HPET_TN_SETVAL should apply to the
+ * high bits part as well.
+ */
timer->config &= ~HPET_TN_SETVAL;
if (hpet_enabled(s)) {
hpet_set_timer(timer);
@@ -564,7 +568,8 @@ static void hpet_ram_write(void *opaque, hwaddr addr,
if (!timer_is_periodic(timer)
|| (timer->config & HPET_TN_SETVAL)) {
timer->cmp = (timer->cmp & 0xffffffffULL) | new_val << 32;
- } else {
+ }
+ if (timer_is_periodic(timer)) {
/*
* FIXME: Clamp period to reasonable min value?
* Clamp period to reasonable max value
@@ -572,12 +577,12 @@ static void hpet_ram_write(void *opaque, hwaddr addr,
new_val = MIN(new_val, ~0u >> 1);
timer->period =
(timer->period & 0xffffffffULL) | new_val << 32;
- }
- timer->config &= ~HPET_TN_SETVAL;
- if (hpet_enabled(s)) {
- hpet_set_timer(timer);
- }
- break;
+ }
+ timer->config &= ~HPET_TN_SETVAL;
+ if (hpet_enabled(s)) {
+ hpet_set_timer(timer);
+ }
+ break;
case HPET_TN_ROUTE:
timer->fsb = (timer->fsb & 0xffffffff00000000ULL) | new_val;
break;
--
2.45.2
- [PULL 01/20] i386/sev: Don't allow automatic fallback to legacy KVM_SEV*_INIT, (continued)
- [PULL 01/20] i386/sev: Don't allow automatic fallback to legacy KVM_SEV*_INIT, Paolo Bonzini, 2024/07/17
- [PULL 03/20] cpu: Free queued CPU work, Paolo Bonzini, 2024/07/17
- [PULL 02/20] Revert "qemu-char: do not operate on sources from finalize callbacks", Paolo Bonzini, 2024/07/17
- [PULL 04/20] disas: Fix build against Capstone v6, Paolo Bonzini, 2024/07/17
- [PULL 06/20] scsi: fix regression and honor bootindex again for legacy drives, Paolo Bonzini, 2024/07/17
- [PULL 07/20] qemu/timer: Add host ticks function for LoongArch, Paolo Bonzini, 2024/07/17
- [PULL 05/20] hw/scsi/lsi53c895a: bump instruction limit in scripts processing to fix regression, Paolo Bonzini, 2024/07/17
- [PULL 09/20] hpet: fix clamping of period, Paolo Bonzini, 2024/07/17
- [PULL 08/20] docs: Update description of 'user=username' for '-run-with', Paolo Bonzini, 2024/07/17
- [PULL 11/20] target/i386/tcg: fix POP to memory in long mode, Paolo Bonzini, 2024/07/17
- [PULL 10/20] hpet: fix HPET_TN_SETVAL for high 32-bits of the comparator,
Paolo Bonzini <=
- [PULL 13/20] target/i386/tcg: Allow IRET from user mode to user mode with SMAP, Paolo Bonzini, 2024/07/17
- [PULL 14/20] target/i386/tcg: use PUSHL/PUSHW for error code, Paolo Bonzini, 2024/07/17
- [PULL 15/20] target/i386/tcg: Reorg push/pop within seg_helper.c, Paolo Bonzini, 2024/07/17
- [PULL 18/20] target/i386/tcg: check for correct busy state before switching to a new task, Paolo Bonzini, 2024/07/17
- [PULL 20/20] target/i386/tcg: save current task state before loading new one, Paolo Bonzini, 2024/07/17
- [PULL 16/20] target/i386/tcg: Introduce x86_mmu_index_{kernel_,}pl, Paolo Bonzini, 2024/07/17
- [PULL 19/20] target/i386/tcg: use X86Access for TSS access, Paolo Bonzini, 2024/07/17
- [PULL 17/20] target/i386/tcg: Compute MMU index once, Paolo Bonzini, 2024/07/17
- [PULL 12/20] target/i386/tcg: Remove SEG_ADDL, Paolo Bonzini, 2024/07/17
- Re: [PULL 00/20] i386, bugfix changes for QEMU 9.1 soft freeze, Richard Henderson, 2024/07/17