Patchwork [QEMU,RFC,7/7] generate APIC IDs according to CPU topology

login
register
mail settings
Submitter Eduardo Habkost
Date July 10, 2012, 8:22 p.m.
Message ID <1341951743-2285-8-git-send-email-ehabkost@redhat.com>
Download mbox | patch
Permalink /patch/170284/
State New
Headers show

Comments

Eduardo Habkost - July 10, 2012, 8:22 p.m.
NOTE: this is unfinished, and will break live-migration between older
and newer QEMU versions if applied as-is. We need to make the older
machine-types keep the existing behavior when generating APIC IDs.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 target-i386/cpu.h |    7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

Patch

diff --git a/target-i386/cpu.h b/target-i386/cpu.h
index e983c10..860aeaa 100644
--- a/target-i386/cpu.h
+++ b/target-i386/cpu.h
@@ -21,6 +21,8 @@ 
 
 #include "config.h"
 #include "qemu-common.h"
+#include "topology.h"
+#include "cpus.h"
 
 #ifdef TARGET_X86_64
 #define TARGET_LONG_BITS 64
@@ -918,10 +920,7 @@  void host_cpuid(uint32_t function, uint32_t count,
  */
 static inline uint8_t apic_id_for_cpu(int cpu_index)
 {
-    /* right now APIC ID == CPU index. this will eventually change to use
-     * the CPU topology configuration properly
-     */
-    return cpu_index;
+    return topo_make_apicid(smp_cores, smp_threads, cpu_index);
 }