[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-ppc] [PATCH 12/58] PPC: E500: create multiple envs
From: |
Alexander Graf |
Subject: |
[Qemu-ppc] [PATCH 12/58] PPC: E500: create multiple envs |
Date: |
Wed, 14 Sep 2011 10:42:36 +0200 |
When creating a VM, we should go through smp_cpus and create a virtual CPU for
every CPU the user requested. This patch adds support for that and moves some
code around to make that more convenient.
Signed-off-by: Alexander Graf <address@hidden>
---
hw/ppce500_mpc8544ds.c | 44 +++++++++++++++++++++++++++++---------------
1 files changed, 29 insertions(+), 15 deletions(-)
diff --git a/hw/ppce500_mpc8544ds.c b/hw/ppce500_mpc8544ds.c
index 1274a3e..8d05587 100644
--- a/hw/ppce500_mpc8544ds.c
+++ b/hw/ppce500_mpc8544ds.c
@@ -226,7 +226,7 @@ static void mpc8544ds_init(ram_addr_t ram_size,
const char *cpu_model)
{
PCIBus *pci_bus;
- CPUState *env;
+ CPUState *env = NULL;
uint64_t elf_entry;
uint64_t elf_lowaddr;
target_phys_addr_t entry=0;
@@ -240,24 +240,40 @@ static void mpc8544ds_init(ram_addr_t ram_size,
qemu_irq *irqs, *mpic;
DeviceState *dev;
struct boot_info *boot_info;
+ CPUState *firstenv = NULL;
- /* Setup CPU */
+ /* Setup CPUs */
if (cpu_model == NULL) {
cpu_model = "e500v2_v30";
}
- env = cpu_ppc_init(cpu_model);
- if (!env) {
- fprintf(stderr, "Unable to initialize CPU!\n");
- exit(1);
- }
+ for (i = 0; i < smp_cpus; i++) {
+ qemu_irq *input;
+ env = cpu_ppc_init(cpu_model);
+ if (!env) {
+ fprintf(stderr, "Unable to initialize CPU!\n");
+ exit(1);
+ }
+
+ if (!firstenv) {
+ firstenv = env;
+ }
- /* XXX register timer? */
- ppc_emb_timers_init(env, 400000000, PPC_INTERRUPT_DECR);
- ppc_dcr_init(env, NULL, NULL);
+ env->spr[SPR_BOOKE_PIR] = env->cpu_index = i;
- /* Register reset handler */
- qemu_register_reset(mpc8544ds_cpu_reset, env);
+ /* XXX register timer? */
+ ppc_emb_timers_init(env, 400000000, PPC_INTERRUPT_DECR);
+ ppc_dcr_init(env, NULL, NULL);
+ /* XXX Enable DEC interrupts - probably wrong in the backend */
+ env->spr[SPR_40x_TCR] = 1 << 26;
+
+ /* Register reset handler */
+ boot_info = g_malloc0(sizeof(struct boot_info));
+ qemu_register_reset(mpc8544ds_cpu_reset, env);
+ env->load_info = boot_info;
+ }
+
+ env = firstenv;
/* Fixup Memory size on a alignment boundary */
ram_size &= ~(RAM_SIZES_ALIGN - 1);
@@ -336,8 +352,6 @@ static void mpc8544ds_init(ram_addr_t ram_size,
}
}
- boot_info = g_malloc0(sizeof(struct boot_info));
-
/* If we're loading a kernel directly, we must load the device tree too. */
if (kernel_filename) {
#ifndef CONFIG_FDT
@@ -350,10 +364,10 @@ static void mpc8544ds_init(ram_addr_t ram_size,
exit(1);
}
+ boot_info = env->load_info;
boot_info->entry = entry;
boot_info->dt_base = dt_base;
}
- env->load_info = boot_info;
if (kvm_enabled()) {
kvmppc_init();
--
1.6.0.2
- [Qemu-ppc] [PATCH 08/58] PPC: Set MPIC IDE for IPI to 0, (continued)
- [Qemu-ppc] [PATCH 08/58] PPC: Set MPIC IDE for IPI to 0, Alexander Graf, 2011/09/14
- [Qemu-ppc] [PATCH 15/58] PPC: bamboo: Move host fdt copy to target, Alexander Graf, 2011/09/14
- [Qemu-ppc] [PATCH 19/58] PPC: bamboo: Use kvm api for freq and clock frequencies, Alexander Graf, 2011/09/14
- [Qemu-ppc] [PATCH 03/58] spapr: make irq customizable via qdev, Alexander Graf, 2011/09/14
- [Qemu-ppc] [PATCH 10/58] PPC: MPIC: Fix CI bit definitions, Alexander Graf, 2011/09/14
- [Qemu-ppc] [PATCH 48/58] pseries: Implement hcall-bulk hypervisor interface, Alexander Graf, 2011/09/14
- [Qemu-ppc] [PATCH 21/58] PPC: KVM: Add stubs for kvm helper functions, Alexander Graf, 2011/09/14
- [Qemu-ppc] [PATCH 09/58] PPC: MPIC: Remove read functionality for WO registers, Alexander Graf, 2011/09/14
- [Qemu-ppc] [PATCH 12/58] PPC: E500: create multiple envs,
Alexander Graf <=
- [Qemu-ppc] [PATCH 16/58] PPC: KVM: Add generic function to read host clockfreq, Alexander Graf, 2011/09/14
- [Qemu-ppc] [PATCH 42/58] pseries: use macro for firmware filename, Alexander Graf, 2011/09/14
- [Qemu-ppc] [PATCH 14/58] device tree: add nop_node, Alexander Graf, 2011/09/14
- [Qemu-ppc] [PATCH 20/58] PPC: KVM: Remove kvmppc_read_host_property, Alexander Graf, 2011/09/14
- [Qemu-ppc] [PATCH 32/58] PPC: Add new target config for pseries, Alexander Graf, 2011/09/14
- [Qemu-ppc] [PATCH 25/58] PPC: E500: Update cpu-release-addr property in cpu nodes, Alexander Graf, 2011/09/14