@@ -1770,7 +1770,7 @@ static void x86_cpu_initfn(Object *obj)
x86_cpuid_get_tsc_freq,
x86_cpuid_set_tsc_freq, NULL, NULL, NULL);
- env->cpuid_apic_id = env->cpu_index;
+ env->cpuid_apic_id = apic_id_for_cpu(env->cpu_index);
/* init various static tables used in TCG mode */
if (tcg_enabled() && !inited) {
@@ -908,6 +908,23 @@ void cpu_clear_apic_feature(CPUX86State *env);
void host_cpuid(uint32_t function, uint32_t count,
uint32_t *eax, uint32_t *ebx, uint32_t *ecx, uint32_t *edx);
+
+/* Calculate initial APIC ID for a specific CPU index
+ *
+ * Currently we need to be able to calculate the APIC ID from the CPU index
+ * only, as the QEMU<->Seabios(ACPI) interface for CPU hotplug isn't able
+ * to let the ACPI CPU hotplug code to retrivew the APIC ID at hotplug
+ * time.
+ */
+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;
+}
+
+
/* helper.c */
int cpu_x86_handle_mmu_fault(CPUX86State *env, target_ulong addr,
int is_write, int mmu_idx);
Currently we need a way to calculate the Initial APIC ID using only the CPU index, as the CPU hotplug interface doesn't have a method to send the correct APIC ID to the ACPI hotplug code at hotplug-time. Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> --- target-i386/cpu.c | 2 +- target-i386/cpu.h | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-)