[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 09/19] hw/ppc: Always store the decrementer value
From: |
Nicholas Piggin |
Subject: |
[PATCH v2 09/19] hw/ppc: Always store the decrementer value |
Date: |
Tue, 8 Aug 2023 14:19:51 +1000 |
When writing a value to the decrementer that raises an exception, the
irq is raised, but the value is not stored so the store doesn't appear
to have changed the register when it is read again.
Always store the write value to the register.
Fixes: e81a982aa53 ("PPC: Clean up DECR implementation")
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
---
hw/ppc/ppc.c | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/hw/ppc/ppc.c b/hw/ppc/ppc.c
index fb4784793c..d9a1cfbf91 100644
--- a/hw/ppc/ppc.c
+++ b/hw/ppc/ppc.c
@@ -841,6 +841,16 @@ static void __cpu_ppc_store_decr(PowerPCCPU *cpu, uint64_t
*nextp,
return;
}
+ /*
+ * Calculate the next decrementer event and set a timer.
+ * decr_next is in timebase units to keep rounding simple. Note it is
+ * not adjusted by tb_offset because if TB changes via tb_offset changing,
+ * decrementer does not change, so not directly comparable with TB.
+ */
+ now = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL);
+ next = ns_to_tb(tb_env->decr_freq, now) + value;
+ *nextp = next; /* nextp is in timebase units */
+
/*
* Going from 1 -> 0 or 0 -> -1 is the event to generate a DEC interrupt.
*
@@ -862,16 +872,6 @@ static void __cpu_ppc_store_decr(PowerPCCPU *cpu, uint64_t
*nextp,
(*lower_excp)(cpu);
}
- /*
- * Calculate the next decrementer event and set a timer.
- * decr_next is in timebase units to keep rounding simple. Note it is
- * not adjusted by tb_offset because if TB changes via tb_offset changing,
- * decrementer does not change, so not directly comparable with TB.
- */
- now = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL);
- next = ns_to_tb(tb_env->decr_freq, now) + value;
- *nextp = next;
-
/* Adjust timer */
timer_mod(timer, tb_to_ns_round_up(tb_env->decr_freq, next));
}
--
2.40.1
- [PATCH v2 for-8.2 00/19] ppc: record-replay enablement and fixes, Nicholas Piggin, 2023/08/08
- [PATCH v2 01/19] ppc/vhyp: reset exception state when handling vhyp hcall, Nicholas Piggin, 2023/08/08
- [PATCH v2 02/19] ppc/vof: Fix missed fields in VOF cleanup, Nicholas Piggin, 2023/08/08
- [PATCH v2 03/19] hw/ppc/ppc.c: Tidy over-long lines, Nicholas Piggin, 2023/08/08
- [PATCH v2 04/19] hw/ppc: Introduce functions for conversion between timebase and nanoseconds, Nicholas Piggin, 2023/08/08
- [PATCH v2 05/19] host-utils: Add muldiv64_round_up, Nicholas Piggin, 2023/08/08
- [PATCH v2 06/19] hw/ppc: Round up the decrementer interval when converting to ns, Nicholas Piggin, 2023/08/08
- [PATCH v2 07/19] hw/ppc: Avoid decrementer rounding errors, Nicholas Piggin, 2023/08/08
- [PATCH v2 08/19] target/ppc: Sign-extend large decrementer to 64-bits, Nicholas Piggin, 2023/08/08
- [PATCH v2 09/19] hw/ppc: Always store the decrementer value,
Nicholas Piggin <=
- [PATCH v2 10/19] target/ppc: Migrate DECR SPR, Nicholas Piggin, 2023/08/08
- [PATCH v2 11/19] hw/ppc: Reset timebase facilities on machine reset, Nicholas Piggin, 2023/08/08
- [PATCH v2 12/19] hw/ppc: Read time only once to perform decrementer write, Nicholas Piggin, 2023/08/08
- [PATCH v2 13/19] target/ppc: Fix CPU reservation migration for record-replay, Nicholas Piggin, 2023/08/08
- [PATCH v2 14/19] target/ppc: Fix timebase reset with record-replay, Nicholas Piggin, 2023/08/08
- [PATCH v2 15/19] spapr: Fix machine reset deadlock from replay-record, Nicholas Piggin, 2023/08/08
- [PATCH v2 16/19] spapr: Fix record-replay machine reset consuming too many events, Nicholas Piggin, 2023/08/08
- [PATCH v2 17/19] tests/avocado: boot ppc64 pseries replay-record test to Linux VFS mount, Nicholas Piggin, 2023/08/08