[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 08/37] target-i386: Introduce x86_cpu_apic_id_from_i
From: |
Andreas Färber |
Subject: |
[Qemu-devel] [PATCH 08/37] target-i386: Introduce x86_cpu_apic_id_from_index() function |
Date: |
Mon, 28 Jan 2013 17:18:25 +0100 |
From: Eduardo Habkost <address@hidden>
This function will be used by both the CPU initialization code and the
fw_cfg table initialization code.
Later this function will be updated to generate APIC IDs according to
the CPU topology.
Signed-off-by: Eduardo Habkost <address@hidden>
Signed-off-by: Andreas Färber <address@hidden>
---
target-i386/cpu.c | 17 ++++++++++++++++-
target-i386/cpu.h | 2 ++
2 Dateien geändert, 18 Zeilen hinzugefügt(+), 1 Zeile entfernt(-)
diff --git a/target-i386/cpu.c b/target-i386/cpu.c
index db9086e..75dc973 100644
--- a/target-i386/cpu.c
+++ b/target-i386/cpu.c
@@ -2194,6 +2194,21 @@ void x86_cpu_realize(Object *obj, Error **errp)
cpu_reset(CPU(cpu));
}
+/* Calculates initial APIC ID for a specific CPU index
+ *
+ * Currently we need to be able to calculate the APIC ID from the CPU index
+ * alone (without requiring a CPU object), as the QEMU<->Seabios interfaces
have
+ * no concept of "CPU index", and the NUMA tables on fw_cfg need the APIC ID of
+ * all CPUs up to max_cpus.
+ */
+uint32_t x86_cpu_apic_id_from_index(unsigned int cpu_index)
+{
+ /* right now APIC ID == CPU index. this will eventually change to use
+ * the CPU topology configuration properly
+ */
+ return cpu_index;
+}
+
static void x86_cpu_initfn(Object *obj)
{
CPUState *cs = CPU(obj);
@@ -2228,7 +2243,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 = cs->cpu_index;
+ env->cpuid_apic_id = x86_cpu_apic_id_from_index(cs->cpu_index);
/* init various static tables used in TCG mode */
if (tcg_enabled() && !inited) {
diff --git a/target-i386/cpu.h b/target-i386/cpu.h
index 9d4fcf9..9442f08 100644
--- a/target-i386/cpu.h
+++ b/target-i386/cpu.h
@@ -1255,4 +1255,6 @@ void disable_kvm_pv_eoi(void);
/* Return name of 32-bit register, from a R_* constant */
const char *get_register_name_32(unsigned int reg);
+uint32_t x86_cpu_apic_id_from_index(unsigned int cpu_index);
+
#endif /* CPU_I386_H */
--
1.7.10.4
- [Qemu-devel] [PULL 00/37] QOM CPUState patch queue 2013-01-28, Andreas Färber, 2013/01/28
- [Qemu-devel] [PATCH 01/37] target-openrisc: Drop OpenRISCCPUList, Andreas Färber, 2013/01/28
- [Qemu-devel] [PATCH 06/37] kvm: Create kvm_arch_vcpu_id() function, Andreas Färber, 2013/01/28
- [Qemu-devel] [PATCH 04/37] target-i386: Don't set any KVM flag by default if KVM is disabled, Andreas Färber, 2013/01/28
- [Qemu-devel] [PATCH 11/37] pc: Set fw_cfg data based on APIC ID calculation, Andreas Färber, 2013/01/28
- [Qemu-devel] [PATCH 05/37] pc: Reverse pc_init_pci() compatibility logic, Andreas Färber, 2013/01/28
- [Qemu-devel] [PATCH 09/37] fw_cfg: Remove FW_CFG_MAX_CPUS from fw_cfg_init(), Andreas Färber, 2013/01/28
- [Qemu-devel] [PATCH 03/37] kvm: Add fake KVM_FEATURE_CLOCKSOURCE_STABLE_BIT for builds without KVM, Andreas Färber, 2013/01/28
- [Qemu-devel] [PATCH 10/37] cpus.h: Make constant smp_cores/smp_threads available on *-user, Andreas Färber, 2013/01/28
- [Qemu-devel] [PATCH 07/37] target-i386: kvm: Set vcpu_id to APIC ID instead of CPU index, Andreas Färber, 2013/01/28
- [Qemu-devel] [PATCH 08/37] target-i386: Introduce x86_cpu_apic_id_from_index() function,
Andreas Färber <=
- [Qemu-devel] [PATCH 02/37] target-openrisc: Clean up triple QOM casts, Andreas Färber, 2013/01/28
- [Qemu-devel] [PATCH 18/37] target-i386: Remove vendor_override field from CPUX86State, Andreas Färber, 2013/01/28
- [Qemu-devel] [PATCH 21/37] cpu: Add model resolution support to CPUClass, Andreas Färber, 2013/01/28
- [Qemu-devel] [PATCH 13/37] pc: Generate APIC IDs according to CPU topology, Andreas Färber, 2013/01/28
- [Qemu-devel] [PATCH 14/37] target-i386: Simplify cpu_x86_find_by_name(), Andreas Färber, 2013/01/28
- [Qemu-devel] [PATCH 19/37] target-i386: Set custom features/properties without intermediate x86_def_t, Andreas Färber, 2013/01/28
- [Qemu-devel] [PATCH 12/37] target-i386: Topology & APIC ID utility functions, Andreas Färber, 2013/01/28
- [Qemu-devel] [PATCH 16/37] target-i386: Print deprecation warning if xlevel < 0x80000000, Andreas Färber, 2013/01/28
- [Qemu-devel] [PATCH 15/37] target-i386: Drop redundant list of CPU definitions, Andreas Färber, 2013/01/28
- [Qemu-devel] [PATCH 17/37] target-i386: Replace uint32_t vendor fields by vendor string in x86_def_t, Andreas Färber, 2013/01/28