[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-ppc] [RFC 4/4] target-ppc: hack to remove existing timebase migrat
From: |
Mark Cave-Ayland |
Subject: |
[Qemu-ppc] [RFC 4/4] target-ppc: hack to remove existing timebase migration code for testing |
Date: |
Thu, 7 Apr 2016 16:23:14 +0100 |
Signed-off-by: Mark Cave-Ayland <address@hidden>
---
hw/ppc/ppc.c | 45 +++++++--------------------------------------
1 file changed, 7 insertions(+), 38 deletions(-)
diff --git a/hw/ppc/ppc.c b/hw/ppc/ppc.c
index 39e15b1..053e600 100644
--- a/hw/ppc/ppc.c
+++ b/hw/ppc/ppc.c
@@ -858,47 +858,15 @@ static void timebase_pre_save(void *opaque)
static int timebase_post_load(void *opaque, int version_id)
{
- PPCTimebase *tb_remote = opaque;
- CPUState *cpu;
- PowerPCCPU *first_ppc_cpu = POWERPC_CPU(first_cpu);
- int64_t tb_off_adj, tb_off, ns_diff;
- int64_t migration_duration_ns, migration_duration_tb, guest_tb, host_ns;
- unsigned long freq;
-
- if (!first_ppc_cpu->env.tb_env) {
- error_report("No timebase object");
- return -1;
- }
-
- freq = first_ppc_cpu->env.tb_env->tb_freq;
- /*
- * Calculate timebase on the destination side of migration.
- * The destination timebase must be not less than the source timebase.
- * We try to adjust timebase by downtime if host clocks are not
- * too much out of sync (1 second for now).
- */
- host_ns = qemu_clock_get_ns(QEMU_CLOCK_HOST);
- ns_diff = MAX(0, host_ns - tb_remote->time_of_the_day_ns);
- migration_duration_ns = MIN(NANOSECONDS_PER_SECOND, ns_diff);
- migration_duration_tb = muldiv64(migration_duration_ns, freq,
- NANOSECONDS_PER_SECOND);
- guest_tb = tb_remote->guest_timebase + MIN(0, migration_duration_tb);
-
- tb_off_adj = guest_tb - cpu_get_host_ticks();
-
- tb_off = first_ppc_cpu->env.tb_env->tb_offset;
- trace_ppc_tb_adjust(tb_off, tb_off_adj, tb_off_adj - tb_off,
- (tb_off_adj - tb_off) / freq);
-
- /* Set new offset to all CPUs */
- CPU_FOREACH(cpu) {
- PowerPCCPU *pcpu = POWERPC_CPU(cpu);
- pcpu->env.tb_env->tb_offset = tb_off_adj;
- }
-
+ /* Now handled via ppc_machine_change_state() */
return 0;
}
+static bool timebase_needed(void *opaque)
+{
+ return false;
+}
+
const VMStateDescription vmstate_ppc_timebase = {
.name = "timebase",
.version_id = 1,
@@ -906,6 +874,7 @@ const VMStateDescription vmstate_ppc_timebase = {
.minimum_version_id_old = 1,
.pre_save = timebase_pre_save,
.post_load = timebase_post_load,
+ .needed = timebase_needed,
.fields = (VMStateField []) {
VMSTATE_UINT64(guest_timebase, PPCTimebase),
VMSTATE_INT64(time_of_the_day_ns, PPCTimebase),
--
1.7.10.4