diff options
author | Anthony Liguori <anthony@codemonkey.ws> | 2013-09-03 12:33:32 -0500 |
---|---|---|
committer | Anthony Liguori <anthony@codemonkey.ws> | 2013-09-03 12:33:32 -0500 |
commit | aaa6a40194e9f204cb853f64ef3c1e170bb014e8 (patch) | |
tree | d2cfe475e7bcdafdf50fa2cca72a1a0050794af8 /exec.c | |
parent | bb7d4d82b63bbde06c5584f94bfd9ba3b3e5ff3f (diff) | |
parent | 5e891bf8fd509c4d83cb95d352d88effb20720b1 (diff) | |
download | qemu-aaa6a40194e9f204cb853f64ef3c1e170bb014e8.zip qemu-aaa6a40194e9f204cb853f64ef3c1e170bb014e8.tar.gz qemu-aaa6a40194e9f204cb853f64ef3c1e170bb014e8.tar.bz2 |
Merge remote-tracking branch 'afaerber/tags/qom-cpu-for-anthony' into staging
QOM CPUState refactorings / X86CPU
* Conversion of global CPU list to QTAILQ - preparing for CPU hot-unplug
* Document X86CPU magic numbers for CPUID cache info
# gpg: Signature made Tue 03 Sep 2013 10:59:22 AM CDT using RSA key ID 3E7E013F
# gpg: Can't check signature: public key not found
# By Andreas Färber (3) and Eduardo Habkost (1)
# Via Andreas Färber
* afaerber/tags/qom-cpu-for-anthony:
target-i386: Use #defines instead of magic numbers for CPUID cache info
cpu: Replace qemu_for_each_cpu()
cpu: Use QTAILQ for CPU list
a15mpcore: Use qemu_get_cpu() for generic timers
Diffstat (limited to 'exec.c')
-rw-r--r-- | exec.c | 33 |
1 files changed, 9 insertions, 24 deletions
@@ -69,7 +69,7 @@ static MemoryRegion io_mem_unassigned; #endif -CPUState *first_cpu; +struct CPUTailQ cpus = QTAILQ_HEAD_INITIALIZER(cpus); /* current CPU in the current thread. It is only valid inside cpu_exec() */ DEFINE_TLS(CPUState *, current_cpu); @@ -351,44 +351,29 @@ const VMStateDescription vmstate_cpu_common = { CPUState *qemu_get_cpu(int index) { - CPUState *cpu = first_cpu; + CPUState *cpu; - while (cpu) { + CPU_FOREACH(cpu) { if (cpu->cpu_index == index) { - break; + return cpu; } - cpu = cpu->next_cpu; } - return cpu; -} - -void qemu_for_each_cpu(void (*func)(CPUState *cpu, void *data), void *data) -{ - CPUState *cpu; - - cpu = first_cpu; - while (cpu) { - func(cpu, data); - cpu = cpu->next_cpu; - } + return NULL; } void cpu_exec_init(CPUArchState *env) { CPUState *cpu = ENV_GET_CPU(env); CPUClass *cc = CPU_GET_CLASS(cpu); - CPUState **pcpu; + CPUState *some_cpu; int cpu_index; #if defined(CONFIG_USER_ONLY) cpu_list_lock(); #endif - cpu->next_cpu = NULL; - pcpu = &first_cpu; cpu_index = 0; - while (*pcpu != NULL) { - pcpu = &(*pcpu)->next_cpu; + CPU_FOREACH(some_cpu) { cpu_index++; } cpu->cpu_index = cpu_index; @@ -398,7 +383,7 @@ void cpu_exec_init(CPUArchState *env) #ifndef CONFIG_USER_ONLY cpu->thread_id = qemu_get_thread_id(); #endif - *pcpu = cpu; + QTAILQ_INSERT_TAIL(&cpus, cpu, node); #if defined(CONFIG_USER_ONLY) cpu_list_unlock(); #endif @@ -1762,7 +1747,7 @@ static void tcg_commit(MemoryListener *listener) /* since each CPU stores ram addresses in its TLB cache, we must reset the modified entries */ /* XXX: slow ! */ - for (cpu = first_cpu; cpu != NULL; cpu = cpu->next_cpu) { + CPU_FOREACH(cpu) { CPUArchState *env = cpu->env_ptr; tlb_flush(env, 1); |