From: Helge Deller <[email protected]> SeaBIOS version 26 allows to use random addresses for CPU_HPA, so drop the hardcoded CPU_HPA which was used until now for all machines, and use individual addresses which correspond to the CPU HPA on the physical machines.
Signed-off-by: Helge Deller <[email protected]> --- hw/hppa/machine.c | 23 +++++++++++++---------- target/hppa/cpu.h | 1 + 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/hw/hppa/machine.c b/hw/hppa/machine.c index e403ae5fc9..f23936fc5b 100644 --- a/hw/hppa/machine.c +++ b/hw/hppa/machine.c @@ -241,11 +241,11 @@ static FWCfgState *create_fw_cfg(MachineState *ms, PCIBus *pci_bus, fw_cfg_add_file(fw_cfg, "/etc/hppa/power-button-addr", g_memdup2(&val, sizeof(val)), sizeof(val)); - val = cpu_to_le64(CPU_HPA + 16); + val = cpu_to_le64(cpu[0]->env.cpu_hpa + 16); fw_cfg_add_file(fw_cfg, "/etc/hppa/rtc-addr", g_memdup2(&val, sizeof(val)), sizeof(val)); - val = cpu_to_le64(CPU_HPA + 24); + val = cpu_to_le64(cpu[0]->env.cpu_hpa + 24); fw_cfg_add_file(fw_cfg, "/etc/hppa/DebugOutputPort", g_memdup2(&val, sizeof(val)), sizeof(val)); @@ -286,7 +286,8 @@ static DinoState *dino_init(MemoryRegion *addr_space) /* * Step 1: Create CPUs and Memory */ -static TranslateFn *machine_HP_common_init_cpus(MachineState *machine) +static TranslateFn *machine_HP_common_init_cpus(MachineState *machine, + target_ulong initial_cpu_hpa) { MemoryRegion *addr_space = get_system_memory(); unsigned int smp_cpus = machine->smp.cpus; @@ -299,6 +300,7 @@ static TranslateFn *machine_HP_common_init_cpus(MachineState *machine) /* Create CPUs. */ for (unsigned int i = 0; i < smp_cpus; i++) { cpu[i] = HPPA_CPU(cpu_create(machine->cpu_type)); + cpu[i]->env.cpu_hpa = initial_cpu_hpa + i * 0x1000; } /* Initialize memory */ @@ -321,7 +323,7 @@ static TranslateFn *machine_HP_common_init_cpus(MachineState *machine) memory_region_init_io(cpu_region, OBJECT(cpu[i]), &hppa_io_eir_ops, cpu[i], name, 4); memory_region_add_subregion(addr_space, - translate(NULL, CPU_HPA + i * 0x1000), + translate(NULL, cpu[i]->env.cpu_hpa), cpu_region); if (!hppa_is_pa20(&cpu[0]->env)) { @@ -339,7 +341,7 @@ static TranslateFn *machine_HP_common_init_cpus(MachineState *machine) memory_region_init_io(cflush, NULL, &hppa_pci_ignore_ops, NULL, cflush_name, 4); memory_region_add_subregion(addr_space, - translate(NULL, CPU_HPA + i * 0x1000 + 0x500), + translate(NULL, cpu[i]->env.cpu_hpa + 0x500), cflush); } @@ -347,7 +349,8 @@ static TranslateFn *machine_HP_common_init_cpus(MachineState *machine) cpu_region = g_new(MemoryRegion, 1); memory_region_init_io(cpu_region, OBJECT(cpu[0]), &hppa_io_helper_ops, cpu[0], "cpu0-io-rtc", 2 * sizeof(uint64_t)); - memory_region_add_subregion(addr_space, translate(NULL, CPU_HPA + 16), + memory_region_add_subregion(addr_space, + translate(NULL, cpu[0]->env.cpu_hpa + 16), cpu_region); /* Main memory region. */ @@ -626,7 +629,7 @@ static void machine_HP_715_init(MachineState *machine) ISABus *isa_bus; /* Create CPUs and RAM. */ - translate = machine_HP_common_init_cpus(machine); + translate = machine_HP_common_init_cpus(machine, 0xfffbe000); if (hppa_is_pa20(&cpu[0]->env)) { error_report("The HP 715/64 workstation requires a 32-bit " @@ -713,7 +716,7 @@ static void machine_HP_B160L_init(MachineState *machine) PCIBus *pci_bus; /* Create CPUs and RAM. */ - translate = machine_HP_common_init_cpus(machine); + translate = machine_HP_common_init_cpus(machine, 0xfff10000); if (hppa_is_pa20(&cpu[0]->env)) { error_report("The HP B160L workstation requires a 32-bit " @@ -810,7 +813,7 @@ static void machine_HP_C3700_init(MachineState *machine) bool is_C3700 = strcmp(mc->name, "C3700") == 0; /* Create CPUs and RAM. */ - translate = machine_HP_common_init_cpus(machine); + translate = machine_HP_common_init_cpus(machine, 0xfffa0000); if (!hppa_is_pa20(&cpu[0]->env)) { error_report("The HP C3000 workstation requires a 64-bit CPU. " @@ -893,7 +896,7 @@ static void hppa_machine_reset(MachineState *ms, ResetType type) cpu[i]->env.psw = PSW_Q; /* Firmware uses FP registers before configuring CCR. */ cpu[i]->env.cr[CR_SCRCCR] = 0xc0; - cpu[i]->env.gr[5] = CPU_HPA + i * 0x1000; + cpu[i]->env.gr[5] = cpu[i]->env.cpu_hpa; } /* diff --git a/target/hppa/cpu.h b/target/hppa/cpu.h index da48a78569..7b708a564b 100644 --- a/target/hppa/cpu.h +++ b/target/hppa/cpu.h @@ -272,6 +272,7 @@ typedef struct CPUArchState { /* Fields up to this point are cleared by a CPU reset */ struct {} end_reset_fields; + target_ulong cpu_hpa; /* HPA of this CPU */ target_ulong kernel_entry; /* Linux kernel was loaded here */ target_ulong cmdline_or_bootorder; target_ulong initrd_base, initrd_end; -- 2.54.0
