Moving reset callback into cpu object from board level will allow properly create object during run-time (hotplug).
When reset over QOM hierarchy is implemented, this reset callback should be removed. Signed-off-by: Igor Mammedov <imamm...@redhat.com> --- hw/pc.c | 7 ------- target-i386/cpu.c | 8 ++++++++ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/hw/pc.c b/hw/pc.c index 677f9e0..70dd0e6 100644 --- a/hw/pc.c +++ b/hw/pc.c @@ -888,12 +888,6 @@ void pc_acpi_smi_interrupt(void *opaque, int irq, int level) } } -static void pc_cpu_reset(void *opaque) -{ - X86CPU *cpu = opaque; - cpu_reset(CPU(cpu)); -} - void pc_cpus_init(const char *cpu_model) { X86CPU *cpu; @@ -904,7 +898,6 @@ void pc_cpus_init(const char *cpu_model) if (cpu == NULL) { exit(1); } - qemu_register_reset(pc_cpu_reset, cpu); } } diff --git a/target-i386/cpu.c b/target-i386/cpu.c index 0e804ea..87f4f5a 100644 --- a/target-i386/cpu.c +++ b/target-i386/cpu.c @@ -1716,6 +1716,13 @@ static void x86_cpu_reset(CPUState *s) env->halted = !(cpu_get_apic_base(env->apic_state) & MSR_IA32_APICBASE_BSP); } +/* TODO: remove me, when reset over QOM tree is implemented */ +static void x86_cpu_machine_reset_cb(void *opaque) +{ + X86CPU *cpu = opaque; + cpu_reset(CPU(cpu)); +} + static void mce_init(X86CPU *cpu) { CPUX86State *cenv = &cpu->env; @@ -1812,6 +1819,7 @@ void x86_cpu_realize(Object *obj, Error **errp) mce_init(cpu); qemu_init_vcpu(env); + qemu_register_reset(x86_cpu_machine_reset_cb, cpu); cpu_reset(CPU(cpu)); } -- 1.7.7.6