diff mbox

[14/15] Don't include qemu-common.h in headers

Message ID 1458054221-16923-15-git-send-email-armbru@redhat.com
State New
Headers show

Commit Message

Markus Armbruster March 15, 2016, 3:03 p.m. UTC
qemu-common.h should only be included by .c files.  Its file comment
explains why: "No header file should depend on qemu-common.h, as this
would easily lead to circular header dependencies."

We include it in many headers anyway.  Fix that.

Dropping these ill-advised includes requires including
qemu/fprintf-fn.h, cpu.h or exec/hwaddr.h instead in a few headers
that actually need those, and of course including qemu-common.h in .c
files that need it, except some of them need only qemu/module.h.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
 arch_init.c                              | 2 ++
 audio/audio.c                            | 2 ++
 backends/hostmem-ram.c                   | 2 ++
 backends/rng-random.c                    | 1 +
 backends/rng.c                           | 1 +
 backends/tpm.c                           | 1 +
 block/backup.c                           | 2 +-
 block/blkverify.c                        | 1 +
 block/block-backend.c                    | 1 +
 block/gluster.c                          | 2 ++
 block/io.c                               | 1 +
 block/nbd-client.h                       | 1 -
 block/nbd.c                              | 1 +
 block/null.c                             | 1 +
 block/qapi.c                             | 1 +
 block/qed.c                              | 1 +
 block/quorum.c                           | 1 +
 block/raw_bsd.c                          | 1 +
 block/ssh.c                              | 3 +--
 block/throttle-groups.c                  | 1 +
 blockdev.c                               | 1 +
 cpu-exec.c                               | 1 +
 cpus.c                                   | 3 +--
 cputlb.c                                 | 1 +
 crypto/secret.c                          | 1 +
 crypto/tlscreds.c                        | 1 +
 crypto/tlscredsanon.c                    | 1 +
 crypto/tlscredsx509.c                    | 1 +
 hmp.c                                    | 1 +
 hmp.h                                    | 1 -
 hw/9pfs/9p-handle.c                      | 1 +
 hw/9pfs/9p-local.c                       | 1 +
 hw/9pfs/9p-proxy.c                       | 1 +
 hw/9pfs/9p-synth.c                       | 1 +
 hw/alpha/dp264.c                         | 1 +
 hw/arm/boot.c                            | 1 +
 hw/arm/digic_boards.c                    | 1 +
 hw/arm/highbank.c                        | 1 +
 hw/arm/omap1.c                           | 1 +
 hw/arm/pxa2xx.c                          | 1 +
 hw/arm/strongarm.c                       | 1 +
 hw/arm/vexpress.c                        | 1 +
 hw/arm/virt.c                            | 1 +
 hw/block/nvme.c                          | 1 +
 hw/core/fw-path-provider.c               | 1 +
 hw/core/loader.c                         | 1 +
 hw/core/machine.c                        | 1 +
 hw/core/nmi.c                            | 1 +
 hw/core/ptimer.c                         | 2 ++
 hw/core/qdev-properties.c                | 1 +
 hw/core/qdev.c                           | 1 +
 hw/core/stream.c                         | 1 +
 hw/display/qxl.h                         | 2 --
 hw/dma/pl330.c                           | 1 +
 hw/i386/pc.c                             | 2 ++
 hw/i386/pc_sysfw.c                       | 1 +
 hw/ide/core.c                            | 1 +
 hw/lm32/lm32_boards.c                    | 1 +
 hw/lm32/lm32_hwsetup.h                   | 1 -
 hw/lm32/milkymist.c                      | 1 +
 hw/mips/mips_fulong2e.c                  | 1 +
 hw/mips/mips_jazz.c                      | 1 +
 hw/mips/mips_malta.c                     | 1 +
 hw/mips/mips_mipssim.c                   | 2 ++
 hw/mips/mips_r4k.c                       | 2 ++
 hw/misc/ivshmem.c                        | 2 ++
 hw/misc/macio/cuda.c                     | 1 +
 hw/net/allwinner_emac.c                  | 1 +
 hw/nvram/fw_cfg.c                        | 1 +
 hw/nvram/mac_nvram.c                     | 2 ++
 hw/pci-bridge/dec.h                      | 2 --
 hw/pci-host/prep.c                       | 1 +
 hw/pci/msix.c                            | 1 +
 hw/pci/pci.c                             | 2 ++
 hw/ppc/mac_newworld.c                    | 2 ++
 hw/ppc/mac_oldworld.c                    | 2 ++
 hw/ppc/ppc405_boards.c                   | 2 ++
 hw/ppc/spapr_drc.c                       | 1 +
 hw/ppc/spapr_events.c                    | 2 ++
 hw/ppc/spapr_rtas.c                      | 2 ++
 hw/ppc/spapr_rtc.c                       | 2 ++
 hw/ppc/virtex_ml507.c                    | 1 +
 hw/s390x/ipl.c                           | 1 +
 hw/scsi/megasas.c                        | 1 +
 hw/scsi/scsi-bus.c                       | 1 +
 hw/scsi/vhost-scsi.c                     | 1 +
 hw/sd/core.c                             | 1 +
 hw/smbios/smbios.c                       | 1 +
 hw/sparc/leon3.c                         | 2 ++
 hw/sparc/sun4m.c                         | 2 ++
 hw/sparc64/sun4u.c                       | 2 ++
 hw/timer/ds1338.c                        | 1 +
 hw/timer/m48t59.c                        | 1 +
 hw/timer/mc146818rtc.c                   | 2 ++
 hw/timer/pl031.c                         | 1 +
 hw/timer/twl92230.c                      | 1 +
 hw/tpm/tpm_tis.h                         | 1 -
 hw/usb/bus.c                             | 1 +
 hw/usb/ccid-card-passthru.c              | 1 +
 hw/vfio/pci.h                            | 1 -
 hw/virtio/vhost-user.c                   | 1 +
 hw/xen/xen_pt.h                          | 1 -
 include/block/aio.h                      | 1 -
 include/block/nbd.h                      | 2 --
 include/block/qapi.h                     | 1 +
 include/block/snapshot.h                 | 1 -
 include/block/write-threshold.h          | 2 --
 include/disas/bfd.h                      | 2 +-
 include/disas/disas.h                    | 2 --
 include/exec/cpu-all.h                   | 1 -
 include/exec/exec-all.h                  | 2 --
 include/exec/ioport.h                    | 1 -
 include/hw/acpi/tco.h                    | 1 -
 include/hw/arm/allwinner-a10.h           | 1 -
 include/hw/arm/bcm2835_peripherals.h     | 1 -
 include/hw/arm/exynos4210.h              | 1 -
 include/hw/arm/omap.h                    | 1 +
 include/hw/arm/sysbus-fdt.h              | 1 -
 include/hw/arm/virt-acpi-build.h         | 1 -
 include/hw/arm/virt.h                    | 2 +-
 include/hw/arm/xlnx-zynqmp.h             | 1 -
 include/hw/block/block.h                 | 1 -
 include/hw/fw-path-provider.h            | 1 -
 include/hw/hw.h                          | 1 +
 include/hw/i386/apic.h                   | 2 +-
 include/hw/i386/pc.h                     | 1 -
 include/hw/ipmi/ipmi.h                   | 1 -
 include/hw/isa/apm.h                     | 1 -
 include/hw/lm32/lm32_pic.h               | 1 -
 include/hw/nmi.h                         | 1 -
 include/hw/pci-host/apb.h                | 1 -
 include/hw/pci-host/pam.h                | 1 -
 include/hw/pci/msi.h                     | 1 -
 include/hw/pci/msix.h                    | 1 -
 include/hw/pci/shpc.h                    | 1 -
 include/hw/pci/slotid_cap.h              | 1 -
 include/hw/ppc/openpic.h                 | 1 -
 include/hw/ptimer.h                      | 1 -
 include/hw/sd/sdhci.h                    | 1 -
 include/hw/sh4/sh_intc.h                 | 1 -
 include/hw/sparc/sun4m.h                 | 1 -
 include/hw/stream.h                      | 1 -
 include/hw/timer/m48t59.h                | 1 -
 include/hw/vfio/vfio-common.h            | 1 -
 include/hw/virtio/vhost-scsi.h           | 1 -
 include/hw/xen/xen.h                     | 1 -
 include/io/channel.h                     | 1 -
 include/io/task.h                        | 1 -
 include/migration/migration.h            | 1 -
 include/monitor/monitor.h                | 1 -
 include/net/filter.h                     | 1 -
 include/net/net.h                        | 1 -
 include/net/queue.h                      | 2 --
 include/net/slirp.h                      | 1 -
 include/net/tap.h                        | 1 -
 include/qapi/qmp/json-parser.h           | 1 -
 include/qemu-io.h                        | 2 --
 include/qemu/base64.h                    | 3 ---
 include/qemu/buffer.h                    | 2 --
 include/qemu/crc32c.h                    | 2 --
 include/qemu/event_notifier.h            | 2 --
 include/qemu/mmap-alloc.h                | 2 --
 include/qemu/throttle.h                  | 1 -
 include/qemu/timer.h                     | 1 -
 include/sysemu/char.h                    | 1 -
 include/sysemu/cpus.h                    | 2 ++
 include/sysemu/kvm.h                     | 4 ++++
 include/sysemu/qtest.h                   | 2 --
 include/sysemu/rng.h                     | 1 -
 include/sysemu/tpm_backend.h             | 1 -
 io/channel-buffer.c                      | 1 +
 io/channel-command.c                     | 1 +
 io/channel-file.c                        | 1 +
 io/channel-socket.c                      | 1 +
 io/channel-tls.c                         | 1 +
 io/channel-util.c                        | 1 +
 io/channel-websock.c                     | 1 +
 io/channel.c                             | 1 +
 ioport.c                                 | 1 +
 linux-user/elfload.c                     | 2 ++
 linux-user/uaccess.c                     | 2 +-
 memory.c                                 | 1 +
 migration/qemu-file-internal.h           | 1 -
 migration/ram.c                          | 1 +
 monitor.c                                | 2 ++
 net/hub.h                                | 2 --
 net/slirp.c                              | 1 +
 net/tap_int.h                            | 1 -
 os-posix.c                               | 1 +
 qdev-monitor.c                           | 1 +
 qemu-io-cmds.c                           | 1 +
 qemu-io.c                                | 1 +
 qemu-timer.c                             | 1 +
 qga/commands-posix.c                     | 1 +
 qga/commands.c                           | 1 +
 qga/guest-agent-core.h                   | 1 -
 qga/main.c                               | 1 +
 qobject/qjson.c                          | 1 +
 qtest.c                                  | 1 +
 scripts/tracetool/format/h.py            | 2 --
 scripts/tracetool/format/ust_events_h.py | 1 -
 slirp/ip_icmp.c                          | 1 +
 slirp/libslirp.h                         | 2 --
 slirp/misc.c                             | 2 +-
 slirp/tcp_subr.c                         | 1 +
 spice-qemu-char.c                        | 1 +
 target-alpha/cpu.h                       | 1 -
 target-alpha/translate.c                 | 1 +
 target-arm/cpu.h                         | 1 -
 target-cris/cpu.h                        | 1 -
 target-i386/cpu.c                        | 3 ++-
 target-i386/cpu.h                        | 1 -
 target-i386/machine.c                    | 1 +
 target-lm32/cpu.h                        | 1 -
 target-m68k/cpu.h                        | 1 -
 target-microblaze/cpu.h                  | 1 -
 target-mips/cpu.h                        | 1 -
 target-moxie/cpu.h                       | 1 -
 target-openrisc/cpu.h                    | 1 -
 target-openrisc/exception.h              | 1 -
 target-ppc/cpu-models.c                  | 1 +
 target-ppc/cpu.h                         | 1 -
 target-ppc/translate_init.c              | 1 +
 target-s390x/cpu.h                       | 1 -
 target-s390x/helper.c                    | 1 +
 target-s390x/misc_helper.c               | 1 +
 target-sh4/cpu.h                         | 1 -
 target-sparc/cpu.c                       | 2 ++
 target-sparc/cpu.h                       | 1 -
 target-tilegx/cpu.h                      | 1 -
 target-tricore/cpu.h                     | 1 -
 target-unicore32/cpu.h                   | 1 -
 target-xtensa/cpu.h                      | 1 -
 tcg/tcg.h                                | 2 +-
 tests/crypto-tls-x509-helpers.h          | 2 --
 tests/test-crypto-tlscredsx509.c         | 1 +
 tests/test-crypto-tlssession.c           | 1 +
 tests/test-io-channel-buffer.c           | 2 +-
 tests/test-io-channel-command.c          | 1 +
 tests/test-io-channel-file.c             | 1 +
 tests/test-io-channel-socket.c           | 1 +
 tests/test-io-channel-tls.c              | 1 +
 tests/test-io-task.c                     | 1 +
 tests/vhost-user-test.c                  | 1 +
 trace/control.c                          | 1 +
 trace/control.h                          | 1 -
 ui/keymaps.c                             | 1 +
 ui/keymaps.h                             | 2 --
 ui/vnc.c                                 | 1 +
 ui/vnc.h                                 | 1 -
 util/buffer.c                            | 1 +
 util/mmap-alloc.c                        | 2 ++
 util/oslib-posix.c                       | 2 +-
 util/qemu-sockets.c                      | 3 ++-
 vl.c                                     | 1 +
 255 files changed, 188 insertions(+), 133 deletions(-)

Comments

Daniel P. Berrangé March 15, 2016, 3:54 p.m. UTC | #1
On Tue, Mar 15, 2016 at 04:03:40PM +0100, Markus Armbruster wrote:
> qemu-common.h should only be included by .c files.  Its file comment
> explains why: "No header file should depend on qemu-common.h, as this
> would easily lead to circular header dependencies."
> 
> We include it in many headers anyway.  Fix that.
> 
> Dropping these ill-advised includes requires including
> qemu/fprintf-fn.h, cpu.h or exec/hwaddr.h instead in a few headers
> that actually need those, and of course including qemu-common.h in .c
> files that need it, except some of them need only qemu/module.h.
> 
> Signed-off-by: Markus Armbruster <armbru@redhat.com>
> ---
>  crypto/secret.c                          | 1 +
>  crypto/tlscreds.c                        | 1 +
>  crypto/tlscredsanon.c                    | 1 +
>  crypto/tlscredsx509.c                    | 1 +


> diff --git a/crypto/secret.c b/crypto/secret.c
> index 285ab7a..65929ac 100644
> --- a/crypto/secret.c
> +++ b/crypto/secret.c
> @@ -19,6 +19,7 @@
>   */
>  
>  #include "qemu/osdep.h"
> +#include "qemu/module.h"
>  #include "crypto/secret.h"
>  #include "crypto/cipher.h"
>  #include "qapi/error.h"
> diff --git a/crypto/tlscreds.c b/crypto/tlscreds.c
> index 1620e12..edc7f88 100644
> --- a/crypto/tlscreds.c
> +++ b/crypto/tlscreds.c
> @@ -20,6 +20,7 @@
>  
>  #include "qemu/osdep.h"
>  #include "qapi/error.h"
> +#include "qemu/module.h"
>  #include "crypto/tlscredspriv.h"
>  #include "trace.h"
>  
> diff --git a/crypto/tlscredsanon.c b/crypto/tlscredsanon.c
> index 1464220..50df4f0 100644
> --- a/crypto/tlscredsanon.c
> +++ b/crypto/tlscredsanon.c
> @@ -19,6 +19,7 @@
>   */
>  
>  #include "qemu/osdep.h"
> +#include "qemu/module.h"
>  #include "crypto/tlscredsanon.h"
>  #include "crypto/tlscredspriv.h"
>  #include "qapi/error.h"
> diff --git a/crypto/tlscredsx509.c b/crypto/tlscredsx509.c
> index 6a0179c..2709b2b 100644
> --- a/crypto/tlscredsx509.c
> +++ b/crypto/tlscredsx509.c
> @@ -19,6 +19,7 @@
>   */
>  
>  #include "qemu/osdep.h"
> +#include "qemu/module.h"
>  #include "crypto/tlscredsx509.h"
>  #include "crypto/tlscredspriv.h"
>  #include "crypto/secret.h"

It feels like these should be in the previous patch that removes
qemu-common.h  from the include/crypto files ?


Regards,
Daniel
Paolo Bonzini March 15, 2016, 3:55 p.m. UTC | #2
On 15/03/2016 16:03, Markus Armbruster wrote:
> diff --git a/include/hw/hw.h b/include/hw/hw.h
> index 2cb69d5..151d65e 100644
> --- a/include/hw/hw.h
> +++ b/include/hw/hw.h
> @@ -15,6 +15,7 @@
>  #include "qemu/module.h"
>  
>  #ifdef NEED_CPU_H
> +#include "cpu.h"
>  #if TARGET_LONG_BITS == 64
>  #define qemu_put_betl qemu_put_be64
>  #define qemu_get_betl qemu_get_be64

This actually makes things somewhat worse.  This dependency of hw/hw.h
on NEED_CPU_H should go away altogether.

Would it be okay to stick to patches 1-13 for now?

Paolo
Markus Armbruster March 15, 2016, 4:31 p.m. UTC | #3
Paolo Bonzini <pbonzini@redhat.com> writes:

