diff options
author | Matthew Rosato <mjrosato@linux.vnet.ibm.com> | 2016-03-04 12:34:33 -0500 |
---|---|---|
committer | Cornelia Huck <cornelia.huck@de.ibm.com> | 2016-03-10 10:37:15 +0100 |
commit | 502edbf834a3c86a8ab40b23e040a45198301e1c (patch) | |
tree | 36afed5c16025916f5071f6402b5ee15b542d754 /hw/s390x/s390-virtio.c | |
parent | 25637d31f2d76f61c078b151ab7912e8d2246b9e (diff) |
s390x/cpu: Add CPU property links
Link each CPUState as property machine/cpu[n] during initialization.
Add a hotplug handler to s390-virtio-ccw machine and set the
state during plug.
Signed-off-by: Matthew Rosato <mjrosato@linux.vnet.ibm.com>
Reviewed-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Message-Id: <1457112875-5209-6-git-send-email-mjrosato@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Diffstat (limited to 'hw/s390x/s390-virtio.c')
-rw-r--r-- | hw/s390x/s390-virtio.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/hw/s390x/s390-virtio.c b/hw/s390x/s390-virtio.c index 57c3c88afd..f00d6b4bae 100644 --- a/hw/s390x/s390-virtio.c +++ b/hw/s390x/s390-virtio.c @@ -97,6 +97,7 @@ void s390_init_ipl_dev(const char *kernel_filename, void s390_init_cpus(MachineState *machine) { int i; + gchar *name; if (machine->cpu_model == NULL) { machine->cpu_model = "host"; @@ -104,12 +105,18 @@ void s390_init_cpus(MachineState *machine) cpu_states = g_malloc0(sizeof(S390CPU *) * max_cpus); - for (i = 0; i < smp_cpus; i++) { - S390CPU *cpu; - - cpu = cpu_s390x_init(machine->cpu_model); + for (i = 0; i < max_cpus; i++) { + name = g_strdup_printf("cpu[%i]", i); + object_property_add_link(OBJECT(machine), name, TYPE_S390_CPU, + (Object **) &cpu_states[i], + object_property_allow_set_link, + OBJ_PROP_LINK_UNREF_ON_RELEASE, + &error_abort); + g_free(name); + } - cpu_states[i] = cpu; + for (i = 0; i < smp_cpus; i++) { + cpu_s390x_init(machine->cpu_model); } } |