hw/loongarch/virt: Add topo properties on CPU object
Add some properties such as socket_id, core_id, thread_id and node_id on LoongArch CPU object. Co-developed-by: Xianglai Li <lixianglai@loongson.cn> Signed-off-by: Bibo Mao <maobibo@loongson.cn>
This commit is contained in:
parent
8ccf28c2f6
commit
d32fde20bd
@ -14,6 +14,7 @@
|
||||
#include "system/tcg.h"
|
||||
#include "system/kvm.h"
|
||||
#include "kvm/kvm_loongarch.h"
|
||||
#include "hw/qdev-properties.h"
|
||||
#include "exec/exec-all.h"
|
||||
#include "exec/translation-block.h"
|
||||
#include "cpu.h"
|
||||
@ -879,6 +880,13 @@ static int64_t loongarch_cpu_get_arch_id(CPUState *cs)
|
||||
}
|
||||
#endif
|
||||
|
||||
static const Property loongarch_cpu_properties[] = {
|
||||
DEFINE_PROP_INT32("socket-id", LoongArchCPU, socket_id, 0),
|
||||
DEFINE_PROP_INT32("core-id", LoongArchCPU, core_id, 0),
|
||||
DEFINE_PROP_INT32("thread-id", LoongArchCPU, thread_id, 0),
|
||||
DEFINE_PROP_INT32("node-id", LoongArchCPU, node_id, CPU_UNSET_NUMA_NODE_ID),
|
||||
};
|
||||
|
||||
static void loongarch_cpu_class_init(ObjectClass *c, void *data)
|
||||
{
|
||||
LoongArchCPUClass *lacc = LOONGARCH_CPU_CLASS(c);
|
||||
@ -886,6 +894,7 @@ static void loongarch_cpu_class_init(ObjectClass *c, void *data)
|
||||
DeviceClass *dc = DEVICE_CLASS(c);
|
||||
ResettableClass *rc = RESETTABLE_CLASS(c);
|
||||
|
||||
device_class_set_props(dc, loongarch_cpu_properties);
|
||||
device_class_set_parent_realize(dc, loongarch_cpu_realizefn,
|
||||
&lacc->parent_realize);
|
||||
resettable_class_set_parent_phases(rc, NULL, loongarch_cpu_reset_hold, NULL,
|
||||
|
@ -417,6 +417,10 @@ struct ArchCPU {
|
||||
OnOffAuto lasx;
|
||||
OnOffAuto kvm_pv_ipi;
|
||||
OnOffAuto kvm_steal_time;
|
||||
int32_t socket_id; /* socket-id of this CPU */
|
||||
int32_t core_id; /* core-id of this CPU */
|
||||
int32_t thread_id; /* thread-id of this CPU */
|
||||
int32_t node_id; /* NUMA node of this CPU */
|
||||
|
||||
/* 'compatible' string for this CPU for Linux device trees */
|
||||
const char *dtb_compatible;
|
||||
|
Loading…
x
Reference in New Issue
Block a user