[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [RFC PATCH v3 06/24] spapr: Consolidate cpu init code into
From: |
Bharata B Rao |
Subject: |
[Qemu-devel] [RFC PATCH v3 06/24] spapr: Consolidate cpu init code into a routine |
Date: |
Fri, 24 Apr 2015 12:17:28 +0530 |
Factor out bits of sPAPR specific CPU initialization code into
a separate routine so that it can be called from CPU hotplug
path too.
Signed-off-by: Bharata B Rao <address@hidden>
Reviewed-by: David Gibson <address@hidden>
---
hw/ppc/spapr.c | 54 +++++++++++++++++++++++++++++-------------------------
1 file changed, 29 insertions(+), 25 deletions(-)
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index a56f9a1..5c8f2ff 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -1440,6 +1440,34 @@ static void spapr_drc_reset(void *opaque)
}
}
+static void spapr_cpu_init(PowerPCCPU *cpu)
+{
+ CPUPPCState *env = &cpu->env;
+
+ /* Set time-base frequency to 512 MHz */
+ cpu_ppc_tb_init(env, TIMEBASE_FREQ);
+
+ /* PAPR always has exception vectors in RAM not ROM. To ensure this,
+ * MSR[IP] should never be set.
+ */
+ env->msr_mask &= ~(1 << 6);
+
+ /* Tell KVM that we're in PAPR mode */
+ if (kvm_enabled()) {
+ kvmppc_set_papr(cpu);
+ }
+
+ if (cpu->max_compat) {
+ if (ppc_set_compat(cpu, cpu->max_compat) < 0) {
+ exit(1);
+ }
+ }
+
+ xics_cpu_setup(spapr->icp, cpu);
+
+ qemu_register_reset(spapr_cpu_reset, cpu);
+}
+
/* pSeries LPAR / sPAPR hardware init */
static void ppc_spapr_init(MachineState *machine)
{
@@ -1451,7 +1479,6 @@ static void ppc_spapr_init(MachineState *machine)
const char *initrd_filename = machine->initrd_filename;
const char *boot_device = machine->boot_order;
PowerPCCPU *cpu;
- CPUPPCState *env;
PCIHostState *phb;
int i;
MemoryRegion *sysmem = get_system_memory();
@@ -1549,30 +1576,7 @@ static void ppc_spapr_init(MachineState *machine)
fprintf(stderr, "Unable to find PowerPC CPU definition\n");
exit(1);
}
- env = &cpu->env;
-
- /* Set time-base frequency to 512 MHz */
- cpu_ppc_tb_init(env, TIMEBASE_FREQ);
-
- /* PAPR always has exception vectors in RAM not ROM. To ensure this,
- * MSR[IP] should never be set.
- */
- env->msr_mask &= ~(1 << 6);
-
- /* Tell KVM that we're in PAPR mode */
- if (kvm_enabled()) {
- kvmppc_set_papr(cpu);
- }
-
- if (cpu->max_compat) {
- if (ppc_set_compat(cpu, cpu->max_compat) < 0) {
- exit(1);
- }
- }
-
- xics_cpu_setup(spapr->icp, cpu);
-
- qemu_register_reset(spapr_cpu_reset, cpu);
+ spapr_cpu_init(cpu);
}
/* allocate RAM */
--
2.1.0
- [Qemu-devel] [RFC PATCH v3 00/24] CPU and Memory hotplug for PowerPC sPAPR guests, Bharata B Rao, 2015/04/24
- [Qemu-devel] [RFC PATCH v3 01/24] spapr: enable PHB/CPU/LMB hotplug for pseries-2.3, Bharata B Rao, 2015/04/24
- [Qemu-devel] [RFC PATCH v3 02/24] spapr: Add DRC dt entries for CPUs, Bharata B Rao, 2015/04/24
- [Qemu-devel] [RFC PATCH v3 03/24] spapr: Consider max_cpus during xics initialization, Bharata B Rao, 2015/04/24
- [Qemu-devel] [RFC PATCH v3 04/24] spapr: Support ibm, lrdr-capacity device tree property, Bharata B Rao, 2015/04/24
- [Qemu-devel] [RFC PATCH v3 05/24] spapr: Reorganize CPU dt generation code, Bharata B Rao, 2015/04/24
- [Qemu-devel] [RFC PATCH v3 06/24] spapr: Consolidate cpu init code into a routine,
Bharata B Rao <=
- [Qemu-devel] [RFC PATCH v3 07/24] cpu: Prepare Socket container type, Bharata B Rao, 2015/04/24
- [Qemu-devel] [RFC PATCH v3 08/24] ppc: Prepare CPU socket/core abstraction, Bharata B Rao, 2015/04/24
- [Qemu-devel] [RFC PATCH v3 09/24] spapr: Add CPU hotplug handler, Bharata B Rao, 2015/04/24
- [Qemu-devel] [RFC PATCH v3 10/24] ppc: Update cpu_model in MachineState, Bharata B Rao, 2015/04/24
- [Qemu-devel] [RFC PATCH v3 11/24] ppc: Create sockets and cores for CPUs, Bharata B Rao, 2015/04/24
- [Qemu-devel] [RFC PATCH v3 12/24] spapr: CPU hotplug support, Bharata B Rao, 2015/04/24
- [Qemu-devel] [RFC PATCH v3 13/24] cpus: Add Error argument to cpu_exec_init(), Bharata B Rao, 2015/04/24
- [Qemu-devel] [RFC PATCH v3 14/24] cpus: Convert cpu_index into a bitmap, Bharata B Rao, 2015/04/24
- [Qemu-devel] [RFC PATCH v3 15/24] ppc: Move cpu_exec_init() call to realize function, Bharata B Rao, 2015/04/24
- [Qemu-devel] [RFC PATCH v3 16/24] qom: Introduce object_has_no_children() API, Bharata B Rao, 2015/04/24