[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 39/53] cpus: Move CPU code from exec.c to cpus-common.c
From: |
Paolo Bonzini |
Subject: |
[PULL 39/53] cpus: Move CPU code from exec.c to cpus-common.c |
Date: |
Mon, 6 Jul 2020 12:41:41 -0400 |
From: Philippe Mathieu-Daudé <philmd@redhat.com>
This code was introduced with SMP support in commit 6a00d60127,
later commit 267f685b8b moved CPU list management to common code
but forgot this code. Move now and simplify ifdef'ry.
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20200702104017.14057-1-philmd@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
cpus-common.c | 18 ++++++++++++++++++
exec.c | 22 ----------------------
2 files changed, 18 insertions(+), 22 deletions(-)
diff --git a/cpus-common.c b/cpus-common.c
index 8f5512b3d7..34044f4e4c 100644
--- a/cpus-common.c
+++ b/cpus-common.c
@@ -72,6 +72,8 @@ static int cpu_get_free_index(void)
return max_cpu_index;
}
+CPUTailQ cpus = QTAILQ_HEAD_INITIALIZER(cpus);
+
void cpu_list_add(CPUState *cpu)
{
QEMU_LOCK_GUARD(&qemu_cpu_list_lock);
@@ -96,6 +98,22 @@ void cpu_list_remove(CPUState *cpu)
cpu->cpu_index = UNASSIGNED_CPU_INDEX;
}
+CPUState *qemu_get_cpu(int index)
+{
+ CPUState *cpu;
+
+ CPU_FOREACH(cpu) {
+ if (cpu->cpu_index == index) {
+ return cpu;
+ }
+ }
+
+ return NULL;
+}
+
+/* current CPU in the current thread. It is only valid inside cpu_exec() */
+__thread CPUState *current_cpu;
+
struct qemu_work_item {
QSIMPLEQ_ENTRY(qemu_work_item) node;
run_on_cpu_func func;
diff --git a/exec.c b/exec.c
index 21926dc9c7..997b7db15f 100644
--- a/exec.c
+++ b/exec.c
@@ -98,12 +98,6 @@ AddressSpace address_space_memory;
static MemoryRegion io_mem_unassigned;
#endif
-CPUTailQ cpus = QTAILQ_HEAD_INITIALIZER(cpus);
-
-/* current CPU in the current thread. It is only valid inside
- cpu_exec() */
-__thread CPUState *current_cpu;
-
uintptr_t qemu_host_page_size;
intptr_t qemu_host_page_mask;
@@ -832,22 +826,6 @@ const VMStateDescription vmstate_cpu_common = {
}
};
-#endif
-
-CPUState *qemu_get_cpu(int index)
-{
- CPUState *cpu;
-
- CPU_FOREACH(cpu) {
- if (cpu->cpu_index == index) {
- return cpu;
- }
- }
-
- return NULL;
-}
-
-#if !defined(CONFIG_USER_ONLY)
void cpu_address_space_init(CPUState *cpu, int asidx,
const char *prefix, MemoryRegion *mr)
{
--
2.26.2
- Re: [PULL 28/53] Makefile: simplify MINIKCONF rules, (continued)
- [PULL 36/53] chardev/tcp: fix error message double free error, Paolo Bonzini, 2020/07/06
- [PULL 48/53] target/i386/kvm: Simplify get_para_features(), Paolo Bonzini, 2020/07/06
- [PULL 44/53] softmmu/vl: Remove the check for colons in -accel parameters, Paolo Bonzini, 2020/07/06
- [PULL 52/53] target/i386: Enable TSX Suspend Load Address Tracking feature, Paolo Bonzini, 2020/07/06
- [PULL 51/53] target/i386: Add SERIALIZE cpu feature, Paolo Bonzini, 2020/07/06
- [PULL 34/53] iscsi: handle check condition status in retry loop, Paolo Bonzini, 2020/07/06
- [PULL 50/53] target/i386/kvm: Simplify kvm_get_supported_[feature]_msrs(), Paolo Bonzini, 2020/07/06
- [PULL 42/53] cpu-throttle: new module, extracted from cpus.c, Paolo Bonzini, 2020/07/06
- [PULL 43/53] cpu-timers, icount: new modules, Paolo Bonzini, 2020/07/06
- [PULL 39/53] cpus: Move CPU code from exec.c to cpus-common.c,
Paolo Bonzini <=
- Re: [PULL 00/53] Misc patches for QEMU 5.1 soft freeze, no-reply, 2020/07/06
- Re: [PULL 00/53] Misc patches for QEMU 5.1 soft freeze, Peter Maydell, 2020/07/07
- Re: [PULL 00/53] Misc patches for QEMU 5.1 soft freeze, Peter Maydell, 2020/07/07
- Re: [PULL 00/53] Misc patches for QEMU 5.1 soft freeze, Claudio Fontana, 2020/07/08
- Re: [PULL 00/53] Misc patches for QEMU 5.1 soft freeze, Paolo Bonzini, 2020/07/08
- Re: [PULL 00/53] Misc patches for QEMU 5.1 soft freeze, Claudio Fontana, 2020/07/08
- Re: [PULL 00/53] Misc patches for QEMU 5.1 soft freeze, Paolo Bonzini, 2020/07/08
- Re: [PULL 00/53] Misc patches for QEMU 5.1 soft freeze, Claudio Fontana, 2020/07/08
- Re: [PULL 00/53] Misc patches for QEMU 5.1 soft freeze, Claudio Fontana, 2020/07/08