@@ -313,6 +313,11 @@ void x86_cpu_pre_plug(HotplugHandler *hotplug_dev,
init_topo_info(&topo_info, x86ms);
+ if (ms->smp.modules > 1) {
+ env->nr_modules = ms->smp.modules;
+ /* TODO: Expose module level in CPUID[0x1F]. */
+ }
+
if (ms->smp.dies > 1) {
env->nr_dies = ms->smp.dies;
set_bit(CPU_TOPO_LEVEL_DIE, env->avail_cpu_topo);
@@ -7712,6 +7712,7 @@ static void x86_cpu_init_default_topo(X86CPU *cpu)
{
CPUX86State *env = &cpu->env;
+ env->nr_modules = 1;
env->nr_dies = 1;
/* SMT, core and package levels are set by default. */
@@ -1899,6 +1899,9 @@ typedef struct CPUArchState {
/* Number of dies within this CPU package. */
unsigned nr_dies;
+ /* Number of modules within one die. */
+ unsigned nr_modules;
+
/* Bitmap of available CPU topology levels for this CPU. */
DECLARE_BITMAP(avail_cpu_topo, CPU_TOPO_LEVEL_MAX);
} CPUX86State;