Browse Source

hw/loongarch/virt: Remove unnecessay pre-boot setting with BSP

With BSP core, it boots from aux boot code and loads data into register
A0-A2 and PC. Pre-boot setting is not unnecessary and can be removed.

Signed-off-by: Bibo Mao <maobibo@loongson.cn>
Reviewed-by: Song Gao <gaosong@loongson.cn>
Message-ID: <20250906070200.3749326-3-maobibo@loongson.cn>
Signed-off-by: Song Gao <gaosong@loongson.cn>
pull/305/head
Bibo Mao 7 months ago
committed by Song Gao
parent
commit
6ca2df47c9
  1. 22
      hw/loongarch/boot.c
  2. 4
      target/loongarch/cpu.h

22
hw/loongarch/boot.c

@ -353,17 +353,8 @@ static int64_t load_kernel_info(struct loongarch_boot_info *info)
static void reset_load_elf(void *opaque)
{
LoongArchCPU *cpu = opaque;
CPULoongArchState *env = &cpu->env;
cpu_reset(CPU(cpu));
if (env->load_elf) {
if (cpu == LOONGARCH_CPU(first_cpu)) {
env->gpr[4] = env->boot_info->a0;
env->gpr[5] = env->boot_info->a1;
env->gpr[6] = env->boot_info->a2;
}
cpu_set_pc(CPU(cpu), env->elf_address);
}
}
static void fw_cfg_add_kernel_info(struct loongarch_boot_info *info,
@ -415,8 +406,6 @@ static void loongarch_direct_kernel_boot(MachineState *ms,
{
void *p, *bp;
int64_t kernel_addr = VIRT_FLASH0_BASE;
LoongArchCPU *lacpu;
CPUState *cs;
uint64_t *data;
if (info->kernel_filename) {
@ -443,17 +432,6 @@ static void loongarch_direct_kernel_boot(MachineState *ms,
*(data - 1) = cpu_to_le64(kernel_addr);
rom_add_blob_fixed("boot_code", boot_code, VIRT_FLASH0_SIZE, VIRT_FLASH0_BASE);
CPU_FOREACH(cs) {
lacpu = LOONGARCH_CPU(cs);
lacpu->env.load_elf = true;
if (cs == first_cpu) {
lacpu->env.elf_address = kernel_addr;
} else {
lacpu->env.elf_address = VIRT_FLASH0_BASE;
}
lacpu->env.boot_info = info;
}
g_free(boot_code);
g_free(bp);
}

4
target/loongarch/cpu.h

@ -387,11 +387,7 @@ typedef struct CPUArchState {
#endif
AddressSpace *address_space_iocsr;
bool load_elf;
uint64_t elf_address;
uint32_t mp_state;
struct loongarch_boot_info *boot_info;
#endif
} CPULoongArchState;

Loading…
Cancel
Save