summary refs log tree commit diff stats
path: root/hw/loongarch/virt.c
diff options
context:
space:
mode:
authorBibo Mao <maobibo@loongson.cn>2025-02-05 11:36:12 +0800
committerBibo Mao <maobibo@loongson.cn>2025-02-12 10:01:55 +0800
commit28bec94c7da29860c27394b1668afc85762db981 (patch)
treeb3eaab55295ee59516d5f83c4edeaafdf3cad116 /hw/loongarch/virt.c
parent3754f985a8816a966b72da0ec8fb9e8a3cf689b9 (diff)
downloadfocaccia-qemu-28bec94c7da29860c27394b1668afc85762db981.tar.gz
focaccia-qemu-28bec94c7da29860c27394b1668afc85762db981.zip
hw/loongarch/virt: Set iocsr address space when CPU is created
There is only one iocsr address space for the whole virt-machine
board. When CPU is created, the one of percpu points to that of
the board.

Here set iocsr address space when CPU is created rather than IPI
creation stage.

Signed-off-by: Bibo Mao <maobibo@loongson.cn>
Reviewed-by: Bibo Mao <maobibo@loongson.cn>
Diffstat (limited to '')
-rw-r--r--hw/loongarch/virt.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/hw/loongarch/virt.c b/hw/loongarch/virt.c
index 9f3843ee34..db48217228 100644
--- a/hw/loongarch/virt.c
+++ b/hw/loongarch/virt.c
@@ -388,7 +388,6 @@ static void virt_irq_init(LoongArchVirtMachineState *lvms)
         cpudev = DEVICE(cpu_state);
         lacpu = LOONGARCH_CPU(cpu_state);
         env = &(lacpu->env);
-        env->address_space_iocsr = &lvms->as_iocsr;
 
         /* connect ipi irq to cpu irq */
         qdev_connect_gpio_out(ipi, cpu, qdev_get_gpio_in(cpudev, IRQ_IPI));
@@ -689,6 +688,7 @@ static void virt_init(MachineState *machine)
         machine->possible_cpus->cpus[i].cpu = cpu;
         lacpu = LOONGARCH_CPU(cpu);
         lacpu->phy_id = machine->possible_cpus->cpus[i].arch_id;
+        lacpu->env.address_space_iocsr = &lvms->as_iocsr;
     }
     fw_cfg_add_memory(machine);