mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-05 08:43:55 -06:00
target/loongarch: cpu: Implement get_arch_id callback
Implement the callback for getting the architecture-dependent CPU ID, the cpu ID is physical id described in ACPI MADT table, this will be used for cpu hotplug. Signed-off-by: Bibo Mao <maobibo@loongson.cn> Reviewed-by: Song Gao <gaosong@loongson.cn> Message-Id: <20230824005007.2000525-1-maobibo@loongson.cn> Signed-off-by: Song Gao <gaosong@loongson.cn>
This commit is contained in:
parent
a380c6f11f
commit
14f21f673a
3 changed files with 11 additions and 0 deletions
|
@ -810,6 +810,8 @@ static void loongarch_init(MachineState *machine)
|
||||||
cpu = cpu_create(machine->cpu_type);
|
cpu = cpu_create(machine->cpu_type);
|
||||||
cpu->cpu_index = i;
|
cpu->cpu_index = i;
|
||||||
machine->possible_cpus->cpus[i].cpu = OBJECT(cpu);
|
machine->possible_cpus->cpus[i].cpu = OBJECT(cpu);
|
||||||
|
lacpu = LOONGARCH_CPU(cpu);
|
||||||
|
lacpu->phy_id = machine->possible_cpus->cpus[i].arch_id;
|
||||||
}
|
}
|
||||||
fdt_add_cpu_nodes(lams);
|
fdt_add_cpu_nodes(lams);
|
||||||
|
|
||||||
|
|
|
@ -722,6 +722,13 @@ static struct TCGCPUOps loongarch_tcg_ops = {
|
||||||
static const struct SysemuCPUOps loongarch_sysemu_ops = {
|
static const struct SysemuCPUOps loongarch_sysemu_ops = {
|
||||||
.get_phys_page_debug = loongarch_cpu_get_phys_page_debug,
|
.get_phys_page_debug = loongarch_cpu_get_phys_page_debug,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static int64_t loongarch_cpu_get_arch_id(CPUState *cs)
|
||||||
|
{
|
||||||
|
LoongArchCPU *cpu = LOONGARCH_CPU(cs);
|
||||||
|
|
||||||
|
return cpu->phy_id;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void loongarch_cpu_class_init(ObjectClass *c, void *data)
|
static void loongarch_cpu_class_init(ObjectClass *c, void *data)
|
||||||
|
@ -742,6 +749,7 @@ static void loongarch_cpu_class_init(ObjectClass *c, void *data)
|
||||||
cc->set_pc = loongarch_cpu_set_pc;
|
cc->set_pc = loongarch_cpu_set_pc;
|
||||||
cc->get_pc = loongarch_cpu_get_pc;
|
cc->get_pc = loongarch_cpu_get_pc;
|
||||||
#ifndef CONFIG_USER_ONLY
|
#ifndef CONFIG_USER_ONLY
|
||||||
|
cc->get_arch_id = loongarch_cpu_get_arch_id;
|
||||||
dc->vmsd = &vmstate_loongarch_cpu;
|
dc->vmsd = &vmstate_loongarch_cpu;
|
||||||
cc->sysemu_ops = &loongarch_sysemu_ops;
|
cc->sysemu_ops = &loongarch_sysemu_ops;
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -376,6 +376,7 @@ struct ArchCPU {
|
||||||
CPUNegativeOffsetState neg;
|
CPUNegativeOffsetState neg;
|
||||||
CPULoongArchState env;
|
CPULoongArchState env;
|
||||||
QEMUTimer timer;
|
QEMUTimer timer;
|
||||||
|
uint32_t phy_id;
|
||||||
|
|
||||||
/* 'compatible' string for this CPU for Linux device trees */
|
/* 'compatible' string for this CPU for Linux device trees */
|
||||||
const char *dtb_compatible;
|
const char *dtb_compatible;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue