[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 18/35] target/ppc: Migrate DECR SPR
From: |
Cédric Le Goater |
Subject: |
[PULL 18/35] target/ppc: Migrate DECR SPR |
Date: |
Mon, 4 Sep 2023 11:06:13 +0200 |
From: Nicholas Piggin <npiggin@gmail.com>
TCG does not maintain the DEC reigster in the SPR array, so it does get
migrated. TCG also needs to re-start the decrementer timer on the
destination machine.
Load and store the decrementer into the SPR when migrating. This works
for the level-triggered (book3s) decrementer, and should be compatible
with existing KVM machines that do keep the DEC value there.
This fixes lost decrementer interrupt on migration that can cause
hangs, as well as other problems including record-replay bugs.
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Cédric Le Goater <clg@kaod.org>
---
target/ppc/machine.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/target/ppc/machine.c b/target/ppc/machine.c
index 8234e35d69f8..8a190c485363 100644
--- a/target/ppc/machine.c
+++ b/target/ppc/machine.c
@@ -209,6 +209,14 @@ static int cpu_pre_save(void *opaque)
/* Used to retain migration compatibility for pre 6.0 for 601 machines. */
env->hflags_compat_nmsr = 0;
+ if (tcg_enabled()) {
+ /*
+ * TCG does not maintain the DECR spr (unlike KVM) so have to save
+ * it here.
+ */
+ env->spr[SPR_DECR] = cpu_ppc_load_decr(env);
+ }
+
return 0;
}
@@ -319,6 +327,12 @@ static int cpu_post_load(void *opaque, int version_id)
ppc_update_ciabr(env);
ppc_update_daw0(env);
#endif
+ /*
+ * TCG needs to re-start the decrementer timer and/or raise the
+ * interrupt. This works for level-triggered decrementer. Edge
+ * triggered types (including HDEC) would need to carry more state.
+ */
+ cpu_ppc_store_decr(env, env->spr[SPR_DECR]);
pmu_mmcr01_updated(env);
}
--
2.41.0
- [PULL 08/35] spapr: implement H_SET_MODE debug facilities, (continued)
- [PULL 08/35] spapr: implement H_SET_MODE debug facilities, Cédric Le Goater, 2023/09/04
- [PULL 09/35] ppc/vhyp: reset exception state when handling vhyp hcall, Cédric Le Goater, 2023/09/04
- [PULL 10/35] ppc/vof: Fix missed fields in VOF cleanup, Cédric Le Goater, 2023/09/04
- [PULL 11/35] hw/ppc/ppc.c: Tidy over-long lines, Cédric Le Goater, 2023/09/04
- [PULL 12/35] hw/ppc: Introduce functions for conversion between timebase and nanoseconds, Cédric Le Goater, 2023/09/04
- [PULL 13/35] host-utils: Add muldiv64_round_up, Cédric Le Goater, 2023/09/04
- [PULL 14/35] hw/ppc: Round up the decrementer interval when converting to ns, Cédric Le Goater, 2023/09/04
- [PULL 15/35] hw/ppc: Avoid decrementer rounding errors, Cédric Le Goater, 2023/09/04
- [PULL 16/35] target/ppc: Sign-extend large decrementer to 64-bits, Cédric Le Goater, 2023/09/04
- [PULL 17/35] hw/ppc: Always store the decrementer value, Cédric Le Goater, 2023/09/04
- [PULL 18/35] target/ppc: Migrate DECR SPR,
Cédric Le Goater <=
- [PULL 19/35] hw/ppc: Reset timebase facilities on machine reset, Cédric Le Goater, 2023/09/04
- [PULL 20/35] hw/ppc: Read time only once to perform decrementer write, Cédric Le Goater, 2023/09/04
- [PULL 21/35] target/ppc: Fix CPU reservation migration for record-replay, Cédric Le Goater, 2023/09/04
- [PULL 23/35] spapr: Fix machine reset deadlock from replay-record, Cédric Le Goater, 2023/09/04
- [PULL 25/35] tests/avocado: boot ppc64 pseries replay-record test to Linux VFS mount, Cédric Le Goater, 2023/09/04
- [PULL 24/35] spapr: Fix record-replay machine reset consuming too many events, Cédric Le Goater, 2023/09/04
- [PULL 22/35] target/ppc: Fix timebase reset with record-replay, Cédric Le Goater, 2023/09/04
- [PULL 27/35] tests/avocado: ppc64 reverse debugging tests for pseries and powernv, Cédric Le Goater, 2023/09/04
- [PULL 26/35] tests/avocado: reverse-debugging cope with re-executing breakpoints, Cédric Le Goater, 2023/09/04
- [PULL 28/35] target/ppc: Fix LQ, STQ register-pair order for big-endian, Cédric Le Goater, 2023/09/04