Message ID | 1439397664-70734-5-git-send-email-pbonzini@redhat.com |
---|---|
State | New |
Headers | show |
On 12 August 2015 at 17:40, Paolo Bonzini <pbonzini@redhat.com> wrote: > The header is included from basically everywhere, thanks to cpu.h. > It should be moved to the (TCG only) files that actually need it. > As a start, remove non-TCG stuff. > > While adding a #ifndef CONFIG_USER_ONLY include section to cpu-exec.c, > move memory API files under it. > > Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> > --- a/cpu-exec.c > +++ b/cpu-exec.c > @@ -22,12 +22,15 @@ > #include "disas/disas.h" > #include "tcg.h" > #include "qemu/atomic.h" > -#include "sysemu/qtest.h" > #include "qemu/timer.h" > +#include "exec/tb-hash.h" > +#include "qemu/rcu.h" > + > +#if !defined(CONFIG_USER_ONLY) > #include "exec/address-spaces.h" > #include "exec/memory-internal.h" > -#include "qemu/rcu.h" > -#include "exec/tb-hash.h" > +#include "sysemu/sysemu.h" > +#endif > --- a/include/sysemu/sysemu.h > +++ b/include/sysemu/sysemu.h > @@ -205,6 +205,9 @@ QemuOpts *qemu_get_machine_opts(void); > bool defaults_enabled(void); > bool usb_enabled(void); > > +bool qemu_in_vcpu_thread(void); > +void phys_mem_set_alloc(void *(*alloc)(size_t, uint64_t *align)); > + > extern QemuOptsList qemu_legacy_drive_opts; > extern QemuOptsList qemu_common_drive_opts; > extern QemuOptsList qemu_drive_opts; sysemu.h is a bit of a huge grab-bag of stuff, so it seems a shame to put qemu_in_vcpu_thread() into it, given that (a) that function is only used by a couple of files and (b) the files that do want that function don't want most of what's in sysemu.h... thanks -- PMM
On 28/08/2015 16:53, Peter Maydell wrote: > sysemu.h is a bit of a huge grab-bag of stuff, so it seems > a shame to put qemu_in_vcpu_thread() into it, given that > (a) that function is only used by a couple of files and > (b) the files that do want that function don't want most of > what's in sysemu.h... Ok, I'll replace it with a different patch that makes qemu_in_vcpu_thread() static. Paolo
diff --git a/cpu-exec.c b/cpu-exec.c index c680cca..599e64d 100644 --- a/cpu-exec.c +++ b/cpu-exec.c @@ -22,12 +22,15 @@ #include "disas/disas.h" #include "tcg.h" #include "qemu/atomic.h" -#include "sysemu/qtest.h" #include "qemu/timer.h" +#include "exec/tb-hash.h" +#include "qemu/rcu.h" + +#if !defined(CONFIG_USER_ONLY) #include "exec/address-spaces.h" #include "exec/memory-internal.h" -#include "qemu/rcu.h" -#include "exec/tb-hash.h" +#include "sysemu/sysemu.h" +#endif /* -icount align implementation. */ diff --git a/include/exec/exec-all.h b/include/exec/exec-all.h index dafd177..eb77373 100644 --- a/include/exec/exec-all.h +++ b/include/exec/exec-all.h @@ -92,7 +92,6 @@ void cpu_exec_init(CPUState *cpu, Error **errp); void QEMU_NORETURN cpu_loop_exit(CPUState *cpu); #if !defined(CONFIG_USER_ONLY) -bool qemu_in_vcpu_thread(void); void cpu_reload_memory_map(CPUState *cpu); void tcg_cpu_address_space_init(CPUState *cpu, AddressSpace *as); /* cputlb.c */ @@ -320,8 +319,6 @@ extern uintptr_t tci_tb_ptr; #if !defined(CONFIG_USER_ONLY) -void phys_mem_set_alloc(void *(*alloc)(size_t, uint64_t *align)); - struct MemoryRegion *iotlb_to_region(CPUState *cpu, hwaddr index); @@ -346,7 +343,4 @@ extern int singlestep; /* cpu-exec.c */ extern volatile sig_atomic_t exit_request; -#if !defined(CONFIG_USER_ONLY) -void migration_bitmap_extend(ram_addr_t old, ram_addr_t new); -#endif #endif diff --git a/include/exec/ram_addr.h b/include/exec/ram_addr.h index c113f21..7e7566e 100644 --- a/include/exec/ram_addr.h +++ b/include/exec/ram_addr.h @@ -249,5 +249,6 @@ uint64_t cpu_physical_memory_sync_dirty_bitmap(unsigned long *dest, return num_dirty; } +void migration_bitmap_extend(ram_addr_t old, ram_addr_t new); #endif #endif diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h index 44570d1..93a70e3 100644 --- a/include/sysemu/sysemu.h +++ b/include/sysemu/sysemu.h @@ -205,6 +205,9 @@ QemuOpts *qemu_get_machine_opts(void); bool defaults_enabled(void); bool usb_enabled(void); +bool qemu_in_vcpu_thread(void); +void phys_mem_set_alloc(void *(*alloc)(size_t, uint64_t *align)); + extern QemuOptsList qemu_legacy_drive_opts; extern QemuOptsList qemu_common_drive_opts; extern QemuOptsList qemu_drive_opts;
The header is included from basically everywhere, thanks to cpu.h. It should be moved to the (TCG only) files that actually need it. As a start, remove non-TCG stuff. While adding a #ifndef CONFIG_USER_ONLY include section to cpu-exec.c, move memory API files under it. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> --- cpu-exec.c | 9 ++++++--- include/exec/exec-all.h | 6 ------ include/exec/ram_addr.h | 1 + include/sysemu/sysemu.h | 3 +++ 4 files changed, 10 insertions(+), 9 deletions(-)