[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-ppc] [PATCH v2 6/7] spapr: use ppc_set_vcpu_dt_id() in CPU hotplug
From: |
Greg Kurz |
Subject: |
[Qemu-ppc] [PATCH v2 6/7] spapr: use ppc_set_vcpu_dt_id() in CPU hotplug code |
Date: |
Sat, 02 Jul 2016 00:42:04 +0200 |
User-agent: |
StGit/0.17.1-dirty |
Starting with version 2.7, pseries machine now support hotplug of
cpu cores. The implementation requires to open code cpu creation
and thus does not call ppc_cpu_init().
This patch does all the plumbing to allow pseries machine types
with version >= 2.7 to generate cpu DT ids out of the indexes
of the cores and threads in their respective arrays.
Suggested-by: Igor Mammedov <address@hidden>
Signed-off-by: Greg Kurz <address@hidden>
---
hw/ppc/ppc.c | 2 +-
hw/ppc/spapr_cpu_core.c | 11 +++++++++--
include/hw/ppc/ppc.h | 1 +
3 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/hw/ppc/ppc.c b/hw/ppc/ppc.c
index dbc8ac7b3a9b..12de255fb211 100644
--- a/hw/ppc/ppc.c
+++ b/hw/ppc/ppc.c
@@ -1352,7 +1352,7 @@ PowerPCCPU *ppc_get_vcpu_by_dt_id(int cpu_dt_id)
return NULL;
}
-static void ppc_set_vcpu_dt_id(PowerPCCPU *cpu, int cpu_index, Error **errp)
+void ppc_set_vcpu_dt_id(PowerPCCPU *cpu, int cpu_index, Error **errp)
{
;
}
diff --git a/hw/ppc/spapr_cpu_core.c b/hw/ppc/spapr_cpu_core.c
index 70b6b0b5ee17..475c8063f086 100644
--- a/hw/ppc/spapr_cpu_core.c
+++ b/hw/ppc/spapr_cpu_core.c
@@ -259,13 +259,20 @@ out:
error_propagate(errp, local_err);
}
-static void spapr_cpu_core_realize_child(Object *child, Error **errp)
+static void spapr_cpu_core_realize_child(Object *child, int cpu_index,
+ Error **errp)
{
Error *local_err = NULL;
sPAPRMachineState *spapr = SPAPR_MACHINE(qdev_get_machine());
CPUState *cs = CPU(child);
PowerPCCPU *cpu = POWERPC_CPU(cs);
+ ppc_set_vcpu_dt_id(cpu, cpu_index, &local_err);
+ if (local_err) {
+ error_propagate(errp, local_err);
+ return;
+ }
+
object_property_set_bool(child, true, "realized", &local_err);
if (local_err) {
error_propagate(errp, local_err);
@@ -306,7 +313,7 @@ static void spapr_cpu_core_realize(DeviceState *dev, Error
**errp)
for (j = 0; j < cc->nr_threads; j++) {
obj = sc->threads + j * size;
- spapr_cpu_core_realize_child(obj, &local_err);
+ spapr_cpu_core_realize_child(obj, cc->core_id + j, &local_err);
if (local_err) {
goto err;
}
diff --git a/include/hw/ppc/ppc.h b/include/hw/ppc/ppc.h
index 647451c9b6ac..a9067f45b3f4 100644
--- a/include/hw/ppc/ppc.h
+++ b/include/hw/ppc/ppc.h
@@ -107,4 +107,5 @@ enum {
void ppc_booke_timers_init(PowerPCCPU *cpu, uint32_t freq, uint32_t flags);
PowerPCCPU *ppc_cpu_init(const char *cpu_model, int cpu_index);
+void ppc_set_vcpu_dt_id(PowerPCCPU *cpu, int cpu_index, Error **errp);
#endif
- Re: [Qemu-ppc] [PATCH v2 3/7] ppc: different creation paths for cpus in system and user mode, (continued)
[Qemu-ppc] [PATCH v2 5/7] ppc: introduce ppc_set_vcpu_dt_id(), Greg Kurz, 2016/07/01
[Qemu-ppc] [PATCH v2 6/7] spapr: use ppc_set_vcpu_dt_id() in CPU hotplug code,
Greg Kurz <=
[Qemu-ppc] [PATCH v2 7/7] ppc: move the cpu_dt_id logic to machine code, Greg Kurz, 2016/07/01
Re: [Qemu-ppc] [PATCH v2 0/7] ppc: compute cpu_dt_id in the machine code, Bharata B Rao, 2016/07/02