> On 15/03/2016 16:03, Markus Armbruster wrote:
>> diff --git a/include/hw/hw.h b/include/hw/hw.h
>> index 2cb69d5..151d65e 100644
>> --- a/include/hw/hw.h
>> +++ b/include/hw/hw.h
>> @@ -15,6 +15,7 @@
>>  #include "qemu/module.h"
>>  
>>  #ifdef NEED_CPU_H
>> +#include "cpu.h"
>>  #if TARGET_LONG_BITS == 64
>>  #define qemu_put_betl qemu_put_be64
>>  #define qemu_get_betl qemu_get_be64
>
> This actually makes things somewhat worse.  This dependency of hw/hw.h
> on NEED_CPU_H should go away altogether.
>
> Would it be okay to stick to patches 1-13 for now?

Yes, as long as "for now" approximately means "until 2.7 opens up".

Proposed plan: I pursue 01-13 now, you rebase your need-cpu-h branch
onto this work when it's ready, I rebase 14-15 onto yours, and carry on.
Makes sense?
Markus Armbruster March 15, 2016, 4:35 p.m. UTC | #4
"Daniel P. Berrange" <berrange@redhat.com> writes:

> On Tue, Mar 15, 2016 at 04:03:40PM +0100, Markus Armbruster wrote:
>> qemu-common.h should only be included by .c files.  Its file comment
>> explains why: "No header file should depend on qemu-common.h, as this
>> would easily lead to circular header dependencies."
>> 
>> We include it in many headers anyway.  Fix that.
>> 
>> Dropping these ill-advised includes requires including
>> qemu/fprintf-fn.h, cpu.h or exec/hwaddr.h instead in a few headers
>> that actually need those, and of course including qemu-common.h in .c
>> files that need it, except some of them need only qemu/module.h.
>> 
>> Signed-off-by: Markus Armbruster <armbru@redhat.com>
>> ---
>>  crypto/secret.c                          | 1 +
>>  crypto/tlscreds.c                        | 1 +
>>  crypto/tlscredsanon.c                    | 1 +
>>  crypto/tlscredsx509.c                    | 1 +
>
>
>> diff --git a/crypto/secret.c b/crypto/secret.c
>> index 285ab7a..65929ac 100644
>> --- a/crypto/secret.c
>> +++ b/crypto/secret.c
>> @@ -19,6 +19,7 @@
>>   */
>>  
>>  #include "qemu/osdep.h"
>> +#include "qemu/module.h"
>>  #include "crypto/secret.h"
>>  #include "crypto/cipher.h"
>>  #include "qapi/error.h"
>> diff --git a/crypto/tlscreds.c b/crypto/tlscreds.c
>> index 1620e12..edc7f88 100644
>> --- a/crypto/tlscreds.c
>> +++ b/crypto/tlscreds.c
>> @@ -20,6 +20,7 @@
>>  
>>  #include "qemu/osdep.h"
>>  #include "qapi/error.h"
>> +#include "qemu/module.h"
>>  #include "crypto/tlscredspriv.h"
>>  #include "trace.h"
>>  
>> diff --git a/crypto/tlscredsanon.c b/crypto/tlscredsanon.c
>> index 1464220..50df4f0 100644
>> --- a/crypto/tlscredsanon.c
>> +++ b/crypto/tlscredsanon.c
>> @@ -19,6 +19,7 @@
>>   */
>>  
>>  #include "qemu/osdep.h"
>> +#include "qemu/module.h"
>>  #include "crypto/tlscredsanon.h"
>>  #include "crypto/tlscredspriv.h"
>>  #include "qapi/error.h"
>> diff --git a/crypto/tlscredsx509.c b/crypto/tlscredsx509.c
>> index 6a0179c..2709b2b 100644
>> --- a/crypto/tlscredsx509.c
>> +++ b/crypto/tlscredsx509.c
>> @@ -19,6 +19,7 @@
>>   */
>>  
>>  #include "qemu/osdep.h"
>> +#include "qemu/module.h"
>>  #include "crypto/tlscredsx509.h"
>>  #include "crypto/tlscredspriv.h"
>>  #include "crypto/secret.h"
>
> It feels like these should be in the previous patch that removes
> qemu-common.h  from the include/crypto files ?

They aren't actually needed then, because qemu/module.h is still
included via some inclusion of qemu-common.h in a header.  But I can
certainly move them to the previous patch anyway, if you'd prefer that.
Since we'll probably defer this patch and the next for a bit, I might
prefer it myself :)
Paolo Bonzini March 15, 2016, 5:25 p.m. UTC | #5
On 15/03/2016 17:31, Markus Armbruster wrote:
> Paolo Bonzini <pbonzini@redhat.com> writes:
> 
>> On 15/03/2016 16:03, Markus Armbruster wrote:
>>> diff --git a/include/hw/hw.h b/include/hw/hw.h
>>> index 2cb69d5..151d65e 100644
>>> --- a/include/hw/hw.h
>>> +++ b/include/hw/hw.h
>>> @@ -15,6 +15,7 @@
>>>  #include "qemu/module.h"
>>>  
>>>  #ifdef NEED_CPU_H
>>> +#include "cpu.h"
>>>  #if TARGET_LONG_BITS == 64
>>>  #define qemu_put_betl qemu_put_be64
>>>  #define qemu_get_betl qemu_get_be64
>>
>> This actually makes things somewhat worse.  This dependency of hw/hw.h
>> on NEED_CPU_H should go away altogether.
>>
>> Would it be okay to stick to patches 1-13 for now?
> 
> Yes, as long as "for now" approximately means "until 2.7 opens up".
> 
> Proposed plan: I pursue 01-13 now, you rebase your need-cpu-h branch
> onto this work when it's ready, I rebase 14-15 onto yours, and carry on.
> Makes sense?

Yes, totally.  I've already started rebasing and there's nothing else
that sticks out.

Since I have your attention, what about getting rid of fprintf-fn.h and
moving it into qemu/osdep.h?

Paolo
Peter Maydell March 15, 2016, 5:34 p.m. UTC | #6
On 15 March 2016 at 17:25, Paolo Bonzini <pbonzini@redhat.com> wrote:
> Since I have your attention, what about getting rid of fprintf-fn.h and
> moving it into qemu/osdep.h?

Not a lot very osdep-ish about it... If you're going to put it anywhere
then typedefs.h seems more appropriate.

(It's in its own file at the moment as part of a previous idea of
cleaning up qemu-common.h by splitting it into separate parts where
necessary so that only the needed parts could be included by the
code that wanted them.)

thanks
-- PMM
Paolo Bonzini March 15, 2016, 5:44 p.m. UTC | #7
On 15/03/2016 18:34, Peter Maydell wrote:
>> > Since I have your attention, what about getting rid of fprintf-fn.h and
>> > moving it into qemu/osdep.h?
> Not a lot very osdep-ish about it... If you're going to put it anywhere
> then typedefs.h seems more appropriate.

Well, osdep.h is the new qemu-common.h.  At least it doesn't include
other^Wtoo many other QEMU header files, but it does have a lot of
prototypes that are even more out of place than fprintf_function.

On the other hand, there are few enough headers that use fprintf-fn.h
that it's feasible to just push it down from qemu-common.h.

Paolo

> (It's in its own file at the moment as part of a previous idea of
> cleaning up qemu-common.h by splitting it into separate parts where
> necessary so that only the needed parts could be included by the
> code that wanted them.)
Peter Maydell March 15, 2016, 5:53 p.m. UTC | #8
On 15 March 2016 at 17:44, Paolo Bonzini <pbonzini@redhat.com> wrote:
> Well, osdep.h is the new qemu-common.h.  At least it doesn't include
> other^Wtoo many other QEMU header files, but it does have a lot of
> prototypes that are even more out of place than fprintf_function.

Yes, those should be moved to somewhere else, they're in the
wrong place (as noted in the comment at the top of osdep.h).

The comment at the top of osdep.h describes the plan:

 * In an ideal world this header would contain only:
 *  (1) things which everybody needs
 *  (2) things without which code would work on most platforms but
 *      fail to compile or misbehave on a minority of host OSes

and I think we should be aiming to move towards the ideal world
rather than away from it.

thanks
-- PMM
Markus Armbruster March 15, 2016, 7:03 p.m. UTC | #9
Peter Maydell <peter.maydell@linaro.org> writes:

> On 15 March 2016 at 17:25, Paolo Bonzini <pbonzini@redhat.com> wrote:
>> Since I have your attention, what about getting rid of fprintf-fn.h and
>> moving it into qemu/osdep.h?
>
> Not a lot very osdep-ish about it... If you're going to put it anywhere
> then typedefs.h seems more appropriate.

Makes sense to me.

> (It's in its own file at the moment as part of a previous idea of
> cleaning up qemu-common.h by splitting it into separate parts where
> necessary so that only the needed parts could be included by the
> code that wanted them.)

Sensible idea, but fprintf_function is hardly worth its very own header.
typedefs.h should do nicely.
diff mbox

Patch

diff --git a/arch_init.c b/arch_init.c
index f6aba02..4ec96b2 100644
--- a/arch_init.c
+++ b/arch_init.c
@@ -21,7 +21,9 @@ 
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
+
 #include "qemu/osdep.h"
+#include "qemu-common.h"
 #include "sysemu/sysemu.h"
 #include "sysemu/arch_init.h"
 #include "hw/pci/pci.h"
diff --git a/audio/audio.c b/audio/audio.c
index e841532..a905a0e 100644
--- a/audio/audio.c
+++ b/audio/audio.c
@@ -21,7 +21,9 @@ 
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
+
 #include "qemu/osdep.h"
+#include "qemu-common.h"
 #include "hw/hw.h"
 #include "audio.h"
 #include "monitor/monitor.h"
diff --git a/backends/hostmem-ram.c b/backends/hostmem-ram.c
index 04a7ac3..78de9b1 100644
--- a/backends/hostmem-ram.c
+++ b/backends/hostmem-ram.c
@@ -9,9 +9,11 @@ 
  * This work is licensed under the terms of the GNU GPL, version 2 or later.
  * See the COPYING file in the top-level directory.
  */
+
 #include "qemu/osdep.h"
 #include "sysemu/hostmem.h"
 #include "qapi/error.h"
+#include "qemu/module.h"
 #include "qom/object_interfaces.h"
 
 #define TYPE_MEMORY_BACKEND_RAM "memory-backend-ram"
diff --git a/backends/rng-random.c b/backends/rng-random.c
index 2e44e25..c214a85 100644
--- a/backends/rng-random.c
+++ b/backends/rng-random.c
@@ -16,6 +16,7 @@ 
 #include "qapi/error.h"
 #include "qapi/qmp/qerror.h"
 #include "qemu/main-loop.h"
