summary refs log tree commit diff stats
path: root/target
diff options
context:
space:
mode:
authorBibo Mao <maobibo@loongson.cn>2024-11-26 16:41:42 +0800
committerBibo Mao <maobibo@loongson.cn>2025-03-05 09:39:17 +0800
commit8ccf28c2f6cf54c82485de099b4566b260893445 (patch)
treecd2755cb902ceb1fee2c1c6509502d9496ae3d63 /target
parent087a23a87c57725f8653aea9be70a2d55cf0309e (diff)
downloadfocaccia-qemu-8ccf28c2f6cf54c82485de099b4566b260893445.tar.gz
focaccia-qemu-8ccf28c2f6cf54c82485de099b4566b260893445.zip
hw/loongarch/virt: Add CPU topology support
Add topological relationships for Loongarch VCPU and initialize
topology member variables.

On LoongArch system there is socket/core/thread topo information,
physical CPU id is calculated from CPU topo, every topo sub-field is
aligned by power of 2. So it is different from logical cpu index.

Co-developed-by: Xianglai Li <lixianglai@loongson.cn>
Signed-off-by: Bibo Mao <maobibo@loongson.cn>
Diffstat (limited to 'target')
-rw-r--r--target/loongarch/cpu.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/target/loongarch/cpu.h b/target/loongarch/cpu.h
index 83183a33ab..9dc71fa7f1 100644
--- a/target/loongarch/cpu.h
+++ b/target/loongarch/cpu.h
@@ -393,6 +393,12 @@ typedef struct CPUArchState {
 #endif
 } CPULoongArchState;
 
+typedef struct LoongArchCPUTopo {
+    int32_t socket_id;  /* socket-id of this VCPU */
+    int32_t core_id;    /* core-id of this VCPU */
+    int32_t thread_id;  /* thread-id of this VCPU */
+} LoongArchCPUTopo;
+
 /**
  * LoongArchCPU:
  * @env: #CPULoongArchState