[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [RFC PATCH v4 07/11] spapr: Enable CPU hotplug for pseries-
From: |
Bharata B Rao |
Subject: |
[Qemu-devel] [RFC PATCH v4 07/11] spapr: Enable CPU hotplug for pseries-2.5 and add CPU DRC DT entries |
Date: |
Thu, 6 Aug 2015 10:57:13 +0530 |
Start supporting CPU hotplug from pseries-2.5 onwards. Add CPU
DRC (Dynamic Resource Connector) device tree entries.
Signed-off-by: Bharata B Rao <address@hidden>
---
hw/ppc/spapr.c | 23 +++++++++++++++++++++++
include/hw/ppc/spapr.h | 1 +
2 files changed, 24 insertions(+)
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index 1d8a12a..a106980 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -955,6 +955,16 @@ static void spapr_finalize_fdt(sPAPRMachineState *spapr,
_FDT(spapr_drc_populate_dt(fdt, 0, NULL, SPAPR_DR_CONNECTOR_TYPE_LMB));
}
+ if (smc->dr_cpu_enabled) {
+ int offset = fdt_path_offset(fdt, "/cpus");
+ ret = spapr_drc_populate_dt(fdt, offset, NULL,
+ SPAPR_DR_CONNECTOR_TYPE_CPU);
+ if (ret < 0) {
+ fprintf(stderr, "Couldn't set up CPU DR device tree properties\n");
+ exit(1);
+ }
+ }
+
_FDT((fdt_pack(fdt)));
if (fdt_totalsize(fdt) > FDT_MAX_SIZE) {
@@ -1674,6 +1684,8 @@ static void ppc_spapr_init(MachineState *machine)
long load_limit, fw_size;
bool kernel_le = false;
char *filename;
+ int smt = kvmppc_smt_threads();
+ int smp_max_cores = DIV_ROUND_UP(max_cpus, smp_threads);
msi_supported = true;
@@ -1739,6 +1751,15 @@ static void ppc_spapr_init(MachineState *machine)
spapr_validate_node_memory(machine);
}
+ if (smc->dr_cpu_enabled) {
+ for (i = 0; i < smp_max_cores; i++) {
+ sPAPRDRConnector *drc =
+ spapr_dr_connector_new(OBJECT(spapr),
+ SPAPR_DR_CONNECTOR_TYPE_CPU, i * smt);
+ qemu_register_reset(spapr_drc_reset, drc);
+ }
+ }
+
/* init CPUs */
if (machine->cpu_model == NULL) {
machine->cpu_model = kvm_enabled() ? "host" : "POWER7";
@@ -2213,6 +2234,7 @@ static void spapr_machine_class_init(ObjectClass *oc,
void *data)
hc->unplug = spapr_machine_device_unplug;
smc->dr_lmb_enabled = false;
+ smc->dr_cpu_enabled = false;
fwc->get_dev_path = spapr_get_fw_dev_path;
nc->nmi_monitor_handler = spapr_nmi;
}
@@ -2376,6 +2398,7 @@ static void spapr_machine_2_5_class_init(ObjectClass *oc,
void *data)
mc->alias = "pseries";
mc->is_default = 1;
smc->dr_lmb_enabled = true;
+ smc->dr_cpu_enabled = true;
}
static const TypeInfo spapr_machine_2_5_info = {
diff --git a/include/hw/ppc/spapr.h b/include/hw/ppc/spapr.h
index b6cb0d0..9e364ba 100644
--- a/include/hw/ppc/spapr.h
+++ b/include/hw/ppc/spapr.h
@@ -36,6 +36,7 @@ struct sPAPRMachineClass {
/*< public >*/
bool dr_lmb_enabled; /* enable dynamic-reconfig/hotplug of LMBs */
+ bool dr_cpu_enabled; /* enable dynamic-reconfig/hotplug of CPUs */
};
/**
--
2.1.0
- [Qemu-devel] [RFC PATCH v4 00/11] sPAPR CPU hotplug, Bharata B Rao, 2015/08/06
- [Qemu-devel] [RFC PATCH v4 02/11] exec: Do vmstate unregistration from cpu_exec_exit(), Bharata B Rao, 2015/08/06
- [Qemu-devel] [RFC PATCH v4 11/11] target-ppc: Enable CPU hotplug for POWER8 CPU family, Bharata B Rao, 2015/08/06
- [Qemu-devel] [RFC PATCH v4 06/11] spapr: Create pseries-2.5 machine, Bharata B Rao, 2015/08/06
- [Qemu-devel] [RFC PATCH v4 07/11] spapr: Enable CPU hotplug for pseries-2.5 and add CPU DRC DT entries,
Bharata B Rao <=
- [Qemu-devel] [RFC PATCH v4 04/11] cpus: Add a sync version of cpu_remove(), Bharata B Rao, 2015/08/06
- [Qemu-devel] [RFC PATCH v4 05/11] xics_kvm: Add cpu_destroy method to XICS, Bharata B Rao, 2015/08/06
- [Qemu-devel] [RFC PATCH v4 03/11] cpus: Reclaim vCPU objects, Bharata B Rao, 2015/08/06
- [Qemu-devel] [RFC PATCH v4 01/11] exec: Remove cpu from cpus list during cpu_exec_exit(), Bharata B Rao, 2015/08/06
- [Qemu-devel] [RFC PATCH v4 10/11] spapr: CPU hot unplug support, Bharata B Rao, 2015/08/06
- [Qemu-devel] [RFC PATCH v4 09/11] spapr: Support topologies with unfilled cores, Bharata B Rao, 2015/08/06
- [Qemu-devel] [RFC PATCH v4 08/11] spapr: CPU hotplug support, Bharata B Rao, 2015/08/06
- Re: [Qemu-devel] [RFC PATCH v4 00/11] sPAPR CPU hotplug, Zhu Guihua, 2015/08/06