[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 16/67] hw/ppc: fix decrementer with BookE timers
From: |
Nicholas Piggin |
Subject: |
[PULL 16/67] hw/ppc: fix decrementer with BookE timers |
Date: |
Mon, 4 Nov 2024 10:18:05 +1000 |
From: Clément Chigot <chigot@adacore.com>
The BookE decrementer stops at 0, meaning that it won't decremented
towards "negative" values. However, the current logic is inverted: decr
is updated solely when the resulting value would be negative.
Signed-off-by: Clément Chigot <chigot@adacore.com>
Fixes: 8e0a5ac87800 ("hw/ppc: Avoid decrementer rounding errors")
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
---
hw/ppc/ppc.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/hw/ppc/ppc.c b/hw/ppc/ppc.c
index fde4619412..b86b5847de 100644
--- a/hw/ppc/ppc.c
+++ b/hw/ppc/ppc.c
@@ -728,7 +728,9 @@ static inline int64_t __cpu_ppc_load_decr(CPUPPCState *env,
int64_t now,
int64_t decr;
n = ns_to_tb(tb_env->decr_freq, now);
- if (next > n && tb_env->flags & PPC_TIMER_BOOKE) {
+
+ /* BookE timers stop when reaching 0. */
+ if (next < n && tb_env->flags & PPC_TIMER_BOOKE) {
decr = 0;
} else {
decr = next - n;
--
2.45.2
- [PULL 08/67] target/ppc: Fix HFSCR facility checks, (continued)
- [PULL 08/67] target/ppc: Fix HFSCR facility checks, Nicholas Piggin, 2024/11/03
- [PULL 09/67] target/ppc: Fix VRMA to not check virtual page class key protection, Nicholas Piggin, 2024/11/03
- [PULL 10/67] ppc/pnv: ADU fix possible buffer overrun with invalid size, Nicholas Piggin, 2024/11/03
- [PULL 11/67] MAINTAINERS: Cover PowerPC SPI model in PowerNV section, Nicholas Piggin, 2024/11/03
- [PULL 12/67] hw/ssi/pnv_spi: Match _xfer_buffer_free() with _xfer_buffer_new(), Nicholas Piggin, 2024/11/03
- [PULL 13/67] hw/ssi/pnv_spi: Return early in transfer(), Nicholas Piggin, 2024/11/03
- [PULL 14/67] hw/ssi/pnv_spi: Fixes Coverity CID 1558831, Nicholas Piggin, 2024/11/03
- [PULL 15/67] tests/tcg: Replace -mpower8-vector with -mcpu=power8, Nicholas Piggin, 2024/11/03
- [PULL 16/67] hw/ppc: fix decrementer with BookE timers,
Nicholas Piggin <=
- [PULL 17/67] ppc/spapr: remove deprecated machine pseries-2.1, Nicholas Piggin, 2024/11/03
- [PULL 18/67] ppc/spapr: remove deprecated machine pseries-2.2, Nicholas Piggin, 2024/11/03
- [PULL 23/67] ppc/spapr: remove deprecated machine pseries-2.7, Nicholas Piggin, 2024/11/03
- [PULL 21/67] ppc/spapr: remove deprecated machine pseries-2.5, Nicholas Piggin, 2024/11/03
- [PULL 19/67] ppc/spapr: remove deprecated machine pseries-2.3, Nicholas Piggin, 2024/11/03
- [PULL 20/67] ppc/spapr: remove deprecated machine pseries-2.4, Nicholas Piggin, 2024/11/03
- [PULL 22/67] ppc/spapr: remove deprecated machine pseries-2.6, Nicholas Piggin, 2024/11/03
- [PULL 25/67] ppc/spapr: remove deprecated machine pseries-2.9, Nicholas Piggin, 2024/11/03
- [PULL 24/67] ppc/spapr: remove deprecated machine pseries-2.8, Nicholas Piggin, 2024/11/03
- [PULL 26/67] ppc/spapr: remove deprecated machine pseries-2.10, Nicholas Piggin, 2024/11/03