diff options
author | Bibo Mao <maobibo@loongson.cn> | 2023-08-24 08:50:07 +0800 |
---|---|---|
committer | Song Gao <gaosong@loongson.cn> | 2023-08-24 11:17:59 +0800 |
commit | 14f21f673a01cf3efa22a70256947fb9b6bbfdfa (patch) | |
tree | 33c5fffff727cbfb8f1cecfabcc4edf9190efda0 /target | |
parent | a380c6f11fd9f1ca96f204c4ae26c79e483ede8a (diff) | |
download | qemu-14f21f673a01cf3efa22a70256947fb9b6bbfdfa.zip qemu-14f21f673a01cf3efa22a70256947fb9b6bbfdfa.tar.gz qemu-14f21f673a01cf3efa22a70256947fb9b6bbfdfa.tar.bz2 |
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>
Diffstat (limited to 'target')
-rw-r--r-- | target/loongarch/cpu.c | 8 | ||||
-rw-r--r-- | target/loongarch/cpu.h | 1 |
2 files changed, 9 insertions, 0 deletions
diff --git a/target/loongarch/cpu.c b/target/loongarch/cpu.c index d3c3e0d..27fc6e1 100644 --- a/target/loongarch/cpu.c +++ b/target/loongarch/cpu.c @@ -722,6 +722,13 @@ static struct TCGCPUOps loongarch_tcg_ops = { static const struct SysemuCPUOps loongarch_sysemu_ops = { .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 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->get_pc = loongarch_cpu_get_pc; #ifndef CONFIG_USER_ONLY + cc->get_arch_id = loongarch_cpu_get_arch_id; dc->vmsd = &vmstate_loongarch_cpu; cc->sysemu_ops = &loongarch_sysemu_ops; #endif diff --git a/target/loongarch/cpu.h b/target/loongarch/cpu.h index 25a0ef7..4d72019 100644 --- a/target/loongarch/cpu.h +++ b/target/loongarch/cpu.h @@ -376,6 +376,7 @@ struct ArchCPU { CPUNegativeOffsetState neg; CPULoongArchState env; QEMUTimer timer; + uint32_t phy_id; /* 'compatible' string for this CPU for Linux device trees */ const char *dtb_compatible; |