@@ -671,6 +671,7 @@ static void microvm_class_init(ObjectClass *oc, void *data)
mc->reset = microvm_machine_reset;
mc->post_init = microvm_machine_state_post_init;
+ mc->smp_props.custom_topo_supported = true;
/* hotplug (for cpu coldplug) */
mc->get_hotplug_handler = microvm_get_hotplug_handler;
@@ -473,6 +473,7 @@ static void pc_i440fx_machine_options(MachineClass *m)
m->no_floppy = !module_object_class_by_name(TYPE_ISA_FDC);
m->no_parallel = !module_object_class_by_name(TYPE_ISA_PARALLEL);
m->post_init = pc_post_init1;
+ m->smp_props.custom_topo_supported = true;
machine_class_allow_dynamic_sysbus_dev(m, TYPE_RAMFB_DEVICE);
machine_class_allow_dynamic_sysbus_dev(m, TYPE_VMBUS_BRIDGE);
@@ -356,6 +356,7 @@ static void pc_q35_machine_options(MachineClass *m)
m->max_cpus = 4096;
m->no_parallel = !module_object_class_by_name(TYPE_ISA_PARALLEL);
m->post_init = pc_q35_post_init;
+ m->smp_props.custom_topo_supported = true;
machine_class_allow_dynamic_sysbus_dev(m, TYPE_AMD_IOMMU_DEVICE);
machine_class_allow_dynamic_sysbus_dev(m, TYPE_INTEL_IOMMU_DEVICE);
machine_class_allow_dynamic_sysbus_dev(m, TYPE_RAMFB_DEVICE);
@@ -195,6 +195,12 @@ void x86_cpus_init(X86MachineState *x86ms, int default_cpu_version)
}
possible_cpus = mc->possible_cpu_arch_ids(ms);
+
+ /* Leave user to add CPUs. */
+ if (ms->topo->custom_topo_enabled) {
+ return;
+ }
+
for (i = 0; i < ms->smp.cpus; i++) {
x86_cpu_new(x86ms, i, possible_cpus->cpus[i].arch_id, &error_fatal);
}
With custom topology enabling, user could configure hyrid CPU topology from CLI. For example, create a Intel Core (P core) with 2 threads and 2 Intel Atom (E core) with single thread for PC machine: -smp maxsockets=1,maxdies=1,maxmodules=2,maxcores=2,maxthreads=2 -machine pc,custom-topo=on \ -device cpu-socket,id=sock0 \ -device cpu-die,id=die0,bus=sock0 \ -device cpu-module,id=mod0,bus=die0 \ -device cpu-module,id=mod1,bus=die0 \ -device x86-intel-core,id=core0,bus=mod0 \ -device x86-intel-atom,id=core1,bus=mod1 \ -device x86-intel-atom,id=core2,bus=mod1 \ -device host-x86_64-cpu,id=cpu0,socket-id=0,die-id=0,module-id=0,core-id=0,thread-id=0 \ -device host-x86_64-cpu,id=cpu1,socket-id=0,die-id=0,module-id=0,core-id=0,thread-id=1 \ -device host-x86_64-cpu,id=cpu2,socket-id=0,die-id=0,module-id=1,core-id=0,thread-id=0 \ -device host-x86_64-cpu,id=cpu3,socket-id=0,die-id=0,module-id=1,core-id=1,thread-id=0 Signed-off-by: Zhao Liu <zhao1.liu@intel.com> --- hw/i386/microvm.c | 1 + hw/i386/pc_piix.c | 1 + hw/i386/pc_q35.c | 1 + hw/i386/x86-common.c | 6 ++++++ 4 files changed, 9 insertions(+)