From 2f34ebf222d6a9367665a4bf78b8c861a988c1d0 Mon Sep 17 00:00:00 2001 From: Liam Merwick <liam.merwick@oracle.com> Date: Mon, 18 Nov 2019 11:13:25 +0000 Subject: hw/i386: Move save_tsc_khz from PCMachineClass to X86MachineClass Attempting to migrate a VM using the microvm machine class results in the source QEMU aborting with the following message/backtrace: target/i386/machine.c:955:tsc_khz_needed: Object 0x555556608fa0 is not an instance of type generic-pc-machine abort() object_class_dynamic_cast_assert() vmstate_save_state_v() vmstate_save_state() vmstate_save() qemu_savevm_state_complete_precopy() migration_thread() migration_thread() migration_thread() qemu_thread_start() start_thread() clone() The access to the machine class returned by MACHINE_GET_CLASS() in tsc_khz_needed() is crashing as it is trying to dereference a different type of machine class object (TYPE_PC_MACHINE) to that of this microVM. This can be resolved by extending the changes in the following commit f0bb276bf8d5 ("hw/i386: split PCMachineState deriving X86MachineState from it") and moving the save_tsc_khz field in PCMachineClass to X86MachineClass. Fixes: f0bb276bf8d5 ("hw/i386: split PCMachineState deriving X86MachineState from it") Signed-off-by: Liam Merwick <liam.merwick@oracle.com> Reviewed-by: Darren Kenny <darren.kenny@oracle.com> Message-Id: <1574075605-25215-1-git-send-email-liam.merwick@oracle.com> Reviewed-by: Sergio Lopez <slp@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> --- include/hw/i386/pc.h | 2 -- include/hw/i386/x86.h | 2 ++ 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index e6fa8418ca..1f86eba3f9 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -116,8 +116,6 @@ typedef struct PCMachineClass { bool enforce_aligned_dimm; bool broken_reserved_end; - /* TSC rate migration: */ - bool save_tsc_khz; /* generate legacy CPU hotplug AML */ bool legacy_cpu_hotplug; diff --git a/include/hw/i386/x86.h b/include/hw/i386/x86.h index 82d09fd7d0..4b84917885 100644 --- a/include/hw/i386/x86.h +++ b/include/hw/i386/x86.h @@ -30,6 +30,8 @@ typedef struct { /*< public >*/ + /* TSC rate migration: */ + bool save_tsc_khz; /* Enables contiguous-apic-ID mode */ bool compat_apic_id_mode; } X86MachineClass; -- cgit v1.2.3