@@ -1040,13 +1040,16 @@ void pc_acpi_smi_interrupt(void *opaque, int irq, int level)
}
static X86CPU *pc_new_cpu(const char *typename, int64_t apic_id,
- Error **errp)
+ Error **errp, int migration_id)
{
X86CPU *cpu = NULL;
+ CPUState *cs;
Error *local_err = NULL;
cpu = X86_CPU(object_new(typename));
+ cs = CPU(cpu);
+ cs->migration_id = migration_id;
object_property_set_int(OBJECT(cpu), apic_id, "apic-id", &local_err);
object_property_set_bool(OBJECT(cpu), true, "realized", &local_err);
@@ -1092,7 +1095,7 @@ void pc_hot_add_cpu(const int64_t id, Error **errp)
assert(pcms->possible_cpus->cpus[0].cpu); /* BSP is always present */
oc = OBJECT_CLASS(CPU_GET_CLASS(pcms->possible_cpus->cpus[0].cpu));
- cpu = pc_new_cpu(object_class_get_name(oc), apic_id, &local_err);
+ cpu = pc_new_cpu(object_class_get_name(oc), apic_id, &local_err, id);
if (local_err) {
error_propagate(errp, local_err);
return;
@@ -1156,7 +1159,7 @@ void pc_cpus_init(PCMachineState *pcms)
pcms->possible_cpus->len++;
if (i < smp_cpus) {
cpu = pc_new_cpu(typename, x86_cpu_apic_id_from_index(i),
- &error_fatal);
+ &error_fatal, i);
pcms->possible_cpus->cpus[i].cpu = CPU(cpu);
object_unref(OBJECT(cpu));
}
@@ -373,6 +373,11 @@ bool e820_get_entry(int, uint32_t, uint64_t *, uint64_t *);
.driver = "vmxnet3",\
.property = "romfile",\
.value = "",\
+ },\
+ { \
+ .driver = TYPE_CPU, \
+ .property = "use-migration-id", \
+ .value = "off", \
},
#define PC_COMPAT_2_5 \
As described in commit: cpu: add migration_id to allow board to provide migration instance_id set CPUState::migration_id explictly to stable index in pcms->possible_cpus so that CPU's instance_id on target would match instance_id on source even if not the last added CPU is removed. Signed-off-by: Igor Mammedov <imammedo@redhat.com> --- hw/i386/pc.c | 9 ++++++--- include/hw/i386/pc.h | 5 +++++ 2 files changed, 11 insertions(+), 3 deletions(-)