@@ -65,6 +65,7 @@
#include "hw/mem/pc-dimm.h"
#include "qapi/visitor.h"
#include "qapi-visit.h"
+#include "hw/cpu/core.h"
/* debug PC/ISA interrupts */
//#define DEBUG_IRQ
@@ -1086,11 +1087,10 @@ void pc_hot_add_cpu(const int64_t id, Error **errp)
void pc_cpus_init(PCMachineState *pcms)
{
- int i;
- X86CPU *cpu = NULL;
+ int i, j;
MachineState *machine = MACHINE(pcms);
- Error *error = NULL;
unsigned long apic_id_limit;
+ int sockets = DIV_ROUND_UP(smp_cpus, smp_cores * smp_threads);
/* init CPUs */
if (machine->cpu_model == NULL) {
@@ -1109,18 +1109,17 @@ void pc_cpus_init(PCMachineState *pcms)
exit(1);
}
- for (i = 0; i < smp_cpus; i++) {
- cpu = pc_new_cpu(machine->cpu_model, x86_cpu_apic_id_from_index(i),
- &error);
- if (error) {
- error_report_err(error);
- exit(1);
+ for (i = 0; i < sockets; i++) {
+ char sid[32];
+
+ snprintf(sid, 32, "" TYPE_CPU_SOCKET "%d", i);
+ for (j = 0; j < smp_cores; j++) {
+ Object *core = object_new(TYPE_CPU_CORE);
+
+ object_property_set_str(core, sid, "socket", &error_abort);
+ object_property_set_bool(core, true, "realized", &error_abort);
}
- object_unref(OBJECT(cpu));
}
-
- /* tell smbios about cpuid version and features */
- smbios_set_cpuid(cpu->env.cpuid_version, cpu->env.features[FEAT_1_EDX]);
}
/* pci-info ROM file. Little endian format */
@@ -1660,6 +1659,11 @@ static void pc_cpu_plug(HotplugHandler *hotplug_dev,
HotplugHandlerClass *hhc;
Error *local_err = NULL;
PCMachineState *pcms = PC_MACHINE(hotplug_dev);
+ CPUState *cs = CPU(dev);
+ X86CPU *cpu = X86_CPU(cs);
+
+ /* tell smbios about cpuid version and features */
+ smbios_set_cpuid(cpu->env.cpuid_version, cpu->env.features[FEAT_1_EDX]);
if (!dev->hotplugged) {
goto out;
Initialize boot CPUs specified with -smp option as CPU core devices. Signed-off-by: Bharata B Rao <bharata@linux.vnet.ibm.com> --- hw/i386/pc.c | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-)