diff mbox

[qom-next,12/22] xilinx_zynq: Use cpu_arm_init() to obtain ARMCPU

Message ID 1337016729-12285-13-git-send-email-afaerber@suse.de
State New
Headers show

Commit Message

Andreas Färber May 14, 2012, 5:31 p.m. UTC
The board initializes only one CPU, so replace first_cpu with that CPU's
state to facilitate review of arm_load_kernel() signature change and to
avoid double casts then.

Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 hw/xilinx_zynq.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

Comments

Peter Maydell May 15, 2012, 11:08 a.m. UTC | #1
On 14 May 2012 18:31, Andreas Färber <afaerber@suse.de> wrote:
> The board initializes only one CPU, so replace first_cpu with that CPU's
> state to facilitate review of arm_load_kernel() signature change and to
> avoid double casts then.

There was a patch proposed to add SMP support to this board:
http://lists.gnu.org/archive/html/qemu-devel/2012-04/msg00047.html

I dunno whether that changes the best thing to do in this patch.

-- PMM
Andreas Färber May 18, 2012, 9:34 a.m. UTC | #2
Am 15.05.2012 13:08, schrieb Peter Maydell:
> On 14 May 2012 18:31, Andreas Färber <afaerber@suse.de> wrote:
>> The board initializes only one CPU, so replace first_cpu with that CPU's
>> state to facilitate review of arm_load_kernel() signature change and to
>> avoid double casts then.
> 
> There was a patch proposed to add SMP support to this board:
> http://lists.gnu.org/archive/html/qemu-devel/2012-04/msg00047.html
> 
> I dunno whether that changes the best thing to do in this patch.

Thanks for pointing me to this. From what I see that series has open
issues and was not applied to target-arm.next yet, right? In that case I
can't rebase my patches on top of it, but I get that touching first_cpu
here is not a good idea for SMP.

I'll apply the preceding patches and will respin with
arm_env_get_cpu(first_cpu) in 15/22.

Andreas
diff mbox

Patch

diff --git a/hw/xilinx_zynq.c b/hw/xilinx_zynq.c
index 7290c64..007b4a6 100644
--- a/hw/xilinx_zynq.c
+++ b/hw/xilinx_zynq.c
@@ -50,7 +50,7 @@  static void zynq_init(ram_addr_t ram_size, const char *boot_device,
                         const char *kernel_filename, const char *kernel_cmdline,
                         const char *initrd_filename, const char *cpu_model)
 {
-    CPUARMState *env = NULL;
+    ARMCPU *cpu;
     MemoryRegion *address_space_mem = get_system_memory();
     MemoryRegion *ext_ram = g_new(MemoryRegion, 1);
     MemoryRegion *ocm_ram = g_new(MemoryRegion, 1);
@@ -66,12 +66,12 @@  static void zynq_init(ram_addr_t ram_size, const char *boot_device,
         cpu_model = "cortex-a9";
     }
 
-    env = cpu_init(cpu_model);
-    if (!env) {
+    cpu = cpu_arm_init(cpu_model);
+    if (!cpu) {
         fprintf(stderr, "Unable to find CPU definition\n");
         exit(1);
     }
-    irqp = arm_pic_init_cpu(env);
+    irqp = arm_pic_init_cpu(&cpu->env);
     cpu_irq = irqp[ARM_PIC_CPU_IRQ];
 
     /* max 2GB ram */
@@ -137,7 +137,7 @@  static void zynq_init(ram_addr_t ram_size, const char *boot_device,
     zynq_binfo.nb_cpus = 1;
     zynq_binfo.board_id = 0xd32;
     zynq_binfo.loader_start = 0;
-    arm_load_kernel(first_cpu, &zynq_binfo);
+    arm_load_kernel(&cpu->env, &zynq_binfo);
 }
 
 static QEMUMachine zynq_machine = {