Patchwork [RFC,13/18] pc: set explicit APIC ID for CPUs

login
register
mail settings
Submitter Eduardo Habkost
Date Oct. 3, 2012, 1:29 p.m.
Message ID <1349270954-4657-14-git-send-email-ehabkost@redhat.com>
Download mbox | patch
Permalink /patch/188782/
State New
Headers show

Comments

Eduardo Habkost - Oct. 3, 2012, 1:29 p.m.
The current behavior (setting APIC ID = CPU index) is kept, but this
will allow the PC code to set the proper CPU topology, later.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 hw/pc.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Patch

diff --git a/hw/pc.c b/hw/pc.c
index a8788de..c64c218 100644
--- a/hw/pc.c
+++ b/hw/pc.c
@@ -903,19 +903,19 @@  void pc_acpi_smi_interrupt(void *opaque, int irq, int level)
     }
 }
 
-static X86CPU *pc_new_cpu(PC *pc, const char *cpu_model)
+static X86CPU *pc_new_cpu(PC *pc, const char *cpu_model, uint32_t apic_id)
 {
     X86CPU *cpu;
     CPUX86State *env;
 
-    cpu = cpu_x86_init(cpu_model, -1);
+    cpu = cpu_x86_init(cpu_model, apic_id);
     if (cpu == NULL) {
         fprintf(stderr, "Unable to find x86 CPU definition\n");
         exit(1);
     }
     env = &cpu->env;
     if ((env->cpuid_features & CPUID_APIC) || smp_cpus > 1) {
-        env->apic_state = apic_init(env, env->cpuid_apic_id);
+        env->apic_state = apic_init(env, apic_id);
     }
     cpu_reset(CPU(cpu));
     return cpu;
@@ -935,7 +935,7 @@  void pc_cpus_init(PC *pc, const char *cpu_model)
     }
 
     for(i = 0; i < smp_cpus; i++) {
-        pc_new_cpu(pc, cpu_model);
+        pc_new_cpu(pc, cpu_model, i);
     }
 }