@@ -870,6 +870,7 @@ static inline void initialize_topo_info(X86CPUTopoInfo *topo_info,
PCMachineState *pcms,
const MachineState *ms)
{
+ topo_info->nodes_per_pkg = ms->numa_state->num_nodes / ms->smp.sockets;
topo_info->dies_per_pkg = pcms->smp_dies;
topo_info->cores_per_die = ms->smp.cores;
topo_info->threads_per_core = ms->smp.threads;
@@ -1390,11 +1391,13 @@ static void pc_new_cpu(PCMachineState *pcms, int64_t apic_id, Error **errp)
Object *cpu = NULL;
Error *local_err = NULL;
CPUX86State *env = NULL;
+ MachineState *ms = MACHINE(pcms);
cpu = object_new(MACHINE(pcms)->cpu_type);
env = &X86_CPU(cpu)->env;
env->nr_dies = pcms->smp_dies;
+ env->nr_nodes = ms->numa_state->num_nodes / ms->smp.sockets;
object_property_set_uint(cpu, apic_id, "apic-id", &local_err);
object_property_set_bool(cpu, true, "realized", &local_err);
@@ -2242,6 +2245,7 @@ static void pc_cpu_pre_plug(HotplugHandler *hotplug_dev,
initialize_topo_info(&topo_info, pcms, ms);
env->nr_dies = pcms->smp_dies;
+ env->nr_nodes = ms->numa_state->num_nodes / ms->smp.sockets;
/*
* If APIC ID is not set,
@@ -54,6 +54,7 @@ typedef struct X86CPUTopoIDs {
} X86CPUTopoIDs;
typedef struct X86CPUTopoInfo {
+ unsigned nodes_per_pkg;
unsigned dies_per_pkg;
unsigned cores_per_die;
unsigned threads_per_core;
@@ -5996,6 +5996,7 @@ static void x86_cpu_initfn(Object *obj)
FeatureWord w;
env->nr_dies = 1;
+ env->nr_nodes = 1;
cpu_set_cpustate_pointers(cpu);
object_property_add(obj, "family", "int",
@@ -1591,6 +1591,7 @@ typedef struct CPUX86State {
TPRAccess tpr_access_type;
unsigned nr_dies;
+ unsigned nr_nodes;
} CPUX86State;
struct kvm_msrs;
Update structures X86CPUTopoIDs and CPUX86State to hold the nodes_per_pkg. This is required to build EPYC mode topology. Signed-off-by: Babu Moger <babu.moger@amd.com> --- hw/i386/pc.c | 4 ++++ include/hw/i386/topology.h | 1 + target/i386/cpu.c | 1 + target/i386/cpu.h | 1 + 4 files changed, 7 insertions(+)