aboutsummaryrefslogtreecommitdiff
path: root/hw/loongarch/virt.c
diff options
context:
space:
mode:
authorTianrui Zhao <zhaotianrui@loongson.cn>2023-06-13 19:37:36 +0800
committerSong Gao <gaosong@loongson.cn>2023-06-16 17:58:46 +0800
commitf33238836544cb6f3b27968d1ececbd46f037904 (patch)
tree42726267a38de086f73b1c93f971cc7a0c44b4c8 /hw/loongarch/virt.c
parent0cf1478d6d708276f37361169e327b755669cf8a (diff)
downloadqemu-f33238836544cb6f3b27968d1ececbd46f037904.zip
qemu-f33238836544cb6f3b27968d1ececbd46f037904.tar.gz
qemu-f33238836544cb6f3b27968d1ececbd46f037904.tar.bz2
hw/loongarch: Supplement cpu topology arguments
Supplement LoongArch cpu topology arguments, including support socket and threads per core. Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Song Gao <gaosong@loongson.cn> Signed-off-by: Tianrui Zhao <zhaotianrui@loongson.cn> Signed-off-by: Song Gao <gaosong@loongson.cn> Message-Id: <20230613123251.2471878-1-zhaotianrui@loongson.cn>
Diffstat (limited to 'hw/loongarch/virt.c')
-rw-r--r--hw/loongarch/virt.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/hw/loongarch/virt.c b/hw/loongarch/virt.c
index 1d5c764..ca8824b 100644
--- a/hw/loongarch/virt.c
+++ b/hw/loongarch/virt.c
@@ -1096,8 +1096,15 @@ static const CPUArchIdList *virt_possible_cpu_arch_ids(MachineState *ms)
for (n = 0; n < ms->possible_cpus->len; n++) {
ms->possible_cpus->cpus[n].type = ms->cpu_type;
ms->possible_cpus->cpus[n].arch_id = n;
+
+ ms->possible_cpus->cpus[n].props.has_socket_id = true;
+ ms->possible_cpus->cpus[n].props.socket_id =
+ n / (ms->smp.cores * ms->smp.threads);
ms->possible_cpus->cpus[n].props.has_core_id = true;
- ms->possible_cpus->cpus[n].props.core_id = n % ms->smp.cores;
+ ms->possible_cpus->cpus[n].props.core_id =
+ n / ms->smp.threads % ms->smp.cores;
+ ms->possible_cpus->cpus[n].props.has_thread_id = true;
+ ms->possible_cpus->cpus[n].props.thread_id = n % ms->smp.threads;
}
return ms->possible_cpus;
}