qemu-arm
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH v3 13/22] x86: coldplug cpus


From: Gerd Hoffmann
Subject: [PATCH v3 13/22] x86: coldplug cpus
Date: Wed, 20 May 2020 15:19:54 +0200

microvm needs this, for correct madt creation
(make sure enable bit is set).

Signed-off-by: Gerd Hoffmann <address@hidden>
---
 hw/i386/x86.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/hw/i386/x86.c b/hw/i386/x86.c
index 7a3bc7ab6639..ac7a0a958781 100644
--- a/hw/i386/x86.c
+++ b/hw/i386/x86.c
@@ -118,6 +118,7 @@ uint32_t x86_cpu_apic_id_from_index(X86MachineState *x86ms,
 
 void x86_cpu_new(X86MachineState *x86ms, int64_t apic_id, Error **errp)
 {
+    MachineClass *mc = MACHINE_GET_CLASS(x86ms);
     Object *cpu = NULL;
     Error *local_err = NULL;
 
@@ -126,6 +127,16 @@ void x86_cpu_new(X86MachineState *x86ms, int64_t apic_id, 
Error **errp)
     object_property_set_uint(cpu, apic_id, "apic-id", &local_err);
     object_property_set_bool(cpu, true, "realized", &local_err);
 
+    if (!mc->has_hotpluggable_cpus) {
+        /* coldplug cpu */
+        MachineState *ms = MACHINE(x86ms);
+        int i = 0;
+        while (ms->possible_cpus->cpus[i].arch_id != apic_id) {
+            i++;
+        }
+        ms->possible_cpus->cpus[i].cpu = cpu;
+    }
+
     object_unref(cpu);
     error_propagate(errp, local_err);
 }
-- 
2.18.4




reply via email to

[Prev in Thread] Current Thread [Next in Thread]