diff options
author | Igor Mammedov <imammedo@redhat.com> | 2017-10-17 17:13:23 +0200 |
---|---|---|
committer | Cornelia Huck <cohuck@redhat.com> | 2017-10-20 13:32:10 +0200 |
commit | 32dc6aa061e76c9acaefff1faa48ab479672ea53 (patch) | |
tree | 871a119dd5da8fd5ec903af778d937a28416fe25 /hw/s390x | |
parent | ac7e4cbbabae5a8e0d3948ddebf33351e61497c3 (diff) |
s390x: move s390x_new_cpu() into board code
s390-virtio-ccw.c is the sole user of s390x_new_cpu(),
so move this helper there.
Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Message-Id: <1508253203-119237-1-git-send-email-imammedo@redhat.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
Diffstat (limited to 'hw/s390x')
-rw-r--r-- | hw/s390x/s390-virtio-ccw.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c index e4474587aa..baeafdcb1c 100644 --- a/hw/s390x/s390-virtio-ccw.c +++ b/hw/s390x/s390-virtio-ccw.c @@ -52,6 +52,27 @@ S390CPU *s390_cpu_addr2state(uint16_t cpu_addr) return S390_CPU(ms->possible_cpus->cpus[cpu_addr].cpu); } +static S390CPU *s390x_new_cpu(const char *typename, uint32_t core_id, + Error **errp) +{ + S390CPU *cpu = S390_CPU(object_new(typename)); + Error *err = NULL; + + object_property_set_int(OBJECT(cpu), core_id, "core-id", &err); + if (err != NULL) { + goto out; + } + object_property_set_bool(OBJECT(cpu), true, "realized", &err); + +out: + object_unref(OBJECT(cpu)); + if (err) { + error_propagate(errp, err); + cpu = NULL; + } + return cpu; +} + static void s390_init_cpus(MachineState *machine) { MachineClass *mc = MACHINE_GET_CLASS(machine); |