From: Zhao Liu <zhao1.liu@xxxxxxxxx> After i386 supports QOM topology, drop original topology logic. Signed-off-by: Zhao Liu <zhao1.liu@xxxxxxxxx> --- hw/i386/x86.c | 52 +++++++++++---------------------------------------- 1 file changed, 11 insertions(+), 41 deletions(-) diff --git a/hw/i386/x86.c b/hw/i386/x86.c index 99f6c502de43..cba8b806cdb6 100644 --- a/hw/i386/x86.c +++ b/hw/i386/x86.c @@ -118,7 +118,8 @@ out: void x86_cpus_init(X86MachineState *x86ms, int default_cpu_version) { - int i; + CPUCore *core; + int i, cpu_index = 0, core_idx = 0; const CPUArchIdList *possible_cpus; MachineState *ms = MACHINE(x86ms); MachineClass *mc = MACHINE_GET_CLASS(x86ms); @@ -153,34 +154,17 @@ void x86_cpus_init(X86MachineState *x86ms, int default_cpu_version) possible_cpus = mc->possible_cpu_arch_ids(ms); - /* - * possible_cpus_qom_granu means the QOM topology support. - * - * TODO: Drop the "!mc->smp_props.possible_cpus_qom_granu" case when - * i386 completes QOM topology support. - */ - if (mc->smp_props.possible_cpus_qom_granu) { - CPUCore *core; - int cpu_index = 0; - int core_idx = 0; - - MACHINE_CORE_FOREACH(ms, core) { - for (i = 0; i < core->plugged_threads; i++) { - x86_cpu_new(x86ms, possible_cpus->cpus[cpu_index].arch_id, - OBJECT(core), cpu_index, &error_fatal); - cpu_index++; - } - - if (core->plugged_threads < core->nr_threads) { - cpu_index += core->nr_threads - core->plugged_threads; - } - core_idx++; + MACHINE_CORE_FOREACH(ms, core) { + for (i = 0; i < core->plugged_threads; i++) { + x86_cpu_new(x86ms, possible_cpus->cpus[cpu_index].arch_id, + OBJECT(core), cpu_index, &error_fatal); + cpu_index++; } - } else { - for (i = 0; i < ms->smp.cpus; i++) { - x86_cpu_new(x86ms, possible_cpus->cpus[i].arch_id, - NULL, i, &error_fatal); + + if (core->plugged_threads < core->nr_threads) { + cpu_index += core->nr_threads - core->plugged_threads; } + core_idx++; } } @@ -460,20 +444,6 @@ void x86_cpu_pre_plug(HotplugHandler *hotplug_dev, return; } - /* - * possible_cpus_qom_granu means the QOM topology support. - * - * TODO: Drop the "!mc->smp_props.possible_cpus_qom_granu" case when - * i386 completes QOM topology support. - */ - if (!mc->smp_props.possible_cpus_qom_granu) { - x86_topo_ids_from_apicid(cpu->apic_id, &topo_info, &topo_ids); - x86_cpu_assign_topo_id(cpu, &topo_ids, errp); - if (*errp) { - return; - } - } - if (hyperv_feat_enabled(cpu, HYPERV_FEAT_VPINDEX) && kvm_enabled() && !kvm_hv_vpindex_settable()) { error_setg(errp, "kernel doesn't allow setting HyperV VP_INDEX"); -- 2.34.1