cpus: Move CPU code from exec.c to cpus.c
PATCH 1/1 cpus: Move CPU code from exec.c to cpus.c
This code was introduced with SMP support in commit 6a00d60127, later commit 296af7c952 moved CPU parts to cpus.c but forgot this code. Move now and simplify ifdef'ry.
--- cpus.c | 18 ++++++++++++++++++ exec.c | 22 ---------------------- 2 files changed, 18 insertions(+), 22 deletions(-)
cpus.c +18 -0
@@ -92,6 +92,11 @@ static unsigned int throttle_percentage;#define CPU_THROTTLE_PCT_MAX 99#define CPU_THROTTLE_TIMESLICE_NS 10000000 +CPUTailQ cpus =QTAILQ_HEAD_INITIALIZER (cpus); + +/* current CPU in the current thread. It is only valid inside cpu_exec() */ +__threadCPUState *current_cpu; +bool cpu_is_stopped (CPUState *cpu) {return cpu->stopped || !runstate_is_running ();
@@ -134,6 +139,19 @@ static bool all_cpu_threads_idle(void)return true; } +CPUState *qemu_get_cpu (int index) +{ +CPUState *cpu; + +CPU_FOREACH (cpu) { +if (cpu->cpu_index == index) { +return cpu; + } + } + +return NULL ; +} +/***********************************************************/ /* guest cycle counter */
exec.c +0 -22
@@ -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() */ -__threadCPUState *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) {
Signature · 1 line
2.21.3
Quoted 9 lines · Philippe Mathieu-Daudé
This code was introduced with SMP support in commit
6a00d60127, later commit296af7c952moved CPU parts tocpus.cbut forgot this code. Move now and simplify ifdef'ry.Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- cpus.c | 18 ++++++++++++++++++ exec.c | 22 ---------------------- 2 files changed, 18 insertions(+), 22 deletions(-)
r~
Paolo Bonzini
AppliedQuoted 77 lines · Philippe Mathieu-Daudé
This code was introduced with SMP support in commit
6a00d60127, later commit296af7c952moved CPU parts tocpus.cbut forgot this code. Move now and simplify ifdef'ry.Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- cpus.c | 18 ++++++++++++++++++ exec.c | 22 ---------------------- 2 files changed, 18 insertions(+), 22 deletions(-)cpus.c +18
-0@@ -92,6 +92,11 @@ static unsigned int throttle_percentage;#define CPU_THROTTLE_PCT_MAX 99#define CPU_THROTTLE_TIMESLICE_NS 10000000 +CPUTailQ cpus =QTAILQ_HEAD_INITIALIZER (cpus); + +/* current CPU in the current thread. It is only valid inside cpu_exec() */ +__threadCPUState *current_cpu; +bool cpu_is_stopped (CPUState *cpu) {return cpu->stopped || !runstate_is_running ();@@ -134,6 +139,19 @@ static bool all_cpu_threads_idle(void)return true; } +CPUState *qemu_get_cpu (int index) +{ +CPUState *cpu; + +CPU_FOREACH (cpu) { +if (cpu->cpu_index == index) { +return cpu; + } + } + +return NULL ; +} +/***********************************************************/ /* guest cycle counter */ exec.c +0
-15@@ -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() */ -__threadCPUState *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;
exec.c const VMStateDescription vmstate_cpu_common = { · line 831
Quoted 10 lines
exec.c +0
-7- } - } - -return NULL ; -} - -#if !defined(CONFIG_USER_ONLY )void cpu_address_space_init (CPUState *cpu,int asidx,const char *prefix,MemoryRegion *mr) {
Queued, thanks.
Paolo
Quoted 91 lines · Paolo Bonzini
Quoted 77 lines · Philippe Mathieu-Daudé
This code was introduced with SMP support in commit
6a00d60127, later commit296af7c952moved CPU parts tocpus.cbut forgot this code. Move now and simplify ifdef'ry.Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- cpus.c | 18 ++++++++++++++++++ exec.c | 22 ---------------------- 2 files changed, 18 insertions(+), 22 deletions(-)cpus.c +18
-0@@ -92,6 +92,11 @@ static unsigned int throttle_percentage;#define CPU_THROTTLE_PCT_MAX 99#define CPU_THROTTLE_TIMESLICE_NS 10000000 +CPUTailQ cpus =QTAILQ_HEAD_INITIALIZER (cpus); + +/* current CPU in the current thread. It is only valid inside cpu_exec() */ +__threadCPUState *current_cpu; +bool cpu_is_stopped (CPUState *cpu) {return cpu->stopped || !runstate_is_running ();@@ -134,6 +139,19 @@ static bool all_cpu_threads_idle(void)return true; } +CPUState *qemu_get_cpu (int index) +{ +CPUState *cpu; + +CPU_FOREACH (cpu) { +if (cpu->cpu_index == index) { +return cpu; + } + } + +return NULL ; +} +/***********************************************************/ /* guest cycle counter */ exec.c +0
-15@@ -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() */ -__threadCPUState *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;exec.c const VMStateDescription vmstate_cpu_common = { · line 831
Quoted 10 lines
exec.c +0
-7- } - } - -return NULL ; -} - -#if !defined(CONFIG_USER_ONLY )void cpu_address_space_init (CPUState *cpu,int asidx,const char *prefix,MemoryRegion *mr) {Queued, thanks.
Quoted 3 lines
Paolo
Wait... this is in exec.c because cpus.c is not linked into user-mode emulators.
Paolo
Quoted 92 lines · Paolo Bonzini
Quoted 91 lines · Paolo Bonzini
Quoted 77 lines · Philippe Mathieu-Daudé
This code was introduced with SMP support in commit
6a00d60127, later commit296af7c952moved CPU parts tocpus.cbut forgot this code. Move now and simplify ifdef'ry.Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- cpus.c | 18 ++++++++++++++++++ exec.c | 22 ---------------------- 2 files changed, 18 insertions(+), 22 deletions(-)cpus.c +18
-0@@ -92,6 +92,11 @@ static unsigned int throttle_percentage;#define CPU_THROTTLE_PCT_MAX 99#define CPU_THROTTLE_TIMESLICE_NS 10000000 +CPUTailQ cpus =QTAILQ_HEAD_INITIALIZER (cpus); + +/* current CPU in the current thread. It is only valid inside cpu_exec() */ +__threadCPUState *current_cpu; +bool cpu_is_stopped (CPUState *cpu) {return cpu->stopped || !runstate_is_running ();@@ -134,6 +139,19 @@ static bool all_cpu_threads_idle(void)return true; } +CPUState *qemu_get_cpu (int index) +{ +CPUState *cpu; + +CPU_FOREACH (cpu) { +if (cpu->cpu_index == index) { +return cpu; + } + } + +return NULL ; +} +/***********************************************************/ /* guest cycle counter */ exec.c +0
-15@@ -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() */ -__threadCPUState *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;exec.c const VMStateDescription vmstate_cpu_common = { · line 831
Quoted 10 lines
exec.c +0
-7- } - } - -return NULL ; -} - -#if !defined(CONFIG_USER_ONLY )void cpu_address_space_init (CPUState *cpu,int asidx,const char *prefix,MemoryRegion *mr) {Queued, thanks.
Quoted 6 lines
Quoted 3 lines
Paolo
Wait... this is in
exec.cbecausecpus.cis not linked into user-mode emulators.
Oops sorry. This should be moved to cpus-common.c then. Will respin.
Quoted 92 lines · Paolo Bonzini
Quoted 91 lines · Paolo Bonzini
Quoted 77 lines · Philippe Mathieu-Daudé
This code was introduced with SMP support in commit
6a00d60127, later commit296af7c952moved CPU parts tocpus.cbut forgot this code. Move now and simplify ifdef'ry.Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- cpus.c | 18 ++++++++++++++++++ exec.c | 22 ---------------------- 2 files changed, 18 insertions(+), 22 deletions(-)cpus.c +18
-0@@ -92,6 +92,11 @@ static unsigned int throttle_percentage;#define CPU_THROTTLE_PCT_MAX 99#define CPU_THROTTLE_TIMESLICE_NS 10000000 +CPUTailQ cpus =QTAILQ_HEAD_INITIALIZER (cpus); + +/* current CPU in the current thread. It is only valid inside cpu_exec() */ +__threadCPUState *current_cpu; +bool cpu_is_stopped (CPUState *cpu) {return cpu->stopped || !runstate_is_running ();@@ -134,6 +139,19 @@ static bool all_cpu_threads_idle(void)return true; } +CPUState *qemu_get_cpu (int index) +{ +CPUState *cpu; + +CPU_FOREACH (cpu) { +if (cpu->cpu_index == index) { +return cpu; + } + } + +return NULL ; +} +/***********************************************************/ /* guest cycle counter */ exec.c +0
-15@@ -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() */ -__threadCPUState *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;exec.c const VMStateDescription vmstate_cpu_common = { · line 831
Quoted 10 lines
exec.c +0
-7- } - } - -return NULL ; -} - -#if !defined(CONFIG_USER_ONLY )void cpu_address_space_init (CPUState *cpu,int asidx,const char *prefix,MemoryRegion *mr) {Queued, thanks.
Quoted 6 lines
Quoted 3 lines
Paolo
Wait... this is in
exec.cbecausecpus.cis not linked into user-mode emulators.
cpus-common then?
Signature · 1 line
Alex Bennée
Quoted 5 lines · Philippe Mathieu-Daudé
This code was introduced with SMP support in commit
6a00d60127, later commit296af7c952moved CPU parts tocpus.cbut forgot this code. Move now and simplify ifdef'ry.Signed-off-by Philippe Mathieu-Daudé <[email protected]>
Signature · 1 line
Alex Bennée