diff mbox series

[1/2] hw/xtensa: xtfpga: fix bootloader placement in SMP

Message ID 20190122221256.20883-2-jcmvbkbc@gmail.com (mailing list archive)
State New, archived
Headers show
Series hw/xtensa: xtfpga board improvements | expand

Commit Message

Max Filippov Jan. 22, 2019, 10:12 p.m. UTC
Use BSP reset PC as a place for the mini-bootloader because in SMP
configurations APs and BSP may have different boot addresses.
This fixes SMP linux uImage boot on xtfpga boards.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
---
 hw/xtensa/xtfpga.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/hw/xtensa/xtfpga.c b/hw/xtensa/xtfpga.c
index 21094319a659..d3afdfc247a7 100644
--- a/hw/xtensa/xtfpga.c
+++ b/hw/xtensa/xtfpga.c
@@ -234,10 +234,15 @@  static void xtfpga_init(const XtfpgaBoardDesc *board, MachineState *machine)
     int n;
 
     for (n = 0; n < smp_cpus; n++) {
+        CPUXtensaState *cenv = NULL;
+
         cpu = XTENSA_CPU(cpu_create(machine->cpu_type));
-        env = &cpu->env;
+        cenv = &cpu->env;
+        if (!env) {
+            env = cenv;
+        }
 
-        env->sregs[PRID] = n;
+        cenv->sregs[PRID] = n;
         qemu_register_reset(xtfpga_reset, cpu);
         /* Need MMU initialized prior to ELF loading,
          * so that ELF gets loaded into virtual addresses