+#include "qemu/module.h"
 
 struct RndRandom
 {
diff --git a/backends/rng.c b/backends/rng.c
index 398ebe4..391888b 100644
--- a/backends/rng.c
+++ b/backends/rng.c
@@ -14,6 +14,7 @@ 
 #include "sysemu/rng.h"
 #include "qapi/error.h"
 #include "qapi/qmp/qerror.h"
+#include "qemu/module.h"
 #include "qom/object_interfaces.h"
 
 void rng_backend_request_entropy(RngBackend *s, size_t size,
diff --git a/backends/tpm.c b/backends/tpm.c
index 536f262..84c4e37 100644
--- a/backends/tpm.c
+++ b/backends/tpm.c
@@ -17,6 +17,7 @@ 
 #include "qapi/error.h"
 #include "qapi/qmp/qerror.h"
 #include "sysemu/tpm.h"
+#include "qemu/module.h"
 #include "qemu/thread.h"
 #include "sysemu/tpm_backend_int.h"
 
diff --git a/block/backup.c b/block/backup.c
index 0e59471..6fc5c09 100644
--- a/block/backup.c
+++ b/block/backup.c
@@ -12,7 +12,7 @@ 
  */
 
 #include "qemu/osdep.h"
-
+#include "qemu-common.h"
 #include "trace.h"
 #include "block/block.h"
 #include "block/block_int.h"
diff --git a/block/blkverify.c b/block/blkverify.c
index 41432e5..11c9b9f 100644
--- a/block/blkverify.c
+++ b/block/blkverify.c
@@ -8,6 +8,7 @@ 
  */
 
 #include "qemu/osdep.h"
+#include "qemu-common.h"
 #include "qapi/error.h"
 #include "qemu/sockets.h" /* for EINPROGRESS on Windows */
 #include "block/block_int.h"
diff --git a/block/block-backend.c b/block/block-backend.c
index ebdf78a..a8b0d96 100644
--- a/block/block-backend.c
+++ b/block/block-backend.c
@@ -11,6 +11,7 @@ 
  */
 
 #include "qemu/osdep.h"
+#include "qemu-common.h"
 #include "sysemu/block-backend.h"
 #include "block/block_int.h"
 #include "block/blockjob.h"
diff --git a/block/gluster.c b/block/gluster.c
index 51e154c..a5595db 100644
--- a/block/gluster.c
+++ b/block/gluster.c
@@ -7,10 +7,12 @@ 
  * See the COPYING file in the top-level directory.
  *
  */
+
 #include "qemu/osdep.h"
 #include <glusterfs/api/glfs.h>
 #include "block/block_int.h"
 #include "qapi/error.h"
+#include "qemu/module.h"
 #include "qemu/uri.h"
 
 typedef struct GlusterAIOCB {
diff --git a/block/io.c b/block/io.c
index d636bf7..69d1134 100644
--- a/block/io.c
+++ b/block/io.c
@@ -23,6 +23,7 @@ 
  */
 
 #include "qemu/osdep.h"
+#include "qemu-common.h"
 #include "trace.h"
 #include "sysemu/block-backend.h"
 #include "block/blockjob.h"
diff --git a/block/nbd-client.h b/block/nbd-client.h
index 53f116d..218f003 100644
--- a/block/nbd-client.h
+++ b/block/nbd-client.h
@@ -1,7 +1,6 @@ 
 #ifndef NBD_CLIENT_H
 #define NBD_CLIENT_H
 
-#include "qemu-common.h"
 #include "block/nbd.h"
 #include "block/block_int.h"
 #include "io/channel-socket.h"
diff --git a/block/nbd.c b/block/nbd.c
index 673f4a9..bf8d44b 100644
--- a/block/nbd.c
+++ b/block/nbd.c
@@ -27,6 +27,7 @@ 
  */
 
 #include "qemu/osdep.h"
+#include "qemu-common.h"
 #include "block/nbd-client.h"
 #include "qapi/error.h"
 #include "qemu/uri.h"
diff --git a/block/null.c b/block/null.c
index 00bc6e4..8a1c8fa 100644
--- a/block/null.c
+++ b/block/null.c
@@ -13,6 +13,7 @@ 
 #include "qemu/osdep.h"
 #include "qapi/error.h"
 #include "block/block_int.h"
+#include "qemu/module.h"
 
 #define NULL_OPT_LATENCY "latency-ns"
 
diff --git a/block/qapi.c b/block/qapi.c
index db2d3fb..979ca8d 100644
--- a/block/qapi.c
+++ b/block/qapi.c
@@ -23,6 +23,7 @@ 
  */
 
 #include "qemu/osdep.h"
+#include "qemu-common.h"
 #include "block/qapi.h"
 #include "block/block_int.h"
 #include "block/throttle-groups.h"
diff --git a/block/qed.c b/block/qed.c
index 3679a32..3709d7b 100644
--- a/block/qed.c
+++ b/block/qed.c
@@ -13,6 +13,7 @@ 
  */
 
 #include "qemu/osdep.h"
+#include "qemu-common.h"
 #include "qapi/error.h"
 #include "qemu/timer.h"
 #include "trace.h"
diff --git a/block/quorum.c b/block/quorum.c
index 11cc60b..548de0d 100644
--- a/block/quorum.c
+++ b/block/quorum.c
@@ -23,6 +23,7 @@ 
 #include "qapi/qmp/qlist.h"
 #include "qapi/qmp/qstring.h"
 #include "qapi-event.h"
+#include "qemu/module.h"
 #include "crypto/hash.h"
 
 #define HASH_LENGTH 32
diff --git a/block/raw_bsd.c b/block/raw_bsd.c
index 41dddf8..f127445 100644
--- a/block/raw_bsd.c
+++ b/block/raw_bsd.c
@@ -27,6 +27,7 @@ 
  */
 
 #include "qemu/osdep.h"
+#include "qemu/module.h"
 #include "block/block_int.h"
 #include "qapi/error.h"
 #include "qemu/option.h"
diff --git a/block/ssh.c b/block/ssh.c
index 06928ed..93ca45b 100644
--- a/block/ssh.c
+++ b/block/ssh.c
@@ -23,10 +23,9 @@ 
  */
 
 #include "qemu/osdep.h"
-
 #include <libssh2.h>
 #include <libssh2_sftp.h>
-
+#include "qemu-common.h"
 #include "block/block_int.h"
 #include "qapi/error.h"
 #include "qemu/error-report.h"
diff --git a/block/throttle-groups.c b/block/throttle-groups.c
index 4920e09..ca708fe 100644
--- a/block/throttle-groups.c
+++ b/block/throttle-groups.c
@@ -25,6 +25,7 @@ 
 #include "qemu/osdep.h"
 #include "block/throttle-groups.h"
 #include "qemu/queue.h"
+#include "qemu/module.h"
 #include "qemu/thread.h"
 #include "sysemu/qtest.h"
 
diff --git a/blockdev.c b/blockdev.c
index 0f20c65..9cc9866 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -31,6 +31,7 @@ 
  */
 
 #include "qemu/osdep.h"
+#include "qemu-common.h"
 #include "sysemu/block-backend.h"
 #include "sysemu/blockdev.h"
 #include "hw/block/block.h"
diff --git a/cpu-exec.c b/cpu-exec.c
index fd92452..dd6eb80 100644
--- a/cpu-exec.c
+++ b/cpu-exec.c
@@ -17,6 +17,7 @@ 
  * License along with this library; if not, see <http://www.gnu.org/licenses/>.
  */
 #include "qemu/osdep.h"
+#include "qemu-common.h"
 #include "cpu.h"
 #include "trace.h"
 #include "disas/disas.h"
diff --git a/cpus.c b/cpus.c
index bc774e2..c50723a 100644
--- a/cpus.c
+++ b/cpus.c
@@ -22,9 +22,8 @@ 
  * THE SOFTWARE.
  */
 
-/* Needed early for CONFIG_BSD etc. */
 #include "qemu/osdep.h"
-
+#include "qemu-common.h"
 #include "monitor/monitor.h"
 #include "qapi/qmp/qerror.h"
 #include "qemu/error-report.h"
diff --git a/cputlb.c b/cputlb.c
index 2f7a166..d78b62a 100644
--- a/cputlb.c
+++ b/cputlb.c
@@ -18,6 +18,7 @@ 
  */
 
 #include "qemu/osdep.h"
+#include "qemu-common.h"
 #include "cpu.h"
 #include "exec/exec-all.h"
 #include "exec/memory.h"
diff --git a/crypto/secret.c b/crypto/secret.c
index 285ab7a..65929ac 100644
--- a/crypto/secret.c
+++ b/crypto/secret.c
@@ -19,6 +19,7 @@ 
  */
 
 #include "qemu/osdep.h"
+#include "qemu/module.h"
 #include "crypto/secret.h"
 #include "crypto/cipher.h"
 #include "qapi/error.h"
diff --git a/crypto/tlscreds.c b/crypto/tlscreds.c
index 1620e12..edc7f88 100644
--- a/crypto/tlscreds.c
+++ b/crypto/tlscreds.c
@@ -20,6 +20,7 @@ 
 
 #include "qemu/osdep.h"
 #include "qapi/error.h"
+#include "qemu/module.h"
 #include "crypto/tlscredspriv.h"
 #include "trace.h"
 
diff --git a/crypto/tlscredsanon.c b/crypto/tlscredsanon.c
index 1464220..50df4f0 100644
--- a/crypto/tlscredsanon.c
+++ b/crypto/tlscredsanon.c
@@ -19,6 +19,7 @@ 
  */
 
 #include "qemu/osdep.h"
+#include "qemu/module.h"
 #include "crypto/tlscredsanon.h"
 #include "crypto/tlscredspriv.h"
 #include "qapi/error.h"
diff --git a/crypto/tlscredsx509.c b/crypto/tlscredsx509.c
index 6a0179c..2709b2b 100644
--- a/crypto/tlscredsx509.c
+++ b/crypto/tlscredsx509.c
@@ -19,6 +19,7 @@ 
  */
 
 #include "qemu/osdep.h"
+#include "qemu/module.h"
 #include "crypto/tlscredsx509.h"
 #include "crypto/tlscredspriv.h"
 #include "crypto/secret.h"
diff --git a/hmp.c b/hmp.c
index 5b6084a..4fb2da6 100644
--- a/hmp.c
+++ b/hmp.c
@@ -14,6 +14,7 @@ 
  */
 
 #include "qemu/osdep.h"
+#include "qemu-common.h"
 #include "hmp.h"
 #include "net/net.h"
 #include "net/eth.h"
diff --git a/hmp.h b/hmp.h
index 093d65f..eefd80f 100644
--- a/hmp.h
+++ b/hmp.h
@@ -14,7 +14,6 @@ 
 #ifndef HMP_H
 #define HMP_H
 
-#include "qemu-common.h"
 #include "qemu/readline.h"
 #include "qapi-types.h"
 #include "qapi/qmp/qdict.h"
diff --git a/hw/9pfs/9p-handle.c b/hw/9pfs/9p-handle.c
index 5088ef5..85da2a7 100644
--- a/hw/9pfs/9p-handle.c
+++ b/hw/9pfs/9p-handle.c
@@ -12,6 +12,7 @@ 
  */
 
 #include "qemu/osdep.h"
+#include "qemu-common.h"
 #include "9p.h"
 #include "9p-xattr.h"
 #include <arpa/inet.h>
diff --git a/hw/9pfs/9p-local.c b/hw/9pfs/9p-local.c
index ca995a7..8d9d00f 100644
--- a/hw/9pfs/9p-local.c
+++ b/hw/9pfs/9p-local.c
@@ -12,6 +12,7 @@ 
  */
 
 #include "qemu/osdep.h"
+#include "qemu-common.h"
 #include "9p.h"
 #include "9p-xattr.h"
 #include "fsdev/qemu-fsdev.h"   /* local_ops */
diff --git a/hw/9pfs/9p-proxy.c b/hw/9pfs/9p-proxy.c
index 0805c9c..211bf47 100644
--- a/hw/9pfs/9p-proxy.c
+++ b/hw/9pfs/9p-proxy.c
@@ -10,6 +10,7 @@ 
  * the COPYING file in the top-level directory.
  */
 #include "qemu/osdep.h"
+#include "qemu-common.h"
 #include <sys/socket.h>
 #include <sys/un.h>
 #include "9p.h"
diff --git a/hw/9pfs/9p-synth.c b/hw/9pfs/9p-synth.c
index 365623e..8bb8fe4 100644
--- a/hw/9pfs/9p-synth.c
+++ b/hw/9pfs/9p-synth.c
@@ -13,6 +13,7 @@ 
  */
 
 #include "qemu/osdep.h"
+#include "qemu-common.h"
 #include "hw/virtio/virtio.h"
 #include "9p.h"
 #include "9p-xattr.h"
diff --git a/hw/alpha/dp264.c b/hw/alpha/dp264.c
index 7c5989b..077adf6 100644
--- a/hw/alpha/dp264.c
+++ b/hw/alpha/dp264.c
@@ -7,6 +7,7 @@ 
  */
 
 #include "qemu/osdep.h"
+#include "qemu-common.h"
 #include "hw/hw.h"
 #include "elf.h"
 #include "hw/loader.h"
diff --git a/hw/arm/boot.c b/hw/arm/boot.c
index 5975fbf..246cfb0 100644
--- a/hw/arm/boot.c
+++ b/hw/arm/boot.c
@@ -8,6 +8,7 @@ 
  */
 
 #include "qemu/osdep.h"
+#include "qemu-common.h"
 #include "qapi/error.h"
 #include "hw/hw.h"
 #include "hw/arm/arm.h"
diff --git a/hw/arm/digic_boards.c b/hw/arm/digic_boards.c
index c4bec42..f2edba4 100644
--- a/hw/arm/digic_boards.c
+++ b/hw/arm/digic_boards.c
@@ -24,6 +24,7 @@ 
  */
 
 #include "qemu/osdep.h"
+#include "qemu-common.h"
 #include "qapi/error.h"
 #include "hw/boards.h"
 #include "exec/address-spaces.h"
diff --git a/hw/arm/highbank.c b/hw/arm/highbank.c
index a482396..4e86f15 100644
--- a/hw/arm/highbank.c
+++ b/hw/arm/highbank.c
@@ -18,6 +18,7 @@ 
  */
 
 #include "qemu/osdep.h"
+#include "qemu-common.h"
 #include "qapi/error.h"
 #include "hw/sysbus.h"
 #include "hw/arm/arm.h"
diff --git a/hw/arm/omap1.c b/hw/arm/omap1.c
index 387a776..94510bf 100644
--- a/hw/arm/omap1.c
+++ b/hw/arm/omap1.c
@@ -18,6 +18,7 @@ 
  */
 
 #include "qemu/osdep.h"
+#include "qemu-common.h"
 #include "qapi/error.h"
 #include "hw/boards.h"
 #include "hw/hw.h"
diff --git a/hw/arm/pxa2xx.c b/hw/arm/pxa2xx.c
index 2410909..3f7d3cb 100644
--- a/hw/arm/pxa2xx.c
+++ b/hw/arm/pxa2xx.c
@@ -8,6 +8,7 @@ 
  */
 
 #include "qemu/osdep.h"
+#include "qemu-common.h"
 #include "qapi/error.h"
 #include "hw/sysbus.h"
 #include "hw/arm/pxa.h"
diff --git a/hw/arm/strongarm.c b/hw/arm/strongarm.c
index 3b17a21..718d1f6 100644
--- a/hw/arm/strongarm.c
+++ b/hw/arm/strongarm.c
@@ -28,6 +28,7 @@ 
  */
 
 #include "qemu/osdep.h"
+#include "qemu-common.h"
 #include "hw/boards.h"
 #include "hw/sysbus.h"
 #include "strongarm.h"
diff --git a/hw/arm/vexpress.c b/hw/arm/vexpress.c
index 83fc0e9..e0d53b5 100644
--- a/hw/arm/vexpress.c
+++ b/hw/arm/vexpress.c
@@ -22,6 +22,7 @@ 
  */
 
 #include "qemu/osdep.h"
+#include "qemu-common.h"
 #include "qapi/error.h"
 #include "hw/sysbus.h"
 #include "hw/arm/arm.h"
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
index a0937bb..8be25f3 100644
--- a/hw/arm/virt.c
+++ b/hw/arm/virt.c
@@ -29,6 +29,7 @@ 
  */
 
 #include "qemu/osdep.h"
+#include "qemu-common.h"
 #include "qapi/error.h"
 #include "hw/sysbus.h"
 #include "hw/arm/arm.h"
diff --git a/hw/block/nvme.c b/hw/block/nvme.c
index 173988e..e14ab5a 100644
--- a/hw/block/nvme.c
+++ b/hw/block/nvme.c
@@ -21,6 +21,7 @@ 
  */
 
 #include "qemu/osdep.h"
+#include "qemu-common.h"
 #include <hw/block/block.h>
 #include <hw/hw.h>
 #include <hw/pci/msix.h>
diff --git a/hw/core/fw-path-provider.c b/hw/core/fw-path-provider.c
index 33b9983..4840fae 100644
--- a/hw/core/fw-path-provider.c
+++ b/hw/core/fw-path-provider.c
@@ -17,6 +17,7 @@ 
 
 #include "qemu/osdep.h"
 #include "hw/fw-path-provider.h"
+#include "qemu/module.h"
 
 char *fw_path_provider_get_dev_path(FWPathProvider *p, BusState *bus,
                                     DeviceState *dev)
diff --git a/hw/core/loader.c b/hw/core/loader.c
index 93410e3..87e760e 100644
--- a/hw/core/loader.c
+++ b/hw/core/loader.c
@@ -43,6 +43,7 @@ 
  */
 
 #include "qemu/osdep.h"
+#include "qemu-common.h"
 #include "qapi/error.h"
 #include "hw/hw.h"
 #include "disas/disas.h"
diff --git a/hw/core/machine.c b/hw/core/machine.c
index 136bf27..c209736 100644
--- a/hw/core/machine.c
+++ b/hw/core/machine.c
@@ -11,6 +11,7 @@ 
  */
 
 #include "qemu/osdep.h"
+#include "qemu-common.h"
 #include "hw/boards.h"
 #include "qapi/error.h"
 #include "qapi-visit.h"
diff --git a/hw/core/nmi.c b/hw/core/nmi.c
index e8bcc41..77ea204 100644
--- a/hw/core/nmi.c
+++ b/hw/core/nmi.c
@@ -23,6 +23,7 @@ 
 #include "hw/nmi.h"
 #include "qapi/error.h"
 #include "qapi/qmp/qerror.h"
+#include "qemu/module.h"
 #include "monitor/monitor.h"
 
 struct do_nmi_s {
diff --git a/hw/core/ptimer.c b/hw/core/ptimer.c
index 153c835..9db6c60 100644
--- a/hw/core/ptimer.c
+++ b/hw/core/ptimer.c
@@ -5,7 +5,9 @@ 
  *
  * This code is licensed under the GNU LGPL.
  */
+
 #include "qemu/osdep.h"
+#include "qemu-common.h"
 #include "hw/hw.h"
 #include "qemu/timer.h"
 #include "hw/ptimer.h"
diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c
index a8c77ec..baac1e2 100644
--- a/hw/core/qdev-properties.c
+++ b/hw/core/qdev-properties.c
@@ -1,4 +1,5 @@ 
 #include "qemu/osdep.h"
+#include "qemu-common.h"
 #include "net/net.h"
 #include "hw/qdev.h"
 #include "qapi/error.h"
diff --git a/hw/core/qdev.c b/hw/core/qdev.c
index db41aa1..3d3eb84 100644
--- a/hw/core/qdev.c
+++ b/hw/core/qdev.c
@@ -26,6 +26,7 @@ 
    this API directly.  */
 
 #include "qemu/osdep.h"
+#include "qemu-common.h"
 #include "hw/qdev.h"
 #include "hw/fw-path-provider.h"
 #include "sysemu/sysemu.h"
diff --git a/hw/core/stream.c b/hw/core/stream.c
index 4439ecd..39b1e59 100644
--- a/hw/core/stream.c
+++ b/hw/core/stream.c
@@ -1,5 +1,6 @@ 
 #include "qemu/osdep.h"
 #include "hw/stream.h"
+#include "qemu/module.h"
 
 size_t
 stream_push(StreamSlave *sink, uint8_t *buf, size_t len)
diff --git a/hw/display/qxl.h b/hw/display/qxl.h
index 2ddf065..f97845c 100644
--- a/hw/display/qxl.h
+++ b/hw/display/qxl.h
@@ -1,8 +1,6 @@ 
 #ifndef HW_QXL_H
 #define HW_QXL_H 1
 
-#include "qemu-common.h"
-
 #include "ui/console.h"
 #include "hw/hw.h"
 #include "hw/pci/pci.h"
diff --git a/hw/dma/pl330.c b/hw/dma/pl330.c
index ea89ecb..2d6b497 100644
--- a/hw/dma/pl330.c
+++ b/hw/dma/pl330.c
@@ -15,6 +15,7 @@ 
  */
 
 #include "qemu/osdep.h"
+#include "qemu-common.h"
 #include "hw/sysbus.h"
 #include "qapi/error.h"
 #include "qemu/timer.h"
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index 56ec6cd..d8e56c0 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -21,7 +21,9 @@ 
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
+
 #include "qemu/osdep.h"
+#include "qemu-common.h"
 #include "hw/hw.h"
 #include "hw/i386/pc.h"
 #include "hw/char/serial.h"
diff --git a/hw/i386/pc_sysfw.c b/hw/i386/pc_sysfw.c
index f915ad0..33d9673 100644
--- a/hw/i386/pc_sysfw.c
+++ b/hw/i386/pc_sysfw.c
@@ -24,6 +24,7 @@ 
  */
 
 #include "qemu/osdep.h"
+#include "qemu-common.h"
 #include "qapi/error.h"
 #include "sysemu/block-backend.h"
 #include "qemu/error-report.h"
diff --git a/hw/ide/core.c b/hw/ide/core.c
index 241e840..18e9191 100644
--- a/hw/ide/core.c
+++ b/hw/ide/core.c
@@ -23,6 +23,7 @@ 
  * THE SOFTWARE.
  */
 #include "qemu/osdep.h"
+#include "qemu-common.h"
 #include <hw/hw.h>
 #include <hw/i386/pc.h>
 #include <hw/pci/pci.h>
diff --git a/hw/lm32/lm32_boards.c b/hw/lm32/lm32_boards.c
index c5a848b..a4ca40d 100644
--- a/hw/lm32/lm32_boards.c
+++ b/hw/lm32/lm32_boards.c
@@ -18,6 +18,7 @@ 
  */
 
 #include "qemu/osdep.h"
+#include "qemu-common.h"
 #include "hw/sysbus.h"
 #include "hw/hw.h"
 #include "hw/block/flash.h"
diff --git a/hw/lm32/lm32_hwsetup.h b/hw/lm32/lm32_hwsetup.h
index 838754d..b730bd1 100644
--- a/hw/lm32/lm32_hwsetup.h
+++ b/hw/lm32/lm32_hwsetup.h
@@ -25,7 +25,6 @@ 
 #ifndef QEMU_HW_LM32_HWSETUP_H
 #define QEMU_HW_LM32_HWSETUP_H
 
-#include "qemu-common.h"
 #include "hw/loader.h"
 
 typedef struct {
diff --git a/hw/lm32/milkymist.c b/hw/lm32/milkymist.c
index f71492e..efd0200 100644
--- a/hw/lm32/milkymist.c
+++ b/hw/lm32/milkymist.c
@@ -18,6 +18,7 @@ 
  */
 
 #include "qemu/osdep.h"
+#include "qemu-common.h"
 #include "hw/sysbus.h"
 #include "hw/hw.h"
 #include "hw/block/flash.h"
diff --git a/hw/mips/mips_fulong2e.c b/hw/mips/mips_fulong2e.c
index bdb716e..fbff7e7 100644
--- a/hw/mips/mips_fulong2e.c
+++ b/hw/mips/mips_fulong2e.c
@@ -19,6 +19,7 @@ 
  */
 
 #include "qemu/osdep.h"
+#include "qemu-common.h"
 #include "qapi/error.h"
 #include "hw/hw.h"
 #include "hw/i386/pc.h"
diff --git a/hw/mips/mips_jazz.c b/hw/mips/mips_jazz.c
index d6d8058..fd5a981 100644
--- a/hw/mips/mips_jazz.c
+++ b/hw/mips/mips_jazz.c
@@ -23,6 +23,7 @@ 
  */
 
 #include "qemu/osdep.h"
+#include "qemu-common.h"
 #include "hw/hw.h"
 #include "hw/mips/mips.h"
 #include "hw/mips/cpudevs.h"
diff --git a/hw/mips/mips_malta.c b/hw/mips/mips_malta.c
index f5173c4..1454ad4 100644
--- a/hw/mips/mips_malta.c
+++ b/hw/mips/mips_malta.c
@@ -23,6 +23,7 @@ 
  */
 
 #include "qemu/osdep.h"
+#include "qemu-common.h"
 #include "hw/hw.h"
 #include "hw/i386/pc.h"
 #include "hw/char/serial.h"
diff --git a/hw/mips/mips_mipssim.c b/hw/mips/mips_mipssim.c
index 23b2dca..2f8b660 100644
--- a/hw/mips/mips_mipssim.c
+++ b/hw/mips/mips_mipssim.c
@@ -24,7 +24,9 @@ 
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
+
 #include "qemu/osdep.h"
+#include "qemu-common.h"
 #include "qapi/error.h"
 #include "hw/hw.h"
 #include "hw/mips/mips.h"
diff --git a/hw/mips/mips_r4k.c b/hw/mips/mips_r4k.c
index 0ef2fb1..fd6ba10 100644
--- a/hw/mips/mips_r4k.c
+++ b/hw/mips/mips_r4k.c
@@ -7,7 +7,9 @@ 
  * All peripherial devices are attached to this "bus" with
  * the standard PC ISA addresses.
 */
+
 #include "qemu/osdep.h"
+#include "qemu-common.h"
 #include "qapi/error.h"
 #include "hw/hw.h"
 #include "hw/mips/mips.h"
diff --git a/hw/misc/ivshmem.c b/hw/misc/ivshmem.c
index 55071dc..967a9f2 100644
--- a/hw/misc/ivshmem.c
+++ b/hw/misc/ivshmem.c
@@ -16,7 +16,9 @@ 
  * Contributions after 2012-01-13 are licensed under the terms of the
  * GNU GPL, version 2 or (at your option) any later version.
  */
+
 #include "qemu/osdep.h"
+#include "qemu-common.h"
 #include "qapi/error.h"
 #include "hw/hw.h"
 #include "hw/i386/pc.h"
diff --git a/hw/misc/macio/cuda.c b/hw/misc/macio/cuda.c
index 481abdb..0eb5bc4 100644
--- a/hw/misc/macio/cuda.c
+++ b/hw/misc/macio/cuda.c
@@ -23,6 +23,7 @@ 
  * THE SOFTWARE.
  */
 #include "qemu/osdep.h"
+#include "qemu-common.h"
 #include "hw/hw.h"
 #include "hw/ppc/mac.h"
 #include "hw/input/adb.h"
diff --git a/hw/net/allwinner_emac.c b/hw/net/allwinner_emac.c
index 16d4b63..8059509 100644
--- a/hw/net/allwinner_emac.c
+++ b/hw/net/allwinner_emac.c
@@ -17,6 +17,7 @@ 
  *
  */
 #include "qemu/osdep.h"
+#include "qemu-common.h"
 #include "hw/sysbus.h"
 #include "net/net.h"
 #include "qemu/fifo8.h"
diff --git a/hw/nvram/fw_cfg.c b/hw/nvram/fw_cfg.c
index 7866248..47d6c42 100644
--- a/hw/nvram/fw_cfg.c
+++ b/hw/nvram/fw_cfg.c
@@ -22,6 +22,7 @@ 
  * THE SOFTWARE.
  */
 #include "qemu/osdep.h"
+#include "qemu-common.h"
 #include "hw/hw.h"
 #include "sysemu/sysemu.h"
 #include "sysemu/dma.h"
diff --git a/hw/nvram/mac_nvram.c b/hw/nvram/mac_nvram.c
index 1671f46..5e6cbf2 100644
--- a/hw/nvram/mac_nvram.c
+++ b/hw/nvram/mac_nvram.c
@@ -22,7 +22,9 @@ 
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
+
 #include "qemu/osdep.h"
+#include "qemu-common.h"
 #include "hw/hw.h"
 #include "hw/nvram/openbios_firmware_abi.h"
 #include "sysemu/sysemu.h"
diff --git a/hw/pci-bridge/dec.h b/hw/pci-bridge/dec.h
index 17dc0c2..8a16f47 100644
--- a/hw/pci-bridge/dec.h
+++ b/hw/pci-bridge/dec.h
@@ -1,8 +1,6 @@ 
 #ifndef DEC_PCI_H
 #define DEC_PCI_H
 
-#include "qemu-common.h"
-
 #define TYPE_DEC_21154 "dec-21154-sysbus"
 
 PCIBus *pci_dec_21154_init(PCIBus *parent_bus, int devfn);
diff --git a/hw/pci-host/prep.c b/hw/pci-host/prep.c
index 487e32e..3a08009 100644
--- a/hw/pci-host/prep.c
+++ b/hw/pci-host/prep.c
@@ -24,6 +24,7 @@ 
  */
 
 #include "qemu/osdep.h"
+#include "qemu-common.h"
 #include "qapi/error.h"
 #include "hw/hw.h"
 #include "hw/pci/pci.h"
diff --git a/hw/pci/msix.c b/hw/pci/msix.c
index 537fdba..6f05ced 100644
--- a/hw/pci/msix.c
+++ b/hw/pci/msix.c
@@ -15,6 +15,7 @@ 
  */
 
 #include "qemu/osdep.h"
+#include "qemu-common.h"
 #include "hw/hw.h"
 #include "hw/pci/msi.h"
 #include "hw/pci/msix.h"
diff --git a/hw/pci/pci.c b/hw/pci/pci.c
index e67664d..c7a0591 100644
--- a/hw/pci/pci.c
+++ b/hw/pci/pci.c
@@ -21,7 +21,9 @@ 
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
+
 #include "qemu/osdep.h"
+#include "qemu-common.h"
 #include "hw/hw.h"
 #include "hw/pci/pci.h"
 #include "hw/pci/pci_bridge.h"
diff --git a/hw/ppc/mac_newworld.c b/hw/ppc/mac_newworld.c
index 1086f88..97966f0 100644
--- a/hw/ppc/mac_newworld.c
+++ b/hw/ppc/mac_newworld.c
@@ -46,7 +46,9 @@ 
  * 0001:05:0c.0 IDE interface [0101]: Broadcom K2 SATA [1166:0240]
  *
  */
+
 #include "qemu/osdep.h"
+#include "qemu-common.h"
 #include "qapi/error.h"
 #include "hw/hw.h"
 #include "hw/ppc/ppc.h"
diff --git a/hw/ppc/mac_oldworld.c b/hw/ppc/mac_oldworld.c
index 9bfa02e..850b4e2 100644
--- a/hw/ppc/mac_oldworld.c
+++ b/hw/ppc/mac_oldworld.c
@@ -23,7 +23,9 @@ 
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
+
 #include "qemu/osdep.h"
+#include "qemu-common.h"
 #include "qapi/error.h"
 #include "hw/hw.h"
 #include "hw/ppc/ppc.h"
diff --git a/hw/ppc/ppc405_boards.c b/hw/ppc/ppc405_boards.c
index 1d51587..bbd0c99 100644
--- a/hw/ppc/ppc405_boards.c
+++ b/hw/ppc/ppc405_boards.c
@@ -21,7 +21,9 @@ 
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
+
 #include "qemu/osdep.h"
+#include "qemu-common.h"
 #include "qapi/error.h"
 #include "hw/hw.h"
 #include "hw/ppc/ppc.h"
diff --git a/hw/ppc/spapr_drc.c b/hw/ppc/spapr_drc.c
index b94b44a..7af1062 100644
--- a/hw/ppc/spapr_drc.c
+++ b/hw/ppc/spapr_drc.c
@@ -11,6 +11,7 @@ 
  */
 
 #include "qemu/osdep.h"
+#include "qemu-common.h"
 #include "qapi/error.h"
 #include "hw/ppc/spapr_drc.h"
 #include "qom/object.h"
diff --git a/hw/ppc/spapr_events.c b/hw/ppc/spapr_events.c
index 61204f0..bb29553 100644
--- a/hw/ppc/spapr_events.c
+++ b/hw/ppc/spapr_events.c
@@ -24,7 +24,9 @@ 
  * THE SOFTWARE.
  *
  */
+
 #include "qemu/osdep.h"
+#include "qemu-common.h"
 #include "qapi/error.h"
 #include "cpu.h"
 #include "sysemu/sysemu.h"
diff --git a/hw/ppc/spapr_rtas.c b/hw/ppc/spapr_rtas.c
index b7c5ebd..16aa618 100644
--- a/hw/ppc/spapr_rtas.c
+++ b/hw/ppc/spapr_rtas.c
@@ -24,7 +24,9 @@ 
  * THE SOFTWARE.
  *
  */
+
 #include "qemu/osdep.h"
+#include "qemu-common.h"
 #include "cpu.h"
 #include "sysemu/sysemu.h"
 #include "sysemu/char.h"
diff --git a/hw/ppc/spapr_rtc.c b/hw/ppc/spapr_rtc.c
index 02fa373..57f80e6 100644
--- a/hw/ppc/spapr_rtc.c
+++ b/hw/ppc/spapr_rtc.c
@@ -25,7 +25,9 @@ 
  * THE SOFTWARE.
  *
  */
+
 #include "qemu/osdep.h"
+#include "qemu-common.h"
 #include "cpu.h"
 #include "qemu/timer.h"
 #include "sysemu/sysemu.h"
diff --git a/hw/ppc/virtex_ml507.c b/hw/ppc/virtex_ml507.c
index b807a08..bed71c2 100644
--- a/hw/ppc/virtex_ml507.c
+++ b/hw/ppc/virtex_ml507.c
@@ -23,6 +23,7 @@ 
  */
 
 #include "qemu/osdep.h"
+#include "qemu-common.h"
 #include "hw/sysbus.h"
 #include "hw/hw.h"
 #include "hw/char/serial.h"
diff --git a/hw/s390x/ipl.c b/hw/s390x/ipl.c
index f104200..cae2e6b 100644
--- a/hw/s390x/ipl.c
+++ b/hw/s390x/ipl.c
@@ -12,6 +12,7 @@ 
  */
 
 #include "qemu/osdep.h"
+#include "qemu-common.h"
 #include "qapi/error.h"
 #include "sysemu/sysemu.h"
 #include "cpu.h"
diff --git a/hw/scsi/megasas.c b/hw/scsi/megasas.c
index a63a581..addd980 100644
--- a/hw/scsi/megasas.c
+++ b/hw/scsi/megasas.c
@@ -19,6 +19,7 @@ 
  */
 
 #include "qemu/osdep.h"
+#include "qemu-common.h"
 #include "hw/hw.h"
 #include "hw/pci/pci.h"
 #include "sysemu/dma.h"
diff --git a/hw/scsi/scsi-bus.c b/hw/scsi/scsi-bus.c
index a5ad3c7..6723da5 100644
--- a/hw/scsi/scsi-bus.c
+++ b/hw/scsi/scsi-bus.c
@@ -1,4 +1,5 @@ 
 #include "qemu/osdep.h"
+#include "qemu-common.h"
 #include "hw/hw.h"
 #include "qapi/error.h"
 #include "qemu/error-report.h"
diff --git a/hw/scsi/vhost-scsi.c b/hw/scsi/vhost-scsi.c
index 97a0dd1..9238cc4 100644
--- a/hw/scsi/vhost-scsi.c
+++ b/hw/scsi/vhost-scsi.c
@@ -17,6 +17,7 @@ 
 #include "qemu/osdep.h"
 #include "qapi/error.h"
 #include <sys/ioctl.h>
+#include "qemu-common.h"
 #include "qemu/error-report.h"
 #include "qemu/queue.h"
 #include "monitor/monitor.h"
diff --git a/hw/sd/core.c b/hw/sd/core.c
index 14c2bdf..3c31ad3 100644
--- a/hw/sd/core.c
+++ b/hw/sd/core.c
@@ -21,6 +21,7 @@ 
 
 #include "qemu/osdep.h"
 #include "hw/qdev-core.h"
+#include "qemu/module.h"
 #include "sysemu/block-backend.h"
 #include "hw/sd/sd.h"
 
diff --git a/hw/smbios/smbios.c b/hw/smbios/smbios.c
index b688b94..13f000b 100644
--- a/hw/smbios/smbios.c
+++ b/hw/smbios/smbios.c
@@ -16,6 +16,7 @@ 
  */
 
 #include "qemu/osdep.h"
+#include "qemu-common.h"
 #include "qapi/error.h"
 #include "qemu/config-file.h"
 #include "qemu/error-report.h"
diff --git a/hw/sparc/leon3.c b/hw/sparc/leon3.c
index 9f085ec..a4d6bbf 100644
--- a/hw/sparc/leon3.c
+++ b/hw/sparc/leon3.c
@@ -21,7 +21,9 @@ 
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
+
 #include "qemu/osdep.h"
+#include "qemu-common.h"
 #include "qapi/error.h"
 #include "hw/hw.h"
 #include "qemu/timer.h"
diff --git a/hw/sparc/sun4m.c b/hw/sparc/sun4m.c
index 28182c3..8646fc5 100644
--- a/hw/sparc/sun4m.c
+++ b/hw/sparc/sun4m.c
@@ -21,7 +21,9 @@ 
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
+
 #include "qemu/osdep.h"
+#include "qemu-common.h"
 #include "qapi/error.h"
 #include "hw/sysbus.h"
 #include "qemu/error-report.h"
diff --git a/hw/sparc64/sun4u.c b/hw/sparc64/sun4u.c
index 2e03a28..abf9493 100644
--- a/hw/sparc64/sun4u.c
+++ b/hw/sparc64/sun4u.c
@@ -21,7 +21,9 @@ 
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
+
 #include "qemu/osdep.h"
+#include "qemu-common.h"
 #include "qapi/error.h"
 #include "hw/hw.h"
 #include "hw/pci/pci.h"
diff --git a/hw/timer/ds1338.c b/hw/timer/ds1338.c
index ff31561..385b7d3 100644
--- a/hw/timer/ds1338.c
+++ b/hw/timer/ds1338.c
@@ -11,6 +11,7 @@ 
  */
 
 #include "qemu/osdep.h"
+#include "qemu-common.h"
 #include "hw/i2c/i2c.h"
 
 /* Size of NVRAM including both the user-accessible area and the
diff --git a/hw/timer/m48t59.c b/hw/timer/m48t59.c
index c4db0e6..c037618 100644
--- a/hw/timer/m48t59.c
+++ b/hw/timer/m48t59.c
@@ -23,6 +23,7 @@ 
  * THE SOFTWARE.
  */
 #include "qemu/osdep.h"
+#include "qemu-common.h"
 #include "hw/hw.h"
 #include "hw/timer/m48t59.h"
 #include "qapi/error.h"
diff --git a/hw/timer/mc146818rtc.c b/hw/timer/mc146818rtc.c
index eb0100a..6083b4d 100644
--- a/hw/timer/mc146818rtc.c
+++ b/hw/timer/mc146818rtc.c
@@ -21,7 +21,9 @@ 
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
+
 #include "qemu/osdep.h"
+#include "qemu-common.h"
 #include "hw/hw.h"
 #include "qemu/timer.h"
 #include "sysemu/sysemu.h"
diff --git a/hw/timer/pl031.c b/hw/timer/pl031.c
index 3ccb2cb..ea355ee 100644
--- a/hw/timer/pl031.c
+++ b/hw/timer/pl031.c
@@ -12,6 +12,7 @@ 
  */
 
 #include "qemu/osdep.h"
+#include "qemu-common.h"
 #include "hw/sysbus.h"
 #include "qemu/timer.h"
 #include "sysemu/sysemu.h"
diff --git a/hw/timer/twl92230.c b/hw/timer/twl92230.c
index 1c92438..7443b74 100644
--- a/hw/timer/twl92230.c
+++ b/hw/timer/twl92230.c
@@ -20,6 +20,7 @@ 
  */
 
 #include "qemu/osdep.h"
+#include "qemu-common.h"
 #include "hw/hw.h"
 #include "qemu/timer.h"
 #include "hw/i2c/i2c.h"
diff --git a/hw/tpm/tpm_tis.h b/hw/tpm/tpm_tis.h
index a1df41f..eadde52 100644
--- a/hw/tpm/tpm_tis.h
+++ b/hw/tpm/tpm_tis.h
@@ -19,7 +19,6 @@ 
 
 #include "hw/isa/isa.h"
 #include "hw/acpi/tpm.h"
-#include "qemu-common.h"
 
 #define TPM_TIS_NUM_LOCALITIES      5     /* per spec */
 #define TPM_TIS_LOCALITY_SHIFT      12
diff --git a/hw/usb/bus.c b/hw/usb/bus.c
index a9a6f9e..b09196f 100644
--- a/hw/usb/bus.c
+++ b/hw/usb/bus.c
@@ -1,4 +1,5 @@ 
 #include "qemu/osdep.h"
+#include "qemu-common.h"
 #include "hw/hw.h"
 #include "hw/usb.h"
 #include "hw/qdev.h"
diff --git a/hw/usb/ccid-card-passthru.c b/hw/usb/ccid-card-passthru.c
index c0e90e5..a50b310 100644
--- a/hw/usb/ccid-card-passthru.c
+++ b/hw/usb/ccid-card-passthru.c
@@ -9,6 +9,7 @@ 
  */
 
 #include "qemu/osdep.h"
+#include "qemu-common.h"
 #include "sysemu/char.h"
 #include "qemu/error-report.h"
 #include "qemu/sockets.h"
diff --git a/hw/vfio/pci.h b/hw/vfio/pci.h
index 3976f68..5529ae9 100644
--- a/hw/vfio/pci.h
+++ b/hw/vfio/pci.h
@@ -12,7 +12,6 @@ 
 #ifndef HW_VFIO_VFIO_PCI_H
 #define HW_VFIO_VFIO_PCI_H
 
-#include "qemu-common.h"
 #include "exec/memory.h"
 #include "hw/pci/pci.h"
 #include "hw/vfio/vfio-common.h"
diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c
index 5914e85..26c88a6 100644
--- a/hw/virtio/vhost-user.c
+++ b/hw/virtio/vhost-user.c
@@ -9,6 +9,7 @@ 
  */
 
 #include "qemu/osdep.h"
+#include "qemu-common.h"
 #include "qapi/error.h"
 #include "hw/virtio/vhost.h"
 #include "hw/virtio/vhost-backend.h"
diff --git a/hw/xen/xen_pt.h b/hw/xen/xen_pt.h
index c2f8e1f..af200de 100644
--- a/hw/xen/xen_pt.h
+++ b/hw/xen/xen_pt.h
@@ -1,7 +1,6 @@ 
 #ifndef XEN_PT_H
 #define XEN_PT_H
 
-#include "qemu-common.h"
 #include "hw/xen/xen_common.h"
 #include "hw/pci/pci.h"
 #include "xen-host-pci-device.h"
diff --git a/include/block/aio.h b/include/block/aio.h
index 88a64ee..fb5dc56 100644
--- a/include/block/aio.h
+++ b/include/block/aio.h
@@ -14,7 +14,6 @@ 
 #ifndef QEMU_AIO_H
 #define QEMU_AIO_H
 
-#include "qemu-common.h"
 #include "qemu/queue.h"
 #include "qemu/event_notifier.h"
 #include "qemu/thread.h"
diff --git a/include/block/nbd.h b/include/block/nbd.h
index b86a976..6f9d77e 100644
--- a/include/block/nbd.h
+++ b/include/block/nbd.h
@@ -19,8 +19,6 @@ 
 #ifndef NBD_H
 #define NBD_H
 
-
-#include "qemu-common.h"
 #include "qemu/option.h"
 #include "io/channel-socket.h"
 #include "crypto/tlscreds.h"
diff --git a/include/block/qapi.h b/include/block/qapi.h
index 327549d..b14bde4 100644
--- a/include/block/qapi.h
+++ b/include/block/qapi.h
@@ -26,6 +26,7 @@ 
 #define BLOCK_QAPI_H
 
 #include "qapi-types.h"
+#include "qemu/fprintf-fn.h"
 #include "block/block.h"
 #include "block/snapshot.h"
 
diff --git a/include/block/snapshot.h b/include/block/snapshot.h
index e5c0553..84ab79c 100644
--- a/include/block/snapshot.h
+++ b/include/block/snapshot.h
@@ -25,7 +25,6 @@ 
 #ifndef SNAPSHOT_H
 #define SNAPSHOT_H
 
-#include "qemu-common.h"
 #include "qemu/option.h"
 
 
diff --git a/include/block/write-threshold.h b/include/block/write-threshold.h
index 234d219..df7290b 100644
--- a/include/block/write-threshold.h
+++ b/include/block/write-threshold.h
@@ -12,8 +12,6 @@ 
 #ifndef BLOCK_WRITE_THRESHOLD_H
 #define BLOCK_WRITE_THRESHOLD_H
 
-#include "qemu-common.h"
-
 /*
  * bdrv_write_threshold_set:
  *
diff --git a/include/disas/bfd.h b/include/disas/bfd.h
index a112e9c..a87b8a1 100644
--- a/include/disas/bfd.h
+++ b/include/disas/bfd.h
@@ -9,7 +9,7 @@ 
 #ifndef DIS_ASM_H
 #define DIS_ASM_H
 
-#include "qemu-common.h"
+#include "qemu/fprintf-fn.h"
 
 typedef void *PTR;
 typedef uint64_t bfd_vma;
diff --git a/include/disas/disas.h b/include/disas/disas.h
index 2b9293b..6371b01 100644
--- a/include/disas/disas.h
+++ b/include/disas/disas.h
@@ -1,8 +1,6 @@ 
 #ifndef _QEMU_DISAS_H
 #define _QEMU_DISAS_H
 
-#include "qemu-common.h"
-
 #ifdef NEED_CPU_H
 /* Disassemble this for me please... (debugging). */
 void disas(FILE *out, void *code, unsigned long size);
diff --git a/include/exec/cpu-all.h b/include/exec/cpu-all.h
index 08e5093..c074840 100644
--- a/include/exec/cpu-all.h
+++ b/include/exec/cpu-all.h
@@ -19,7 +19,6 @@ 
 #ifndef CPU_ALL_H
 #define CPU_ALL_H
 
-#include "qemu-common.h"
 #include "exec/cpu-common.h"
 #include "exec/memory.h"
 #include "qemu/thread.h"
diff --git a/include/exec/exec-all.h b/include/exec/exec-all.h
index 05a151d..92d2bbb 100644
--- a/include/exec/exec-all.h
+++ b/include/exec/exec-all.h
@@ -20,8 +20,6 @@ 
 #ifndef _EXEC_ALL_H_
 #define _EXEC_ALL_H_
 
-#include "qemu-common.h"
-
 /* allow to see translation results - the slowdown should be negligible, so we leave it */
 #define DEBUG_DISAS
 
diff --git a/include/exec/ioport.h b/include/exec/ioport.h
index 3bd6722..3009c45 100644
--- a/include/exec/ioport.h
+++ b/include/exec/ioport.h
@@ -24,7 +24,6 @@ 
 #ifndef IOPORT_H
 #define IOPORT_H
 
-#include "qemu-common.h"
 #include "qom/object.h"
 #include "exec/memory.h"
 
diff --git a/include/hw/acpi/tco.h b/include/hw/acpi/tco.h
index 52ad767..d19dd59 100644
--- a/include/hw/acpi/tco.h
+++ b/include/hw/acpi/tco.h
@@ -9,7 +9,6 @@ 
 #ifndef HW_ACPI_TCO_H
 #define HW_ACPI_TCO_H
 
-#include "qemu-common.h"
 
 /* As per ICH9 spec, the internal timer has an error of ~0.6s on every tick */
 #define TCO_TICK_NSEC 600000000LL
diff --git a/include/hw/arm/allwinner-a10.h b/include/hw/arm/allwinner-a10.h
index 6b32a99..42d581b 100644
--- a/include/hw/arm/allwinner-a10.h
+++ b/include/hw/arm/allwinner-a10.h
@@ -1,6 +1,5 @@ 
 #ifndef ALLWINNER_H_
 
-#include "qemu-common.h"
 #include "qemu/error-report.h"
 #include "hw/char/serial.h"
 #include "hw/arm/arm.h"
diff --git a/include/hw/arm/bcm2835_peripherals.h b/include/hw/arm/bcm2835_peripherals.h
index 5d888dc..28b6938 100644
--- a/include/hw/arm/bcm2835_peripherals.h
+++ b/include/hw/arm/bcm2835_peripherals.h
@@ -11,7 +11,6 @@ 
 #ifndef BCM2835_PERIPHERALS_H
 #define BCM2835_PERIPHERALS_H
 
-#include "qemu-common.h"
 #include "exec/address-spaces.h"
 #include "hw/sysbus.h"
 #include "hw/intc/bcm2835_ic.h"
diff --git a/include/hw/arm/exynos4210.h b/include/hw/arm/exynos4210.h
index 5c1820f..754c306 100644
--- a/include/hw/arm/exynos4210.h
+++ b/include/hw/arm/exynos4210.h
@@ -26,7 +26,6 @@ 
 #ifndef EXYNOS4210_H_
 #define EXYNOS4210_H_
 
-#include "qemu-common.h"
 #include "exec/memory.h"
 
 #define EXYNOS4210_NCPUS                    2
diff --git a/include/hw/arm/omap.h b/include/hw/arm/omap.h
index 0ad5fb8..a40f7d4 100644
--- a/include/hw/arm/omap.h
+++ b/include/hw/arm/omap.h
@@ -20,6 +20,7 @@ 
 #include "exec/memory.h"
 # define hw_omap_h		"omap.h"
 #include "hw/irq.h"
+#include "cpu.h"
 
 # define OMAP_EMIFS_BASE	0x00000000
 # define OMAP2_Q0_BASE		0x00000000
diff --git a/include/hw/arm/sysbus-fdt.h b/include/hw/arm/sysbus-fdt.h
index e15bb81..ba0fcc7 100644
--- a/include/hw/arm/sysbus-fdt.h
+++ b/include/hw/arm/sysbus-fdt.h
@@ -25,7 +25,6 @@ 
 #define HW_ARM_SYSBUS_FDT_H
 
 #include "hw/arm/arm.h"
-#include "qemu-common.h"
 #include "hw/sysbus.h"
 
 /*
diff --git a/include/hw/arm/virt-acpi-build.h b/include/hw/arm/virt-acpi-build.h
index 7d3700e..d57566d 100644
--- a/include/hw/arm/virt-acpi-build.h
+++ b/include/hw/arm/virt-acpi-build.h
@@ -20,7 +20,6 @@ 
 #ifndef QEMU_VIRT_ACPI_BUILD_H
 #define QEMU_VIRT_ACPI_BUILD_H
 
-#include "qemu-common.h"
 #include "hw/arm/virt.h"
 
 #define ACPI_GICC_ENABLED 1
diff --git a/include/hw/arm/virt.h b/include/hw/arm/virt.h
index ecd8589..dde33f5 100644
--- a/include/hw/arm/virt.h
+++ b/include/hw/arm/virt.h
@@ -30,7 +30,7 @@ 
 #ifndef QEMU_ARM_VIRT_H
 #define QEMU_ARM_VIRT_H
 
-#include "qemu-common.h"
+#include "exec/hwaddr.h"
 
 #define NUM_GICV2M_SPIS       64
 #define NUM_VIRTIO_TRANSPORTS 32
diff --git a/include/hw/arm/xlnx-zynqmp.h b/include/hw/arm/xlnx-zynqmp.h
index 2332596..2b02283 100644
--- a/include/hw/arm/xlnx-zynqmp.h
+++ b/include/hw/arm/xlnx-zynqmp.h
@@ -17,7 +17,6 @@ 
 
 #ifndef XLNX_ZYNQMP_H
 
-#include "qemu-common.h"
 #include "hw/arm/arm.h"
 #include "hw/intc/arm_gic.h"
 #include "hw/net/cadence_gem.h"
diff --git a/include/hw/block/block.h b/include/hw/block/block.h
index 984660e..a11f3e0 100644
--- a/include/hw/block/block.h
+++ b/include/hw/block/block.h
@@ -11,7 +11,6 @@ 
 #ifndef HW_BLOCK_COMMON_H
 #define HW_BLOCK_COMMON_H
 
-#include "qemu-common.h"
 
 /* Configuration */
 
diff --git a/include/hw/fw-path-provider.h b/include/hw/fw-path-provider.h
index 7afaec0..43727ec 100644
--- a/include/hw/fw-path-provider.h
+++ b/include/hw/fw-path-provider.h
@@ -18,7 +18,6 @@ 
 #ifndef FW_PATH_PROVIDER_H
 #define FW_PATH_PROVIDER_H 1
 
-#include "qemu-common.h"
 #include "qom/object.h"
 
 #define TYPE_FW_PATH_PROVIDER "fw-path-provider"
diff --git a/include/hw/hw.h b/include/hw/hw.h
index 2cb69d5..151d65e 100644
--- a/include/hw/hw.h
+++ b/include/hw/hw.h
@@ -15,6 +15,7 @@ 
 #include "qemu/module.h"
 
 #ifdef NEED_CPU_H
+#include "cpu.h"
 #if TARGET_LONG_BITS == 64
 #define qemu_put_betl qemu_put_be64
 #define qemu_get_betl qemu_get_be64
diff --git a/include/hw/i386/apic.h b/include/hw/i386/apic.h
index 51eb6d3..9efec6f 100644
--- a/include/hw/i386/apic.h
+++ b/include/hw/i386/apic.h
@@ -1,7 +1,7 @@ 
 #ifndef APIC_H
 #define APIC_H
 
-#include "qemu-common.h"
+#include "cpu.h"
 
 /* apic.c */
 void apic_deliver_irq(uint8_t dest, uint8_t dest_mode, uint8_t delivery_mode,
diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
index 4f6ce10..8f2acfd 100644
--- a/include/hw/i386/pc.h
+++ b/include/hw/i386/pc.h
@@ -1,7 +1,6 @@ 
 #ifndef HW_PC_H
 #define HW_PC_H
 
-#include "qemu-common.h"
 #include "exec/memory.h"
 #include "hw/boards.h"
 #include "hw/isa/isa.h"
diff --git a/include/hw/ipmi/ipmi.h b/include/hw/ipmi/ipmi.h
index 74a2b5a..b5f01be 100644
--- a/include/hw/ipmi/ipmi.h
+++ b/include/hw/ipmi/ipmi.h
@@ -26,7 +26,6 @@ 
 #define HW_IPMI_H
 
 #include "exec/memory.h"
-#include "qemu-common.h"
 #include "hw/qdev.h"
 
 #define MAX_IPMI_MSG_SIZE 300
diff --git a/include/hw/isa/apm.h b/include/hw/isa/apm.h
index 4839ff1..d65faea 100644
--- a/include/hw/isa/apm.h
+++ b/include/hw/isa/apm.h
@@ -1,7 +1,6 @@ 
 #ifndef APM_H
 #define APM_H
 
-#include "qemu-common.h"
 #include "hw/hw.h"
 #include "exec/memory.h"
 
diff --git a/include/hw/lm32/lm32_pic.h b/include/hw/lm32/lm32_pic.h
index 189fa38..9aa3fc4 100644
--- a/include/hw/lm32/lm32_pic.h
+++ b/include/hw/lm32/lm32_pic.h
@@ -1,7 +1,6 @@ 
 #ifndef QEMU_HW_LM32_PIC_H
 #define QEMU_HW_LM32_PIC_H
 
-#include "qemu-common.h"
 
 uint32_t lm32_pic_get_ip(DeviceState *d);
 uint32_t lm32_pic_get_im(DeviceState *d);
diff --git a/include/hw/nmi.h b/include/hw/nmi.h
index f4cec62..ff6a7a6 100644
--- a/include/hw/nmi.h
+++ b/include/hw/nmi.h
@@ -22,7 +22,6 @@ 
 #ifndef NMI_H
 #define NMI_H 1
 
-#include "qemu-common.h"
 #include "qom/object.h"
 
 #define TYPE_NMI "nmi"
diff --git a/include/hw/pci-host/apb.h b/include/hw/pci-host/apb.h
index 736db61..5f04048 100644
--- a/include/hw/pci-host/apb.h
+++ b/include/hw/pci-host/apb.h
@@ -1,7 +1,6 @@ 
 #ifndef APB_PCI_H
 #define APB_PCI_H
 
-#include "qemu-common.h"
 
 PCIBus *pci_apb_init(hwaddr special_base,
                      hwaddr mem_base,
diff --git a/include/hw/pci-host/pam.h b/include/hw/pci-host/pam.h
index 6116c63..fec5cd3 100644
--- a/include/hw/pci-host/pam.h
+++ b/include/hw/pci-host/pam.h
@@ -50,7 +50,6 @@ 
  * 0xf0000 - 0xfffff System BIOS Area Memory Segments
  */
 
-#include "qemu-common.h"
 #include "exec/memory.h"
 
 #define SMRAM_C_BASE    0xa0000
diff --git a/include/hw/pci/msi.h b/include/hw/pci/msi.h
index 50e452b..f52cbbd 100644
--- a/include/hw/pci/msi.h
+++ b/include/hw/pci/msi.h
@@ -21,7 +21,6 @@ 
 #ifndef QEMU_MSI_H
 #define QEMU_MSI_H
 
-#include "qemu-common.h"
 #include "hw/pci/pci.h"
 
 struct MSIMessage {
diff --git a/include/hw/pci/msix.h b/include/hw/pci/msix.h
index 72e5f93..14fb80d 100644
--- a/include/hw/pci/msix.h
+++ b/include/hw/pci/msix.h
@@ -1,7 +1,6 @@ 
 #ifndef QEMU_MSIX_H
 #define QEMU_MSIX_H
 
-#include "qemu-common.h"
 #include "hw/pci/pci.h"
 
 void msix_set_message(PCIDevice *dev, int vector, MSIMessage msg);
diff --git a/include/hw/pci/shpc.h b/include/hw/pci/shpc.h
index b208554..52522c6 100644
--- a/include/hw/pci/shpc.h
+++ b/include/hw/pci/shpc.h
@@ -1,7 +1,6 @@ 
 #ifndef SHPC_H
 #define SHPC_H
 
-#include "qemu-common.h"
 #include "exec/memory.h"
 #include "migration/vmstate.h"
 #include "hw/hotplug.h"
diff --git a/include/hw/pci/slotid_cap.h b/include/hw/pci/slotid_cap.h
index 70db047..98edc53 100644
--- a/include/hw/pci/slotid_cap.h
+++ b/include/hw/pci/slotid_cap.h
@@ -1,7 +1,6 @@ 
 #ifndef PCI_SLOTID_CAP_H
 #define PCI_SLOTID_CAP_H
 
-#include "qemu-common.h"
 
 int slotid_cap_init(PCIDevice *dev, int nslots,
                     uint8_t chassis,
diff --git a/include/hw/ppc/openpic.h b/include/hw/ppc/openpic.h
index ee67098..02c2fb1 100644
--- a/include/hw/ppc/openpic.h
+++ b/include/hw/ppc/openpic.h
@@ -1,7 +1,6 @@ 
 #if !defined(__OPENPIC_H__)
 #define __OPENPIC_H__
 
-#include "qemu-common.h"
 #include "hw/qdev.h"
 
 #define TYPE_OPENPIC "openpic"
diff --git a/include/hw/ptimer.h b/include/hw/ptimer.h
index 8ebacbb..a3d090f 100644
--- a/include/hw/ptimer.h
+++ b/include/hw/ptimer.h
@@ -8,7 +8,6 @@ 
 #ifndef PTIMER_H
 #define PTIMER_H
 
-#include "qemu-common.h"
 #include "qemu/timer.h"
 #include "migration/vmstate.h"
 
diff --git a/include/hw/sd/sdhci.h b/include/hw/sd/sdhci.h
index 0f0c3f1..b739552 100644
--- a/include/hw/sd/sdhci.h
+++ b/include/hw/sd/sdhci.h
@@ -25,7 +25,6 @@ 
 #ifndef SDHCI_H
 #define SDHCI_H
 
-#include "qemu-common.h"
 #include "hw/block/block.h"
 #include "hw/pci/pci.h"
 #include "hw/sysbus.h"
diff --git a/include/hw/sh4/sh_intc.h b/include/hw/sh4/sh_intc.h
index b7ddcb0..cf24236 100644
--- a/include/hw/sh4/sh_intc.h
+++ b/include/hw/sh4/sh_intc.h
@@ -1,7 +1,6 @@ 
 #ifndef __SH_INTC_H__
 #define __SH_INTC_H__
 
-#include "qemu-common.h"
 #include "hw/irq.h"
 #include "exec/address-spaces.h"
 
diff --git a/include/hw/sparc/sun4m.h b/include/hw/sparc/sun4m.h
index 9c17425..5e724d3 100644
--- a/include/hw/sparc/sun4m.h
+++ b/include/hw/sparc/sun4m.h
@@ -1,7 +1,6 @@ 
 #ifndef SUN4M_H
 #define SUN4M_H
 
-#include "qemu-common.h"
 #include "exec/hwaddr.h"
 #include "qapi/qmp/types.h"
 
diff --git a/include/hw/stream.h b/include/hw/stream.h
index 30ccc56..ec7bc35 100644
--- a/include/hw/stream.h
+++ b/include/hw/stream.h
@@ -1,7 +1,6 @@ 
 #ifndef STREAM_H
 #define STREAM_H 1
 
-#include "qemu-common.h"
 #include "qom/object.h"
 
 /* stream slave. Used until qdev provides a generic way.  */
diff --git a/include/hw/timer/m48t59.h b/include/hw/timer/m48t59.h
index 3367923..700a097 100644
--- a/include/hw/timer/m48t59.h
+++ b/include/hw/timer/m48t59.h
@@ -1,7 +1,6 @@ 
 #ifndef NVRAM_H
 #define NVRAM_H
 
-#include "qemu-common.h"
 #include "qom/object.h"
 
 #define TYPE_NVRAM "nvram"
diff --git a/include/hw/vfio/vfio-common.h b/include/hw/vfio/vfio-common.h
index eb0e1b0..7d193b9 100644
--- a/include/hw/vfio/vfio-common.h
+++ b/include/hw/vfio/vfio-common.h
@@ -20,7 +20,6 @@ 
 #ifndef HW_VFIO_VFIO_COMMON_H
 #define HW_VFIO_VFIO_COMMON_H
 
-#include "qemu-common.h"
 #include "exec/address-spaces.h"
 #include "exec/memory.h"
 #include "qemu/queue.h"
diff --git a/include/hw/virtio/vhost-scsi.h b/include/hw/virtio/vhost-scsi.h
index 9fd63df..8aa0f8b 100644
--- a/include/hw/virtio/vhost-scsi.h
+++ b/include/hw/virtio/vhost-scsi.h
@@ -14,7 +14,6 @@ 
 #ifndef VHOST_SCSI_H
 #define VHOST_SCSI_H
 
-#include "qemu-common.h"
 #include "hw/qdev.h"
 #include "hw/virtio/virtio-scsi.h"
 #include "hw/virtio/vhost.h"
diff --git a/include/hw/xen/xen.h b/include/hw/xen/xen.h
index 6eb815a..5279211 100644
--- a/include/hw/xen/xen.h
+++ b/include/hw/xen/xen.h
@@ -8,7 +8,6 @@ 
  */
 
 #include "hw/irq.h"
-#include "qemu-common.h"
 
 /* xen-machine.c */
 enum xen_mode {
diff --git a/include/io/channel.h b/include/io/channel.h
index d37acd2..1294152 100644
--- a/include/io/channel.h
+++ b/include/io/channel.h
@@ -21,7 +21,6 @@ 
 #ifndef QIO_CHANNEL_H__
 #define QIO_CHANNEL_H__
 
-#include "qemu-common.h"
 #include "qom/object.h"
 
 #define TYPE_QIO_CHANNEL "qio-channel"
diff --git a/include/io/task.h b/include/io/task.h
index 2e69d8a..bf42b23 100644
--- a/include/io/task.h
+++ b/include/io/task.h
@@ -21,7 +21,6 @@ 
 #ifndef QIO_TASK_H__
 #define QIO_TASK_H__
 
-#include "qemu-common.h"
 #include "qom/object.h"
 
 typedef struct QIOTask QIOTask;
diff --git a/include/migration/migration.h b/include/migration/migration.h
index ac2c12c..69b5409 100644
--- a/include/migration/migration.h
+++ b/include/migration/migration.h
@@ -15,7 +15,6 @@ 
 #define QEMU_MIGRATION_H
 
 #include "qapi/qmp/qdict.h"
-#include "qemu-common.h"
 #include "qemu/thread.h"
 #include "qemu/notify.h"
 #include "migration/vmstate.h"
diff --git a/include/monitor/monitor.h b/include/monitor/monitor.h
index aa0f373..27a4d4f 100644
--- a/include/monitor/monitor.h
+++ b/include/monitor/monitor.h
@@ -1,7 +1,6 @@ 
 #ifndef MONITOR_H
 #define MONITOR_H
 
-#include "qemu-common.h"
 #include "qapi/qmp/qdict.h"
 #include "block/block.h"
 #include "qemu/readline.h"
diff --git a/include/net/filter.h b/include/net/filter.h
index 0c4a2ea..6ca4e27 100644
--- a/include/net/filter.h
+++ b/include/net/filter.h
@@ -10,7 +10,6 @@ 
 #define QEMU_NET_FILTER_H
 
 #include "qom/object.h"
-#include "qemu-common.h"
 #include "net/queue.h"
 
 #define TYPE_NETFILTER "netfilter"
diff --git a/include/net/net.h b/include/net/net.h
index 73e4c46..c6f8d8e 100644
--- a/include/net/net.h
+++ b/include/net/net.h
@@ -2,7 +2,6 @@ 
 #define QEMU_NET_H
 
 #include "qemu/queue.h"
-#include "qemu-common.h"
 #include "qapi/qmp/qdict.h"
 #include "qemu/option.h"
 #include "net/queue.h"
diff --git a/include/net/queue.h b/include/net/queue.h
index 5469fdb..ea5386c 100644
--- a/include/net/queue.h
+++ b/include/net/queue.h
@@ -24,8 +24,6 @@ 
 #ifndef QEMU_NET_QUEUE_H
 #define QEMU_NET_QUEUE_H
 
-#include "qemu-common.h"
-
 typedef struct NetPacket NetPacket;
 typedef struct NetQueue NetQueue;
 
diff --git a/include/net/slirp.h b/include/net/slirp.h
index 64b795c..69f0d5e 100644
--- a/include/net/slirp.h
+++ b/include/net/slirp.h
@@ -24,7 +24,6 @@ 
 #ifndef QEMU_NET_SLIRP_H
 #define QEMU_NET_SLIRP_H
 
-#include "qemu-common.h"
 #include "qapi/qmp/qdict.h"
 #include "qemu/option.h"
 #include "qapi-types.h"
diff --git a/include/net/tap.h b/include/net/tap.h
index 5da4edc..af00904 100644
--- a/include/net/tap.h
+++ b/include/net/tap.h
@@ -26,7 +26,6 @@ 
 #ifndef QEMU_NET_TAP_H
 #define QEMU_NET_TAP_H
 
-#include "qemu-common.h"
 #include "qapi-types.h"
 #include "standard-headers/linux/virtio_net.h"
 
diff --git a/include/qapi/qmp/json-parser.h b/include/qapi/qmp/json-parser.h
index 9987f8c..e7621fe 100644
--- a/include/qapi/qmp/json-parser.h
+++ b/include/qapi/qmp/json-parser.h
@@ -14,7 +14,6 @@ 
 #ifndef QEMU_JSON_PARSER_H
 #define QEMU_JSON_PARSER_H
 
-#include "qemu-common.h"
 #include "qapi/qmp/qlist.h"
 
 QObject *json_parser_parse(GQueue *tokens, va_list *ap);
diff --git a/include/qemu-io.h b/include/qemu-io.h
index 4d402b9..e5d2140 100644
--- a/include/qemu-io.h
+++ b/include/qemu-io.h
@@ -18,8 +18,6 @@ 
 #ifndef QEMU_IO_H
 #define QEMU_IO_H
 
-#include "qemu-common.h"
-
 #define CMD_FLAG_GLOBAL ((int)0x80000000) /* don't iterate "args" */
 
 typedef int (*cfunc_t)(BlockBackend *blk, int argc, char **argv);
diff --git a/include/qemu/base64.h b/include/qemu/base64.h
index 793708d..161914d 100644
--- a/include/qemu/base64.h
+++ b/include/qemu/base64.h
@@ -21,9 +21,6 @@ 
 #ifndef QEMU_BASE64_H__
 #define QEMU_BASE64_H__
 
-#include "qemu-common.h"
-
-
 /**
  * qbase64_decode:
  * @input: the (possibly) base64 encoded text
diff --git a/include/qemu/buffer.h b/include/qemu/buffer.h
index dead9b7..f6f6ce3 100644
--- a/include/qemu/buffer.h
+++ b/include/qemu/buffer.h
@@ -21,8 +21,6 @@ 
 #ifndef QEMU_BUFFER_H__
 #define QEMU_BUFFER_H__
 
-#include "qemu-common.h"
-
 typedef struct Buffer Buffer;
 
 /**
diff --git a/include/qemu/crc32c.h b/include/qemu/crc32c.h
index dafb6a1..a58ee1e 100644
--- a/include/qemu/crc32c.h
+++ b/include/qemu/crc32c.h
@@ -28,8 +28,6 @@ 
 #ifndef QEMU_CRC32C_H
 #define QEMU_CRC32C_H
 
-#include "qemu-common.h"
-
 uint32_t crc32c(uint32_t crc, const uint8_t *data, unsigned int length);
 
 #endif
diff --git a/include/qemu/event_notifier.h b/include/qemu/event_notifier.h
index a8f2854..b1b4fd1 100644
--- a/include/qemu/event_notifier.h
+++ b/include/qemu/event_notifier.h
@@ -13,8 +13,6 @@ 
 #ifndef QEMU_EVENT_NOTIFIER_H
 #define QEMU_EVENT_NOTIFIER_H
 
-#include "qemu-common.h"
-
 #ifdef _WIN32
 #include <windows.h>
 #endif
diff --git a/include/qemu/mmap-alloc.h b/include/qemu/mmap-alloc.h
index 0899b2f..3bc9ce6 100644
--- a/include/qemu/mmap-alloc.h
+++ b/include/qemu/mmap-alloc.h
@@ -1,8 +1,6 @@ 
 #ifndef QEMU_MMAP_ALLOC
 #define QEMU_MMAP_ALLOC
 
-#include "qemu-common.h"
-
 size_t qemu_fd_getpagesize(int fd);
 
 void *qemu_ram_mmap(int fd, size_t size, size_t align, bool shared);
diff --git a/include/qemu/throttle.h b/include/qemu/throttle.h
index 9109657..d218753 100644
--- a/include/qemu/throttle.h
+++ b/include/qemu/throttle.h
@@ -25,7 +25,6 @@ 
 #ifndef THROTTLE_H
 #define THROTTLE_H
 
-#include "qemu-common.h"
 #include "qemu/timer.h"
 
 #define THROTTLE_VALUE_MAX 1000000000000000LL
diff --git a/include/qemu/timer.h b/include/qemu/timer.h
index 59a7169..655d69f 100644
--- a/include/qemu/timer.h
+++ b/include/qemu/timer.h
@@ -1,7 +1,6 @@ 
 #ifndef QEMU_TIMER_H
 #define QEMU_TIMER_H
 
-#include "qemu-common.h"
 #include "qemu/notify.h"
 #include "qemu/host-utils.h"
 
diff --git a/include/sysemu/char.h b/include/sysemu/char.h
index 7aac3b6..09894bd 100644
--- a/include/sysemu/char.h
+++ b/include/sysemu/char.h
@@ -1,7 +1,6 @@ 
 #ifndef QEMU_CHAR_H
 #define QEMU_CHAR_H
 
-#include "qemu-common.h"
 #include "qemu/queue.h"
 #include "qemu/option.h"
 #include "qemu/config-file.h"
diff --git a/include/sysemu/cpus.h b/include/sysemu/cpus.h
index 3d1e5ba..a228648 100644
--- a/include/sysemu/cpus.h
+++ b/include/sysemu/cpus.h
@@ -1,6 +1,8 @@ 
 #ifndef QEMU_CPUS_H
 #define QEMU_CPUS_H
 
+#include "qemu/fprintf-fn.h"
+
 /* cpus.c */
 bool qemu_in_vcpu_thread(void);
 void qemu_init_cpu_loop(void);
diff --git a/include/sysemu/kvm.h b/include/sysemu/kvm.h
index 6695fa7..fa3d52d 100644
--- a/include/sysemu/kvm.h
+++ b/include/sysemu/kvm.h
@@ -19,6 +19,10 @@ 
 #include "exec/memattrs.h"
 #include "hw/irq.h"
 
+#ifdef NEED_CPU_H
+#include "cpu.h"
+#endif
+
 #ifdef CONFIG_KVM
 #include <linux/kvm.h>
 #include <linux/kvm_para.h>
diff --git a/include/sysemu/qtest.h b/include/sysemu/qtest.h
index 70aa40a..eb57518 100644
--- a/include/sysemu/qtest.h
+++ b/include/sysemu/qtest.h
@@ -14,8 +14,6 @@ 
 #ifndef QTEST_H
 #define QTEST_H
 
-#include "qemu-common.h"
-
 extern bool qtest_allowed;
 
 static inline bool qtest_enabled(void)
diff --git a/include/sysemu/rng.h b/include/sysemu/rng.h
index 45629c4..9b5a1c6 100644
--- a/include/sysemu/rng.h
+++ b/include/sysemu/rng.h
@@ -14,7 +14,6 @@ 
 #define QEMU_RNG_H
 
 #include "qom/object.h"
-#include "qemu-common.h"
 
 #define TYPE_RNG_BACKEND "rng-backend"
 #define RNG_BACKEND(obj) \
diff --git a/include/sysemu/tpm_backend.h b/include/sysemu/tpm_backend.h
index e3ec800..0a8baec 100644
--- a/include/sysemu/tpm_backend.h
+++ b/include/sysemu/tpm_backend.h
@@ -14,7 +14,6 @@ 
 #define _QEMU_TPM_H
 
 #include "qom/object.h"
-#include "qemu-common.h"
 #include "qapi-types.h"
 #include "qemu/option.h"
 #include "sysemu/tpm.h"
diff --git a/io/channel-buffer.c b/io/channel-buffer.c
index 3e5117b..e9f4479 100644
--- a/io/channel-buffer.c
+++ b/io/channel-buffer.c
@@ -19,6 +19,7 @@ 
  */
 
 #include "qemu/osdep.h"
+#include "qemu/module.h"
 #include "io/channel-buffer.h"
 #include "io/channel-watch.h"
 #include "qemu/sockets.h"
diff --git a/io/channel-command.c b/io/channel-command.c
index ad25313..138877a 100644
--- a/io/channel-command.c
+++ b/io/channel-command.c
@@ -19,6 +19,7 @@ 
  */
 
 #include "qemu/osdep.h"
+#include "qemu/module.h"
 #include "io/channel-command.h"
 #include "io/channel-watch.h"
 #include "qapi/error.h"
diff --git a/io/channel-file.c b/io/channel-file.c
index e1da243..38a4b4d 100644
--- a/io/channel-file.c
+++ b/io/channel-file.c
@@ -19,6 +19,7 @@ 
  */
 
 #include "qemu/osdep.h"
+#include "qemu/module.h"
 #include "io/channel-file.h"
 #include "io/channel-watch.h"
 #include "qapi/error.h"
diff --git a/io/channel-socket.c b/io/channel-socket.c
index ca8bc20..e880234 100644
--- a/io/channel-socket.c
+++ b/io/channel-socket.c
@@ -19,6 +19,7 @@ 
  */
 
 #include "qemu/osdep.h"
+#include "qemu-common.h"
 #include "qapi/error.h"
 #include "io/channel-socket.h"
 #include "io/channel-watch.h"
diff --git a/io/channel-tls.c b/io/channel-tls.c
index 9a8525c..857bb6c 100644
--- a/io/channel-tls.c
+++ b/io/channel-tls.c
@@ -19,6 +19,7 @@ 
  */
 
 #include "qemu/osdep.h"
+#include "qemu/module.h"
 #include "qapi/error.h"
 #include "io/channel-tls.h"
 #include "trace.h"
diff --git a/io/channel-util.c b/io/channel-util.c
index 0fb4bd0..bb78c98 100644
--- a/io/channel-util.c
+++ b/io/channel-util.c
@@ -19,6 +19,7 @@ 
  */
 
 #include "qemu/osdep.h"
+#include "qemu-common.h"
 #include "io/channel-util.h"
 #include "io/channel-file.h"
 #include "io/channel-socket.h"
diff --git a/io/channel-websock.c b/io/channel-websock.c
index 7081787..fe7956e 100644
--- a/io/channel-websock.c
+++ b/io/channel-websock.c
@@ -19,6 +19,7 @@ 
  */
 
 #include "qemu/osdep.h"
+#include "qemu-common.h"
 #include "qapi/error.h"
 #include "io/channel-websock.h"
 #include "crypto/hash.h"
diff --git a/io/channel.c b/io/channel.c
index 692eb17..0d4b852 100644
--- a/io/channel.c
+++ b/io/channel.c
@@ -22,6 +22,7 @@ 
 #include "io/channel.h"
 #include "qapi/error.h"
 #include "qemu/coroutine.h"
+#include "qemu/module.h"
 
 bool qio_channel_has_feature(QIOChannel *ioc,
                              QIOChannelFeature feature)
diff --git a/ioport.c b/ioport.c
index 7a84d54..1eb336d 100644
--- a/ioport.c
+++ b/ioport.c
@@ -26,6 +26,7 @@ 
  */
 
 #include "qemu/osdep.h"
+#include "qemu-common.h"
 #include "exec/ioport.h"
 #include "trace.h"
 #include "exec/memory.h"
diff --git a/linux-user/elfload.c b/linux-user/elfload.c
index 19dc7f5..f336dd4 100644
--- a/linux-user/elfload.c
+++ b/linux-user/elfload.c
@@ -1,5 +1,7 @@ 
 /* This is the Linux kernel elf-loading code, ported into user space */
+
 #include "qemu/osdep.h"
+#include "qemu-common.h"
 #include <sys/param.h>
 
 #include <sys/mman.h>
diff --git a/linux-user/uaccess.c b/linux-user/uaccess.c
index 75d890d..1ef8647 100644
--- a/linux-user/uaccess.c
+++ b/linux-user/uaccess.c
@@ -1,6 +1,6 @@ 
 /* User memory access */
 #include "qemu/osdep.h"
-
+#include "qemu-common.h"
 #include "qemu.h"
 
 /* copy_from_user() and copy_to_user() are usually used to copy data
diff --git a/memory.c b/memory.c
index 44bf93e..f576226 100644
--- a/memory.c
+++ b/memory.c
@@ -14,6 +14,7 @@ 
  */
 
 #include "qemu/osdep.h"
+#include "qemu-common.h"
 #include "qapi/error.h"
 #include "exec/memory.h"
 #include "exec/address-spaces.h"
diff --git a/migration/qemu-file-internal.h b/migration/qemu-file-internal.h
index d95e853..c7dfff1 100644
--- a/migration/qemu-file-internal.h
+++ b/migration/qemu-file-internal.h
@@ -25,7 +25,6 @@ 
 #ifndef QEMU_FILE_INTERNAL_H
 #define QEMU_FILE_INTERNAL_H 1
 
-#include "qemu-common.h"
 #include "qemu/iov.h"
 
 #define IO_BUF_SIZE 32768
diff --git a/migration/ram.c b/migration/ram.c
index 704f6a9..d2315e8 100644
--- a/migration/ram.c
+++ b/migration/ram.c
@@ -27,6 +27,7 @@ 
  */
 #include "qemu/osdep.h"
 #include <zlib.h>
+#include "qemu-common.h"
 #include "qapi-event.h"
 #include "qemu/bitops.h"
 #include "qemu/bitmap.h"
diff --git a/monitor.c b/monitor.c
index e99ca8c..0e13907 100644
--- a/monitor.c
+++ b/monitor.c
@@ -21,7 +21,9 @@ 
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
+
 #include "qemu/osdep.h"
+#include "qemu-common.h"
 #include <dirent.h>
 #include "hw/hw.h"
 #include "monitor/qdev.h"
diff --git a/net/hub.h b/net/hub.h
index a625eff..53a6bc5 100644
--- a/net/hub.h
+++ b/net/hub.h
@@ -15,8 +15,6 @@ 
 #ifndef NET_HUB_H
 #define NET_HUB_H
 
-#include "qemu-common.h"
-
 NetClientState *net_hub_add_port(int hub_id, const char *name);
 NetClientState *net_hub_find_client_by_name(int hub_id, const char *name);
 void net_hub_info(Monitor *mon);
diff --git a/net/slirp.c b/net/slirp.c
index 6b51fbc..68d29f7 100644
--- a/net/slirp.c
+++ b/net/slirp.c
@@ -22,6 +22,7 @@ 
  * THE SOFTWARE.
  */
 #include "qemu/osdep.h"
+#include "qemu-common.h"
 #include "net/slirp.h"
 
 
diff --git a/net/tap_int.h b/net/tap_int.h
index 2378021..e4ef1f2 100644
--- a/net/tap_int.h
+++ b/net/tap_int.h
@@ -26,7 +26,6 @@ 
 #ifndef QEMU_TAP_H
 #define QEMU_TAP_H
 
-#include "qemu-common.h"
 #include "qapi-types.h"
 
 int tap_open(char *ifname, int ifname_size, int *vnet_hdr,
diff --git a/os-posix.c b/os-posix.c
index 92fa3ba..3bfab01 100644
--- a/os-posix.c
+++ b/os-posix.c
@@ -24,6 +24,7 @@ 
  */
 
 #include "qemu/osdep.h"
+#include "qemu-common.h"
 #include <sys/wait.h>
 /*needed for MAP_POPULATE before including qemu-options.h */
 #include <sys/mman.h>
diff --git a/qdev-monitor.c b/qdev-monitor.c
index 81e3ff3..84b47d3 100644
--- a/qdev-monitor.c
+++ b/qdev-monitor.c
@@ -18,6 +18,7 @@ 
  */
 
 #include "qemu/osdep.h"
+#include "qemu-common.h"
 #include "hw/qdev.h"
 #include "hw/sysbus.h"
 #include "monitor/monitor.h"
diff --git a/qemu-io-cmds.c b/qemu-io-cmds.c
index 13fbb59..cecc5d9 100644
--- a/qemu-io-cmds.c
+++ b/qemu-io-cmds.c
@@ -9,6 +9,7 @@ 
  */
 
 #include "qemu/osdep.h"
+#include "qemu-common.h"
 #include "qapi/error.h"
 #include "qemu-io.h"
 #include "sysemu/block-backend.h"
diff --git a/qemu-io.c b/qemu-io.c
index f5b3058..6ebc352 100644
--- a/qemu-io.c
+++ b/qemu-io.c
@@ -15,6 +15,7 @@ 
 #include "qemu-io.h"
 #include "qemu/error-report.h"
 #include "qemu/main-loop.h"
+#include "qemu/module.h"
 #include "qemu/option.h"
 #include "qemu/config-file.h"
 #include "qemu/readline.h"
diff --git a/qemu-timer.c b/qemu-timer.c
index e98ecc9..51a23d4 100644
--- a/qemu-timer.c
+++ b/qemu-timer.c
@@ -23,6 +23,7 @@ 
  */
 
 #include "qemu/osdep.h"
+#include "qemu-common.h"
 #include "qemu/main-loop.h"
 #include "qemu/timer.h"
 #include "sysemu/replay.h"
diff --git a/qga/commands-posix.c b/qga/commands-posix.c
index 9f51fae..f4f491b 100644
--- a/qga/commands-posix.c
+++ b/qga/commands-posix.c
@@ -16,6 +16,7 @@ 
 #include <sys/ioctl.h>
 #include <sys/wait.h>
 #include <dirent.h>
+#include "qemu-common.h"
 #include "qga/guest-agent-core.h"
 #include "qga-qmp-commands.h"
 #include "qapi/qmp/qerror.h"
diff --git a/qga/commands.c b/qga/commands.c
index e091ee1..0a4cabf 100644
--- a/qga/commands.c
+++ b/qga/commands.c
@@ -12,6 +12,7 @@ 
 
 #include "qemu/osdep.h"
 #include <glib.h>
+#include "qemu-common.h"
 #include "qga/guest-agent-core.h"
 #include "qga-qmp-commands.h"
 #include "qapi/qmp/qerror.h"
diff --git a/qga/guest-agent-core.h b/qga/guest-agent-core.h
index 0a49516..e8c1fdf 100644
--- a/qga/guest-agent-core.h
+++ b/qga/guest-agent-core.h
@@ -11,7 +11,6 @@ 
  * See the COPYING file in the top-level directory.
  */
 #include "qapi/qmp/dispatch.h"
-#include "qemu-common.h"
 #include "qga-qmp-commands.h"
 
 #define QGA_READ_COUNT_DEFAULT 4096
diff --git a/qga/main.c b/qga/main.c
index fb2f663..b526482 100644
--- a/qga/main.c
+++ b/qga/main.c
@@ -18,6 +18,7 @@ 
 #include <syslog.h>
 #include <sys/wait.h>
 #endif
+#include "qemu-common.h"
 #include "qapi/qmp/json-streamer.h"
 #include "qapi/qmp/json-parser.h"
 #include "qapi/qmp/qint.h"
diff --git a/qobject/qjson.c b/qobject/qjson.c
index 06dc210..b2601bc 100644
--- a/qobject/qjson.c
+++ b/qobject/qjson.c
@@ -12,6 +12,7 @@ 
  */
 
 #include "qemu/osdep.h"
+#include "qemu-common.h"
 #include "qapi/qmp/json-lexer.h"
 #include "qapi/qmp/json-parser.h"
 #include "qapi/qmp/json-streamer.h"
diff --git a/qtest.c b/qtest.c
index 87575bc..6f2bd8a 100644
--- a/qtest.c
+++ b/qtest.c
@@ -12,6 +12,7 @@ 
  */
 
 #include "qemu/osdep.h"
+#include "qemu-common.h"
 #include "qapi/error.h"
 #include "sysemu/qtest.h"
 #include "hw/qdev.h"
diff --git a/scripts/tracetool/format/h.py b/scripts/tracetool/format/h.py
index 0835406..32f1371 100644
--- a/scripts/tracetool/format/h.py
+++ b/scripts/tracetool/format/h.py
@@ -21,8 +21,6 @@  def generate(events, backend):
         '',
         '#ifndef TRACE__GENERATED_TRACERS_H',
         '#define TRACE__GENERATED_TRACERS_H',
-        '',
-        '#include "qemu-common.h"',
         '')
 
     backend.generate_begin(events)
diff --git a/scripts/tracetool/format/ust_events_h.py b/scripts/tracetool/format/ust_events_h.py
index 3e8a7cd..c171e6c 100644
--- a/scripts/tracetool/format/ust_events_h.py
+++ b/scripts/tracetool/format/ust_events_h.py
@@ -31,7 +31,6 @@  def generate(events, backend):
         '#if !defined (TRACE__GENERATED_UST_H) || defined(TRACEPOINT_HEADER_MULTI_READ)',
         '#define TRACE__GENERATED_UST_H',
         '',
-        '#include "qemu-common.h"',
         '#include <lttng/tracepoint.h>',
         '',
         '/*',
diff --git a/slirp/ip_icmp.c b/slirp/ip_icmp.c
index ace3982..0c6b526 100644
--- a/slirp/ip_icmp.c
+++ b/slirp/ip_icmp.c
@@ -31,6 +31,7 @@ 
  */
 
 #include "qemu/osdep.h"
+#include "qemu-common.h"
 #include "slirp.h"
 #include "ip_icmp.h"
 
diff --git a/slirp/libslirp.h b/slirp/libslirp.h
index 5bdcbd5..0198fd8 100644
--- a/slirp/libslirp.h
+++ b/slirp/libslirp.h
@@ -1,8 +1,6 @@ 
 #ifndef _LIBSLIRP_H
 #define _LIBSLIRP_H
 
-#include "qemu-common.h"
-
 struct Slirp;
 typedef struct Slirp Slirp;
 
diff --git a/slirp/misc.c b/slirp/misc.c
index e2eea2e..eb380ba 100644
--- a/slirp/misc.c
+++ b/slirp/misc.c
@@ -8,7 +8,7 @@ 
 #include "qemu/osdep.h"
 #include <slirp.h>
 #include <libslirp.h>
-
+#include "qemu-common.h"
 #include "monitor/monitor.h"
 #include "qemu/error-report.h"
 #include "qemu/main-loop.h"
diff --git a/slirp/tcp_subr.c b/slirp/tcp_subr.c
index b1aa1f2..9438f23 100644
--- a/slirp/tcp_subr.c
+++ b/slirp/tcp_subr.c
@@ -39,6 +39,7 @@ 
  */
 
 #include "qemu/osdep.h"
+#include "qemu-common.h"
 #include <slirp.h>
 
 /* patchable/settable parameters for tcp */
diff --git a/spice-qemu-char.c b/spice-qemu-char.c
index 21885c5..d7248b2 100644
--- a/spice-qemu-char.c
+++ b/spice-qemu-char.c
@@ -1,4 +1,5 @@ 
 #include "qemu/osdep.h"
+#include "qemu/module.h"
 #include "trace.h"
 #include "ui/qemu-spice.h"
 #include "sysemu/char.h"
diff --git a/target-alpha/cpu.h b/target-alpha/cpu.h
index 420f2a5..8824c5c 100644
--- a/target-alpha/cpu.h
+++ b/target-alpha/cpu.h
@@ -20,7 +20,6 @@ 
 #if !defined (__CPU_ALPHA_H__)
 #define __CPU_ALPHA_H__
 
-#include "qemu-common.h"
 
 #define TARGET_LONG_BITS 64
 #define ALIGNED_ONLY
diff --git a/target-alpha/translate.c b/target-alpha/translate.c
index 5b86992..d07f6bf 100644
--- a/target-alpha/translate.c
+++ b/target-alpha/translate.c
@@ -18,6 +18,7 @@ 
  */
 
 #include "qemu/osdep.h"
+#include "qemu-common.h"
 #include "cpu.h"
 #include "disas/disas.h"
 #include "qemu/host-utils.h"
diff --git a/target-arm/cpu.h b/target-arm/cpu.h
index 066ff67..8ba6475 100644
--- a/target-arm/cpu.h
+++ b/target-arm/cpu.h
@@ -33,7 +33,6 @@ 
 
 #define CPUArchState struct CPUARMState
 
-#include "qemu-common.h"
 #include "exec/cpu-defs.h"
 
 #include "fpu/softfloat.h"
diff --git a/target-cris/cpu.h b/target-cris/cpu.h
index 415cf91..6bb7e44 100644
--- a/target-cris/cpu.h
+++ b/target-cris/cpu.h
@@ -20,7 +20,6 @@ 
 #ifndef CPU_CRIS_H
 #define CPU_CRIS_H
 
-#include "qemu-common.h"
 
 #define TARGET_LONG_BITS 32
 
diff --git a/target-i386/cpu.c b/target-i386/cpu.c
index 0f38d1e..5cd7d85 100644
--- a/target-i386/cpu.c
+++ b/target-i386/cpu.c
@@ -16,8 +16,9 @@ 
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library; if not, see <http://www.gnu.org/licenses/>.
  */
+
 #include "qemu/osdep.h"
-
+#include "qemu-common.h"
 #include "cpu.h"
 #include "sysemu/kvm.h"
 #include "sysemu/cpus.h"
diff --git a/target-i386/cpu.h b/target-i386/cpu.h
index 5148c82..8aa0e8a 100644
--- a/target-i386/cpu.h
+++ b/target-i386/cpu.h
@@ -19,7 +19,6 @@ 
 #ifndef CPU_I386_H
 #define CPU_I386_H
 
-#include "qemu-common.h"
 #include "standard-headers/asm-x86/hyperv.h"
 
 #ifdef TARGET_X86_64
diff --git a/target-i386/machine.c b/target-i386/machine.c
index ee5b949..962185e 100644
--- a/target-i386/machine.c
+++ b/target-i386/machine.c
@@ -1,4 +1,5 @@ 
 #include "qemu/osdep.h"
+#include "qemu-common.h"
 #include "hw/hw.h"
 #include "hw/boards.h"
 #include "hw/i386/pc.h"
diff --git a/target-lm32/cpu.h b/target-lm32/cpu.h
index f220fc0..c689608 100644
--- a/target-lm32/cpu.h
+++ b/target-lm32/cpu.h
@@ -24,7 +24,6 @@ 
 
 #define CPUArchState struct CPULM32State
 
-#include "qemu-common.h"
 #include "exec/cpu-defs.h"
 struct CPULM32State;
 typedef struct CPULM32State CPULM32State;
diff --git a/target-m68k/cpu.h b/target-m68k/cpu.h
index 48b4c87..f9f7f7d 100644
--- a/target-m68k/cpu.h
+++ b/target-m68k/cpu.h
@@ -24,7 +24,6 @@ 
 
 #define CPUArchState struct CPUM68KState
 
-#include "qemu-common.h"
 #include "exec/cpu-defs.h"
 
 #include "fpu/softfloat.h"
diff --git a/target-microblaze/cpu.h b/target-microblaze/cpu.h
index 2f7335e..b39f4cf 100644
--- a/target-microblaze/cpu.h
+++ b/target-microblaze/cpu.h
@@ -19,7 +19,6 @@ 
 #ifndef CPU_MICROBLAZE_H
 #define CPU_MICROBLAZE_H
 
-#include "qemu-common.h"
 
 #define TARGET_LONG_BITS 32
 
diff --git a/target-mips/cpu.h b/target-mips/cpu.h
index 1e2b070..7a65845 100644
--- a/target-mips/cpu.h
+++ b/target-mips/cpu.h
@@ -7,7 +7,6 @@ 
 
 #define CPUArchState struct CPUMIPSState
 
-#include "qemu-common.h"
 #include "mips-defs.h"
 #include "exec/cpu-defs.h"
 #include "fpu/softfloat.h"
diff --git a/target-moxie/cpu.h b/target-moxie/cpu.h
index 4ee2077..f8d23d2 100644
--- a/target-moxie/cpu.h
+++ b/target-moxie/cpu.h
@@ -19,7 +19,6 @@ 
 #ifndef _CPU_MOXIE_H
 #define _CPU_MOXIE_H
 
-#include "qemu-common.h"
 
 #define TARGET_LONG_BITS 32
 
diff --git a/target-openrisc/cpu.h b/target-openrisc/cpu.h
index 4b63f25..9f88ef7 100644
--- a/target-openrisc/cpu.h
+++ b/target-openrisc/cpu.h
@@ -27,7 +27,6 @@ 
 /* cpu_openrisc_map_address_* in CPUOpenRISCTLBContext need this decl.  */
 struct OpenRISCCPU;
 
-#include "qemu-common.h"
 #include "exec/cpu-defs.h"
 #include "fpu/softfloat.h"
 #include "qom/cpu.h"
diff --git a/target-openrisc/exception.h b/target-openrisc/exception.h
index 4b64430..490500e 100644
--- a/target-openrisc/exception.h
+++ b/target-openrisc/exception.h
@@ -21,7 +21,6 @@ 
 #define QEMU_OPENRISC_EXCP_H
 
 #include "cpu.h"
-#include "qemu-common.h"
 
 void QEMU_NORETURN raise_exception(OpenRISCCPU *cpu, uint32_t excp);
 
diff --git a/target-ppc/cpu-models.c b/target-ppc/cpu-models.c
index ed005d7..b65b504 100644
--- a/target-ppc/cpu-models.c
+++ b/target-ppc/cpu-models.c
@@ -25,6 +25,7 @@ 
  */
 
 #include "qemu/osdep.h"
+#include "qemu-common.h"
 #include "cpu.h"
 #include "cpu-models.h"
 
diff --git a/target-ppc/cpu.h b/target-ppc/cpu.h
index 2b10597..c79d76f 100644
--- a/target-ppc/cpu.h
+++ b/target-ppc/cpu.h
@@ -19,7 +19,6 @@ 
 #if !defined (__CPU_PPC_H__)
 #define __CPU_PPC_H__
 
-#include "qemu-common.h"
 
 //#define PPC_EMULATE_32BITS_HYPV
 
diff --git a/target-ppc/translate_init.c b/target-ppc/translate_init.c
index bd0cffc..2ae5b09 100644
--- a/target-ppc/translate_init.c
+++ b/target-ppc/translate_init.c
@@ -19,6 +19,7 @@ 
  */
 
 #include "qemu/osdep.h"
+#include "qemu-common.h"
 #include "disas/bfd.h"
 #include "exec/gdbstub.h"
 #include <sysemu/kvm.h>
diff --git a/target-s390x/cpu.h b/target-s390x/cpu.h
index 6d97c08..f2d36b6 100644
--- a/target-s390x/cpu.h
+++ b/target-s390x/cpu.h
@@ -22,7 +22,6 @@ 
 #ifndef CPU_S390X_H
 #define CPU_S390X_H
 
-#include "qemu-common.h"
 
 #define TARGET_LONG_BITS 64
 
diff --git a/target-s390x/helper.c b/target-s390x/helper.c
index 92abe7e..bc9f10d 100644
--- a/target-s390x/helper.c
+++ b/target-s390x/helper.c
@@ -19,6 +19,7 @@ 
  */
 
 #include "qemu/osdep.h"
+#include "qemu-common.h"
 #include "qapi/error.h"
 #include "cpu.h"
 #include "exec/gdbstub.h"
diff --git a/target-s390x/misc_helper.c b/target-s390x/misc_helper.c
index 71cbe34..a5c268b 100644
--- a/target-s390x/misc_helper.c
+++ b/target-s390x/misc_helper.c
@@ -19,6 +19,7 @@ 
  */
 
 #include "qemu/osdep.h"
+#include "qemu-common.h"
 #include "cpu.h"
 #include "exec/memory.h"
 #include "qemu/host-utils.h"
diff --git a/target-sh4/cpu.h b/target-sh4/cpu.h
index 3b23e96..44b6b08 100644
--- a/target-sh4/cpu.h
+++ b/target-sh4/cpu.h
@@ -19,7 +19,6 @@ 
 #ifndef _CPU_SH4_H
 #define _CPU_SH4_H
 
-#include "qemu-common.h"
 
 #define TARGET_LONG_BITS 32
 
diff --git a/target-sparc/cpu.c b/target-sparc/cpu.c
index fe4119e..58218db 100644
--- a/target-sparc/cpu.c
+++ b/target-sparc/cpu.c
@@ -18,9 +18,11 @@ 
  */
 
 #include "qemu/osdep.h"
+#include "qemu-common.h"
 #include "qapi/error.h"
 #include "cpu.h"
 #include "qemu/error-report.h"
+#include "qemu/module.h"
 
 //#define DEBUG_FEATURES
 
diff --git a/target-sparc/cpu.h b/target-sparc/cpu.h
index dc46122..cb4fd12 100644
--- a/target-sparc/cpu.h
+++ b/target-sparc/cpu.h
@@ -1,7 +1,6 @@ 
 #ifndef CPU_SPARC_H
 #define CPU_SPARC_H
 
-#include "qemu-common.h"
 #include "qemu/bswap.h"
 
 #define ALIGNED_ONLY
diff --git a/target-tilegx/cpu.h b/target-tilegx/cpu.h
index 022cad1..899aef8 100644
--- a/target-tilegx/cpu.h
+++ b/target-tilegx/cpu.h
@@ -19,7 +19,6 @@ 
 #ifndef CPU_TILEGX_H
 #define CPU_TILEGX_H
 
-#include "qemu-common.h"
 
 #define TARGET_LONG_BITS 64
 
diff --git a/target-tricore/cpu.h b/target-tricore/cpu.h
index 5fee376..a56db44 100644
--- a/target-tricore/cpu.h
+++ b/target-tricore/cpu.h
@@ -20,7 +20,6 @@ 
 #define __TRICORE_CPU_H__
 
 #include "tricore-defs.h"
-#include "qemu-common.h"
 #include "exec/cpu-defs.h"
 #include "fpu/softfloat.h"
 
diff --git a/target-unicore32/cpu.h b/target-unicore32/cpu.h
index 9c1fbf9..85acdd2 100644
--- a/target-unicore32/cpu.h
+++ b/target-unicore32/cpu.h
@@ -19,7 +19,6 @@ 
 
 #define CPUArchState                struct CPUUniCore32State
 
-#include "qemu-common.h"
 #include "exec/cpu-defs.h"
 #include "fpu/softfloat.h"
 
diff --git a/target-xtensa/cpu.h b/target-xtensa/cpu.h
index d0bd9da..118db74 100644
--- a/target-xtensa/cpu.h
+++ b/target-xtensa/cpu.h
@@ -33,7 +33,6 @@ 
 
 #define CPUArchState struct CPUXtensaState
 
-#include "qemu-common.h"
 #include "exec/cpu-defs.h"
 #include "fpu/softfloat.h"
 
diff --git a/tcg/tcg.h b/tcg/tcg.h
index b83f763..5a7d43f 100644
--- a/tcg/tcg.h
+++ b/tcg/tcg.h
@@ -25,7 +25,7 @@ 
 #ifndef TCG_H
 #define TCG_H
 
-#include "qemu-common.h"
+#include "cpu.h"
 #include "qemu/bitops.h"
 #include "tcg-target.h"
 
diff --git a/tests/crypto-tls-x509-helpers.h b/tests/crypto-tls-x509-helpers.h
index 356b49c..bad1e53 100644
--- a/tests/crypto-tls-x509-helpers.h
+++ b/tests/crypto-tls-x509-helpers.h
@@ -34,8 +34,6 @@ 
 #ifdef QCRYPTO_HAVE_TLS_TEST_SUPPORT
 # include <libtasn1.h>
 
-# include "qemu-common.h"
-
 /*
  * This contains parameter about how to generate
  * certificates.
diff --git a/tests/test-crypto-tlscredsx509.c b/tests/test-crypto-tlscredsx509.c
index af2f80e..a8a0ebd 100644
--- a/tests/test-crypto-tlscredsx509.c
+++ b/tests/test-crypto-tlscredsx509.c
@@ -23,6 +23,7 @@ 
 #include "crypto-tls-x509-helpers.h"
 #include "crypto/tlscredsx509.h"
 #include "qapi/error.h"
+#include "qemu/module.h"
 
 #ifdef QCRYPTO_HAVE_TLS_TEST_SUPPORT
 
diff --git a/tests/test-crypto-tlssession.c b/tests/test-crypto-tlssession.c
index 1a4a066..a5ce55d 100644
--- a/tests/test-crypto-tlssession.c
+++ b/tests/test-crypto-tlssession.c
@@ -25,6 +25,7 @@ 
 #include "crypto/tlssession.h"
 #include "qom/object_interfaces.h"
 #include "qapi/error.h"
+#include "qemu/module.h"
 #include "qemu/sockets.h"
 #include "qemu/acl.h"
 
diff --git a/tests/test-io-channel-buffer.c b/tests/test-io-channel-buffer.c
index 64722a2..c9cf623 100644
--- a/tests/test-io-channel-buffer.c
+++ b/tests/test-io-channel-buffer.c
@@ -21,7 +21,7 @@ 
 #include "qemu/osdep.h"
 #include "io/channel-buffer.h"
 #include "io-channel-helpers.h"
-
+#include "qemu/module.h"
 
 static void test_io_channel_buf(void)
 {
diff --git a/tests/test-io-channel-command.c b/tests/test-io-channel-command.c
index 1d1f461..bec9409 100644
--- a/tests/test-io-channel-command.c
+++ b/tests/test-io-channel-command.c
@@ -22,6 +22,7 @@ 
 #include "io/channel-command.h"
 #include "io-channel-helpers.h"
 #include "qapi/error.h"
+#include "qemu/module.h"
 
 #ifndef WIN32
 static void test_io_channel_command_fifo(bool async)
diff --git a/tests/test-io-channel-file.c b/tests/test-io-channel-file.c
index 6bfede6..a944298 100644
--- a/tests/test-io-channel-file.c
+++ b/tests/test-io-channel-file.c
@@ -23,6 +23,7 @@ 
 #include "io/channel-util.h"
 #include "io-channel-helpers.h"
 #include "qapi/error.h"
+#include "qemu/module.h"
 
 static void test_io_channel_file(void)
 {
diff --git a/tests/test-io-channel-socket.c b/tests/test-io-channel-socket.c
index d0664fb..1c1d52d 100644
--- a/tests/test-io-channel-socket.c
+++ b/tests/test-io-channel-socket.c
@@ -23,6 +23,7 @@ 
 #include "io/channel-util.h"
 #include "io-channel-helpers.h"
 #include "qapi/error.h"
+#include "qemu/module.h"
 
 static int check_bind(struct sockaddr *sa, socklen_t salen, bool *has_proto)
 {
diff --git a/tests/test-io-channel-tls.c b/tests/test-io-channel-tls.c
index 3c361a7..749c1b7 100644
--- a/tests/test-io-channel-tls.c
+++ b/tests/test-io-channel-tls.c
@@ -29,6 +29,7 @@ 
 #include "io-channel-helpers.h"
 #include "crypto/tlscredsx509.h"
 #include "qemu/acl.h"
+#include "qemu/module.h"
 #include "qom/object_interfaces.h"
 
 #ifdef QCRYPTO_HAVE_TLS_TEST_SUPPORT
diff --git a/tests/test-io-task.c b/tests/test-io-task.c
index 5a97750..beaea24 100644
--- a/tests/test-io-task.c
+++ b/tests/test-io-task.c
@@ -23,6 +23,7 @@ 
 
 #include "io/task.h"
 #include "qapi/error.h"
+#include "qemu/module.h"
 
 #define TYPE_DUMMY "qemu:dummy"
 
diff --git a/tests/vhost-user-test.c b/tests/vhost-user-test.c
index 6961596..efb0cf6 100644
--- a/tests/vhost-user-test.c
+++ b/tests/vhost-user-test.c
@@ -12,6 +12,7 @@ 
 #include <glib.h>
 
 #include "libqtest.h"
+#include "qemu/module.h"
 #include "qemu/option.h"
 #include "qemu/range.h"
 #include "sysemu/char.h"
diff --git a/trace/control.c b/trace/control.c
index 20d3370..d4ca9a6 100644
--- a/trace/control.c
+++ b/trace/control.c
@@ -8,6 +8,7 @@ 
  */
 
 #include "qemu/osdep.h"
+#include "qemu-common.h"
 #include "trace/control.h"
 #ifdef CONFIG_TRACE_SIMPLE
 #include "trace/simple.h"
diff --git a/trace/control.h b/trace/control.h
index e2ba6d4..5bd92f3 100644
--- a/trace/control.h
+++ b/trace/control.h
@@ -10,7 +10,6 @@ 
 #ifndef TRACE__CONTROL_H
 #define TRACE__CONTROL_H
 
-#include "qemu-common.h"
 #include "trace/generated-events.h"
 
 
diff --git a/ui/keymaps.c b/ui/keymaps.c
index 8899a0b..6b6901c 100644
--- a/ui/keymaps.c
+++ b/ui/keymaps.c
@@ -23,6 +23,7 @@ 
  */
 
 #include "qemu/osdep.h"
+#include "qemu-common.h"
 #include "keymaps.h"
 #include "sysemu/sysemu.h"
 
diff --git a/ui/keymaps.h b/ui/keymaps.h
index a7600d5..536632d 100644
--- a/ui/keymaps.h
+++ b/ui/keymaps.h
@@ -25,8 +25,6 @@ 
 #ifndef __QEMU_KEYMAPS_H__
 #define __QEMU_KEYMAPS_H__
 
-#include "qemu-common.h"
-
 typedef struct {
 	const char* name;
 	int keysym;
diff --git a/ui/vnc.c b/ui/vnc.c
index 729f630..674dace 100644
--- a/ui/vnc.c
+++ b/ui/vnc.c
@@ -25,6 +25,7 @@ 
  */
 
 #include "qemu/osdep.h"
+#include "qemu-common.h"
 #include "vnc.h"
 #include "vnc-jobs.h"
 #include "trace.h"
diff --git a/ui/vnc.h b/ui/vnc.h
index 81a3261..ab6e486 100644
--- a/ui/vnc.h
+++ b/ui/vnc.h
@@ -27,7 +27,6 @@ 
 #ifndef __QEMU_VNC_H
 #define __QEMU_VNC_H
 
-#include "qemu-common.h"
 #include "qemu/queue.h"
 #include "qemu/thread.h"
 #include "ui/console.h"
diff --git a/util/buffer.c b/util/buffer.c
index a6118bf..be58643 100644
--- a/util/buffer.c
+++ b/util/buffer.c
@@ -19,6 +19,7 @@ 
  */
 
 #include "qemu/osdep.h"
+#include "qemu-common.h"
 #include "qemu/buffer.h"
 #include "trace.h"
 
diff --git a/util/mmap-alloc.c b/util/mmap-alloc.c
index 0b4cc7f..a4ae464 100644
--- a/util/mmap-alloc.c
+++ b/util/mmap-alloc.c
@@ -9,9 +9,11 @@ 
  * This work is licensed under the terms of the GNU GPL, version 2 or
  * later.  See the COPYING file in the top-level directory.
  */
+
 #include "qemu/osdep.h"
 #include <qemu/mmap-alloc.h>
 #include <sys/mman.h>
+#include "qemu-common.h"
 
 #define HUGETLBFS_MAGIC       0x958458f6
 
diff --git a/util/oslib-posix.c b/util/oslib-posix.c
index dcc3c7e..15e66e9 100644
--- a/util/oslib-posix.c
+++ b/util/oslib-posix.c
@@ -39,7 +39,7 @@ 
 #endif
 
 #include "qemu/osdep.h"
-#include <termios.h>
+#include "qemu-common.h"
 #include <termios.h>
 
 #include <glib/gprintf.h>
diff --git a/util/qemu-sockets.c b/util/qemu-sockets.c
index d9cf1eb..58c06f3 100644
--- a/util/qemu-sockets.c
+++ b/util/qemu-sockets.c
@@ -15,8 +15,9 @@ 
  * Contributions after 2012-01-13 are licensed under the terms of the
  * GNU GPL, version 2 or (at your option) any later version.
  */
+
 #include "qemu/osdep.h"
-
+#include "qemu-common.h"
 #include "monitor/monitor.h"
 #include "qapi/error.h"
 #include "qemu/sockets.h"
diff --git a/vl.c b/vl.c
index 7a28982..5e8e4dc 100644
--- a/vl.c
+++ b/vl.c
@@ -52,6 +52,7 @@  int main(int argc, char **argv)
 
 #include <glib.h>
 
+#include "qemu-common.h"
 #include "qemu/error-report.h"
 #include "qemu/sockets.h"
 #include "hw/hw.h"