All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH for-2.7 00/49] NEED_CPU_H / cpu.h / hw/hw.h cleanups
@ 2016-04-08 20:28 Paolo Bonzini
  2016-04-08 20:28 ` [Qemu-devel] [PATCH 01/50] scripts: add script to build QEMU and analyze inclusions Paolo Bonzini
                   ` (51 more replies)
  0 siblings, 52 replies; 72+ messages in thread
From: Paolo Bonzini @ 2016-04-08 20:28 UTC (permalink / raw)
  To: qemu-devel; +Cc: armbru, peter.maydell

(CCs only on cover letter due to huge series).

I am sending this now because of vacation coming soon (yay!).
This series removes usage of NEED_CPU_H from several central
include files in QEMU, most notably hw/hw.h and qemu-common.h.
Definitions conditional on NEED_CPU_H remain only in disas/disas.h,
exec/gdbstub.h, exec/helper-head.h and exec/log.h.

The interesting patches are interspersed with other miscellaenous
cleanups that I won't really dwell on in the cover letter.  Most
of them are just making indirect inclusions explicit.

Patches 5 to 27 make sure that target-independent code can access
QOM objects for the CPU through an opaque type.  This is useful
because often target-independent code uses a target-specific header
file that happens to use pointers to ARMCPU* or similar.  The
target-independent code itself does not use the pointed-to object,
but the very presenece of the ARMCPU* name means that all users of
that header have to bring in cpu.h.  By providing the opaque type,
a much smaller API can be exposed to all these users in hw/.

Patches 34 to 37 remove NEED_CPU_H from hw/hw.h, exec/memory.h
and exec/cpu-common.h.

Patches 38 and 39 remove two nested inclusions from qemu-common.h.
This should make Markus's patch to remove unnecessary qemu-common.h
inclusions even more effective.

Patches 42 and 43 disentangle qemu-common.h and cpu.h, so that all
users of the latter have to be explicit.  This has the biggest
effect on reducing include pollution (the next offender is now
exec/cpu-common.h).

Patches 46 to 50 remove more nested inclusions, and especially:
1) the inclusion of the (TCG-specific) exec-all.h header from
cpu.h, so that non-TCG functions cannot anymore creep into
exec-all.h; 2) indirect qemu-common.h inclusion in hw/hw.h.

At the end, hw/hw.h includes 13 fewer headers indirectly compared
to before when NEED_CPU_H is not defined, and 27 fewer headers
when NEED_CPU_H is defined.  This was found with the script of
patch 1, which produces the following statistics:

Compiled 3979 files                         | After: 4006 (nmi.o now built per target)
3773 files include qemu-common.h            | After: 3702 (-71)
1658 files include hw/hw.h                  | After: 1589 (-69)
3101 files include cpu.h                    | After: 2337 (-764, -25%!)
3800 files include qapi-types.h             | After: 3811 (+11, mostly from nmi.c)
 844 files include generated-tracers.h      | After: 844
1270 files include qapi/error.h             | After: 1297 (+27, from nmi.c)
1996 files include block/aio.h              | After: 1647 (-349, -18%)
3544 files include qom/object.h             | After: 3514 (-30)
3451 files include exec/memory.h            | After: 3540 (+89, from indirect inclusions)
3840 files include fpu/softfloat.h          | After: 3701 (-139)
3783 files include qemu/bswap.h             | After: 3644 (-139)
                                            |
osdep.h:                                    | After: (adds exec/poison.h)
lines    bytes   files   source             | lines    bytes   files   source
174      4944    3       QEMU               | 226      5217    4       QEMU
17460    440677  157     total              | 17512    440950  158     total
                                            |
qemu-common.h:                              | After:
lines    bytes   files   source             | lines    bytes   files   source
7037     160007  14      QEMU               | 5919     132798  12      QEMU
24323    595740  168     total              | 23205    568531  166     total
                                            |
hw/hw.h:                                    | After:
lines    bytes   files   source             | lines    bytes   files   source
9714     228659  36      QEMU               | 8458     201740  24      QEMU
27052    665298  192     total              | 25796    638379  180     total
                                            |
target-i386/cpu.h:                          | After:
lines    bytes   files   source             | lines    bytes   files   source
11259    270041  41      QEMU               | 10981    263615  39      QEMU
28597    706680  197     total              | 28319    700254  195     total
                                            |
hw/hw.h + NEED_CPU_H:                       | After:
lines    bytes   files   source             | lines    bytes   files   source
12340    294661  50      QEMU               | 8407     201467  23      QEMU
29678    731300  206     total              | 25745    638106  179     total

The next objectives should be removing unnecessary inclusions from/of
qemu-common.h (or delete it altogether) and exec/cpu-common.h.

Paolo

Paolo Bonzini (50):
  scripts: add script to build QEMU and analyze inclusions
  include: move CPU-related definitions out of qemu-common.h
  log: do not use CONFIG_USER_ONLY
  cpu: make cpu-qom.h only include-able from cpu.h
  target-alpha: make cpu-qom.h not target specific
  target-arm: make cpu-qom.h not target specific
  target-cris: make cpu-qom.h not target specific
  target-i386: make cpu-qom.h not target specific
  target-lm32: make cpu-qom.h not target specific
  target-m68k: make cpu-qom.h not target specific
  target-microblaze: make cpu-qom.h not target specific
  target-mips: make cpu-qom.h not target specific
  target-ppc: do not use target_ulong in cpu-qom.h
  target-ppc: make cpu-qom.h not target specific
  target-s390x: make cpu-qom.h not target specific
  target-sh4: make cpu-qom.h not target specific
  target-sparc: make cpu-qom.h not target specific
  target-tricore: make cpu-qom.h not target specific
  target-unicore32: make cpu-qom.h not target specific
  target-xtensa: make cpu-qom.h not target specific
  arm: include cpu-qom.h in files that require ARMCPU
  m68k: include cpu-qom.h in files that require M68KCPU
  sh4: include cpu-qom.h in files that require SuperHCPU
  alpha: include cpu-qom.h in files that require AlphaCPU
  mips: use MIPSCPU instead of CPUMIPSState
  ppc: use PowerPCCPU instead of CPUPPCState
  arm: remove useless cpu.h inclusion
  explicitly include qom/cpu.h
  explicitly include hw/qdev-core.h
  explicitly include linux/kvm.h
  apic: move target-dependent definitions to cpu.h
  include: poison symbols in osdep.h
  hw: do not use VMSTATE_*TL
  hw: move CPU state serialization to migration/cpu.h
  hw: cannot include hw/hw.h from user emulation
  cpu: move endian-dependent load/store functions to cpu-all.h
  qemu-common: stop including qemu/bswap.h from qemu-common.h
  qemu-common: stop including qemu/host-utils.h from qemu-common.h
  gdbstub: remove includes from gdbstub-xml.c
  dma: do not depend on kvm_enabled()
  s390x: move stuff out of cpu.h
  acpi: do not use TARGET_PAGE_SIZE
  qemu-common: push cpu.h inclusion out of qemu-common.h
  arm: move arm_log_exception into .c file
  mips: move CP0 functions out of cpu.h
  hw: explicitly include qemu/log.h
  exec: extract exec/tb-context.h
  cpu: move exec-all.h inclusion out of cpu.h
  hw: remove pio_addr_t
  hw: clean up hw/hw.h includes

 arch_init.c                                 |   2 +
 audio/mixeng.c                              |   1 +
 audio/noaudio.c                             |   1 +
 audio/wavaudio.c                            |   2 +-
 block/bochs.c                               |   1 +
 block/cloop.c                               |   1 +
 block/parallels.c                           |   1 +
 block/qcow.c                                |   1 +
 block/qcow2-cluster.c                       |   1 +
 block/qcow2-refcount.c                      |   1 +
 block/qcow2-snapshot.c                      |   1 +
 block/qcow2.c                               |   1 +
 block/qed-table.c                           |   1 +
 block/qed.c                                 |   1 +
 block/vdi.c                                 |   1 +
 block/vhdx-endian.c                         |   1 +
 block/vhdx-log.c                            |   1 +
 block/vhdx.c                                |   1 +
 block/vmdk.c                                |   1 +
 block/vpc.c                                 |   1 +
 block/vvfat.c                               |   1 +
 bootdevice.c                                |   1 +
 bsd-user/main.c                             |   2 +
 bsd-user/qemu.h                             |   1 +
 contrib/ivshmem-server/ivshmem-server.c     |   1 +
 cpu-exec-common.c                           |   1 +
 cpu-exec.c                                  |   1 +
 cpus.c                                      |   4 +-
 cputlb.c                                    |   1 +
 crypto/afsplit.c                            |   1 +
 crypto/block-luks.c                         |   1 +
 device_tree.c                               |   1 +
 disas/tci.c                                 |   1 +
 exec.c                                      |  25 ++--
 gdbstub.c                                   |   3 +-
 hw/acpi/core.c                              |   6 +
 hw/acpi/nvdimm.c                            |  22 ++--
 hw/acpi/piix4.c                             |   1 +
 hw/alpha/alpha_sys.h                        |   1 +
 hw/alpha/pci.c                              |   1 -
 hw/arm/ast2400.c                            |   1 +
 hw/arm/collie.c                             |   1 +
 hw/arm/nseries.c                            |   3 +
 hw/arm/palmetto-bmc.c                       |   1 +
 hw/arm/pxa2xx_gpio.c                        |   2 +
 hw/arm/stellaris.c                          |   1 +
 hw/arm/stm32f205_soc.c                      |   1 -
 hw/arm/strongarm.c                          |   1 +
 hw/arm/strongarm.h                          |   1 +
 hw/arm/xlnx-ep108.c                         |   1 +
 hw/audio/pl041.c                            |   1 +
 hw/block/hd-geometry.c                      |   1 +
 hw/block/m25p80.c                           |   1 +
 hw/block/pflash_cfi01.c                     |   1 +
 hw/bt/hci-csr.c                             |   1 +
 hw/bt/l2cap.c                               |   1 +
 hw/bt/sdp.c                                 |   1 +
 hw/char/bcm2835_aux.c                       |   1 +
 hw/char/cadence_uart.c                      |   4 +
 hw/char/digic-uart.c                        |   1 +
 hw/char/imx_serial.c                        |   1 +
 hw/char/pl011.c                             |   1 +
 hw/char/stm32f2xx_usart.c                   |   1 +
 hw/core/Makefile.objs                       |   2 +-
 hw/core/nmi.c                               |   5 +
 hw/core/sysbus.c                            |   4 +-
 hw/cpu/a9mpcore.c                           |   1 +
 hw/display/bcm2835_fb.c                     |   1 +
 hw/display/cg3.c                            |   2 +
 hw/display/pl110.c                          |   1 +
 hw/display/tc6393xb.c                       |   1 +
 hw/display/virtio-gpu.c                     |   1 +
 hw/dma/bcm2835_dma.c                        |   1 +
 hw/dma/pl080.c                              |   1 +
 hw/dma/pl330.c                              |   1 +
 hw/dma/rc4030.c                             |   1 +
 hw/gpio/gpio_key.c                          |   1 +
 hw/gpio/imx_gpio.c                          |   1 +
 hw/gpio/pl061.c                             |   1 +
 hw/i2c/imx_i2c.c                            |   1 +
 hw/i2c/versatile_i2c.c                      |   1 +
 hw/i386/kvm/apic.c                          |   2 +
 hw/i386/kvm/clock.c                         |   1 +
 hw/i386/kvm/i8254.c                         |   1 +
 hw/i386/kvm/pci-assign.c                    |   1 +
 hw/i386/kvmvapic.c                          |   3 +
 hw/input/pl050.c                            |   1 +
 hw/intc/allwinner-a10-pic.c                 |   1 +
 hw/intc/apic.c                              |   2 +
 hw/intc/apic_common.c                       |   2 +
 hw/intc/arm_gic.c                           |   1 +
 hw/intc/arm_gic_kvm.c                       |   2 +
 hw/intc/arm_gicv2m.c                        |   2 +
 hw/intc/armv7m_nvic.c                       |   2 +
 hw/intc/bcm2835_ic.c                        |   1 +
 hw/intc/bcm2836_control.c                   |   1 +
 hw/intc/i8259.c                             |   1 +
 hw/intc/imx_avic.c                          |   1 +
 hw/intc/ioapic.c                            |   1 +
 hw/intc/openpic.c                           |   1 +
 hw/intc/openpic_kvm.c                       |   2 +
 hw/intc/pl190.c                             |   1 +
 hw/intc/s390_flic_kvm.c                     |   2 +
 hw/isa/lpc_ich9.c                           |   1 +
 hw/mips/cps.c                               |   7 +-
 hw/mips/cputimer.c                          |   4 +-
 hw/mips/mips_fulong2e.c                     |   4 +-
 hw/mips/mips_int.c                          |   3 +-
 hw/mips/mips_jazz.c                         |   4 +-
 hw/mips/mips_malta.c                        |   5 +-
 hw/mips/mips_mipssim.c                      |   4 +-
 hw/mips/mips_r4k.c                          |   4 +-
 hw/misc/arm11scu.c                          |   1 +
 hw/misc/arm_integrator_debug.c              |   1 +
 hw/misc/arm_l2x0.c                          |   1 +
 hw/misc/arm_sysctl.c                        |   1 +
 hw/misc/bcm2835_mbox.c                      |   1 +
 hw/misc/bcm2835_property.c                  |   1 +
 hw/misc/imx25_ccm.c                         |   1 +
 hw/misc/imx31_ccm.c                         |   1 +
 hw/misc/imx6_ccm.c                          |   1 +
 hw/misc/imx_ccm.c                           |   1 +
 hw/misc/macio/cuda.c                        |   1 +
 hw/misc/macio/mac_dbdma.c                   |   1 +
 hw/misc/mips_cmgcr.c                        |   1 +
 hw/misc/mips_cpc.c                          |   2 +
 hw/misc/mips_itu.c                          |   3 +
 hw/misc/stm32f2xx_syscfg.c                  |   1 +
 hw/misc/zynq-xadc.c                         |   1 +
 hw/misc/zynq_slcr.c                         |   1 +
 hw/net/allwinner_emac.c                     |   1 +
 hw/net/fsl_etsec/etsec.c                    |   1 +
 hw/net/fsl_etsec/rings.c                    |   2 +-
 hw/net/imx_fec.c                            |   1 +
 hw/net/lan9118.c                            |   1 +
 hw/net/spapr_llan.c                         |   9 +-
 hw/pci-host/apb.c                           |   1 +
 hw/pci-host/versatile.c                     |   1 +
 hw/ppc/e500plat.c                           |   1 +
 hw/ppc/ppc.c                                |  20 +--
 hw/ppc/ppc4xx_devs.c                        |   1 +
 hw/ppc/prep.c                               |   1 +
 hw/ppc/spapr.c                              |   1 +
 hw/ppc/spapr_hcall.c                        |   3 +
 hw/ppc/spapr_iommu.c                        |   1 +
 hw/ppc/spapr_rtas.c                         |   2 +
 hw/ppc/spapr_vio.c                          |   3 +-
 hw/ppc/virtex_ml507.c                       |   1 +
 hw/s390x/css.c                              |   4 +-
 hw/s390x/s390-skeys.c                       |   1 +
 hw/s390x/s390-virtio-ccw.c                  |   4 +-
 hw/s390x/virtio-ccw.c                       |   5 +-
 hw/s390x/virtio-ccw.h                       |   3 +-
 hw/sd/pl181.c                               |   1 +
 hw/sd/sd.c                                  |   1 +
 hw/sd/sdhci.c                               |   1 +
 hw/sh4/sh7750.c                             |   1 +
 hw/ssi/pl022.c                              |   1 +
 hw/timer/allwinner-a10-pit.c                |   1 +
 hw/timer/arm_timer.c                        |   1 +
 hw/timer/digic-timer.c                      |   1 +
 hw/timer/imx_epit.c                         |   1 +
 hw/timer/imx_gpt.c                          |   1 +
 hw/timer/pl031.c                            |   1 +
 hw/timer/stm32f2xx_timer.c                  |   1 +
 hw/vfio/common.c                            |   3 +
 hw/watchdog/wdt_diag288.c                   |   1 +
 hw/xtensa/pic_cpu.c                         |   1 +
 include/disas/disas.h                       |   2 +
 include/exec/cpu-all.h                      |  25 ++++
 include/exec/cpu-common.h                   |  14 --
 include/exec/cpu-defs.h                     |   1 +
 include/exec/exec-all.h                     |  56 +-------
 include/exec/gdbstub.h                      |   2 +
 include/exec/helper-head.h                  |  23 ++--
 include/exec/hwaddr.h                       |   2 +
 include/exec/ioport.h                       |  19 +--
 include/exec/memory.h                       |  17 ---
 include/exec/poison.h                       |   8 --
 include/exec/tb-context.h                   |  46 +++++++
 include/hw/acpi/acpi.h                      |   7 -
 include/hw/arm/arm.h                        |   2 +-
 include/hw/arm/digic.h                      |   1 -
 include/hw/arm/exynos4210.h                 |   1 +
 include/hw/arm/omap.h                       |   1 +
 include/hw/arm/pxa.h                        |   1 +
 include/hw/arm/virt-acpi-build.h            |   1 +
 include/hw/arm/virt.h                       |   1 +
 include/hw/hw.h                             |  60 +--------
 include/hw/i386/apic.h                      |   5 -
 include/hw/isa/isa.h                        |   2 +-
 include/hw/m68k/mcf.h                       |   2 +
 include/hw/mips/cpudevs.h                   |   7 +-
 include/hw/ppc/openpic.h                    |   3 +-
 include/hw/ppc/ppc.h                        |  24 ++--
 include/hw/ppc/spapr_vio.h                  |   2 +-
 {hw => include/hw}/s390x/css.h              |  31 ++++-
 {target-s390x => include/hw/s390x}/ioinst.h |  16 +--
 include/hw/sd/sd.h                          |   2 +
 include/hw/sh4/sh.h                         |   1 +
 include/hw/sysbus.h                         |   4 +-
 include/hw/xen/xen.h                        |   7 +-
 include/migration/cpu.h                     |  48 +++++++
 include/qemu-common.h                       |  32 -----
 include/qemu/log.h                          |  17 +--
 include/qemu/osdep.h                        |   2 +
 include/qemu/timer.h                        |   2 +-
 include/qom/cpu.h                           |  19 +++
 include/sysemu/cpus.h                       |  13 ++
 include/sysemu/dma.h                        |   5 +-
 include/sysemu/kvm.h                        |   1 +
 io/channel-websock.c                        |   1 +
 ioport.c                                    |  14 +-
 kvm-stub.c                                  |   1 -
 linux-user/main.c                           |   2 +
 linux-user/qemu.h                           |   1 +
 memory.c                                    |   2 +
 migration/ram.c                             |   2 +
 migration/savevm.c                          |   1 +
 monitor.c                                   |   4 +
 nbd/nbd-internal.h                          |   1 +
 page_cache.c                                |   1 +
 qemu-nbd.c                                  |   1 +
 qtest.c                                     |   2 +
 scripts/analyze-inclusions                  |  89 +++++++++++++
 scripts/create_config                       |   2 +-
 scripts/feature_to_c.sh                     |   3 -
 scripts/tracetool/format/tcg_helper_c.py    |   1 +
 slirp/slirp.h                               |   1 +
 stubs/cpu-get-icount.c                      |   1 +
 stubs/slirp.c                               |   1 +
 target-alpha/cpu-qom.h                      |  41 +-----
 target-alpha/cpu.c                          |   1 +
 target-alpha/cpu.h                          |  44 ++++++-
 target-alpha/fpu_helper.c                   |   1 +
 target-alpha/gdbstub.c                      |   1 +
 target-alpha/helper.c                       |   1 +
 target-alpha/int_helper.c                   |   1 +
 target-alpha/machine.c                      |   3 +
 target-alpha/mem_helper.c                   |   1 +
 target-alpha/sys_helper.c                   |   1 +
 target-alpha/translate.c                    |   1 +
 target-alpha/vax_helper.c                   |   1 +
 target-arm/arm_ldst.h                       |   1 +
 target-arm/cpu-qom.h                        | 178 +------------------------
 target-arm/cpu.c                            |   1 +
 target-arm/cpu.h                            | 181 +++++++++++++++++++++++++-
 target-arm/gdbstub.c                        |   1 +
 target-arm/gdbstub64.c                      |   1 +
 target-arm/helper-a64.c                     |   1 +
 target-arm/helper.c                         |  16 +++
 target-arm/internals.h                      |  15 ---
 target-arm/kvm-stub.c                       |   1 +
 target-arm/kvm32.c                          |   2 +-
 target-arm/kvm64.c                          |   2 +-
 target-arm/machine.c                        |   3 +
 target-arm/op_helper.c                      |   1 +
 target-arm/psci.c                           |   2 +-
 target-arm/translate-a64.c                  |   1 +
 target-arm/translate.c                      |   1 +
 target-cris/cpu-qom.h                       |  40 +-----
 target-cris/cpu.c                           |   1 +
 target-cris/cpu.h                           |  43 +++++-
 target-cris/gdbstub.c                       |   1 +
 target-cris/helper.c                        |   1 +
 target-cris/machine.c                       |   3 +
 target-cris/mmu.c                           |   1 +
 target-cris/op_helper.c                     |   1 +
 target-cris/translate.c                     |   1 +
 target-i386/bpt_helper.c                    |   1 +
 target-i386/cpu-qom.h                       |  98 +-------------
 target-i386/cpu.c                           |   3 +-
 target-i386/cpu.h                           | 107 ++++++++++++++-
 target-i386/excp_helper.c                   |   1 +
 target-i386/fpu_helper.c                    |   1 +
 target-i386/gdbstub.c                       |   1 +
 target-i386/helper.c                        |   1 +
 target-i386/int_helper.c                    |   1 +
 target-i386/kvm-stub.c                      |   1 +
 target-i386/kvm.c                           |   2 +-
 target-i386/machine.c                       |   6 +
 target-i386/mem_helper.c                    |   1 +
 target-i386/misc_helper.c                   |   1 +
 target-i386/mpx_helper.c                    |   1 +
 target-i386/seg_helper.c                    |   1 +
 target-i386/svm_helper.c                    |   1 +
 target-i386/translate.c                     |   1 +
 target-lm32/cpu-qom.h                       |  42 +-----
 target-lm32/cpu.c                           |   1 +
 target-lm32/cpu.h                           |  46 ++++++-
 target-lm32/gdbstub.c                       |   1 +
 target-lm32/helper.c                        |   1 +
 target-lm32/machine.c                       |   3 +
 target-lm32/op_helper.c                     |   1 +
 target-lm32/translate.c                     |   1 +
 target-m68k/cpu-qom.h                       |  34 +----
 target-m68k/cpu.c                           |   1 +
 target-m68k/cpu.h                           |  38 +++++-
 target-m68k/gdbstub.c                       |   1 +
 target-m68k/helper.c                        |   1 +
 target-m68k/m68k-semi.c                     |   1 +
 target-m68k/op_helper.c                     |   1 +
 target-m68k/translate.c                     |   1 +
 target-microblaze/cpu-qom.h                 |  44 +------
 target-microblaze/cpu.c                     |   1 +
 target-microblaze/cpu.h                     |  47 ++++++-
 target-microblaze/gdbstub.c                 |   1 +
 target-microblaze/helper.c                  |   1 +
 target-microblaze/mmu.c                     |   1 +
 target-microblaze/op_helper.c               |   1 +
 target-microblaze/translate.c               |   1 +
 target-mips/cpu-qom.h                       |  37 +-----
 target-mips/cpu.c                           |   1 +
 target-mips/cpu.h                           | 171 ++++++------------------
 target-mips/gdbstub.c                       |   1 +
 target-mips/helper.c                        | 126 ++++++++++++++++++
 target-mips/kvm.c                           |   2 +-
 target-mips/machine.c                       |   4 +-
 target-mips/mips-semi.c                     |   1 +
 target-mips/msa_helper.c                    |   1 +
 target-mips/op_helper.c                     |   1 +
 target-mips/translate.c                     |   1 +
 target-moxie/cpu.c                          |   1 +
 target-moxie/cpu.h                          |   1 -
 target-moxie/machine.c                      |   3 +
 target-openrisc/cpu.c                       |   1 +
 target-openrisc/cpu.h                       |   2 -
 target-openrisc/exception.c                 |   1 +
 target-openrisc/gdbstub.c                   |   1 +
 target-openrisc/interrupt.c                 |   1 +
 target-openrisc/interrupt_helper.c          |   1 +
 target-openrisc/machine.c                   |   3 +
 target-openrisc/mmu.c                       |   1 +
 target-openrisc/mmu_helper.c                |   1 +
 target-openrisc/sys_helper.c                |   1 +
 target-ppc/cpu-qom.h                        | 165 +++++++++++++++--------
 target-ppc/cpu.h                            | 166 ++++++++---------------
 target-ppc/excp_helper.c                    |   1 +
 target-ppc/gdbstub.c                        |   1 +
 target-ppc/int_helper.c                     |   1 +
 target-ppc/kvm-stub.c                       |   1 +
 target-ppc/kvm.c                            |   2 +-
 target-ppc/machine.c                        |   5 +
 target-ppc/mem_helper.c                     |   2 +
 target-ppc/misc_helper.c                    |   1 +
 target-ppc/mmu-hash32.c                     |   3 +-
 target-ppc/mmu-hash32.h                     |   2 +-
 target-ppc/mmu-hash64.c                     |   3 +-
 target-ppc/mmu-hash64.h                     |   2 +-
 target-ppc/mmu_helper.c                     |   1 +
 target-ppc/timebase_helper.c                |   1 +
 target-ppc/translate.c                      |   1 +
 target-ppc/translate_init.c                 |  92 ++++++-------
 target-s390x/cc_helper.c                    |   1 +
 target-s390x/cpu-qom.h                      |  46 +------
 target-s390x/cpu.c                          |   4 +-
 target-s390x/cpu.h                          | 166 ++++++++++-------------
 target-s390x/fpu_helper.c                   |   1 +
 target-s390x/gdbstub.c                      |   2 +
 target-s390x/helper.c                       |   2 +
 target-s390x/int_helper.c                   |   1 +
 target-s390x/interrupt.c                    |  64 +++++++++
 target-s390x/ioinst.c                       |   2 +-
 target-s390x/kvm.c                          |   2 +-
 target-s390x/mem_helper.c                   |   4 +
 target-s390x/misc_helper.c                  |   3 +-
 target-s390x/translate.c                    |   1 +
 target-sh4/cpu-qom.h                        |  31 +----
 target-sh4/cpu.c                            |   1 +
 target-sh4/cpu.h                            |  34 ++++-
 target-sh4/gdbstub.c                        |   1 +
 target-sh4/helper.c                         |   1 +
 target-sh4/op_helper.c                      |   1 +
 target-sh4/translate.c                      |   1 +
 target-sparc/cpu-qom.h                      |  38 +-----
 target-sparc/cpu.c                          |   1 +
 target-sparc/cpu.h                          |  40 +++++-
 target-sparc/gdbstub.c                      |   1 +
 target-sparc/helper.c                       |   1 +
 target-sparc/ldst_helper.c                  |   1 +
 target-sparc/machine.c                      |   6 +
 target-sparc/mmu_helper.c                   |   1 +
 target-sparc/translate.c                    |   1 +
 target-tilegx/cpu.c                         |   1 +
 target-tilegx/cpu.h                         |   2 -
 target-tilegx/helper.c                      |   1 +
 target-tilegx/translate.c                   |   1 +
 target-tricore/cpu-qom.h                    |  28 +---
 target-tricore/cpu.c                        |   1 +
 target-tricore/cpu.h                        |  32 ++++-
 target-tricore/helper.c                     |   1 +
 target-tricore/op_helper.c                  |   1 +
 target-tricore/translate.c                  |   1 +
 target-unicore32/cpu-qom.h                  |  30 +----
 target-unicore32/cpu.c                      |   1 +
 target-unicore32/cpu.h                      |  32 ++++-
 target-unicore32/helper.c                   |   1 +
 target-unicore32/op_helper.c                |   1 +
 target-unicore32/softmmu.c                  |   1 +
 target-unicore32/translate.c                |   1 +
 target-xtensa/cpu-qom.h                     | 194 ++++++++++++++++++++++-----
 target-xtensa/cpu.c                         |   1 +
 target-xtensa/cpu.h                         | 195 +++++-----------------------
 target-xtensa/gdbstub.c                     |   2 +
 target-xtensa/op_helper.c                   |   1 +
 target-xtensa/translate.c                   |   1 +
 tcg/optimize.c                              |   3 +-
 tcg/tcg-common.c                            |   2 +
 tcg/tcg-op.c                                |   3 +
 tcg/tcg.c                                   |   5 +
 tcg/tcg.h                                   |  23 ++++
 tests/ide-test.c                            |   1 +
 tests/libqos/malloc.c                       |   1 +
 translate-all.c                             |   1 +
 translate-common.c                          |   1 +
 ui/vnc-ws.c                                 |   1 +
 user-exec.c                                 |   1 +
 util/buffer.c                               |   1 +
 util/log.c                                  |  12 +-
 vl.c                                        |   2 +
 xen-hvm.c                                   |   8 +-
 421 files changed, 2214 insertions(+), 1745 deletions(-)
 create mode 100644 include/exec/tb-context.h
 rename {hw => include/hw}/s390x/css.h (76%)
 rename {target-s390x => include/hw/s390x}/ioinst.h (87%)
 create mode 100644 include/migration/cpu.h
 create mode 100644 scripts/analyze-inclusions

-- 
1.8.3.1

^ permalink raw reply	[flat|nested] 72+ messages in thread

* [Qemu-devel] [PATCH 01/50] scripts: add script to build QEMU and analyze inclusions
  2016-04-08 20:28 [Qemu-devel] [PATCH for-2.7 00/49] NEED_CPU_H / cpu.h / hw/hw.h cleanups Paolo Bonzini
@ 2016-04-08 20:28 ` Paolo Bonzini
  2016-04-18 13:10   ` Markus Armbruster
  2016-04-20 19:47   ` Alex Bennée
  2016-04-08 20:28 ` [Qemu-devel] [PATCH 02/50] include: move CPU-related definitions out of qemu-common.h Paolo Bonzini
                   ` (50 subsequent siblings)
  51 siblings, 2 replies; 72+ messages in thread
From: Paolo Bonzini @ 2016-04-08 20:28 UTC (permalink / raw)
  To: qemu-devel

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 scripts/analyze-inclusions | 89 ++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 89 insertions(+)
 create mode 100644 scripts/analyze-inclusions

diff --git a/scripts/analyze-inclusions b/scripts/analyze-inclusions
new file mode 100644
index 0000000..e241bd4
--- /dev/null
+++ b/scripts/analyze-inclusions
@@ -0,0 +1,89 @@
+#! /bin/sh
+#
+# Copyright (C) 2016 Red Hat, Inc.
+#
+# Author: Paolo Bonzini <pbonzini@redhat.com>
+#
+# Print statistics about header file inclusions.
+# The script configures and builds QEMU itself in a "+build"
+# subdirectory which is left around when the script exits.
+# To run the statistics on a pre-existing "+build" directory,
+# pass "--no-build" as the first argument on the command line.
+# Any other command line is passed directly to "make" (so
+# you can for example pass a "-j" argument suitable for your
+# system).
+#
+# Inspired by a post by Markus Armbruster.
+
+mkdir -p +build
+cd +build
+if test "x$1" != "x--no-build"; then
+  test -f Makefile && make distclean
+  ../configure
+  make "$@"
+fi
+
+QEMU_CFLAGS=$(sed -n s/^QEMU_CFLAGS=//p config-host.mak)
+QEMU_INCLUDES=$(sed -n s/^QEMU_INCLUDES=//p config-host.mak | \
+    sed 's/$(SRC_PATH)/../g' )
+CFLAGS=$(sed -n s/^CFLAGS=//p config-host.mak)
+
+grep_include() {
+  find . -name "*.d" | xargs grep -l "$@" | wc -l
+}
+
+echo Found $(find . -name "*.d" | wc -l) object files
+echo $(grep_include -F 'include/qemu-common.h') files include qemu-common.h
+echo $(grep_include -F 'hw/hw.h') files include hw/hw.h
+echo $(grep_include 'target-[a-z0-9]*/cpu\.h') files include cpu.h
+echo $(grep_include -F 'qapi-types.h') files include qapi-types.h
+echo $(grep_include -F 'trace/generated-tracers.h') files include generated-tracers.h
+echo $(grep_include -F 'qapi/error.h') files include qapi/error.h
+echo $(grep_include -F 'qom/object.h') files include qom/object.h
+echo $(grep_include -F 'block/aio.h') files include block/aio.h
+echo $(grep_include -F 'exec/memory.h') files include exec/memory.h
+echo $(grep_include -F 'fpu/softfloat.h') files include fpu/softfloat.h
+echo $(grep_include -F 'qemu/bswap.h') files include qemu/bswap.h
+echo
+
+awk1='
+    /^# / { file = $3;next }
+    NR>1 { bytes[file]+=length; lines[file]++ }
+    END { for(i in lines) print i,lines[i],bytes[i] }'
+
+awk2='
+    {tot_l+=$2;tot_b+=$3;tot_f++}
+    /\/usr.*\/glib/ {glib_l+=$2;glib_b+=$3;glib_f++;next}
+    /\/usr/ {sys_l+=$2;sys_b+=$3;sys_f++;next}
+    {qemu_l+=$2;qemu_b+=$3;qemu_f++;next}
+    END {
+      printf "%s\t %s\t %s\t %s\n", "lines", "bytes", "files", "source"
+      printf "%s\t %s\t %s\t %s\n", qemu_l, qemu_b, qemu_f, "QEMU"
+      printf "%s\t %s\t %s\t %s\n", sys_l, sys_b, sys_f, "system"
+      printf "%s\t %s\t %s\t %s\n", glib_l, glib_b, glib_f, "glib"
+      printf "%s\t %s\t %s\t %s\n", tot_l, tot_b, tot_f, "total"
+    }'
+
+analyze() {
+  cc $QEMU_CFLAGS $QEMU_INCLUDES $CFLAGS  -E -o - "$@" | \
+    awk "$awk1" | awk "$awk2"
+  echo
+}
+
+echo osdep.h:
+analyze ../include/qemu/osdep.h
+
+echo qemu-common.h:
+analyze  -include ../include/qemu/osdep.h ../include/qemu-common.h
+
+echo hw/hw.h:
+analyze -include ../include/qemu/osdep.h ../include/hw/hw.h
+
+echo trace/generated-tracers.h:
+analyze -include ../include/qemu/osdep.h trace/generated-tracers.h
+
+echo target-i386/cpu.h:
+analyze -DNEED_CPU_H -I../target-i386 -Ii386-softmmu -include ../include/qemu/osdep.h ../target-i386/cpu.h
+
+echo hw/hw.h + NEED_CPU_H:
+analyze -DNEED_CPU_H -I../target-i386 -Ii386-softmmu -include ../include/qemu/osdep.h ../include/hw/hw.h
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 72+ messages in thread

* [Qemu-devel] [PATCH 02/50] include: move CPU-related definitions out of qemu-common.h
  2016-04-08 20:28 [Qemu-devel] [PATCH for-2.7 00/49] NEED_CPU_H / cpu.h / hw/hw.h cleanups Paolo Bonzini
  2016-04-08 20:28 ` [Qemu-devel] [PATCH 01/50] scripts: add script to build QEMU and analyze inclusions Paolo Bonzini
@ 2016-04-08 20:28 ` Paolo Bonzini
  2016-04-21  7:53   ` Alex Bennée
  2016-04-08 20:28 ` [Qemu-devel] [PATCH 03/50] log: do not use CONFIG_USER_ONLY Paolo Bonzini
                   ` (49 subsequent siblings)
  51 siblings, 1 reply; 72+ messages in thread
From: Paolo Bonzini @ 2016-04-08 20:28 UTC (permalink / raw)
  To: qemu-devel

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 include/qemu-common.h  | 24 ------------------------
 include/qemu/timer.h   |  1 +
 include/qom/cpu.h      |  9 +++++++++
 include/sysemu/cpus.h  | 13 +++++++++++++
 stubs/cpu-get-icount.c |  1 +
 translate-common.c     |  1 +
 vl.c                   |  1 +
 7 files changed, 26 insertions(+), 24 deletions(-)

diff --git a/include/qemu-common.h b/include/qemu-common.h
index 163bcbb..f0d74076 100644
--- a/include/qemu-common.h
+++ b/include/qemu-common.h
@@ -23,17 +23,6 @@
 #include "qemu/option.h"
 #include "qemu/host-utils.h"
 
-void cpu_ticks_init(void);
-
-/* icount */
-void configure_icount(QemuOpts *opts, Error **errp);
-extern int use_icount;
-extern int icount_align_option;
-/* drift information for info jit command */
-extern int64_t max_delay;
-extern int64_t max_advance;
-void dump_drift_info(FILE *f, fprintf_function cpu_fprintf);
-
 #include "qemu/bswap.h"
 
 /* FIXME: Remove NEED_CPU_H.  */
@@ -100,19 +89,6 @@ bool tcg_enabled(void);
 
 void cpu_exec_init_all(void);
 
-/* Unblock cpu */
-void qemu_cpu_kick_self(void);
-
-/* work queue */
-struct qemu_work_item {
-    struct qemu_work_item *next;
-    void (*func)(void *data);
-    void *data;
-    int done;
-    bool free;
-};
-
-
 /**
  * Sends a (part of) iovec down a socket, yielding when the socket is full, or
  * Receives data into a (part of) iovec from a socket,
diff --git a/include/qemu/timer.h b/include/qemu/timer.h
index 471969a..309f3d0 100644
--- a/include/qemu/timer.h
+++ b/include/qemu/timer.h
@@ -4,6 +4,7 @@
 #include "qemu-common.h"
 #include "qemu/notify.h"
 #include "qemu/host-utils.h"
+#include "sysemu/cpus.h"
 
 #define NANOSECONDS_PER_SECOND 1000000000LL
 
diff --git a/include/qom/cpu.h b/include/qom/cpu.h
index b7a10f7..ab38ce1 100644
--- a/include/qom/cpu.h
+++ b/include/qom/cpu.h
@@ -222,6 +222,15 @@ struct kvm_run;
 #define TB_JMP_CACHE_BITS 12
 #define TB_JMP_CACHE_SIZE (1 << TB_JMP_CACHE_BITS)
 
+/* work queue */
+struct qemu_work_item {
+    struct qemu_work_item *next;
+    void (*func)(void *data);
+    void *data;
+    int done;
+    bool free;
+};
+
 /**
  * CPUState:
  * @cpu_index: CPU index (informative).
diff --git a/include/sysemu/cpus.h b/include/sysemu/cpus.h
index 3d1e5ba..fe992a8 100644
--- a/include/sysemu/cpus.h
+++ b/include/sysemu/cpus.h
@@ -7,6 +7,19 @@ void qemu_init_cpu_loop(void);
 void resume_all_vcpus(void);
 void pause_all_vcpus(void);
 void cpu_stop_current(void);
+void cpu_ticks_init(void);
+
+void configure_icount(QemuOpts *opts, Error **errp);
+extern int use_icount;
+extern int icount_align_option;
+
+/* drift information for info jit command */
+extern int64_t max_delay;
+extern int64_t max_advance;
+void dump_drift_info(FILE *f, fprintf_function cpu_fprintf);
+
+/* Unblock cpu */
+void qemu_cpu_kick_self(void);
 
 void cpu_synchronize_all_states(void);
 void cpu_synchronize_all_post_reset(void);
diff --git a/stubs/cpu-get-icount.c b/stubs/cpu-get-icount.c
index 3a6f2ab..2e8b63b 100644
--- a/stubs/cpu-get-icount.c
+++ b/stubs/cpu-get-icount.c
@@ -1,6 +1,7 @@
 #include "qemu/osdep.h"
 #include "qemu-common.h"
 #include "qemu/timer.h"
+#include "sysemu/cpus.h"
 
 int use_icount;
 
diff --git a/translate-common.c b/translate-common.c
index ffbfe85..5e989cd 100644
--- a/translate-common.c
+++ b/translate-common.c
@@ -20,6 +20,7 @@
 #include "qemu/osdep.h"
 #include "qemu-common.h"
 #include "qom/cpu.h"
+#include "sysemu/cpus.h"
 
 uintptr_t qemu_real_host_page_size;
 intptr_t qemu_real_host_page_mask;
diff --git a/vl.c b/vl.c
index 3629336..b83d275 100644
--- a/vl.c
+++ b/vl.c
@@ -87,6 +87,7 @@ int main(int argc, char **argv)
 #include "sysemu/dma.h"
 #include "audio/audio.h"
 #include "migration/migration.h"
+#include "sysemu/cpus.h"
 #include "sysemu/kvm.h"
 #include "qapi/qmp/qjson.h"
 #include "qemu/option.h"
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 72+ messages in thread

* [Qemu-devel] [PATCH 03/50] log: do not use CONFIG_USER_ONLY
  2016-04-08 20:28 [Qemu-devel] [PATCH for-2.7 00/49] NEED_CPU_H / cpu.h / hw/hw.h cleanups Paolo Bonzini
  2016-04-08 20:28 ` [Qemu-devel] [PATCH 01/50] scripts: add script to build QEMU and analyze inclusions Paolo Bonzini
  2016-04-08 20:28 ` [Qemu-devel] [PATCH 02/50] include: move CPU-related definitions out of qemu-common.h Paolo Bonzini
@ 2016-04-08 20:28 ` Paolo Bonzini
  2016-04-21 10:20   ` Alex Bennée
  2016-04-08 20:28 ` [Qemu-devel] [PATCH 04/50] cpu: make cpu-qom.h only include-able from cpu.h Paolo Bonzini
                   ` (48 subsequent siblings)
  51 siblings, 1 reply; 72+ messages in thread
From: Paolo Bonzini @ 2016-04-08 20:28 UTC (permalink / raw)
  To: qemu-devel

This decouples logging further from config-target.h

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 bsd-user/main.c    |  1 +
 include/qemu/log.h | 17 ++---------------
 linux-user/main.c  |  1 +
 util/log.c         | 12 ++++++++++--
 4 files changed, 14 insertions(+), 17 deletions(-)

diff --git a/bsd-user/main.c b/bsd-user/main.c
index 27854c1..058eaca 100644
--- a/bsd-user/main.c
+++ b/bsd-user/main.c
@@ -849,6 +849,7 @@ int main(int argc, char **argv)
     }
 
     /* init debug */
+    qemu_log_needs_buffers();
     qemu_set_log_filename(log_file);
     if (log_mask) {
         int mask;
diff --git a/include/qemu/log.h b/include/qemu/log.h
index c52f136..234fa81 100644
--- a/include/qemu/log.h
+++ b/include/qemu/log.h
@@ -104,21 +104,8 @@ typedef struct QEMULogItem {
 
 extern const QEMULogItem qemu_log_items[];
 
-/* This is the function that actually does the work of
- * changing the log level; it should only be accessed via
- * the qemu_set_log() wrapper.
- */
-void do_qemu_set_log(int log_flags, bool use_own_buffers);
-
-static inline void qemu_set_log(int log_flags)
-{
-#ifdef CONFIG_USER_ONLY
-    do_qemu_set_log(log_flags, true);
-#else
-    do_qemu_set_log(log_flags, false);
-#endif
-}
-
+void qemu_set_log(int log_flags);
+void qemu_log_needs_buffers(void);
 void qemu_set_log_filename(const char *filename);
 void qemu_set_dfilter_ranges(const char *ranges);
 bool qemu_log_in_addr_range(uint64_t addr);
diff --git a/linux-user/main.c b/linux-user/main.c
index 5f3ec97..2b7fa9c 100644
--- a/linux-user/main.c
+++ b/linux-user/main.c
@@ -3760,6 +3760,7 @@ static void handle_arg_log(const char *arg)
         qemu_print_log_usage(stdout);
         exit(EXIT_FAILURE);
     }
+    qemu_log_needs_buffers();
     qemu_set_log(mask);
 }
 
diff --git a/util/log.c b/util/log.c
index 1857730..5ad72c1 100644
--- a/util/log.c
+++ b/util/log.c
@@ -42,8 +42,10 @@ void qemu_log(const char *fmt, ...)
     va_end(ap);
 }
 
+static bool log_uses_own_buffers;
+
 /* enable or disable low levels log */
-void do_qemu_set_log(int log_flags, bool use_own_buffers)
+void qemu_set_log(int log_flags)
 {
     qemu_loglevel = log_flags;
 #ifdef CONFIG_TRACE_LOG
@@ -70,7 +72,7 @@ void do_qemu_set_log(int log_flags, bool use_own_buffers)
             qemu_logfile = stderr;
         }
         /* must avoid mmap() usage of glibc by setting a buffer "by hand" */
-        if (use_own_buffers) {
+        if (log_uses_own_buffers) {
             static char logfile_buf[4096];
 
             setvbuf(qemu_logfile, logfile_buf, _IOLBF, sizeof(logfile_buf));
@@ -89,6 +91,12 @@ void do_qemu_set_log(int log_flags, bool use_own_buffers)
         qemu_log_close();
     }
 }
+
+void qemu_log_needs_buffers(void)
+{
+    log_uses_own_buffers = true;
+}
+
 /*
  * Allow the user to include %d in their logfile which will be
  * substituted with the current PID. This is useful for debugging many
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 72+ messages in thread

* [Qemu-devel] [PATCH 04/50] cpu: make cpu-qom.h only include-able from cpu.h
  2016-04-08 20:28 [Qemu-devel] [PATCH for-2.7 00/49] NEED_CPU_H / cpu.h / hw/hw.h cleanups Paolo Bonzini
                   ` (2 preceding siblings ...)
  2016-04-08 20:28 ` [Qemu-devel] [PATCH 03/50] log: do not use CONFIG_USER_ONLY Paolo Bonzini
@ 2016-04-08 20:28 ` Paolo Bonzini
  2016-04-21 10:26   ` Alex Bennée
  2016-04-08 20:28 ` [Qemu-devel] [PATCH 05/50] target-alpha: make cpu-qom.h not target specific Paolo Bonzini
                   ` (47 subsequent siblings)
  51 siblings, 1 reply; 72+ messages in thread
From: Paolo Bonzini @ 2016-04-08 20:28 UTC (permalink / raw)
  To: qemu-devel

Make cpu-qom.h so that it is only included from cpu.h.  Then there
is no need for it to include cpu.h again.

Later we will make cpu-qom.h target independent and we will _want_
to include it from elsewhere, but for now reduce the number of cases
to handle.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 target-alpha/cpu-qom.h     | 1 -
 target-arm/psci.c          | 1 -
 target-i386/cpu-qom.h      | 1 -
 target-lm32/cpu-qom.h      | 1 -
 target-ppc/cpu-qom.h       | 1 -
 target-s390x/cpu-qom.h     | 1 -
 target-sparc/cpu-qom.h     | 1 -
 target-unicore32/cpu-qom.h | 1 -
 target-xtensa/cpu-qom.h    | 1 -
 9 files changed, 9 deletions(-)

diff --git a/target-alpha/cpu-qom.h b/target-alpha/cpu-qom.h
index b01c6c8..cf5264a 100644
--- a/target-alpha/cpu-qom.h
+++ b/target-alpha/cpu-qom.h
@@ -21,7 +21,6 @@
 #define QEMU_ALPHA_CPU_QOM_H
 
 #include "qom/cpu.h"
-#include "cpu.h"
 
 #define TYPE_ALPHA_CPU "alpha-cpu"
 
diff --git a/target-arm/psci.c b/target-arm/psci.c
index c55487f..2b624b9 100644
--- a/target-arm/psci.c
+++ b/target-arm/psci.c
@@ -17,7 +17,6 @@
  */
 #include "qemu/osdep.h"
 #include <cpu.h>
-#include <cpu-qom.h>
 #include <exec/helper-proto.h>
 #include <kvm-consts.h>
 #include <sysemu/sysemu.h>
diff --git a/target-i386/cpu-qom.h b/target-i386/cpu-qom.h
index cb75017..2ca7b9e 100644
--- a/target-i386/cpu-qom.h
+++ b/target-i386/cpu-qom.h
@@ -21,7 +21,6 @@
 #define QEMU_I386_CPU_QOM_H
 
 #include "qom/cpu.h"
-#include "cpu.h"
 #include "qemu/notify.h"
 
 #ifdef TARGET_X86_64
diff --git a/target-lm32/cpu-qom.h b/target-lm32/cpu-qom.h
index 77bc7b2..54989e4 100644
--- a/target-lm32/cpu-qom.h
+++ b/target-lm32/cpu-qom.h
@@ -21,7 +21,6 @@
 #define QEMU_LM32_CPU_QOM_H
 
 #include "qom/cpu.h"
-#include "cpu.h"
 
 #define TYPE_LM32_CPU "lm32-cpu"
 
diff --git a/target-ppc/cpu-qom.h b/target-ppc/cpu-qom.h
index 7d5e2b3..eb822a3 100644
--- a/target-ppc/cpu-qom.h
+++ b/target-ppc/cpu-qom.h
@@ -21,7 +21,6 @@
 #define QEMU_PPC_CPU_QOM_H
 
 #include "qom/cpu.h"
-#include "cpu.h"
 
 #ifdef TARGET_PPC64
 #define TYPE_POWERPC_CPU "powerpc64-cpu"
diff --git a/target-s390x/cpu-qom.h b/target-s390x/cpu-qom.h
index 1c90933..681e370 100644
--- a/target-s390x/cpu-qom.h
+++ b/target-s390x/cpu-qom.h
@@ -21,7 +21,6 @@
 #define QEMU_S390_CPU_QOM_H
 
 #include "qom/cpu.h"
-#include "cpu.h"
 
 #define TYPE_S390_CPU "s390-cpu"
 
diff --git a/target-sparc/cpu-qom.h b/target-sparc/cpu-qom.h
index 5096b10..174dfd3 100644
--- a/target-sparc/cpu-qom.h
+++ b/target-sparc/cpu-qom.h
@@ -21,7 +21,6 @@
 #define QEMU_SPARC_CPU_QOM_H
 
 #include "qom/cpu.h"
-#include "cpu.h"
 
 #ifdef TARGET_SPARC64
 #define TYPE_SPARC_CPU "sparc64-cpu"
diff --git a/target-unicore32/cpu-qom.h b/target-unicore32/cpu-qom.h
index ea65b83..e554f1f 100644
--- a/target-unicore32/cpu-qom.h
+++ b/target-unicore32/cpu-qom.h
@@ -12,7 +12,6 @@
 #define QEMU_UC32_CPU_QOM_H
 
 #include "qom/cpu.h"
-#include "cpu.h"
 
 #define TYPE_UNICORE32_CPU "unicore32-cpu"
 
diff --git a/target-xtensa/cpu-qom.h b/target-xtensa/cpu-qom.h
index 2258224..f5d9b9f 100644
--- a/target-xtensa/cpu-qom.h
+++ b/target-xtensa/cpu-qom.h
@@ -30,7 +30,6 @@
 #define QEMU_XTENSA_CPU_QOM_H
 
 #include "qom/cpu.h"
-#include "cpu.h"
 
 #define TYPE_XTENSA_CPU "xtensa-cpu"
 
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 72+ messages in thread

* [Qemu-devel] [PATCH 05/50] target-alpha: make cpu-qom.h not target specific
  2016-04-08 20:28 [Qemu-devel] [PATCH for-2.7 00/49] NEED_CPU_H / cpu.h / hw/hw.h cleanups Paolo Bonzini
                   ` (3 preceding siblings ...)
  2016-04-08 20:28 ` [Qemu-devel] [PATCH 04/50] cpu: make cpu-qom.h only include-able from cpu.h Paolo Bonzini
@ 2016-04-08 20:28 ` Paolo Bonzini
  2016-04-08 20:28 ` [Qemu-devel] [PATCH 06/50] target-arm: " Paolo Bonzini
                   ` (46 subsequent siblings)
  51 siblings, 0 replies; 72+ messages in thread
From: Paolo Bonzini @ 2016-04-08 20:28 UTC (permalink / raw)
  To: qemu-devel

Make AlphaCPU an opaque type within cpu-qom.h, and move all definitions
of private methods, as well as all type definitions that require knowledge
of the layout to cpu.h.  This helps making files independent of NEED_CPU_H
if they only need to pass around CPU pointers.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 target-alpha/cpu-qom.h | 40 +---------------------------------------
 target-alpha/cpu.h     | 42 +++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 42 insertions(+), 40 deletions(-)

diff --git a/target-alpha/cpu-qom.h b/target-alpha/cpu-qom.h
index cf5264a..bae4945 100644
--- a/target-alpha/cpu-qom.h
+++ b/target-alpha/cpu-qom.h
@@ -47,44 +47,6 @@ typedef struct AlphaCPUClass {
     void (*parent_reset)(CPUState *cpu);
 } AlphaCPUClass;
 
-/**
- * AlphaCPU:
- * @env: #CPUAlphaState
- *
- * An Alpha CPU.
- */
-typedef struct AlphaCPU {
-    /*< private >*/
-    CPUState parent_obj;
-    /*< public >*/
-
-    CPUAlphaState env;
-
-    /* This alarm doesn't exist in real hardware; we wish it did.  */
-    QEMUTimer *alarm_timer;
-} AlphaCPU;
-
-static inline AlphaCPU *alpha_env_get_cpu(CPUAlphaState *env)
-{
-    return container_of(env, AlphaCPU, env);
-}
-
-#define ENV_GET_CPU(e) CPU(alpha_env_get_cpu(e))
-
-#define ENV_OFFSET offsetof(AlphaCPU, env)
-
-#ifndef CONFIG_USER_ONLY
-extern const struct VMStateDescription vmstate_alpha_cpu;
-#endif
-
-void alpha_cpu_do_interrupt(CPUState *cpu);
-bool alpha_cpu_exec_interrupt(CPUState *cpu, int int_req);
-void alpha_cpu_dump_state(CPUState *cs, FILE *f, fprintf_function cpu_fprintf,
-                          int flags);
-hwaddr alpha_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr);
-int alpha_cpu_gdb_read_register(CPUState *cpu, uint8_t *buf, int reg);
-int alpha_cpu_gdb_write_register(CPUState *cpu, uint8_t *buf, int reg);
-void alpha_cpu_do_unaligned_access(CPUState *cpu, vaddr addr,
-                                   int is_write, int is_user, uintptr_t retaddr);
+typedef struct AlphaCPU AlphaCPU;
 
 #endif
diff --git a/target-alpha/cpu.h b/target-alpha/cpu.h
index 420f2a5..8353bda 100644
--- a/target-alpha/cpu.h
+++ b/target-alpha/cpu.h
@@ -21,6 +21,7 @@
 #define __CPU_ALPHA_H__
 
 #include "qemu-common.h"
+#include "cpu-qom.h"
 
 #define TARGET_LONG_BITS 64
 #define ALIGNED_ONLY
@@ -284,12 +285,51 @@ struct CPUAlphaState {
     int implver;
 };
 
+/**
+ * AlphaCPU:
+ * @env: #CPUAlphaState
+ *
+ * An Alpha CPU.
+ */
+struct AlphaCPU {
+    /*< private >*/
+    CPUState parent_obj;
+    /*< public >*/
+
+    CPUAlphaState env;
+
+    /* This alarm doesn't exist in real hardware; we wish it did.  */
+    QEMUTimer *alarm_timer;
+};
+
+static inline AlphaCPU *alpha_env_get_cpu(CPUAlphaState *env)
+{
+    return container_of(env, AlphaCPU, env);
+}
+
+#define ENV_GET_CPU(e) CPU(alpha_env_get_cpu(e))
+
+#define ENV_OFFSET offsetof(AlphaCPU, env)
+
+#ifndef CONFIG_USER_ONLY
+extern const struct VMStateDescription vmstate_alpha_cpu;
+#endif
+
+void alpha_cpu_do_interrupt(CPUState *cpu);
+bool alpha_cpu_exec_interrupt(CPUState *cpu, int int_req);
+void alpha_cpu_dump_state(CPUState *cs, FILE *f, fprintf_function cpu_fprintf,
+                          int flags);
+hwaddr alpha_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr);
+int alpha_cpu_gdb_read_register(CPUState *cpu, uint8_t *buf, int reg);
+int alpha_cpu_gdb_write_register(CPUState *cpu, uint8_t *buf, int reg);
+void alpha_cpu_do_unaligned_access(CPUState *cpu, vaddr addr,
+                                   int is_write, int is_user, uintptr_t retaddr);
+
 #define cpu_list alpha_cpu_list
 #define cpu_exec cpu_alpha_exec
 #define cpu_signal_handler cpu_alpha_signal_handler
 
 #include "exec/cpu-all.h"
-#include "cpu-qom.h"
 
 enum {
     FEATURE_ASN    = 0x00000001,
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 72+ messages in thread

* [Qemu-devel] [PATCH 06/50] target-arm: make cpu-qom.h not target specific
  2016-04-08 20:28 [Qemu-devel] [PATCH for-2.7 00/49] NEED_CPU_H / cpu.h / hw/hw.h cleanups Paolo Bonzini
                   ` (4 preceding siblings ...)
  2016-04-08 20:28 ` [Qemu-devel] [PATCH 05/50] target-alpha: make cpu-qom.h not target specific Paolo Bonzini
@ 2016-04-08 20:28 ` Paolo Bonzini
  2016-04-21 10:29   ` Alex Bennée
  2016-04-08 20:28 ` [Qemu-devel] [PATCH 07/50] target-cris: " Paolo Bonzini
                   ` (45 subsequent siblings)
  51 siblings, 1 reply; 72+ messages in thread
From: Paolo Bonzini @ 2016-04-08 20:28 UTC (permalink / raw)
  To: qemu-devel

Make ARMCPU an opaque type within cpu-qom.h, and move all definitions of
private methods, as well as all type definitions that require knowledge
of the layout to cpu.h.  This helps making files independent of NEED_CPU_H
if they only need to pass around CPU pointers.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 target-arm/cpu-qom.h | 178 +-------------------------------------------------
 target-arm/cpu.h     | 179 ++++++++++++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 179 insertions(+), 178 deletions(-)

diff --git a/target-arm/cpu-qom.h b/target-arm/cpu-qom.h
index 1061c08..3991173 100644
--- a/target-arm/cpu-qom.h
+++ b/target-arm/cpu-qom.h
@@ -22,6 +22,8 @@
 
 #include "qom/cpu.h"
 
+struct arm_boot_info;
+
 #define TYPE_ARM_CPU "arm-cpu"
 
 #define ARM_CPU_CLASS(klass) \
@@ -47,145 +49,7 @@ typedef struct ARMCPUClass {
     void (*parent_reset)(CPUState *cpu);
 } ARMCPUClass;
 
-/**
- * ARMCPU:
- * @env: #CPUARMState
- *
- * An ARM CPU core.
- */
-typedef struct ARMCPU {
-    /*< private >*/
-    CPUState parent_obj;
-    /*< public >*/
-
-    CPUARMState env;
-
-    /* Coprocessor information */
-    GHashTable *cp_regs;
-    /* For marshalling (mostly coprocessor) register state between the
-     * kernel and QEMU (for KVM) and between two QEMUs (for migration),
-     * we use these arrays.
-     */
-    /* List of register indexes managed via these arrays; (full KVM style
-     * 64 bit indexes, not CPRegInfo 32 bit indexes)
-     */
-    uint64_t *cpreg_indexes;
-    /* Values of the registers (cpreg_indexes[i]'s value is cpreg_values[i]) */
-    uint64_t *cpreg_values;
-    /* Length of the indexes, values, reset_values arrays */
-    int32_t cpreg_array_len;
-    /* These are used only for migration: incoming data arrives in
-     * these fields and is sanity checked in post_load before copying
-     * to the working data structures above.
-     */
-    uint64_t *cpreg_vmstate_indexes;
-    uint64_t *cpreg_vmstate_values;
-    int32_t cpreg_vmstate_array_len;
-
-    /* Timers used by the generic (architected) timer */
-    QEMUTimer *gt_timer[NUM_GTIMERS];
-    /* GPIO outputs for generic timer */
-    qemu_irq gt_timer_outputs[NUM_GTIMERS];
-
-    /* MemoryRegion to use for secure physical accesses */
-    MemoryRegion *secure_memory;
-
-    /* 'compatible' string for this CPU for Linux device trees */
-    const char *dtb_compatible;
-
-    /* PSCI version for this CPU
-     * Bits[31:16] = Major Version
-     * Bits[15:0] = Minor Version
-     */
-    uint32_t psci_version;
-
-    /* Should CPU start in PSCI powered-off state? */
-    bool start_powered_off;
-    /* CPU currently in PSCI powered-off state */
-    bool powered_off;
-    /* CPU has security extension */
-    bool has_el3;
-
-    /* CPU has memory protection unit */
-    bool has_mpu;
-    /* PMSAv7 MPU number of supported regions */
-    uint32_t pmsav7_dregion;
-
-    /* PSCI conduit used to invoke PSCI methods
-     * 0 - disabled, 1 - smc, 2 - hvc
-     */
-    uint32_t psci_conduit;
-
-    /* [QEMU_]KVM_ARM_TARGET_* constant for this CPU, or
-     * QEMU_KVM_ARM_TARGET_NONE if the kernel doesn't support this CPU type.
-     */
-    uint32_t kvm_target;
-
-    /* KVM init features for this CPU */
-    uint32_t kvm_init_features[7];
-
-    /* Uniprocessor system with MP extensions */
-    bool mp_is_up;
-
-    /* The instance init functions for implementation-specific subclasses
-     * set these fields to specify the implementation-dependent values of
-     * various constant registers and reset values of non-constant
-     * registers.
-     * Some of these might become QOM properties eventually.
-     * Field names match the official register names as defined in the
-     * ARMv7AR ARM Architecture Reference Manual. A reset_ prefix
-     * is used for reset values of non-constant registers; no reset_
-     * prefix means a constant register.
-     */
-    uint32_t midr;
-    uint32_t revidr;
-    uint32_t reset_fpsid;
-    uint32_t mvfr0;
-    uint32_t mvfr1;
-    uint32_t mvfr2;
-    uint32_t ctr;
-    uint32_t reset_sctlr;
-    uint32_t id_pfr0;
-    uint32_t id_pfr1;
-    uint32_t id_dfr0;
-    uint32_t pmceid0;
-    uint32_t pmceid1;
-    uint32_t id_afr0;
-    uint32_t id_mmfr0;
-    uint32_t id_mmfr1;
-    uint32_t id_mmfr2;
-    uint32_t id_mmfr3;
-    uint32_t id_mmfr4;
-    uint32_t id_isar0;
-    uint32_t id_isar1;
-    uint32_t id_isar2;
-    uint32_t id_isar3;
-    uint32_t id_isar4;
-    uint32_t id_isar5;
-    uint64_t id_aa64pfr0;
-    uint64_t id_aa64pfr1;
-    uint64_t id_aa64dfr0;
-    uint64_t id_aa64dfr1;
-    uint64_t id_aa64afr0;
-    uint64_t id_aa64afr1;
-    uint64_t id_aa64isar0;
-    uint64_t id_aa64isar1;
-    uint64_t id_aa64mmfr0;
-    uint64_t id_aa64mmfr1;
-    uint32_t dbgdidr;
-    uint32_t clidr;
-    uint64_t mp_affinity; /* MP ID without feature bits */
-    /* The elements of this array are the CCSIDR values for each cache,
-     * in the order L1DCache, L1ICache, L2DCache, L2ICache, etc.
-     */
-    uint32_t ccsidr[16];
-    uint64_t reset_cbar;
-    uint32_t reset_auxcr;
-    bool reset_hivecs;
-    /* DCZ blocksize, in log_2(words), ie low 4 bits of DCZID_EL0 */
-    uint32_t dcz_blocksize;
-    uint64_t rvbar;
-} ARMCPU;
+typedef struct ARMCPU ARMCPU;
 
 #define TYPE_AARCH64_CPU "aarch64-cpu"
 #define AARCH64_CPU_CLASS(klass) \
@@ -199,40 +63,9 @@ typedef struct AArch64CPUClass {
     /*< public >*/
 } AArch64CPUClass;
 
-static inline ARMCPU *arm_env_get_cpu(CPUARMState *env)
-{
-    return container_of(env, ARMCPU, env);
-}
-
-#define ENV_GET_CPU(e) CPU(arm_env_get_cpu(e))
-
-#define ENV_OFFSET offsetof(ARMCPU, env)
-
-#ifndef CONFIG_USER_ONLY
-extern const struct VMStateDescription vmstate_arm_cpu;
-#endif
-
 void register_cp_regs_for_features(ARMCPU *cpu);
 void init_cpreg_list(ARMCPU *cpu);
 
-void arm_cpu_do_interrupt(CPUState *cpu);
-void arm_v7m_cpu_do_interrupt(CPUState *cpu);
-bool arm_cpu_exec_interrupt(CPUState *cpu, int int_req);
-
-void arm_cpu_dump_state(CPUState *cs, FILE *f, fprintf_function cpu_fprintf,
-                        int flags);
-
-hwaddr arm_cpu_get_phys_page_attrs_debug(CPUState *cpu, vaddr addr,
-                                         MemTxAttrs *attrs);
-
-int arm_cpu_gdb_read_register(CPUState *cpu, uint8_t *buf, int reg);
-int arm_cpu_gdb_write_register(CPUState *cpu, uint8_t *buf, int reg);
-
-int arm_cpu_write_elf64_note(WriteCoreDumpFunction f, CPUState *cs,
-                             int cpuid, void *opaque);
-int arm_cpu_write_elf32_note(WriteCoreDumpFunction f, CPUState *cs,
-                             int cpuid, void *opaque);
-
 /* Callback functions for the generic timer's timers. */
 void arm_gt_ptimer_cb(void *opaque);
 void arm_gt_vtimer_cb(void *opaque);
@@ -252,9 +85,4 @@ void arm_gt_stimer_cb(void *opaque);
 #define ARM64_AFFINITY_MASK \
     (ARM_AFF0_MASK|ARM_AFF1_MASK|ARM_AFF2_MASK|ARM_AFF3_MASK)
 
-#ifdef TARGET_AARCH64
-int aarch64_cpu_gdb_read_register(CPUState *cpu, uint8_t *buf, int reg);
-int aarch64_cpu_gdb_write_register(CPUState *cpu, uint8_t *buf, int reg);
-#endif
-
 #endif
diff --git a/target-arm/cpu.h b/target-arm/cpu.h
index 066ff67..bf6904c 100644
--- a/target-arm/cpu.h
+++ b/target-arm/cpu.h
@@ -34,6 +34,7 @@
 #define CPUArchState struct CPUARMState
 
 #include "qemu-common.h"
+#include "cpu-qom.h"
 #include "exec/cpu-defs.h"
 
 #include "fpu/softfloat.h"
@@ -91,8 +92,6 @@
 #define ARM_CPU_VIRQ 2
 #define ARM_CPU_VFIQ 3
 
-struct arm_boot_info;
-
 #define NB_MMU_MODES 7
 #define TARGET_INSN_START_EXTRA_WORDS 1
 
@@ -504,7 +503,181 @@ typedef struct CPUARMState {
     const struct arm_boot_info *boot_info;
 } CPUARMState;
 
-#include "cpu-qom.h"
+/**
+ * ARMCPU:
+ * @env: #CPUARMState
+ *
+ * An ARM CPU core.
+ */
+struct ARMCPU {
+    /*< private >*/
+    CPUState parent_obj;
+    /*< public >*/
+
+    CPUARMState env;
+
+    /* Coprocessor information */
+    GHashTable *cp_regs;
+    /* For marshalling (mostly coprocessor) register state between the
+     * kernel and QEMU (for KVM) and between two QEMUs (for migration),
+     * we use these arrays.
+     */
+    /* List of register indexes managed via these arrays; (full KVM style
+     * 64 bit indexes, not CPRegInfo 32 bit indexes)
+     */
+    uint64_t *cpreg_indexes;
+    /* Values of the registers (cpreg_indexes[i]'s value is cpreg_values[i]) */
+    uint64_t *cpreg_values;
+    /* Length of the indexes, values, reset_values arrays */
+    int32_t cpreg_array_len;
+    /* These are used only for migration: incoming data arrives in
+     * these fields and is sanity checked in post_load before copying
+     * to the working data structures above.
+     */
+    uint64_t *cpreg_vmstate_indexes;
+    uint64_t *cpreg_vmstate_values;
+    int32_t cpreg_vmstate_array_len;
+
+    /* Timers used by the generic (architected) timer */
+    QEMUTimer *gt_timer[NUM_GTIMERS];
+    /* GPIO outputs for generic timer */
+    qemu_irq gt_timer_outputs[NUM_GTIMERS];
+
+    /* MemoryRegion to use for secure physical accesses */
+    MemoryRegion *secure_memory;
+
+    /* 'compatible' string for this CPU for Linux device trees */
+    const char *dtb_compatible;
+
+    /* PSCI version for this CPU
+     * Bits[31:16] = Major Version
+     * Bits[15:0] = Minor Version
+     */
+    uint32_t psci_version;
+
+    /* Should CPU start in PSCI powered-off state? */
+    bool start_powered_off;
+    /* CPU currently in PSCI powered-off state */
+    bool powered_off;
+    /* CPU has security extension */
+    bool has_el3;
+
+    /* CPU has memory protection unit */
+    bool has_mpu;
+    /* PMSAv7 MPU number of supported regions */
+    uint32_t pmsav7_dregion;
+
+    /* PSCI conduit used to invoke PSCI methods
+     * 0 - disabled, 1 - smc, 2 - hvc
+     */
+    uint32_t psci_conduit;
+
+    /* [QEMU_]KVM_ARM_TARGET_* constant for this CPU, or
+     * QEMU_KVM_ARM_TARGET_NONE if the kernel doesn't support this CPU type.
+     */
+    uint32_t kvm_target;
+
+    /* KVM init features for this CPU */
+    uint32_t kvm_init_features[7];
+
+    /* Uniprocessor system with MP extensions */
+    bool mp_is_up;
+
+    /* The instance init functions for implementation-specific subclasses
+     * set these fields to specify the implementation-dependent values of
+     * various constant registers and reset values of non-constant
+     * registers.
+     * Some of these might become QOM properties eventually.
+     * Field names match the official register names as defined in the
+     * ARMv7AR ARM Architecture Reference Manual. A reset_ prefix
+     * is used for reset values of non-constant registers; no reset_
+     * prefix means a constant register.
+     */
+    uint32_t midr;
+    uint32_t revidr;
+    uint32_t reset_fpsid;
+    uint32_t mvfr0;
+    uint32_t mvfr1;
+    uint32_t mvfr2;
+    uint32_t ctr;
+    uint32_t reset_sctlr;
+    uint32_t id_pfr0;
+    uint32_t id_pfr1;
+    uint32_t id_dfr0;
+    uint32_t pmceid0;
+    uint32_t pmceid1;
+    uint32_t id_afr0;
+    uint32_t id_mmfr0;
+    uint32_t id_mmfr1;
+    uint32_t id_mmfr2;
+    uint32_t id_mmfr3;
+    uint32_t id_mmfr4;
+    uint32_t id_isar0;
+    uint32_t id_isar1;
+    uint32_t id_isar2;
+    uint32_t id_isar3;
+    uint32_t id_isar4;
+    uint32_t id_isar5;
+    uint64_t id_aa64pfr0;
+    uint64_t id_aa64pfr1;
+    uint64_t id_aa64dfr0;
+    uint64_t id_aa64dfr1;
+    uint64_t id_aa64afr0;
+    uint64_t id_aa64afr1;
+    uint64_t id_aa64isar0;
+    uint64_t id_aa64isar1;
+    uint64_t id_aa64mmfr0;
+    uint64_t id_aa64mmfr1;
+    uint32_t dbgdidr;
+    uint32_t clidr;
+    uint64_t mp_affinity; /* MP ID without feature bits */
+    /* The elements of this array are the CCSIDR values for each cache,
+     * in the order L1DCache, L1ICache, L2DCache, L2ICache, etc.
+     */
+    uint32_t ccsidr[16];
+    uint64_t reset_cbar;
+    uint32_t reset_auxcr;
+    bool reset_hivecs;
+    /* DCZ blocksize, in log_2(words), ie low 4 bits of DCZID_EL0 */
+    uint32_t dcz_blocksize;
+    uint64_t rvbar;
+};
+
+static inline ARMCPU *arm_env_get_cpu(CPUARMState *env)
+{
+    return container_of(env, ARMCPU, env);
+}
+
+#define ENV_GET_CPU(e) CPU(arm_env_get_cpu(e))
+
+#define ENV_OFFSET offsetof(ARMCPU, env)
+
+#ifndef CONFIG_USER_ONLY
+extern const struct VMStateDescription vmstate_arm_cpu;
+#endif
+
+void arm_cpu_do_interrupt(CPUState *cpu);
+void arm_v7m_cpu_do_interrupt(CPUState *cpu);
+bool arm_cpu_exec_interrupt(CPUState *cpu, int int_req);
+
+void arm_cpu_dump_state(CPUState *cs, FILE *f, fprintf_function cpu_fprintf,
+                        int flags);
+
+hwaddr arm_cpu_get_phys_page_attrs_debug(CPUState *cpu, vaddr addr,
+                                         MemTxAttrs *attrs);
+
+int arm_cpu_gdb_read_register(CPUState *cpu, uint8_t *buf, int reg);
+int arm_cpu_gdb_write_register(CPUState *cpu, uint8_t *buf, int reg);
+
+int arm_cpu_write_elf64_note(WriteCoreDumpFunction f, CPUState *cs,
+                             int cpuid, void *opaque);
+int arm_cpu_write_elf32_note(WriteCoreDumpFunction f, CPUState *cs,
+                             int cpuid, void *opaque);
+
+#ifdef TARGET_AARCH64
+int aarch64_cpu_gdb_read_register(CPUState *cpu, uint8_t *buf, int reg);
+int aarch64_cpu_gdb_write_register(CPUState *cpu, uint8_t *buf, int reg);
+#endif
 
 ARMCPU *cpu_arm_init(const char *cpu_model);
 int cpu_arm_exec(CPUState *cpu);
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 72+ messages in thread

* [Qemu-devel] [PATCH 07/50] target-cris: make cpu-qom.h not target specific
  2016-04-08 20:28 [Qemu-devel] [PATCH for-2.7 00/49] NEED_CPU_H / cpu.h / hw/hw.h cleanups Paolo Bonzini
                   ` (5 preceding siblings ...)
  2016-04-08 20:28 ` [Qemu-devel] [PATCH 06/50] target-arm: " Paolo Bonzini
@ 2016-04-08 20:28 ` Paolo Bonzini
  2016-04-08 20:28 ` [Qemu-devel] [PATCH 08/50] target-i386: " Paolo Bonzini
                   ` (44 subsequent siblings)
  51 siblings, 0 replies; 72+ messages in thread
From: Paolo Bonzini @ 2016-04-08 20:28 UTC (permalink / raw)
  To: qemu-devel

Make CRISCPU an opaque type within cpu-qom.h, and move all definitions of
private methods, as well as all type definitions that require knowledge
of the layout to cpu.h.  This helps making files independent of NEED_CPU_H
if they only need to pass around CPU pointers.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 target-cris/cpu-qom.h | 40 +---------------------------------------
 target-cris/cpu.h     | 41 ++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 41 insertions(+), 40 deletions(-)

diff --git a/target-cris/cpu-qom.h b/target-cris/cpu-qom.h
index df4c0b5..7556e9f 100644
--- a/target-cris/cpu-qom.h
+++ b/target-cris/cpu-qom.h
@@ -50,44 +50,6 @@ typedef struct CRISCPUClass {
     uint32_t vr;
 } CRISCPUClass;
 
-/**
- * CRISCPU:
- * @env: #CPUCRISState
- *
- * A CRIS CPU.
- */
-typedef struct CRISCPU {
-    /*< private >*/
-    CPUState parent_obj;
-    /*< public >*/
-
-    CPUCRISState env;
-} CRISCPU;
-
-static inline CRISCPU *cris_env_get_cpu(CPUCRISState *env)
-{
-    return container_of(env, CRISCPU, env);
-}
-
-#define ENV_GET_CPU(e) CPU(cris_env_get_cpu(e))
-
-#define ENV_OFFSET offsetof(CRISCPU, env)
-
-#ifndef CONFIG_USER_ONLY
-extern const struct VMStateDescription vmstate_cris_cpu;
-#endif
-
-void cris_cpu_do_interrupt(CPUState *cpu);
-void crisv10_cpu_do_interrupt(CPUState *cpu);
-bool cris_cpu_exec_interrupt(CPUState *cpu, int int_req);
-
-void cris_cpu_dump_state(CPUState *cs, FILE *f, fprintf_function cpu_fprintf,
-                         int flags);
-
-hwaddr cris_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr);
-
-int crisv10_cpu_gdb_read_register(CPUState *cpu, uint8_t *buf, int reg);
-int cris_cpu_gdb_read_register(CPUState *cpu, uint8_t *buf, int reg);
-int cris_cpu_gdb_write_register(CPUState *cpu, uint8_t *buf, int reg);
+typedef struct CRISCPU CRISCPU;
 
 #endif
diff --git a/target-cris/cpu.h b/target-cris/cpu.h
index 415cf91..e3411687 100644
--- a/target-cris/cpu.h
+++ b/target-cris/cpu.h
@@ -21,6 +21,7 @@
 #define CPU_CRIS_H
 
 #include "qemu-common.h"
+#include "cpu-qom.h"
 
 #define TARGET_LONG_BITS 32
 
@@ -171,7 +172,45 @@ typedef struct CPUCRISState {
     void *load_info;
 } CPUCRISState;
 
-#include "cpu-qom.h"
+/**
+ * CRISCPU:
+ * @env: #CPUCRISState
+ *
+ * A CRIS CPU.
+ */
+struct CRISCPU {
+    /*< private >*/
+    CPUState parent_obj;
+    /*< public >*/
+
+    CPUCRISState env;
+};
+
+static inline CRISCPU *cris_env_get_cpu(CPUCRISState *env)
+{
+    return container_of(env, CRISCPU, env);
+}
+
+#define ENV_GET_CPU(e) CPU(cris_env_get_cpu(e))
+
+#define ENV_OFFSET offsetof(CRISCPU, env)
+
+#ifndef CONFIG_USER_ONLY
+extern const struct VMStateDescription vmstate_cris_cpu;
+#endif
+
+void cris_cpu_do_interrupt(CPUState *cpu);
+void crisv10_cpu_do_interrupt(CPUState *cpu);
+bool cris_cpu_exec_interrupt(CPUState *cpu, int int_req);
+
+void cris_cpu_dump_state(CPUState *cs, FILE *f, fprintf_function cpu_fprintf,
+                         int flags);
+
+hwaddr cris_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr);
+
+int crisv10_cpu_gdb_read_register(CPUState *cpu, uint8_t *buf, int reg);
+int cris_cpu_gdb_read_register(CPUState *cpu, uint8_t *buf, int reg);
+int cris_cpu_gdb_write_register(CPUState *cpu, uint8_t *buf, int reg);
 
 CRISCPU *cpu_cris_init(const char *cpu_model);
 int cpu_cris_exec(CPUState *cpu);
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 72+ messages in thread

* [Qemu-devel] [PATCH 08/50] target-i386: make cpu-qom.h not target specific
  2016-04-08 20:28 [Qemu-devel] [PATCH for-2.7 00/49] NEED_CPU_H / cpu.h / hw/hw.h cleanups Paolo Bonzini
                   ` (6 preceding siblings ...)
  2016-04-08 20:28 ` [Qemu-devel] [PATCH 07/50] target-cris: " Paolo Bonzini
@ 2016-04-08 20:28 ` Paolo Bonzini
  2016-04-08 20:28 ` [Qemu-devel] [PATCH 09/50] target-lm32: " Paolo Bonzini
                   ` (43 subsequent siblings)
  51 siblings, 0 replies; 72+ messages in thread
From: Paolo Bonzini @ 2016-04-08 20:28 UTC (permalink / raw)
  To: qemu-devel

Make X86CPU an opaque type within cpu-qom.h, and move all definitions of
private methods, as well as all type definitions that require knowledge
of the layout to cpu.h.  This helps making files independent of NEED_CPU_H
if they only need to pass around CPU pointers.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 target-i386/cpu-qom.h | 97 +-------------------------------------------------
 target-i386/cpu.h     | 98 ++++++++++++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 98 insertions(+), 97 deletions(-)

diff --git a/target-i386/cpu-qom.h b/target-i386/cpu-qom.h
index 2ca7b9e..5dde658 100644
--- a/target-i386/cpu-qom.h
+++ b/target-i386/cpu-qom.h
@@ -67,101 +67,6 @@ typedef struct X86CPUClass {
     void (*parent_reset)(CPUState *cpu);
 } X86CPUClass;
 
-/**
- * X86CPU:
- * @env: #CPUX86State
- * @migratable: If set, only migratable flags will be accepted when "enforce"
- * mode is used, and only migratable flags will be included in the "host"
- * CPU model.
- *
- * An x86 CPU.
- */
-typedef struct X86CPU {
-    /*< private >*/
-    CPUState parent_obj;
-    /*< public >*/
-
-    CPUX86State env;
-
-    bool hyperv_vapic;
-    bool hyperv_relaxed_timing;
-    int hyperv_spinlock_attempts;
-    char *hyperv_vendor_id;
-    bool hyperv_time;
-    bool hyperv_crash;
-    bool hyperv_reset;
-    bool hyperv_vpindex;
-    bool hyperv_runtime;
-    bool hyperv_synic;
-    bool hyperv_stimer;
-    bool check_cpuid;
-    bool enforce_cpuid;
-    bool expose_kvm;
-    bool migratable;
-    bool host_features;
-    int64_t apic_id;
-
-    /* if true the CPUID code directly forward host cache leaves to the guest */
-    bool cache_info_passthrough;
-
-    /* Features that were filtered out because of missing host capabilities */
-    uint32_t filtered_features[FEATURE_WORDS];
-
-    /* Enable PMU CPUID bits. This can't be enabled by default yet because
-     * it doesn't have ABI stability guarantees, as it passes all PMU CPUID
-     * bits returned by GET_SUPPORTED_CPUID (that depend on host CPU and kernel
-     * capabilities) directly to the guest.
-     */
-    bool enable_pmu;
-
-    /* in order to simplify APIC support, we leave this pointer to the
-       user */
-    struct DeviceState *apic_state;
-    struct MemoryRegion *cpu_as_root, *cpu_as_mem, *smram;
-    Notifier machine_done;
-} X86CPU;
-
-static inline X86CPU *x86_env_get_cpu(CPUX86State *env)
-{
-    return container_of(env, X86CPU, env);
-}
-
-#define ENV_GET_CPU(e) CPU(x86_env_get_cpu(e))
-
-#define ENV_OFFSET offsetof(X86CPU, env)
-
-#ifndef CONFIG_USER_ONLY
-extern struct VMStateDescription vmstate_x86_cpu;
-#endif
-
-/**
- * x86_cpu_do_interrupt:
- * @cpu: vCPU the interrupt is to be handled by.
- */
-void x86_cpu_do_interrupt(CPUState *cpu);
-bool x86_cpu_exec_interrupt(CPUState *cpu, int int_req);
-
-int x86_cpu_write_elf64_note(WriteCoreDumpFunction f, CPUState *cpu,
-                             int cpuid, void *opaque);
-int x86_cpu_write_elf32_note(WriteCoreDumpFunction f, CPUState *cpu,
-                             int cpuid, void *opaque);
-int x86_cpu_write_elf64_qemunote(WriteCoreDumpFunction f, CPUState *cpu,
-                                 void *opaque);
-int x86_cpu_write_elf32_qemunote(WriteCoreDumpFunction f, CPUState *cpu,
-                                 void *opaque);
-
-void x86_cpu_get_memory_mapping(CPUState *cpu, MemoryMappingList *list,
-                                Error **errp);
-
-void x86_cpu_dump_state(CPUState *cs, FILE *f, fprintf_function cpu_fprintf,
-                        int flags);
-
-hwaddr x86_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr);
-
-int x86_cpu_gdb_read_register(CPUState *cpu, uint8_t *buf, int reg);
-int x86_cpu_gdb_write_register(CPUState *cpu, uint8_t *buf, int reg);
-
-void x86_cpu_exec_enter(CPUState *cpu);
-void x86_cpu_exec_exit(CPUState *cpu);
+typedef struct X86CPU X86CPU;
 
 #endif
diff --git a/target-i386/cpu.h b/target-i386/cpu.h
index 732eb6d..9614c88 100644
--- a/target-i386/cpu.h
+++ b/target-i386/cpu.h
@@ -20,6 +20,7 @@
 #define CPU_I386_H
 
 #include "qemu-common.h"
+#include "cpu-qom.h"
 #include "standard-headers/asm-x86/hyperv.h"
 
 #ifdef TARGET_X86_64
@@ -1028,7 +1029,102 @@ typedef struct CPUX86State {
     TPRAccess tpr_access_type;
 } CPUX86State;
 
-#include "cpu-qom.h"
+/**
+ * X86CPU:
+ * @env: #CPUX86State
+ * @migratable: If set, only migratable flags will be accepted when "enforce"
+ * mode is used, and only migratable flags will be included in the "host"
+ * CPU model.
+ *
+ * An x86 CPU.
+ */
+struct X86CPU {
+    /*< private >*/
+    CPUState parent_obj;
+    /*< public >*/
+
+    CPUX86State env;
+
+    bool hyperv_vapic;
+    bool hyperv_relaxed_timing;
+    int hyperv_spinlock_attempts;
+    char *hyperv_vendor_id;
+    bool hyperv_time;
+    bool hyperv_crash;
+    bool hyperv_reset;
+    bool hyperv_vpindex;
+    bool hyperv_runtime;
+    bool hyperv_synic;
+    bool hyperv_stimer;
+    bool check_cpuid;
+    bool enforce_cpuid;
+    bool expose_kvm;
+    bool migratable;
+    bool host_features;
+    int64_t apic_id;
+
+    /* if true the CPUID code directly forward host cache leaves to the guest */
+    bool cache_info_passthrough;
+
+    /* Features that were filtered out because of missing host capabilities */
+    uint32_t filtered_features[FEATURE_WORDS];
+
+    /* Enable PMU CPUID bits. This can't be enabled by default yet because
+     * it doesn't have ABI stability guarantees, as it passes all PMU CPUID
+     * bits returned by GET_SUPPORTED_CPUID (that depend on host CPU and kernel
+     * capabilities) directly to the guest.
+     */
+    bool enable_pmu;
+
+    /* in order to simplify APIC support, we leave this pointer to the
+       user */
+    struct DeviceState *apic_state;
+    struct MemoryRegion *cpu_as_root, *cpu_as_mem, *smram;
+    Notifier machine_done;
+};
+
+static inline X86CPU *x86_env_get_cpu(CPUX86State *env)
+{
+    return container_of(env, X86CPU, env);
+}
+
+#define ENV_GET_CPU(e) CPU(x86_env_get_cpu(e))
+
+#define ENV_OFFSET offsetof(X86CPU, env)
+
+#ifndef CONFIG_USER_ONLY
+extern struct VMStateDescription vmstate_x86_cpu;
+#endif
+
+/**
+ * x86_cpu_do_interrupt:
+ * @cpu: vCPU the interrupt is to be handled by.
+ */
+void x86_cpu_do_interrupt(CPUState *cpu);
+bool x86_cpu_exec_interrupt(CPUState *cpu, int int_req);
+
+int x86_cpu_write_elf64_note(WriteCoreDumpFunction f, CPUState *cpu,
+                             int cpuid, void *opaque);
+int x86_cpu_write_elf32_note(WriteCoreDumpFunction f, CPUState *cpu,
+                             int cpuid, void *opaque);
+int x86_cpu_write_elf64_qemunote(WriteCoreDumpFunction f, CPUState *cpu,
+                                 void *opaque);
+int x86_cpu_write_elf32_qemunote(WriteCoreDumpFunction f, CPUState *cpu,
+                                 void *opaque);
+
+void x86_cpu_get_memory_mapping(CPUState *cpu, MemoryMappingList *list,
+                                Error **errp);
+
+void x86_cpu_dump_state(CPUState *cs, FILE *f, fprintf_function cpu_fprintf,
+                        int flags);
+
+hwaddr x86_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr);
+
+int x86_cpu_gdb_read_register(CPUState *cpu, uint8_t *buf, int reg);
+int x86_cpu_gdb_write_register(CPUState *cpu, uint8_t *buf, int reg);
+
+void x86_cpu_exec_enter(CPUState *cpu);
+void x86_cpu_exec_exit(CPUState *cpu);
 
 X86CPU *cpu_x86_init(const char *cpu_model);
 X86CPU *cpu_x86_create(const char *cpu_model, Error **errp);
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 72+ messages in thread

* [Qemu-devel] [PATCH 09/50] target-lm32: make cpu-qom.h not target specific
  2016-04-08 20:28 [Qemu-devel] [PATCH for-2.7 00/49] NEED_CPU_H / cpu.h / hw/hw.h cleanups Paolo Bonzini
                   ` (7 preceding siblings ...)
  2016-04-08 20:28 ` [Qemu-devel] [PATCH 08/50] target-i386: " Paolo Bonzini
@ 2016-04-08 20:28 ` Paolo Bonzini
  2016-04-08 20:28 ` [Qemu-devel] [PATCH 10/50] target-m68k: " Paolo Bonzini
                   ` (42 subsequent siblings)
  51 siblings, 0 replies; 72+ messages in thread
From: Paolo Bonzini @ 2016-04-08 20:28 UTC (permalink / raw)
  To: qemu-devel

Make LM32CPU an opaque type within cpu-qom.h, and move all definitions of
private methods, as well as all type definitions that require knowledge
of the layout to cpu.h.  This helps making files independent of NEED_CPU_H
if they only need to pass around CPU pointers.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 target-lm32/cpu-qom.h | 41 +----------------------------------------
 target-lm32/cpu.h     | 44 ++++++++++++++++++++++++++++++++++++++++++--
 2 files changed, 43 insertions(+), 42 deletions(-)

diff --git a/target-lm32/cpu-qom.h b/target-lm32/cpu-qom.h
index 54989e4..b423d25 100644
--- a/target-lm32/cpu-qom.h
+++ b/target-lm32/cpu-qom.h
@@ -47,45 +47,6 @@ typedef struct LM32CPUClass {
     void (*parent_reset)(CPUState *cpu);
 } LM32CPUClass;
 
-/**
- * LM32CPU:
- * @env: #CPULM32State
- *
- * A LatticeMico32 CPU.
- */
-typedef struct LM32CPU {
-    /*< private >*/
-    CPUState parent_obj;
-    /*< public >*/
-
-    CPULM32State env;
-
-    uint32_t revision;
-    uint8_t num_interrupts;
-    uint8_t num_breakpoints;
-    uint8_t num_watchpoints;
-    uint32_t features;
-} LM32CPU;
-
-static inline LM32CPU *lm32_env_get_cpu(CPULM32State *env)
-{
-    return container_of(env, LM32CPU, env);
-}
-
-#define ENV_GET_CPU(e) CPU(lm32_env_get_cpu(e))
-
-#define ENV_OFFSET offsetof(LM32CPU, env)
-
-#ifndef CONFIG_USER_ONLY
-extern const struct VMStateDescription vmstate_lm32_cpu;
-#endif
-
-void lm32_cpu_do_interrupt(CPUState *cpu);
-bool lm32_cpu_exec_interrupt(CPUState *cs, int int_req);
-void lm32_cpu_dump_state(CPUState *cpu, FILE *f, fprintf_function cpu_fprintf,
-                         int flags);
-hwaddr lm32_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr);
-int lm32_cpu_gdb_read_register(CPUState *cpu, uint8_t *buf, int reg);
-int lm32_cpu_gdb_write_register(CPUState *cpu, uint8_t *buf, int reg);
+typedef struct LM32CPU LM32CPU;
 
 #endif
diff --git a/target-lm32/cpu.h b/target-lm32/cpu.h
index f220fc0..22ffa68 100644
--- a/target-lm32/cpu.h
+++ b/target-lm32/cpu.h
@@ -25,6 +25,7 @@
 #define CPUArchState struct CPULM32State
 
 #include "qemu-common.h"
+#include "cpu-qom.h"
 #include "exec/cpu-defs.h"
 struct CPULM32State;
 typedef struct CPULM32State CPULM32State;
@@ -180,6 +181,47 @@ struct CPULM32State {
 
 };
 
+/**
+ * LM32CPU:
+ * @env: #CPULM32State
+ *
+ * A LatticeMico32 CPU.
+ */
+struct LM32CPU {
+    /*< private >*/
+    CPUState parent_obj;
+    /*< public >*/
+
+    CPULM32State env;
+
+    uint32_t revision;
+    uint8_t num_interrupts;
+    uint8_t num_breakpoints;
+    uint8_t num_watchpoints;
+    uint32_t features;
+};
+
+static inline LM32CPU *lm32_env_get_cpu(CPULM32State *env)
+{
+    return container_of(env, LM32CPU, env);
+}
+
+#define ENV_GET_CPU(e) CPU(lm32_env_get_cpu(e))
+
+#define ENV_OFFSET offsetof(LM32CPU, env)
+
+#ifndef CONFIG_USER_ONLY
+extern const struct VMStateDescription vmstate_lm32_cpu;
+#endif
+
+void lm32_cpu_do_interrupt(CPUState *cpu);
+bool lm32_cpu_exec_interrupt(CPUState *cs, int int_req);
+void lm32_cpu_dump_state(CPUState *cpu, FILE *f, fprintf_function cpu_fprintf,
+                         int flags);
+hwaddr lm32_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr);
+int lm32_cpu_gdb_read_register(CPUState *cpu, uint8_t *buf, int reg);
+int lm32_cpu_gdb_write_register(CPUState *cpu, uint8_t *buf, int reg);
+
 typedef enum {
     LM32_WP_DISABLED = 0,
     LM32_WP_READ,
@@ -193,8 +235,6 @@ static inline lm32_wp_t lm32_wp_type(uint32_t dc, int idx)
     return (dc >> (idx+1)*2) & 0x3;
 }
 
-#include "cpu-qom.h"
-
 LM32CPU *cpu_lm32_init(const char *cpu_model);
 int cpu_lm32_exec(CPUState *cpu);
 /* you can call this signal handler from your SIGBUS and SIGSEGV
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 72+ messages in thread

* [Qemu-devel] [PATCH 10/50] target-m68k: make cpu-qom.h not target specific
  2016-04-08 20:28 [Qemu-devel] [PATCH for-2.7 00/49] NEED_CPU_H / cpu.h / hw/hw.h cleanups Paolo Bonzini
                   ` (8 preceding siblings ...)
  2016-04-08 20:28 ` [Qemu-devel] [PATCH 09/50] target-lm32: " Paolo Bonzini
@ 2016-04-08 20:28 ` Paolo Bonzini
  2016-04-08 20:28 ` [Qemu-devel] [PATCH 11/50] target-microblaze: " Paolo Bonzini
                   ` (41 subsequent siblings)
  51 siblings, 0 replies; 72+ messages in thread
From: Paolo Bonzini @ 2016-04-08 20:28 UTC (permalink / raw)
  To: qemu-devel

Make M68KCPU an opaque type within cpu-qom.h, and move all definitions of
private methods, as well as all type definitions that require knowledge
of the layout to cpu.h.  This helps making files independent of NEED_CPU_H
if they only need to pass around CPU pointers.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 target-m68k/cpu-qom.h | 34 +---------------------------------
 target-m68k/cpu.h     | 36 ++++++++++++++++++++++++++++++++++--
 2 files changed, 35 insertions(+), 35 deletions(-)

diff --git a/target-m68k/cpu-qom.h b/target-m68k/cpu-qom.h
index c28e55d..9885bba 100644
--- a/target-m68k/cpu-qom.h
+++ b/target-m68k/cpu-qom.h
@@ -47,38 +47,6 @@ typedef struct M68kCPUClass {
     void (*parent_reset)(CPUState *cpu);
 } M68kCPUClass;
 
-/**
- * M68kCPU:
- * @env: #CPUM68KState
- *
- * A Motorola 68k CPU.
- */
-typedef struct M68kCPU {
-    /*< private >*/
-    CPUState parent_obj;
-    /*< public >*/
-
-    CPUM68KState env;
-} M68kCPU;
-
-static inline M68kCPU *m68k_env_get_cpu(CPUM68KState *env)
-{
-    return container_of(env, M68kCPU, env);
-}
-
-#define ENV_GET_CPU(e) CPU(m68k_env_get_cpu(e))
-
-#define ENV_OFFSET offsetof(M68kCPU, env)
-
-void m68k_cpu_do_interrupt(CPUState *cpu);
-bool m68k_cpu_exec_interrupt(CPUState *cpu, int int_req);
-void m68k_cpu_dump_state(CPUState *cpu, FILE *f, fprintf_function cpu_fprintf,
-                         int flags);
-hwaddr m68k_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr);
-int m68k_cpu_gdb_read_register(CPUState *cpu, uint8_t *buf, int reg);
-int m68k_cpu_gdb_write_register(CPUState *cpu, uint8_t *buf, int reg);
-
-void m68k_cpu_exec_enter(CPUState *cs);
-void m68k_cpu_exec_exit(CPUState *cs);
+typedef struct M68kCPU M68kCPU;
 
 #endif
diff --git a/target-m68k/cpu.h b/target-m68k/cpu.h
index 48b4c87..57c2c8d 100644
--- a/target-m68k/cpu.h
+++ b/target-m68k/cpu.h
@@ -26,7 +26,7 @@
 
 #include "qemu-common.h"
 #include "exec/cpu-defs.h"
-
+#include "cpu-qom.h"
 #include "fpu/softfloat.h"
 
 #define MAX_QREGS 32
@@ -109,7 +109,39 @@ typedef struct CPUM68KState {
     uint32_t features;
 } CPUM68KState;
 
-#include "cpu-qom.h"
+/**
+ * M68kCPU:
+ * @env: #CPUM68KState
+ *
+ * A Motorola 68k CPU.
+ */
+struct M68kCPU {
+    /*< private >*/
+    CPUState parent_obj;
+    /*< public >*/
+
+    CPUM68KState env;
+};
+
+static inline M68kCPU *m68k_env_get_cpu(CPUM68KState *env)
+{
+    return container_of(env, M68kCPU, env);
+}
+
+#define ENV_GET_CPU(e) CPU(m68k_env_get_cpu(e))
+
+#define ENV_OFFSET offsetof(M68kCPU, env)
+
+void m68k_cpu_do_interrupt(CPUState *cpu);
+bool m68k_cpu_exec_interrupt(CPUState *cpu, int int_req);
+void m68k_cpu_dump_state(CPUState *cpu, FILE *f, fprintf_function cpu_fprintf,
+                         int flags);
+hwaddr m68k_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr);
+int m68k_cpu_gdb_read_register(CPUState *cpu, uint8_t *buf, int reg);
+int m68k_cpu_gdb_write_register(CPUState *cpu, uint8_t *buf, int reg);
+
+void m68k_cpu_exec_enter(CPUState *cs);
+void m68k_cpu_exec_exit(CPUState *cs);
 
 void m68k_tcg_init(void);
 void m68k_cpu_init_gdb(M68kCPU *cpu);
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 72+ messages in thread

* [Qemu-devel] [PATCH 11/50] target-microblaze: make cpu-qom.h not target specific
  2016-04-08 20:28 [Qemu-devel] [PATCH for-2.7 00/49] NEED_CPU_H / cpu.h / hw/hw.h cleanups Paolo Bonzini
                   ` (9 preceding siblings ...)
  2016-04-08 20:28 ` [Qemu-devel] [PATCH 10/50] target-m68k: " Paolo Bonzini
@ 2016-04-08 20:28 ` Paolo Bonzini
  2016-04-08 20:28 ` [Qemu-devel] [PATCH 12/50] target-mips: " Paolo Bonzini
                   ` (40 subsequent siblings)
  51 siblings, 0 replies; 72+ messages in thread
From: Paolo Bonzini @ 2016-04-08 20:28 UTC (permalink / raw)
  To: qemu-devel

Make MicroBlazeCPU an opaque type within cpu-qom.h, and move all
definitions of private methods, as well as all type definitions that
require knowledge of the layout to cpu.h.  This helps making files
independent of NEED_CPU_H if they only need to pass around CPU pointers.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 target-microblaze/cpu-qom.h | 44 +-------------------------------------------
 target-microblaze/cpu.h     | 45 ++++++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 45 insertions(+), 44 deletions(-)

diff --git a/target-microblaze/cpu-qom.h b/target-microblaze/cpu-qom.h
index 34f6273..1a61db7 100644
--- a/target-microblaze/cpu-qom.h
+++ b/target-microblaze/cpu-qom.h
@@ -47,48 +47,6 @@ typedef struct MicroBlazeCPUClass {
     void (*parent_reset)(CPUState *cpu);
 } MicroBlazeCPUClass;
 
-/**
- * MicroBlazeCPU:
- * @env: #CPUMBState
- *
- * A MicroBlaze CPU.
- */
-typedef struct MicroBlazeCPU {
-    /*< private >*/
-    CPUState parent_obj;
-
-    /*< public >*/
-
-    /* Microblaze Configuration Settings */
-    struct {
-        bool stackprot;
-        uint32_t base_vectors;
-        uint8_t use_fpu;
-        bool use_mmu;
-        bool dcache_writeback;
-        bool endi;
-        char *version;
-        uint8_t pvr;
-    } cfg;
-
-    CPUMBState env;
-} MicroBlazeCPU;
-
-static inline MicroBlazeCPU *mb_env_get_cpu(CPUMBState *env)
-{
-    return container_of(env, MicroBlazeCPU, env);
-}
-
-#define ENV_GET_CPU(e) CPU(mb_env_get_cpu(e))
-
-#define ENV_OFFSET offsetof(MicroBlazeCPU, env)
-
-void mb_cpu_do_interrupt(CPUState *cs);
-bool mb_cpu_exec_interrupt(CPUState *cs, int int_req);
-void mb_cpu_dump_state(CPUState *cpu, FILE *f, fprintf_function cpu_fprintf,
-                       int flags);
-hwaddr mb_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr);
-int mb_cpu_gdb_read_register(CPUState *cpu, uint8_t *buf, int reg);
-int mb_cpu_gdb_write_register(CPUState *cpu, uint8_t *buf, int reg);
+typedef struct MicroBlazeCPU MicroBlazeCPU;
 
 #endif
diff --git a/target-microblaze/cpu.h b/target-microblaze/cpu.h
index 2f7335e..4c4db7f 100644
--- a/target-microblaze/cpu.h
+++ b/target-microblaze/cpu.h
@@ -20,6 +20,7 @@
 #define CPU_MICROBLAZE_H
 
 #include "qemu-common.h"
+#include "cpu-qom.h"
 
 #define TARGET_LONG_BITS 32
 
@@ -274,7 +275,49 @@ struct CPUMBState {
     } pvr;
 };
 
-#include "cpu-qom.h"
+/**
+ * MicroBlazeCPU:
+ * @env: #CPUMBState
+ *
+ * A MicroBlaze CPU.
+ */
+struct MicroBlazeCPU {
+    /*< private >*/
+    CPUState parent_obj;
+
+    /*< public >*/
+
+    /* Microblaze Configuration Settings */
+    struct {
+        bool stackprot;
+        uint32_t base_vectors;
+        uint8_t use_fpu;
+        bool use_mmu;
+        bool dcache_writeback;
+        bool endi;
+        char *version;
+        uint8_t pvr;
+    } cfg;
+
+    CPUMBState env;
+};
+
+static inline MicroBlazeCPU *mb_env_get_cpu(CPUMBState *env)
+{
+    return container_of(env, MicroBlazeCPU, env);
+}
+
+#define ENV_GET_CPU(e) CPU(mb_env_get_cpu(e))
+
+#define ENV_OFFSET offsetof(MicroBlazeCPU, env)
+
+void mb_cpu_do_interrupt(CPUState *cs);
+bool mb_cpu_exec_interrupt(CPUState *cs, int int_req);
+void mb_cpu_dump_state(CPUState *cpu, FILE *f, fprintf_function cpu_fprintf,
+                       int flags);
+hwaddr mb_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr);
+int mb_cpu_gdb_read_register(CPUState *cpu, uint8_t *buf, int reg);
+int mb_cpu_gdb_write_register(CPUState *cpu, uint8_t *buf, int reg);
 
 void mb_tcg_init(void);
 MicroBlazeCPU *cpu_mb_init(const char *cpu_model);
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 72+ messages in thread

* [Qemu-devel] [PATCH 12/50] target-mips: make cpu-qom.h not target specific
  2016-04-08 20:28 [Qemu-devel] [PATCH for-2.7 00/49] NEED_CPU_H / cpu.h / hw/hw.h cleanups Paolo Bonzini
                   ` (10 preceding siblings ...)
  2016-04-08 20:28 ` [Qemu-devel] [PATCH 11/50] target-microblaze: " Paolo Bonzini
@ 2016-04-08 20:28 ` Paolo Bonzini
  2016-04-08 20:28 ` [Qemu-devel] [PATCH 13/50] target-ppc: do not use target_ulong in cpu-qom.h Paolo Bonzini
                   ` (39 subsequent siblings)
  51 siblings, 0 replies; 72+ messages in thread
From: Paolo Bonzini @ 2016-04-08 20:28 UTC (permalink / raw)
  To: qemu-devel

Make MIPSCPU an opaque type within cpu-qom.h, and move all definitions of
private methods, as well as all type definitions that require knowledge
of the layout to cpu.h.  This helps making files independent of NEED_CPU_H
if they only need to pass around CPU pointers.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 target-mips/cpu-qom.h | 37 +------------------------------------
 target-mips/cpu.h     | 38 +++++++++++++++++++++++++++++++++++++-
 2 files changed, 38 insertions(+), 37 deletions(-)

diff --git a/target-mips/cpu-qom.h b/target-mips/cpu-qom.h
index 4d6f9de..3f5bf23 100644
--- a/target-mips/cpu-qom.h
+++ b/target-mips/cpu-qom.h
@@ -51,41 +51,6 @@ typedef struct MIPSCPUClass {
     void (*parent_reset)(CPUState *cpu);
 } MIPSCPUClass;
 
-/**
- * MIPSCPU:
- * @env: #CPUMIPSState
- *
- * A MIPS CPU.
- */
-typedef struct MIPSCPU {
-    /*< private >*/
-    CPUState parent_obj;
-    /*< public >*/
-
-    CPUMIPSState env;
-} MIPSCPU;
-
-static inline MIPSCPU *mips_env_get_cpu(CPUMIPSState *env)
-{
-    return container_of(env, MIPSCPU, env);
-}
-
-#define ENV_GET_CPU(e) CPU(mips_env_get_cpu(e))
-
-#define ENV_OFFSET offsetof(MIPSCPU, env)
-
-#ifndef CONFIG_USER_ONLY
-extern const struct VMStateDescription vmstate_mips_cpu;
-#endif
-
-void mips_cpu_do_interrupt(CPUState *cpu);
-bool mips_cpu_exec_interrupt(CPUState *cpu, int int_req);
-void mips_cpu_dump_state(CPUState *cpu, FILE *f, fprintf_function cpu_fprintf,
-                         int flags);
-hwaddr mips_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr);
-int mips_cpu_gdb_read_register(CPUState *cpu, uint8_t *buf, int reg);
-int mips_cpu_gdb_write_register(CPUState *cpu, uint8_t *buf, int reg);
-void mips_cpu_do_unaligned_access(CPUState *cpu, vaddr addr,
-                                  int is_write, int is_user, uintptr_t retaddr);
+typedef struct MIPSCPU MIPSCPU;
 
 #endif
diff --git a/target-mips/cpu.h b/target-mips/cpu.h
index 866924d..078fabc 100644
--- a/target-mips/cpu.h
+++ b/target-mips/cpu.h
@@ -8,6 +8,7 @@
 #define CPUArchState struct CPUMIPSState
 
 #include "qemu-common.h"
+#include "cpu-qom.h"
 #include "mips-defs.h"
 #include "exec/cpu-defs.h"
 #include "fpu/softfloat.h"
@@ -615,7 +616,42 @@ struct CPUMIPSState {
     MemoryRegion *itc_tag; /* ITC Configuration Tags */
 };
 
-#include "cpu-qom.h"
+/**
+ * MIPSCPU:
+ * @env: #CPUMIPSState
+ *
+ * A MIPS CPU.
+ */
+struct MIPSCPU {
+    /*< private >*/
+    CPUState parent_obj;
+    /*< public >*/
+
+    CPUMIPSState env;
+};
+
+static inline MIPSCPU *mips_env_get_cpu(CPUMIPSState *env)
+{
+    return container_of(env, MIPSCPU, env);
+}
+
+#define ENV_GET_CPU(e) CPU(mips_env_get_cpu(e))
+
+#define ENV_OFFSET offsetof(MIPSCPU, env)
+
+#ifndef CONFIG_USER_ONLY
+extern const struct VMStateDescription vmstate_mips_cpu;
+#endif
+
+void mips_cpu_do_interrupt(CPUState *cpu);
+bool mips_cpu_exec_interrupt(CPUState *cpu, int int_req);
+void mips_cpu_dump_state(CPUState *cpu, FILE *f, fprintf_function cpu_fprintf,
+                         int flags);
+hwaddr mips_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr);
+int mips_cpu_gdb_read_register(CPUState *cpu, uint8_t *buf, int reg);
+int mips_cpu_gdb_write_register(CPUState *cpu, uint8_t *buf, int reg);
+void mips_cpu_do_unaligned_access(CPUState *cpu, vaddr addr,
+                                  int is_write, int is_user, uintptr_t retaddr);
 
 #if !defined(CONFIG_USER_ONLY)
 int no_mmu_map_address (CPUMIPSState *env, hwaddr *physical, int *prot,
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 72+ messages in thread

* [Qemu-devel] [PATCH 13/50] target-ppc: do not use target_ulong in cpu-qom.h
  2016-04-08 20:28 [Qemu-devel] [PATCH for-2.7 00/49] NEED_CPU_H / cpu.h / hw/hw.h cleanups Paolo Bonzini
                   ` (11 preceding siblings ...)
  2016-04-08 20:28 ` [Qemu-devel] [PATCH 12/50] target-mips: " Paolo Bonzini
@ 2016-04-08 20:28 ` Paolo Bonzini
  2016-04-18 13:46   ` Markus Armbruster
  2016-04-08 20:28 ` [Qemu-devel] [PATCH 14/50] target-ppc: make cpu-qom.h not target specific Paolo Bonzini
                   ` (38 subsequent siblings)
  51 siblings, 1 reply; 72+ messages in thread
From: Paolo Bonzini @ 2016-04-08 20:28 UTC (permalink / raw)
  To: qemu-devel

Bring the PowerPCCPUClass handle_mmu_fault method type into line with
the one in CPUState.

Using vaddr also makes the cpu-qom.h file target independent.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 target-ppc/cpu-qom.h    | 3 +--
 target-ppc/mmu-hash32.c | 2 +-
 target-ppc/mmu-hash32.h | 2 +-
 target-ppc/mmu-hash64.c | 2 +-
 target-ppc/mmu-hash64.h | 2 +-
 5 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/target-ppc/cpu-qom.h b/target-ppc/cpu-qom.h
index eb822a3..bab501f 100644
--- a/target-ppc/cpu-qom.h
+++ b/target-ppc/cpu-qom.h
@@ -73,8 +73,7 @@ typedef struct PowerPCCPUClass {
     void (*init_proc)(CPUPPCState *env);
     int  (*check_pow)(CPUPPCState *env);
 #if defined(CONFIG_SOFTMMU)
-    int (*handle_mmu_fault)(PowerPCCPU *cpu, target_ulong eaddr, int rwx,
-                            int mmu_idx);
+    int (*handle_mmu_fault)(PowerPCCPU *cpu, vaddr eaddr, int rwx, int mmu_idx);
 #endif
     bool (*interrupts_big_endian)(PowerPCCPU *cpu);
 } PowerPCCPUClass;
diff --git a/target-ppc/mmu-hash32.c b/target-ppc/mmu-hash32.c
index 39abb2f..06ce4d6 100644
--- a/target-ppc/mmu-hash32.c
+++ b/target-ppc/mmu-hash32.c
@@ -383,7 +383,7 @@ static hwaddr ppc_hash32_pte_raddr(target_ulong sr, ppc_hash_pte32_t pte,
     return (rpn & ~mask) | (eaddr & mask);
 }
 
-int ppc_hash32_handle_mmu_fault(PowerPCCPU *cpu, target_ulong eaddr, int rwx,
+int ppc_hash32_handle_mmu_fault(PowerPCCPU *cpu, vaddr eaddr, int rwx,
                                 int mmu_idx)
 {
     CPUState *cs = CPU(cpu);
diff --git a/target-ppc/mmu-hash32.h b/target-ppc/mmu-hash32.h
index afbb9dd..aaceacd 100644
--- a/target-ppc/mmu-hash32.h
+++ b/target-ppc/mmu-hash32.h
@@ -5,7 +5,7 @@
 
 hwaddr get_pteg_offset32(PowerPCCPU *cpu, hwaddr hash);
 hwaddr ppc_hash32_get_phys_page_debug(PowerPCCPU *cpu, target_ulong addr);
-int ppc_hash32_handle_mmu_fault(PowerPCCPU *cpu, target_ulong address, int rw,
+int ppc_hash32_handle_mmu_fault(PowerPCCPU *cpu, vaddr address, int rw,
                                 int mmu_idx);
 
 /*
diff --git a/target-ppc/mmu-hash64.c b/target-ppc/mmu-hash64.c
index 72c4ab5..5184626 100644
--- a/target-ppc/mmu-hash64.c
+++ b/target-ppc/mmu-hash64.c
@@ -589,7 +589,7 @@ unsigned ppc_hash64_hpte_page_shift_noslb(PowerPCCPU *cpu,
     return 0;
 }
 
-int ppc_hash64_handle_mmu_fault(PowerPCCPU *cpu, target_ulong eaddr,
+int ppc_hash64_handle_mmu_fault(PowerPCCPU *cpu, vaddr eaddr,
                                 int rwx, int mmu_idx)
 {
     CPUState *cs = CPU(cpu);
diff --git a/target-ppc/mmu-hash64.h b/target-ppc/mmu-hash64.h
index 9bf8b9b..6423b9f 100644
--- a/target-ppc/mmu-hash64.h
+++ b/target-ppc/mmu-hash64.h
@@ -9,7 +9,7 @@ void dump_slb(FILE *f, fprintf_function cpu_fprintf, PowerPCCPU *cpu);
 int ppc_store_slb(PowerPCCPU *cpu, target_ulong slot,
                   target_ulong esid, target_ulong vsid);
 hwaddr ppc_hash64_get_phys_page_debug(PowerPCCPU *cpu, target_ulong addr);
-int ppc_hash64_handle_mmu_fault(PowerPCCPU *cpu, target_ulong address, int rw,
+int ppc_hash64_handle_mmu_fault(PowerPCCPU *cpu, vaddr address, int rw,
                                 int mmu_idx);
 void ppc_hash64_store_hpte(PowerPCCPU *cpu, target_ulong index,
                            target_ulong pte0, target_ulong pte1);
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 72+ messages in thread

* [Qemu-devel] [PATCH 14/50] target-ppc: make cpu-qom.h not target specific
  2016-04-08 20:28 [Qemu-devel] [PATCH for-2.7 00/49] NEED_CPU_H / cpu.h / hw/hw.h cleanups Paolo Bonzini
                   ` (12 preceding siblings ...)
  2016-04-08 20:28 ` [Qemu-devel] [PATCH 13/50] target-ppc: do not use target_ulong in cpu-qom.h Paolo Bonzini
@ 2016-04-08 20:28 ` Paolo Bonzini
  2016-04-08 20:28 ` [Qemu-devel] [PATCH 15/50] target-s390x: " Paolo Bonzini
                   ` (37 subsequent siblings)
  51 siblings, 0 replies; 72+ messages in thread
From: Paolo Bonzini @ 2016-04-08 20:28 UTC (permalink / raw)
  To: qemu-devel

Make PowerPCCPU an opaque type within cpu-qom.h, and move all definitions
of private methods, as well as all type definitions that require knowledge
of the layout to cpu.h.  Conversely, move all definitions needed to define
a class to cpu-qom.h.  This helps making files independent of NEED_CPU_H
if they only need to pass around CPU pointers.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 target-ppc/cpu-qom.h | 161 ++++++++++++++++++++++++++++++++++----------------
 target-ppc/cpu.h     | 164 ++++++++++++++++-----------------------------------
 2 files changed, 163 insertions(+), 162 deletions(-)

diff --git a/target-ppc/cpu-qom.h b/target-ppc/cpu-qom.h
index bab501f..49c71fa 100644
--- a/target-ppc/cpu-qom.h
+++ b/target-ppc/cpu-qom.h
@@ -38,6 +38,117 @@
     OBJECT_GET_CLASS(PowerPCCPUClass, (obj), TYPE_POWERPC_CPU)
 
 typedef struct PowerPCCPU PowerPCCPU;
+typedef struct CPUPPCState CPUPPCState;
+typedef struct ppc_tb_t ppc_tb_t;
+typedef struct ppc_dcr_t ppc_dcr_t;
+
+/*****************************************************************************/
+/* MMU model                                                                 */
+typedef enum powerpc_mmu_t powerpc_mmu_t;
+enum powerpc_mmu_t {
+    POWERPC_MMU_UNKNOWN    = 0x00000000,
+    /* Standard 32 bits PowerPC MMU                            */
+    POWERPC_MMU_32B        = 0x00000001,
+    /* PowerPC 6xx MMU with software TLB                       */
+    POWERPC_MMU_SOFT_6xx   = 0x00000002,
+    /* PowerPC 74xx MMU with software TLB                      */
+    POWERPC_MMU_SOFT_74xx  = 0x00000003,
+    /* PowerPC 4xx MMU with software TLB                       */
+    POWERPC_MMU_SOFT_4xx   = 0x00000004,
+    /* PowerPC 4xx MMU with software TLB and zones protections */
+    POWERPC_MMU_SOFT_4xx_Z = 0x00000005,
+    /* PowerPC MMU in real mode only                           */
+    POWERPC_MMU_REAL       = 0x00000006,
+    /* Freescale MPC8xx MMU model                              */
+    POWERPC_MMU_MPC8xx     = 0x00000007,
+    /* BookE MMU model                                         */
+    POWERPC_MMU_BOOKE      = 0x00000008,
+    /* BookE 2.06 MMU model                                    */
+    POWERPC_MMU_BOOKE206   = 0x00000009,
+    /* PowerPC 601 MMU model (specific BATs format)            */
+    POWERPC_MMU_601        = 0x0000000A,
+#if defined(TARGET_PPC64)
+#define POWERPC_MMU_64       0x00010000
+#define POWERPC_MMU_1TSEG    0x00020000
+#define POWERPC_MMU_AMR      0x00040000
+    /* 64 bits PowerPC MMU                                     */
+    POWERPC_MMU_64B        = POWERPC_MMU_64 | 0x00000001,
+    /* Architecture 2.03 and later (has LPCR) */
+    POWERPC_MMU_2_03       = POWERPC_MMU_64 | 0x00000002,
+    /* Architecture 2.06 variant                               */
+    POWERPC_MMU_2_06       = POWERPC_MMU_64 | POWERPC_MMU_1TSEG
+                             | POWERPC_MMU_AMR | 0x00000003,
+    /* Architecture 2.06 "degraded" (no 1T segments)           */
+    POWERPC_MMU_2_06a      = POWERPC_MMU_64 | POWERPC_MMU_AMR
+                             | 0x00000003,
+    /* Architecture 2.07 variant                               */
+    POWERPC_MMU_2_07       = POWERPC_MMU_64 | POWERPC_MMU_1TSEG
+                             | POWERPC_MMU_AMR | 0x00000004,
+    /* Architecture 2.07 "degraded" (no 1T segments)           */
+    POWERPC_MMU_2_07a      = POWERPC_MMU_64 | POWERPC_MMU_AMR
+                             | 0x00000004,
+#endif /* defined(TARGET_PPC64) */
+};
+
+/*****************************************************************************/
+/* Exception model                                                           */
+typedef enum powerpc_excp_t powerpc_excp_t;
+enum powerpc_excp_t {
+    POWERPC_EXCP_UNKNOWN   = 0,
+    /* Standard PowerPC exception model */
+    POWERPC_EXCP_STD,
+    /* PowerPC 40x exception model      */
+    POWERPC_EXCP_40x,
+    /* PowerPC 601 exception model      */
+    POWERPC_EXCP_601,
+    /* PowerPC 602 exception model      */
+    POWERPC_EXCP_602,
+    /* PowerPC 603 exception model      */
+    POWERPC_EXCP_603,
+    /* PowerPC 603e exception model     */
+    POWERPC_EXCP_603E,
+    /* PowerPC G2 exception model       */
+    POWERPC_EXCP_G2,
+    /* PowerPC 604 exception model      */
+    POWERPC_EXCP_604,
+    /* PowerPC 7x0 exception model      */
+    POWERPC_EXCP_7x0,
+    /* PowerPC 7x5 exception model      */
+    POWERPC_EXCP_7x5,
+    /* PowerPC 74xx exception model     */
+    POWERPC_EXCP_74xx,
+    /* BookE exception model            */
+    POWERPC_EXCP_BOOKE,
+#if defined(TARGET_PPC64)
+    /* PowerPC 970 exception model      */
+    POWERPC_EXCP_970,
+    /* POWER7 exception model           */
+    POWERPC_EXCP_POWER7,
+    /* POWER8 exception model           */
+    POWERPC_EXCP_POWER8,
+#endif /* defined(TARGET_PPC64) */
+};
+
+/*****************************************************************************/
+/* Input pins model                                                          */
+typedef enum powerpc_input_t powerpc_input_t;
+enum powerpc_input_t {
+    PPC_FLAGS_INPUT_UNKNOWN = 0,
+    /* PowerPC 6xx bus                  */
+    PPC_FLAGS_INPUT_6xx,
+    /* BookE bus                        */
+    PPC_FLAGS_INPUT_BookE,
+    /* PowerPC 405 bus                  */
+    PPC_FLAGS_INPUT_405,
+    /* PowerPC 970 bus                  */
+    PPC_FLAGS_INPUT_970,
+    /* PowerPC POWER7 bus               */
+    PPC_FLAGS_INPUT_POWER7,
+    /* PowerPC 401 bus                  */
+    PPC_FLAGS_INPUT_401,
+    /* Freescale RCPU bus               */
+    PPC_FLAGS_INPUT_RCPU,
+};
 
 /**
  * PowerPCCPUClass:
@@ -78,57 +189,7 @@ typedef struct PowerPCCPUClass {
     bool (*interrupts_big_endian)(PowerPCCPU *cpu);
 } PowerPCCPUClass;
 
-/**
- * PowerPCCPU:
- * @env: #CPUPPCState
- * @cpu_dt_id: CPU index used in the device tree. KVM uses this index too
- * @max_compat: Maximal supported logical PVR from the command line
- * @cpu_version: Current logical PVR, zero if in "raw" mode
- *
- * A PowerPC CPU.
- */
-struct PowerPCCPU {
-    /*< private >*/
-    CPUState parent_obj;
-    /*< public >*/
-
-    CPUPPCState env;
-    int cpu_dt_id;
-    uint32_t max_compat;
-    uint32_t cpu_version;
-};
-
-static inline PowerPCCPU *ppc_env_get_cpu(CPUPPCState *env)
-{
-    return container_of(env, PowerPCCPU, env);
-}
-
-#define ENV_GET_CPU(e) CPU(ppc_env_get_cpu(e))
-
-#define ENV_OFFSET offsetof(PowerPCCPU, env)
-
-PowerPCCPUClass *ppc_cpu_class_by_pvr(uint32_t pvr);
-PowerPCCPUClass *ppc_cpu_class_by_pvr_mask(uint32_t pvr);
-
-void ppc_cpu_do_interrupt(CPUState *cpu);
-bool ppc_cpu_exec_interrupt(CPUState *cpu, int int_req);
-void ppc_cpu_dump_state(CPUState *cpu, FILE *f, fprintf_function cpu_fprintf,
-                        int flags);
-void ppc_cpu_dump_statistics(CPUState *cpu, FILE *f,
-                             fprintf_function cpu_fprintf, int flags);
-int ppc_cpu_get_monitor_def(CPUState *cs, const char *name,
-                            uint64_t *pval);
-hwaddr ppc_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr);
-int ppc_cpu_gdb_read_register(CPUState *cpu, uint8_t *buf, int reg);
-int ppc_cpu_gdb_read_register_apple(CPUState *cpu, uint8_t *buf, int reg);
-int ppc_cpu_gdb_write_register(CPUState *cpu, uint8_t *buf, int reg);
-int ppc_cpu_gdb_write_register_apple(CPUState *cpu, uint8_t *buf, int reg);
-int ppc64_cpu_write_elf64_note(WriteCoreDumpFunction f, CPUState *cs,
-                               int cpuid, void *opaque);
 #ifndef CONFIG_USER_ONLY
-void ppc_cpu_do_system_reset(CPUState *cs);
-extern const struct VMStateDescription vmstate_ppc_cpu;
-
 typedef struct PPCTimebase {
     uint64_t guest_timebase;
     int64_t time_of_the_day_ns;
diff --git a/target-ppc/cpu.h b/target-ppc/cpu.h
index 9d4e43c..bcd29d1 100644
--- a/target-ppc/cpu.h
+++ b/target-ppc/cpu.h
@@ -76,7 +76,7 @@
 #define CPUArchState struct CPUPPCState
 
 #include "exec/cpu-defs.h"
-
+#include "cpu-qom.h"
 #include "fpu/softfloat.h"
 
 #if defined (TARGET_PPC64)
@@ -86,93 +86,6 @@
 #endif
 
 /*****************************************************************************/
-/* MMU model                                                                 */
-typedef enum powerpc_mmu_t powerpc_mmu_t;
-enum powerpc_mmu_t {
-    POWERPC_MMU_UNKNOWN    = 0x00000000,
-    /* Standard 32 bits PowerPC MMU                            */
-    POWERPC_MMU_32B        = 0x00000001,
-    /* PowerPC 6xx MMU with software TLB                       */
-    POWERPC_MMU_SOFT_6xx   = 0x00000002,
-    /* PowerPC 74xx MMU with software TLB                      */
-    POWERPC_MMU_SOFT_74xx  = 0x00000003,
-    /* PowerPC 4xx MMU with software TLB                       */
-    POWERPC_MMU_SOFT_4xx   = 0x00000004,
-    /* PowerPC 4xx MMU with software TLB and zones protections */
-    POWERPC_MMU_SOFT_4xx_Z = 0x00000005,
-    /* PowerPC MMU in real mode only                           */
-    POWERPC_MMU_REAL       = 0x00000006,
-    /* Freescale MPC8xx MMU model                              */
-    POWERPC_MMU_MPC8xx     = 0x00000007,
-    /* BookE MMU model                                         */
-    POWERPC_MMU_BOOKE      = 0x00000008,
-    /* BookE 2.06 MMU model                                    */
-    POWERPC_MMU_BOOKE206   = 0x00000009,
-    /* PowerPC 601 MMU model (specific BATs format)            */
-    POWERPC_MMU_601        = 0x0000000A,
-#if defined(TARGET_PPC64)
-#define POWERPC_MMU_64       0x00010000
-#define POWERPC_MMU_1TSEG    0x00020000
-#define POWERPC_MMU_AMR      0x00040000
-    /* 64 bits PowerPC MMU                                     */
-    POWERPC_MMU_64B        = POWERPC_MMU_64 | 0x00000001,
-    /* Architecture 2.03 and later (has LPCR) */
-    POWERPC_MMU_2_03       = POWERPC_MMU_64 | 0x00000002,
-    /* Architecture 2.06 variant                               */
-    POWERPC_MMU_2_06       = POWERPC_MMU_64 | POWERPC_MMU_1TSEG
-                             | POWERPC_MMU_AMR | 0x00000003,
-    /* Architecture 2.06 "degraded" (no 1T segments)           */
-    POWERPC_MMU_2_06a      = POWERPC_MMU_64 | POWERPC_MMU_AMR
-                             | 0x00000003,
-    /* Architecture 2.07 variant                               */
-    POWERPC_MMU_2_07       = POWERPC_MMU_64 | POWERPC_MMU_1TSEG
-                             | POWERPC_MMU_AMR | 0x00000004,
-    /* Architecture 2.07 "degraded" (no 1T segments)           */
-    POWERPC_MMU_2_07a      = POWERPC_MMU_64 | POWERPC_MMU_AMR
-                             | 0x00000004,
-#endif /* defined(TARGET_PPC64) */
-};
-
-/*****************************************************************************/
-/* Exception model                                                           */
-typedef enum powerpc_excp_t powerpc_excp_t;
-enum powerpc_excp_t {
-    POWERPC_EXCP_UNKNOWN   = 0,
-    /* Standard PowerPC exception model */
-    POWERPC_EXCP_STD,
-    /* PowerPC 40x exception model      */
-    POWERPC_EXCP_40x,
-    /* PowerPC 601 exception model      */
-    POWERPC_EXCP_601,
-    /* PowerPC 602 exception model      */
-    POWERPC_EXCP_602,
-    /* PowerPC 603 exception model      */
-    POWERPC_EXCP_603,
-    /* PowerPC 603e exception model     */
-    POWERPC_EXCP_603E,
-    /* PowerPC G2 exception model       */
-    POWERPC_EXCP_G2,
-    /* PowerPC 604 exception model      */
-    POWERPC_EXCP_604,
-    /* PowerPC 7x0 exception model      */
-    POWERPC_EXCP_7x0,
-    /* PowerPC 7x5 exception model      */
-    POWERPC_EXCP_7x5,
-    /* PowerPC 74xx exception model     */
-    POWERPC_EXCP_74xx,
-    /* BookE exception model            */
-    POWERPC_EXCP_BOOKE,
-#if defined(TARGET_PPC64)
-    /* PowerPC 970 exception model      */
-    POWERPC_EXCP_970,
-    /* POWER7 exception model           */
-    POWERPC_EXCP_POWER7,
-    /* POWER8 exception model           */
-    POWERPC_EXCP_POWER8,
-#endif /* defined(TARGET_PPC64) */
-};
-
-/*****************************************************************************/
 /* Exception vectors definitions                                             */
 enum {
     POWERPC_EXCP_NONE    = -1,
@@ -297,27 +210,6 @@ enum {
     POWERPC_EXCP_TRAP          = 0x40,
 };
 
-/*****************************************************************************/
-/* Input pins model                                                          */
-typedef enum powerpc_input_t powerpc_input_t;
-enum powerpc_input_t {
-    PPC_FLAGS_INPUT_UNKNOWN = 0,
-    /* PowerPC 6xx bus                  */
-    PPC_FLAGS_INPUT_6xx,
-    /* BookE bus                        */
-    PPC_FLAGS_INPUT_BookE,
-    /* PowerPC 405 bus                  */
-    PPC_FLAGS_INPUT_405,
-    /* PowerPC 970 bus                  */
-    PPC_FLAGS_INPUT_970,
-    /* PowerPC POWER7 bus               */
-    PPC_FLAGS_INPUT_POWER7,
-    /* PowerPC 401 bus                  */
-    PPC_FLAGS_INPUT_401,
-    /* Freescale RCPU bus               */
-    PPC_FLAGS_INPUT_RCPU,
-};
-
 #define PPC_INPUT(env) (env->bus_model)
 
 /*****************************************************************************/
@@ -327,9 +219,7 @@ typedef struct opc_handler_t opc_handler_t;
 /* Types used to describe some PowerPC registers */
 typedef struct CPUPPCState CPUPPCState;
 typedef struct DisasContext DisasContext;
-typedef struct ppc_tb_t ppc_tb_t;
 typedef struct ppc_spr_t ppc_spr_t;
-typedef struct ppc_dcr_t ppc_dcr_t;
 typedef union ppc_avr_t ppc_avr_t;
 typedef union ppc_tlb_t ppc_tlb_t;
 
@@ -1215,7 +1105,57 @@ do {                                            \
     env->wdt_period[3] = (d_);                  \
  } while (0)
 
-#include "cpu-qom.h"
+/**
+ * PowerPCCPU:
+ * @env: #CPUPPCState
+ * @cpu_dt_id: CPU index used in the device tree. KVM uses this index too
+ * @max_compat: Maximal supported logical PVR from the command line
+ * @cpu_version: Current logical PVR, zero if in "raw" mode
+ *
+ * A PowerPC CPU.
+ */
+struct PowerPCCPU {
+    /*< private >*/
+    CPUState parent_obj;
+    /*< public >*/
+
+    CPUPPCState env;
+    int cpu_dt_id;
+    uint32_t max_compat;
+    uint32_t cpu_version;
+};
+
+static inline PowerPCCPU *ppc_env_get_cpu(CPUPPCState *env)
+{
+    return container_of(env, PowerPCCPU, env);
+}
+
+#define ENV_GET_CPU(e) CPU(ppc_env_get_cpu(e))
+
+#define ENV_OFFSET offsetof(PowerPCCPU, env)
+
+PowerPCCPUClass *ppc_cpu_class_by_pvr(uint32_t pvr);
+PowerPCCPUClass *ppc_cpu_class_by_pvr_mask(uint32_t pvr);
+
+void ppc_cpu_do_interrupt(CPUState *cpu);
+bool ppc_cpu_exec_interrupt(CPUState *cpu, int int_req);
+void ppc_cpu_dump_state(CPUState *cpu, FILE *f, fprintf_function cpu_fprintf,
+                        int flags);
+void ppc_cpu_dump_statistics(CPUState *cpu, FILE *f,
+                             fprintf_function cpu_fprintf, int flags);
+int ppc_cpu_get_monitor_def(CPUState *cs, const char *name,
+                            uint64_t *pval);
+hwaddr ppc_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr);
+int ppc_cpu_gdb_read_register(CPUState *cpu, uint8_t *buf, int reg);
+int ppc_cpu_gdb_read_register_apple(CPUState *cpu, uint8_t *buf, int reg);
+int ppc_cpu_gdb_write_register(CPUState *cpu, uint8_t *buf, int reg);
+int ppc_cpu_gdb_write_register_apple(CPUState *cpu, uint8_t *buf, int reg);
+int ppc64_cpu_write_elf64_note(WriteCoreDumpFunction f, CPUState *cs,
+                               int cpuid, void *opaque);
+#ifndef CONFIG_USER_ONLY
+void ppc_cpu_do_system_reset(CPUState *cs);
+extern const struct VMStateDescription vmstate_ppc_cpu;
+#endif
 
 /*****************************************************************************/
 PowerPCCPU *cpu_ppc_init(const char *cpu_model);
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 72+ messages in thread

* [Qemu-devel] [PATCH 15/50] target-s390x: make cpu-qom.h not target specific
  2016-04-08 20:28 [Qemu-devel] [PATCH for-2.7 00/49] NEED_CPU_H / cpu.h / hw/hw.h cleanups Paolo Bonzini
                   ` (13 preceding siblings ...)
  2016-04-08 20:28 ` [Qemu-devel] [PATCH 14/50] target-ppc: make cpu-qom.h not target specific Paolo Bonzini
@ 2016-04-08 20:28 ` Paolo Bonzini
  2016-04-08 20:28 ` [Qemu-devel] [PATCH 16/50] target-sh4: " Paolo Bonzini
                   ` (36 subsequent siblings)
  51 siblings, 0 replies; 72+ messages in thread
From: Paolo Bonzini @ 2016-04-08 20:28 UTC (permalink / raw)
  To: qemu-devel

Make S390XCPU an opaque type within cpu-qom.h, and move all definitions
of private methods, as well as all type definitions that require knowledge
of the layout to cpu.h.  This helps making files independent of NEED_CPU_H
if they only need to pass around CPU pointers.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 target-s390x/cpu-qom.h | 45 +--------------------------------------------
 target-s390x/cpu.h     | 47 ++++++++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 47 insertions(+), 45 deletions(-)

diff --git a/target-s390x/cpu-qom.h b/target-s390x/cpu-qom.h
index 681e370..66b5d18 100644
--- a/target-s390x/cpu-qom.h
+++ b/target-s390x/cpu-qom.h
@@ -55,49 +55,6 @@ typedef struct S390CPUClass {
     void (*initial_cpu_reset)(CPUState *cpu);
 } S390CPUClass;
 
-/**
- * S390CPU:
- * @env: #CPUS390XState.
- *
- * An S/390 CPU.
- */
-typedef struct S390CPU {
-    /*< private >*/
-    CPUState parent_obj;
-    /*< public >*/
-
-    CPUS390XState env;
-    int64_t id;
-    /* needed for live migration */
-    void *irqstate;
-    uint32_t irqstate_saved_size;
-} S390CPU;
-
-static inline S390CPU *s390_env_get_cpu(CPUS390XState *env)
-{
-    return container_of(env, S390CPU, env);
-}
-
-#define ENV_GET_CPU(e) CPU(s390_env_get_cpu(e))
-
-#define ENV_OFFSET offsetof(S390CPU, env)
-
-#ifndef CONFIG_USER_ONLY
-extern const struct VMStateDescription vmstate_s390_cpu;
-#endif
-
-void s390_cpu_do_interrupt(CPUState *cpu);
-bool s390_cpu_exec_interrupt(CPUState *cpu, int int_req);
-void s390_cpu_dump_state(CPUState *cpu, FILE *f, fprintf_function cpu_fprintf,
-                         int flags);
-int s390_cpu_write_elf64_note(WriteCoreDumpFunction f, CPUState *cs,
-                              int cpuid, void *opaque);
-
-hwaddr s390_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr);
-hwaddr s390_cpu_get_phys_addr_debug(CPUState *cpu, vaddr addr);
-int s390_cpu_gdb_read_register(CPUState *cpu, uint8_t *buf, int reg);
-int s390_cpu_gdb_write_register(CPUState *cpu, uint8_t *buf, int reg);
-void s390_cpu_gdb_init(CPUState *cs);
-void s390x_cpu_debug_excp_handler(CPUState *cs);
+typedef struct S390CPU S390CPU;
 
 #endif
diff --git a/target-s390x/cpu.h b/target-s390x/cpu.h
index 6d97c08..760eadf 100644
--- a/target-s390x/cpu.h
+++ b/target-s390x/cpu.h
@@ -23,6 +23,7 @@
 #define CPU_S390X_H
 
 #include "qemu-common.h"
+#include "cpu-qom.h"
 
 #define TARGET_LONG_BITS 64
 
@@ -171,7 +172,51 @@ static inline CPU_DoubleU *get_freg(CPUS390XState *cs, int nr)
     return &cs->vregs[nr][0];
 }
 
-#include "cpu-qom.h"
+/**
+ * S390CPU:
+ * @env: #CPUS390XState.
+ *
+ * An S/390 CPU.
+ */
+struct S390CPU {
+    /*< private >*/
+    CPUState parent_obj;
+    /*< public >*/
+
+    CPUS390XState env;
+    int64_t id;
+    /* needed for live migration */
+    void *irqstate;
+    uint32_t irqstate_saved_size;
+};
+
+static inline S390CPU *s390_env_get_cpu(CPUS390XState *env)
+{
+    return container_of(env, S390CPU, env);
+}
+
+#define ENV_GET_CPU(e) CPU(s390_env_get_cpu(e))
+
+#define ENV_OFFSET offsetof(S390CPU, env)
+
+#ifndef CONFIG_USER_ONLY
+extern const struct VMStateDescription vmstate_s390_cpu;
+#endif
+
+void s390_cpu_do_interrupt(CPUState *cpu);
+bool s390_cpu_exec_interrupt(CPUState *cpu, int int_req);
+void s390_cpu_dump_state(CPUState *cpu, FILE *f, fprintf_function cpu_fprintf,
+                         int flags);
+int s390_cpu_write_elf64_note(WriteCoreDumpFunction f, CPUState *cs,
+                              int cpuid, void *opaque);
+
+hwaddr s390_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr);
+hwaddr s390_cpu_get_phys_addr_debug(CPUState *cpu, vaddr addr);
+int s390_cpu_gdb_read_register(CPUState *cpu, uint8_t *buf, int reg);
+int s390_cpu_gdb_write_register(CPUState *cpu, uint8_t *buf, int reg);
+void s390_cpu_gdb_init(CPUState *cs);
+void s390x_cpu_debug_excp_handler(CPUState *cs);
+
 #include <sysemu/kvm.h>
 
 /* distinguish between 24 bit and 31 bit addressing */
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 72+ messages in thread

* [Qemu-devel] [PATCH 16/50] target-sh4: make cpu-qom.h not target specific
  2016-04-08 20:28 [Qemu-devel] [PATCH for-2.7 00/49] NEED_CPU_H / cpu.h / hw/hw.h cleanups Paolo Bonzini
                   ` (14 preceding siblings ...)
  2016-04-08 20:28 ` [Qemu-devel] [PATCH 15/50] target-s390x: " Paolo Bonzini
@ 2016-04-08 20:28 ` Paolo Bonzini
  2016-04-08 20:28 ` [Qemu-devel] [PATCH 17/50] target-sparc: " Paolo Bonzini
                   ` (35 subsequent siblings)
  51 siblings, 0 replies; 72+ messages in thread
From: Paolo Bonzini @ 2016-04-08 20:28 UTC (permalink / raw)
  To: qemu-devel

Make SuperHCPU an opaque type within cpu-qom.h, and move all definitions
of private methods, as well as all type definitions that require knowledge
of the layout to cpu.h.  This helps making files independent of NEED_CPU_H
if they only need to pass around CPU pointers.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 target-sh4/cpu-qom.h | 31 +------------------------------
 target-sh4/cpu.h     | 32 +++++++++++++++++++++++++++++++-
 2 files changed, 32 insertions(+), 31 deletions(-)

diff --git a/target-sh4/cpu-qom.h b/target-sh4/cpu-qom.h
index 6341238..01abb20 100644
--- a/target-sh4/cpu-qom.h
+++ b/target-sh4/cpu-qom.h
@@ -60,35 +60,6 @@ typedef struct SuperHCPUClass {
     uint32_t cvr;
 } SuperHCPUClass;
 
-/**
- * SuperHCPU:
- * @env: #CPUSH4State
- *
- * A SuperH CPU.
- */
-typedef struct SuperHCPU {
-    /*< private >*/
-    CPUState parent_obj;
-    /*< public >*/
-
-    CPUSH4State env;
-} SuperHCPU;
-
-static inline SuperHCPU *sh_env_get_cpu(CPUSH4State *env)
-{
-    return container_of(env, SuperHCPU, env);
-}
-
-#define ENV_GET_CPU(e) CPU(sh_env_get_cpu(e))
-
-#define ENV_OFFSET offsetof(SuperHCPU, env)
-
-void superh_cpu_do_interrupt(CPUState *cpu);
-bool superh_cpu_exec_interrupt(CPUState *cpu, int int_req);
-void superh_cpu_dump_state(CPUState *cpu, FILE *f,
-                           fprintf_function cpu_fprintf, int flags);
-hwaddr superh_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr);
-int superh_cpu_gdb_read_register(CPUState *cpu, uint8_t *buf, int reg);
-int superh_cpu_gdb_write_register(CPUState *cpu, uint8_t *buf, int reg);
+typedef struct SuperHCPU SuperHCPU;
 
 #endif
diff --git a/target-sh4/cpu.h b/target-sh4/cpu.h
index 3b23e96..0acb60c 100644
--- a/target-sh4/cpu.h
+++ b/target-sh4/cpu.h
@@ -20,6 +20,7 @@
 #define _CPU_SH4_H
 
 #include "qemu-common.h"
+#include "cpu-qom.h"
 
 #define TARGET_LONG_BITS 32
 
@@ -187,7 +188,36 @@ typedef struct CPUSH4State {
     memory_content **movcal_backup_tail;
 } CPUSH4State;
 
-#include "cpu-qom.h"
+/**
+ * SuperHCPU:
+ * @env: #CPUSH4State
+ *
+ * A SuperH CPU.
+ */
+struct SuperHCPU {
+    /*< private >*/
+    CPUState parent_obj;
+    /*< public >*/
+
+    CPUSH4State env;
+};
+
+static inline SuperHCPU *sh_env_get_cpu(CPUSH4State *env)
+{
+    return container_of(env, SuperHCPU, env);
+}
+
+#define ENV_GET_CPU(e) CPU(sh_env_get_cpu(e))
+
+#define ENV_OFFSET offsetof(SuperHCPU, env)
+
+void superh_cpu_do_interrupt(CPUState *cpu);
+bool superh_cpu_exec_interrupt(CPUState *cpu, int int_req);
+void superh_cpu_dump_state(CPUState *cpu, FILE *f,
+                           fprintf_function cpu_fprintf, int flags);
+hwaddr superh_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr);
+int superh_cpu_gdb_read_register(CPUState *cpu, uint8_t *buf, int reg);
+int superh_cpu_gdb_write_register(CPUState *cpu, uint8_t *buf, int reg);
 
 void sh4_translate_init(void);
 SuperHCPU *cpu_sh4_init(const char *cpu_model);
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 72+ messages in thread

* [Qemu-devel] [PATCH 17/50] target-sparc: make cpu-qom.h not target specific
  2016-04-08 20:28 [Qemu-devel] [PATCH for-2.7 00/49] NEED_CPU_H / cpu.h / hw/hw.h cleanups Paolo Bonzini
                   ` (15 preceding siblings ...)
  2016-04-08 20:28 ` [Qemu-devel] [PATCH 16/50] target-sh4: " Paolo Bonzini
@ 2016-04-08 20:28 ` Paolo Bonzini
  2016-04-08 20:28 ` [Qemu-devel] [PATCH 18/50] target-tricore: " Paolo Bonzini
                   ` (34 subsequent siblings)
  51 siblings, 0 replies; 72+ messages in thread
From: Paolo Bonzini @ 2016-04-08 20:28 UTC (permalink / raw)
  To: qemu-devel

Make SPARCCPU an opaque type within cpu-qom.h, and move all definitions
of private methods, as well as all type definitions that require knowledge
of the layout to cpu.h.  This helps making files independent of NEED_CPU_H
if they only need to pass around CPU pointers.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 target-sparc/cpu-qom.h | 37 +------------------------------------
 target-sparc/cpu.h     | 38 +++++++++++++++++++++++++++++++++++++-
 2 files changed, 38 insertions(+), 37 deletions(-)

diff --git a/target-sparc/cpu-qom.h b/target-sparc/cpu-qom.h
index 174dfd3..f63af72 100644
--- a/target-sparc/cpu-qom.h
+++ b/target-sparc/cpu-qom.h
@@ -51,41 +51,6 @@ typedef struct SPARCCPUClass {
     void (*parent_reset)(CPUState *cpu);
 } SPARCCPUClass;
 
-/**
- * SPARCCPU:
- * @env: #CPUSPARCState
- *
- * A SPARC CPU.
- */
-typedef struct SPARCCPU {
-    /*< private >*/
-    CPUState parent_obj;
-    /*< public >*/
-
-    CPUSPARCState env;
-} SPARCCPU;
-
-static inline SPARCCPU *sparc_env_get_cpu(CPUSPARCState *env)
-{
-    return container_of(env, SPARCCPU, env);
-}
-
-#define ENV_GET_CPU(e) CPU(sparc_env_get_cpu(e))
-
-#define ENV_OFFSET offsetof(SPARCCPU, env)
-
-#ifndef CONFIG_USER_ONLY
-extern const struct VMStateDescription vmstate_sparc_cpu;
-#endif
-
-void sparc_cpu_do_interrupt(CPUState *cpu);
-void sparc_cpu_dump_state(CPUState *cpu, FILE *f,
-                          fprintf_function cpu_fprintf, int flags);
-hwaddr sparc_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr);
-int sparc_cpu_gdb_read_register(CPUState *cpu, uint8_t *buf, int reg);
-int sparc_cpu_gdb_write_register(CPUState *cpu, uint8_t *buf, int reg);
-void QEMU_NORETURN sparc_cpu_do_unaligned_access(CPUState *cpu,
-                                                 vaddr addr, int is_write,
-                                                 int is_user, uintptr_t retaddr);
+typedef struct SPARCCPU SPARCCPU;
 
 #endif
diff --git a/target-sparc/cpu.h b/target-sparc/cpu.h
index dc46122..55981b5 100644
--- a/target-sparc/cpu.h
+++ b/target-sparc/cpu.h
@@ -3,6 +3,7 @@
 
 #include "qemu-common.h"
 #include "qemu/bswap.h"
+#include "cpu-qom.h"
 
 #define ALIGNED_ONLY
 
@@ -506,7 +507,42 @@ struct CPUSPARCState {
     uint32_t cache_control;
 };
 
-#include "cpu-qom.h"
+/**
+ * SPARCCPU:
+ * @env: #CPUSPARCState
+ *
+ * A SPARC CPU.
+ */
+struct SPARCCPU {
+    /*< private >*/
+    CPUState parent_obj;
+    /*< public >*/
+
+    CPUSPARCState env;
+};
+
+static inline SPARCCPU *sparc_env_get_cpu(CPUSPARCState *env)
+{
+    return container_of(env, SPARCCPU, env);
+}
+
+#define ENV_GET_CPU(e) CPU(sparc_env_get_cpu(e))
+
+#define ENV_OFFSET offsetof(SPARCCPU, env)
+
+#ifndef CONFIG_USER_ONLY
+extern const struct VMStateDescription vmstate_sparc_cpu;
+#endif
+
+void sparc_cpu_do_interrupt(CPUState *cpu);
+void sparc_cpu_dump_state(CPUState *cpu, FILE *f,
+                          fprintf_function cpu_fprintf, int flags);
+hwaddr sparc_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr);
+int sparc_cpu_gdb_read_register(CPUState *cpu, uint8_t *buf, int reg);
+int sparc_cpu_gdb_write_register(CPUState *cpu, uint8_t *buf, int reg);
+void QEMU_NORETURN sparc_cpu_do_unaligned_access(CPUState *cpu,
+                                                 vaddr addr, int is_write,
+                                                 int is_user, uintptr_t retaddr);
 
 #ifndef NO_CPU_IO_DEFS
 /* cpu_init.c */
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 72+ messages in thread

* [Qemu-devel] [PATCH 18/50] target-tricore: make cpu-qom.h not target specific
  2016-04-08 20:28 [Qemu-devel] [PATCH for-2.7 00/49] NEED_CPU_H / cpu.h / hw/hw.h cleanups Paolo Bonzini
                   ` (16 preceding siblings ...)
  2016-04-08 20:28 ` [Qemu-devel] [PATCH 17/50] target-sparc: " Paolo Bonzini
@ 2016-04-08 20:28 ` Paolo Bonzini
  2016-04-08 20:28 ` [Qemu-devel] [PATCH 19/50] target-unicore32: " Paolo Bonzini
                   ` (33 subsequent siblings)
  51 siblings, 0 replies; 72+ messages in thread
From: Paolo Bonzini @ 2016-04-08 20:28 UTC (permalink / raw)
  To: qemu-devel

Make TriCoreCPU an opaque type within cpu-qom.h, and move all definitions
of private methods, as well as all type definitions that require knowledge
of the layout to cpu.h.  This helps making files independent of NEED_CPU_H
if they only need to pass around CPU pointers.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 target-tricore/cpu-qom.h | 28 +---------------------------
 target-tricore/cpu.h     | 30 +++++++++++++++++++++++++++++-
 2 files changed, 30 insertions(+), 28 deletions(-)

diff --git a/target-tricore/cpu-qom.h b/target-tricore/cpu-qom.h
index 66c9664..399c98f 100644
--- a/target-tricore/cpu-qom.h
+++ b/target-tricore/cpu-qom.h
@@ -39,32 +39,6 @@ typedef struct TriCoreCPUClass {
     void (*parent_reset)(CPUState *cpu);
 } TriCoreCPUClass;
 
-/**
- * TriCoreCPU:
- * @env: #CPUTriCoreState
- *
- * A TriCore CPU.
- */
-typedef struct TriCoreCPU {
-    /*< private >*/
-    CPUState parent_obj;
-    /*< public >*/
-
-    CPUTriCoreState env;
-} TriCoreCPU;
-
-static inline TriCoreCPU *tricore_env_get_cpu(CPUTriCoreState *env)
-{
-    return TRICORE_CPU(container_of(env, TriCoreCPU, env));
-}
-
-#define ENV_GET_CPU(e) CPU(tricore_env_get_cpu(e))
-
-#define ENV_OFFSET offsetof(TriCoreCPU, env)
-
-hwaddr tricore_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr);
-void tricore_cpu_dump_state(CPUState *cpu, FILE *f,
-                            fprintf_function cpu_fprintf, int flags);
-
+typedef struct TriCoreCPU TriCoreCPU;
 
 #endif /*QEMU_TRICORE_CPU_QOM_H */
diff --git a/target-tricore/cpu.h b/target-tricore/cpu.h
index 90045a9..cd350b4 100644
--- a/target-tricore/cpu.h
+++ b/target-tricore/cpu.h
@@ -21,6 +21,7 @@
 
 #include "tricore-defs.h"
 #include "qemu-common.h"
+#include "cpu-qom.h"
 #include "exec/cpu-defs.h"
 #include "fpu/softfloat.h"
 
@@ -198,6 +199,34 @@ struct CPUTriCoreState {
     struct QEMUTimer *timer; /* Internal timer */
 };
 
+/**
+ * TriCoreCPU:
+ * @env: #CPUTriCoreState
+ *
+ * A TriCore CPU.
+ */
+struct TriCoreCPU {
+    /*< private >*/
+    CPUState parent_obj;
+    /*< public >*/
+
+    CPUTriCoreState env;
+};
+
+static inline TriCoreCPU *tricore_env_get_cpu(CPUTriCoreState *env)
+{
+    return TRICORE_CPU(container_of(env, TriCoreCPU, env));
+}
+
+#define ENV_GET_CPU(e) CPU(tricore_env_get_cpu(e))
+
+#define ENV_OFFSET offsetof(TriCoreCPU, env)
+
+hwaddr tricore_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr);
+void tricore_cpu_dump_state(CPUState *cpu, FILE *f,
+                            fprintf_function cpu_fprintf, int flags);
+
+
 #define MASK_PCXI_PCPN 0xff000000
 #define MASK_PCXI_PIE  0x00800000
 #define MASK_PCXI_UL   0x00400000
@@ -341,7 +370,6 @@ void psw_write(CPUTriCoreState *env, uint32_t val);
 
 void fpu_set_state(CPUTriCoreState *env);
 
-#include "cpu-qom.h"
 #define MMU_USER_IDX 2
 
 void tricore_cpu_list(FILE *f, fprintf_function cpu_fprintf);
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 72+ messages in thread

* [Qemu-devel] [PATCH 19/50] target-unicore32: make cpu-qom.h not target specific
  2016-04-08 20:28 [Qemu-devel] [PATCH for-2.7 00/49] NEED_CPU_H / cpu.h / hw/hw.h cleanups Paolo Bonzini
                   ` (17 preceding siblings ...)
  2016-04-08 20:28 ` [Qemu-devel] [PATCH 18/50] target-tricore: " Paolo Bonzini
@ 2016-04-08 20:28 ` Paolo Bonzini
  2016-04-08 20:28 ` [Qemu-devel] [PATCH 20/50] target-xtensa: " Paolo Bonzini
                   ` (32 subsequent siblings)
  51 siblings, 0 replies; 72+ messages in thread
From: Paolo Bonzini @ 2016-04-08 20:28 UTC (permalink / raw)
  To: qemu-devel

Make UniCore32CPU an opaque type within cpu-qom.h, and move all
definitions of private methods, as well as all type definitions that
require knowledge of the layout to cpu.h.  This helps making files
independent of NEED_CPU_H if they only need to pass around CPU pointers.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 target-unicore32/cpu-qom.h | 29 +----------------------------
 target-unicore32/cpu.h     | 31 ++++++++++++++++++++++++++++++-
 2 files changed, 31 insertions(+), 29 deletions(-)

diff --git a/target-unicore32/cpu-qom.h b/target-unicore32/cpu-qom.h
index e554f1f..bc68e78 100644
--- a/target-unicore32/cpu-qom.h
+++ b/target-unicore32/cpu-qom.h
@@ -36,33 +36,6 @@ typedef struct UniCore32CPUClass {
     DeviceRealize parent_realize;
 } UniCore32CPUClass;
 
-/**
- * UniCore32CPU:
- * @env: #CPUUniCore32State
- *
- * A UniCore32 CPU.
- */
-typedef struct UniCore32CPU {
-    /*< private >*/
-    CPUState parent_obj;
-    /*< public >*/
-
-    CPUUniCore32State env;
-} UniCore32CPU;
-
-static inline UniCore32CPU *uc32_env_get_cpu(CPUUniCore32State *env)
-{
-    return container_of(env, UniCore32CPU, env);
-}
-
-#define ENV_GET_CPU(e) CPU(uc32_env_get_cpu(e))
-
-#define ENV_OFFSET offsetof(UniCore32CPU, env)
-
-void uc32_cpu_do_interrupt(CPUState *cpu);
-bool uc32_cpu_exec_interrupt(CPUState *cpu, int int_req);
-void uc32_cpu_dump_state(CPUState *cpu, FILE *f,
-                         fprintf_function cpu_fprintf, int flags);
-hwaddr uc32_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr);
+typedef struct UniCore32CPU UniCore32CPU;
 
 #endif
diff --git a/target-unicore32/cpu.h b/target-unicore32/cpu.h
index 9c1fbf9..22a0aef 100644
--- a/target-unicore32/cpu.h
+++ b/target-unicore32/cpu.h
@@ -20,6 +20,7 @@
 #define CPUArchState                struct CPUUniCore32State
 
 #include "qemu-common.h"
+#include "cpu-qom.h"
 #include "exec/cpu-defs.h"
 #include "fpu/softfloat.h"
 
@@ -71,6 +72,35 @@ typedef struct CPUUniCore32State {
 
 } CPUUniCore32State;
 
+/**
+ * UniCore32CPU:
+ * @env: #CPUUniCore32State
+ *
+ * A UniCore32 CPU.
+ */
+struct UniCore32CPU {
+    /*< private >*/
+    CPUState parent_obj;
+    /*< public >*/
+
+    CPUUniCore32State env;
+};
+
+static inline UniCore32CPU *uc32_env_get_cpu(CPUUniCore32State *env)
+{
+    return container_of(env, UniCore32CPU, env);
+}
+
+#define ENV_GET_CPU(e) CPU(uc32_env_get_cpu(e))
+
+#define ENV_OFFSET offsetof(UniCore32CPU, env)
+
+void uc32_cpu_do_interrupt(CPUState *cpu);
+bool uc32_cpu_exec_interrupt(CPUState *cpu, int int_req);
+void uc32_cpu_dump_state(CPUState *cpu, FILE *f,
+                         fprintf_function cpu_fprintf, int flags);
+hwaddr uc32_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr);
+
 #define ASR_M                   (0x1f)
 #define ASR_MODE_USER           (0x10)
 #define ASR_MODE_INTR           (0x12)
@@ -134,7 +164,6 @@ static inline int cpu_mmu_index(CPUUniCore32State *env, bool ifetch)
 }
 
 #include "exec/cpu-all.h"
-#include "cpu-qom.h"
 #include "exec/exec-all.h"
 
 int uc32_cpu_exec(CPUState *s);
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 72+ messages in thread

* [Qemu-devel] [PATCH 20/50] target-xtensa: make cpu-qom.h not target specific
  2016-04-08 20:28 [Qemu-devel] [PATCH for-2.7 00/49] NEED_CPU_H / cpu.h / hw/hw.h cleanups Paolo Bonzini
                   ` (18 preceding siblings ...)
  2016-04-08 20:28 ` [Qemu-devel] [PATCH 19/50] target-unicore32: " Paolo Bonzini
@ 2016-04-08 20:28 ` Paolo Bonzini
  2016-04-08 20:28 ` [Qemu-devel] [PATCH 21/50] arm: include cpu-qom.h in files that require ARMCPU Paolo Bonzini
                   ` (31 subsequent siblings)
  51 siblings, 0 replies; 72+ messages in thread
From: Paolo Bonzini @ 2016-04-08 20:28 UTC (permalink / raw)
  To: qemu-devel

Make XtensaCPU an opaque type within cpu-qom.h, and move all definitions
of private methods, as well as all type definitions that require knowledge
of the layout to cpu.h.  Conversely, move all definitions needed to
define a class to cpu-qom.h.  This helps making files independent of
NEED_CPU_H if they only need to pass around CPU pointers.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 target-xtensa/cpu-qom.h | 193 ++++++++++++++++++++++++++++++++++++++---------
 target-xtensa/cpu.h     | 194 +++++++++---------------------------------------
 2 files changed, 194 insertions(+), 193 deletions(-)

diff --git a/target-xtensa/cpu-qom.h b/target-xtensa/cpu-qom.h
index f5d9b9f..e7de30e 100644
--- a/target-xtensa/cpu-qom.h
+++ b/target-xtensa/cpu-qom.h
@@ -40,6 +40,163 @@
 #define XTENSA_CPU_GET_CLASS(obj) \
     OBJECT_GET_CLASS(XtensaCPUClass, (obj), TYPE_XTENSA_CPU)
 
+enum {
+    /* Additional instructions */
+    XTENSA_OPTION_CODE_DENSITY,
+    XTENSA_OPTION_LOOP,
+    XTENSA_OPTION_EXTENDED_L32R,
+    XTENSA_OPTION_16_BIT_IMUL,
+    XTENSA_OPTION_32_BIT_IMUL,
+    XTENSA_OPTION_32_BIT_IMUL_HIGH,
+    XTENSA_OPTION_32_BIT_IDIV,
+    XTENSA_OPTION_MAC16,
+    XTENSA_OPTION_MISC_OP_NSA,
+    XTENSA_OPTION_MISC_OP_MINMAX,
+    XTENSA_OPTION_MISC_OP_SEXT,
+    XTENSA_OPTION_MISC_OP_CLAMPS,
+    XTENSA_OPTION_COPROCESSOR,
+    XTENSA_OPTION_BOOLEAN,
+    XTENSA_OPTION_FP_COPROCESSOR,
+    XTENSA_OPTION_MP_SYNCHRO,
+    XTENSA_OPTION_CONDITIONAL_STORE,
+    XTENSA_OPTION_ATOMCTL,
+    XTENSA_OPTION_DEPBITS,
+
+    /* Interrupts and exceptions */
+    XTENSA_OPTION_EXCEPTION,
+    XTENSA_OPTION_RELOCATABLE_VECTOR,
+    XTENSA_OPTION_UNALIGNED_EXCEPTION,
+    XTENSA_OPTION_INTERRUPT,
+    XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT,
+    XTENSA_OPTION_TIMER_INTERRUPT,
+
+    /* Local memory */
+    XTENSA_OPTION_ICACHE,
+    XTENSA_OPTION_ICACHE_TEST,
+    XTENSA_OPTION_ICACHE_INDEX_LOCK,
+    XTENSA_OPTION_DCACHE,
+    XTENSA_OPTION_DCACHE_TEST,
+    XTENSA_OPTION_DCACHE_INDEX_LOCK,
+    XTENSA_OPTION_IRAM,
+    XTENSA_OPTION_IROM,
+    XTENSA_OPTION_DRAM,
+    XTENSA_OPTION_DROM,
+    XTENSA_OPTION_XLMI,
+    XTENSA_OPTION_HW_ALIGNMENT,
+    XTENSA_OPTION_MEMORY_ECC_PARITY,
+
+    /* Memory protection and translation */
+    XTENSA_OPTION_REGION_PROTECTION,
+    XTENSA_OPTION_REGION_TRANSLATION,
+    XTENSA_OPTION_MMU,
+    XTENSA_OPTION_CACHEATTR,
+
+    /* Other */
+    XTENSA_OPTION_WINDOWED_REGISTER,
+    XTENSA_OPTION_PROCESSOR_INTERFACE,
+    XTENSA_OPTION_MISC_SR,
+    XTENSA_OPTION_THREAD_POINTER,
+    XTENSA_OPTION_PROCESSOR_ID,
+    XTENSA_OPTION_DEBUG,
+    XTENSA_OPTION_TRACE_PORT,
+};
+
+#define MAX_NAREG 64
+#define MAX_NINTERRUPT 32
+#define MAX_NLEVEL 6
+#define MAX_NNMI 1
+#define MAX_NCCOMPARE 3
+#define MAX_TLB_WAY_SIZE 8
+#define MAX_NDBREAK 2
+
+enum {
+    /* Static vectors */
+    EXC_RESET,
+    EXC_MEMORY_ERROR,
+
+    /* Dynamic vectors */
+    EXC_WINDOW_OVERFLOW4,
+    EXC_WINDOW_UNDERFLOW4,
+    EXC_WINDOW_OVERFLOW8,
+    EXC_WINDOW_UNDERFLOW8,
+    EXC_WINDOW_OVERFLOW12,
+    EXC_WINDOW_UNDERFLOW12,
+    EXC_IRQ,
+    EXC_KERNEL,
+    EXC_USER,
+    EXC_DOUBLE,
+    EXC_DEBUG,
+    EXC_MAX
+};
+
+typedef enum {
+    INTTYPE_LEVEL,
+    INTTYPE_EDGE,
+    INTTYPE_NMI,
+    INTTYPE_SOFTWARE,
+    INTTYPE_TIMER,
+    INTTYPE_DEBUG,
+    INTTYPE_WRITE_ERR,
+    INTTYPE_PROFILING,
+    INTTYPE_MAX
+} interrupt_type;
+
+typedef struct xtensa_tlb {
+    unsigned nways;
+    const unsigned way_size[10];
+    bool varway56;
+    unsigned nrefillentries;
+} xtensa_tlb;
+
+typedef struct XtensaGdbReg {
+    int targno;
+    int type;
+    int group;
+    unsigned size;
+} XtensaGdbReg;
+
+typedef struct XtensaGdbRegmap {
+    int num_regs;
+    int num_core_regs;
+    /* PC + a + ar + sr + ur */
+    XtensaGdbReg reg[1 + 16 + 64 + 256 + 256];
+} XtensaGdbRegmap;
+
+typedef struct XtensaConfig {
+    const char *name;
+    uint64_t options;
+    XtensaGdbRegmap gdb_regmap;
+    unsigned nareg;
+    int excm_level;
+    int ndepc;
+    uint32_t vecbase;
+    uint32_t exception_vector[EXC_MAX];
+    unsigned ninterrupt;
+    unsigned nlevel;
+    uint32_t interrupt_vector[MAX_NLEVEL + MAX_NNMI + 1];
+    uint32_t level_mask[MAX_NLEVEL + MAX_NNMI + 1];
+    uint32_t inttype_mask[INTTYPE_MAX];
+    struct {
+        uint32_t level;
+        interrupt_type inttype;
+    } interrupt[MAX_NINTERRUPT];
+    unsigned nccompare;
+    uint32_t timerint[MAX_NCCOMPARE];
+    unsigned nextint;
+    unsigned extint[MAX_NINTERRUPT];
+
+    unsigned debug_level;
+    unsigned nibreak;
+    unsigned ndbreak;
+
+    uint32_t configid[2];
+
+    uint32_t clock_freq_khz;
+
+    xtensa_tlb itlb;
+    xtensa_tlb dtlb;
+} XtensaConfig;
+
 /**
  * XtensaCPUClass:
  * @parent_realize: The parent class' realize handler.
@@ -59,40 +216,6 @@ typedef struct XtensaCPUClass {
     const XtensaConfig *config;
 } XtensaCPUClass;
 
-/**
- * XtensaCPU:
- * @env: #CPUXtensaState
- *
- * An Xtensa CPU.
- */
-typedef struct XtensaCPU {
-    /*< private >*/
-    CPUState parent_obj;
-    /*< public >*/
-
-    CPUXtensaState env;
-} XtensaCPU;
-
-static inline XtensaCPU *xtensa_env_get_cpu(const CPUXtensaState *env)
-{
-    return container_of(env, XtensaCPU, env);
-}
-
-#define ENV_GET_CPU(e) CPU(xtensa_env_get_cpu(e))
-
-#define ENV_OFFSET offsetof(XtensaCPU, env)
-
-void xtensa_cpu_do_interrupt(CPUState *cpu);
-bool xtensa_cpu_exec_interrupt(CPUState *cpu, int interrupt_request);
-void xtensa_cpu_do_unassigned_access(CPUState *cpu, hwaddr addr,
-                                     bool is_write, bool is_exec, int opaque,
-                                     unsigned size);
-void xtensa_cpu_dump_state(CPUState *cpu, FILE *f,
-                           fprintf_function cpu_fprintf, int flags);
-hwaddr xtensa_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr);
-int xtensa_cpu_gdb_read_register(CPUState *cpu, uint8_t *buf, int reg);
-int xtensa_cpu_gdb_write_register(CPUState *cpu, uint8_t *buf, int reg);
-void xtensa_cpu_do_unaligned_access(CPUState *cpu, vaddr addr,
-                                    int is_write, int is_user, uintptr_t retaddr);
+typedef struct XtensaCPU XtensaCPU;
 
 #endif
diff --git a/target-xtensa/cpu.h b/target-xtensa/cpu.h
index d0bd9da..b1958f0 100644
--- a/target-xtensa/cpu.h
+++ b/target-xtensa/cpu.h
@@ -34,6 +34,7 @@
 #define CPUArchState struct CPUXtensaState
 
 #include "qemu-common.h"
+#include "cpu-qom.h"
 #include "exec/cpu-defs.h"
 #include "fpu/softfloat.h"
 
@@ -44,67 +45,6 @@
 #define TARGET_PAGE_BITS 12
 
 enum {
-    /* Additional instructions */
-    XTENSA_OPTION_CODE_DENSITY,
-    XTENSA_OPTION_LOOP,
-    XTENSA_OPTION_EXTENDED_L32R,
-    XTENSA_OPTION_16_BIT_IMUL,
-    XTENSA_OPTION_32_BIT_IMUL,
-    XTENSA_OPTION_32_BIT_IMUL_HIGH,
-    XTENSA_OPTION_32_BIT_IDIV,
-    XTENSA_OPTION_MAC16,
-    XTENSA_OPTION_MISC_OP_NSA,
-    XTENSA_OPTION_MISC_OP_MINMAX,
-    XTENSA_OPTION_MISC_OP_SEXT,
-    XTENSA_OPTION_MISC_OP_CLAMPS,
-    XTENSA_OPTION_COPROCESSOR,
-    XTENSA_OPTION_BOOLEAN,
-    XTENSA_OPTION_FP_COPROCESSOR,
-    XTENSA_OPTION_MP_SYNCHRO,
-    XTENSA_OPTION_CONDITIONAL_STORE,
-    XTENSA_OPTION_ATOMCTL,
-    XTENSA_OPTION_DEPBITS,
-
-    /* Interrupts and exceptions */
-    XTENSA_OPTION_EXCEPTION,
-    XTENSA_OPTION_RELOCATABLE_VECTOR,
-    XTENSA_OPTION_UNALIGNED_EXCEPTION,
-    XTENSA_OPTION_INTERRUPT,
-    XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT,
-    XTENSA_OPTION_TIMER_INTERRUPT,
-
-    /* Local memory */
-    XTENSA_OPTION_ICACHE,
-    XTENSA_OPTION_ICACHE_TEST,
-    XTENSA_OPTION_ICACHE_INDEX_LOCK,
-    XTENSA_OPTION_DCACHE,
-    XTENSA_OPTION_DCACHE_TEST,
-    XTENSA_OPTION_DCACHE_INDEX_LOCK,
-    XTENSA_OPTION_IRAM,
-    XTENSA_OPTION_IROM,
-    XTENSA_OPTION_DRAM,
-    XTENSA_OPTION_DROM,
-    XTENSA_OPTION_XLMI,
-    XTENSA_OPTION_HW_ALIGNMENT,
-    XTENSA_OPTION_MEMORY_ECC_PARITY,
-
-    /* Memory protection and translation */
-    XTENSA_OPTION_REGION_PROTECTION,
-    XTENSA_OPTION_REGION_TRANSLATION,
-    XTENSA_OPTION_MMU,
-    XTENSA_OPTION_CACHEATTR,
-
-    /* Other */
-    XTENSA_OPTION_WINDOWED_REGISTER,
-    XTENSA_OPTION_PROCESSOR_INTERFACE,
-    XTENSA_OPTION_MISC_SR,
-    XTENSA_OPTION_THREAD_POINTER,
-    XTENSA_OPTION_PROCESSOR_ID,
-    XTENSA_OPTION_DEBUG,
-    XTENSA_OPTION_TRACE_PORT,
-};
-
-enum {
     THREADPTR = 231,
     FCR = 232,
     FSR = 233,
@@ -188,14 +128,6 @@ enum {
 #define DBREAKC_SB_LB (DBREAKC_SB | DBREAKC_LB)
 #define DBREAKC_MASK 0x3f
 
-#define MAX_NAREG 64
-#define MAX_NINTERRUPT 32
-#define MAX_NLEVEL 6
-#define MAX_NNMI 1
-#define MAX_NCCOMPARE 3
-#define MAX_TLB_WAY_SIZE 8
-#define MAX_NDBREAK 2
-
 #define REGION_PAGE_MASK 0xe0000000
 
 #define PAGE_CACHE_MASK    0x700
@@ -207,26 +139,6 @@ enum {
 #define PAGE_CACHE_ISOLATE 0x600
 
 enum {
-    /* Static vectors */
-    EXC_RESET,
-    EXC_MEMORY_ERROR,
-
-    /* Dynamic vectors */
-    EXC_WINDOW_OVERFLOW4,
-    EXC_WINDOW_UNDERFLOW4,
-    EXC_WINDOW_OVERFLOW8,
-    EXC_WINDOW_UNDERFLOW8,
-    EXC_WINDOW_OVERFLOW12,
-    EXC_WINDOW_UNDERFLOW12,
-    EXC_IRQ,
-    EXC_KERNEL,
-    EXC_USER,
-    EXC_DOUBLE,
-    EXC_DEBUG,
-    EXC_MAX
-};
-
-enum {
     ILLEGAL_INSTRUCTION_CAUSE = 0,
     SYSCALL_CAUSE,
     INSTRUCTION_FETCH_ERROR_CAUSE,
@@ -255,18 +167,6 @@ enum {
     COPROCESSOR0_DISABLED = 32,
 };
 
-typedef enum {
-    INTTYPE_LEVEL,
-    INTTYPE_EDGE,
-    INTTYPE_NMI,
-    INTTYPE_SOFTWARE,
-    INTTYPE_TIMER,
-    INTTYPE_DEBUG,
-    INTTYPE_WRITE_ERR,
-    INTTYPE_PROFILING,
-    INTTYPE_MAX
-} interrupt_type;
-
 typedef struct xtensa_tlb_entry {
     uint32_t vaddr;
     uint32_t paddr;
@@ -275,62 +175,6 @@ typedef struct xtensa_tlb_entry {
     bool variable;
 } xtensa_tlb_entry;
 
-typedef struct xtensa_tlb {
-    unsigned nways;
-    const unsigned way_size[10];
-    bool varway56;
-    unsigned nrefillentries;
-} xtensa_tlb;
-
-typedef struct XtensaGdbReg {
-    int targno;
-    int type;
-    int group;
-    unsigned size;
-} XtensaGdbReg;
-
-typedef struct XtensaGdbRegmap {
-    int num_regs;
-    int num_core_regs;
-    /* PC + a + ar + sr + ur */
-    XtensaGdbReg reg[1 + 16 + 64 + 256 + 256];
-} XtensaGdbRegmap;
-
-typedef struct XtensaConfig {
-    const char *name;
-    uint64_t options;
-    XtensaGdbRegmap gdb_regmap;
-    unsigned nareg;
-    int excm_level;
-    int ndepc;
-    uint32_t vecbase;
-    uint32_t exception_vector[EXC_MAX];
-    unsigned ninterrupt;
-    unsigned nlevel;
-    uint32_t interrupt_vector[MAX_NLEVEL + MAX_NNMI + 1];
-    uint32_t level_mask[MAX_NLEVEL + MAX_NNMI + 1];
-    uint32_t inttype_mask[INTTYPE_MAX];
-    struct {
-        uint32_t level;
-        interrupt_type inttype;
-    } interrupt[MAX_NINTERRUPT];
-    unsigned nccompare;
-    uint32_t timerint[MAX_NCCOMPARE];
-    unsigned nextint;
-    unsigned extint[MAX_NINTERRUPT];
-
-    unsigned debug_level;
-    unsigned nibreak;
-    unsigned ndbreak;
-
-    uint32_t configid[2];
-
-    uint32_t clock_freq_khz;
-
-    xtensa_tlb itlb;
-    xtensa_tlb dtlb;
-} XtensaConfig;
-
 typedef struct XtensaConfigList {
     const XtensaConfig *config;
     struct XtensaConfigList *next;
@@ -379,7 +223,41 @@ typedef struct CPUXtensaState {
     CPU_COMMON
 } CPUXtensaState;
 
-#include "cpu-qom.h"
+/**
+ * XtensaCPU:
+ * @env: #CPUXtensaState
+ *
+ * An Xtensa CPU.
+ */
+struct XtensaCPU {
+    /*< private >*/
+    CPUState parent_obj;
+    /*< public >*/
+
+    CPUXtensaState env;
+};
+
+static inline XtensaCPU *xtensa_env_get_cpu(const CPUXtensaState *env)
+{
+    return container_of(env, XtensaCPU, env);
+}
+
+#define ENV_GET_CPU(e) CPU(xtensa_env_get_cpu(e))
+
+#define ENV_OFFSET offsetof(XtensaCPU, env)
+
+void xtensa_cpu_do_interrupt(CPUState *cpu);
+bool xtensa_cpu_exec_interrupt(CPUState *cpu, int interrupt_request);
+void xtensa_cpu_do_unassigned_access(CPUState *cpu, hwaddr addr,
+                                     bool is_write, bool is_exec, int opaque,
+                                     unsigned size);
+void xtensa_cpu_dump_state(CPUState *cpu, FILE *f,
+                           fprintf_function cpu_fprintf, int flags);
+hwaddr xtensa_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr);
+int xtensa_cpu_gdb_read_register(CPUState *cpu, uint8_t *buf, int reg);
+int xtensa_cpu_gdb_write_register(CPUState *cpu, uint8_t *buf, int reg);
+void xtensa_cpu_do_unaligned_access(CPUState *cpu, vaddr addr,
+                                    int is_write, int is_user, uintptr_t retaddr);
 
 #define cpu_exec cpu_xtensa_exec
 #define cpu_signal_handler cpu_xtensa_signal_handler
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 72+ messages in thread

* [Qemu-devel] [PATCH 21/50] arm: include cpu-qom.h in files that require ARMCPU
  2016-04-08 20:28 [Qemu-devel] [PATCH for-2.7 00/49] NEED_CPU_H / cpu.h / hw/hw.h cleanups Paolo Bonzini
                   ` (19 preceding siblings ...)
  2016-04-08 20:28 ` [Qemu-devel] [PATCH 20/50] target-xtensa: " Paolo Bonzini
@ 2016-04-08 20:28 ` Paolo Bonzini
  2016-04-08 20:28 ` [Qemu-devel] [PATCH 22/50] m68k: include cpu-qom.h in files that require M68KCPU Paolo Bonzini
                   ` (30 subsequent siblings)
  51 siblings, 0 replies; 72+ messages in thread
From: Paolo Bonzini @ 2016-04-08 20:28 UTC (permalink / raw)
  To: qemu-devel

This will keep things working when cpu.h will not be included
indirectly almost everywhere (either directly or through
qemu-common.h).

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 hw/arm/stm32f205_soc.c      | 1 -
 hw/arm/strongarm.h          | 1 +
 include/hw/arm/arm.h        | 2 +-
 include/hw/arm/exynos4210.h | 1 +
 include/hw/arm/omap.h       | 1 +
 include/hw/arm/pxa.h        | 1 +
 6 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/hw/arm/stm32f205_soc.c b/hw/arm/stm32f205_soc.c
index a5ea1e2..9c1dafb 100644
--- a/hw/arm/stm32f205_soc.c
+++ b/hw/arm/stm32f205_soc.c
@@ -25,7 +25,6 @@
 #include "qemu/osdep.h"
 #include "qapi/error.h"
 #include "qemu-common.h"
-#include "cpu.h"
 #include "hw/arm/arm.h"
 #include "exec/address-spaces.h"
 #include "hw/arm/stm32f205_soc.h"
diff --git a/hw/arm/strongarm.h b/hw/arm/strongarm.h
index 2893f94..cd32bbd 100644
--- a/hw/arm/strongarm.h
+++ b/hw/arm/strongarm.h
@@ -2,6 +2,7 @@
 #define _STRONGARM_H
 
 #include "exec/memory.h"
+#include "target-arm/cpu-qom.h"
 
 #define SA_CS0          0x00000000
 #define SA_CS1          0x08000000
diff --git a/include/hw/arm/arm.h b/include/hw/arm/arm.h
index b2517f9..8b49a98 100644
--- a/include/hw/arm/arm.h
+++ b/include/hw/arm/arm.h
@@ -12,9 +12,9 @@
 #define ARM_MISC_H 1
 
 #include "exec/memory.h"
+#include "target-arm/cpu-qom.h"
 #include "hw/irq.h"
 #include "qemu/notify.h"
-#include "cpu.h"
 
 typedef enum {
     ARM_ENDIANNESS_UNKNOWN = 0,
diff --git a/include/hw/arm/exynos4210.h b/include/hw/arm/exynos4210.h
index 5c1820f..b6d929d 100644
--- a/include/hw/arm/exynos4210.h
+++ b/include/hw/arm/exynos4210.h
@@ -28,6 +28,7 @@
 
 #include "qemu-common.h"
 #include "exec/memory.h"
+#include "target-arm/cpu-qom.h"
 
 #define EXYNOS4210_NCPUS                    2
 
diff --git a/include/hw/arm/omap.h b/include/hw/arm/omap.h
index 0ad5fb8..f026c8d 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 "target-arm/cpu-qom.h"
 
 # define OMAP_EMIFS_BASE	0x00000000
 # define OMAP2_Q0_BASE		0x00000000
diff --git a/include/hw/arm/pxa.h b/include/hw/arm/pxa.h
index 259b852..074feac 100644
--- a/include/hw/arm/pxa.h
+++ b/include/hw/arm/pxa.h
@@ -10,6 +10,7 @@
 # define PXA_H			"pxa.h"
 
 #include "exec/memory.h"
+#include "target-arm/cpu-qom.h"
 
 /* Interrupt numbers */
 # define PXA2XX_PIC_SSP3	0
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 72+ messages in thread

* [Qemu-devel] [PATCH 22/50] m68k: include cpu-qom.h in files that require M68KCPU
  2016-04-08 20:28 [Qemu-devel] [PATCH for-2.7 00/49] NEED_CPU_H / cpu.h / hw/hw.h cleanups Paolo Bonzini
                   ` (20 preceding siblings ...)
  2016-04-08 20:28 ` [Qemu-devel] [PATCH 21/50] arm: include cpu-qom.h in files that require ARMCPU Paolo Bonzini
@ 2016-04-08 20:28 ` Paolo Bonzini
  2016-04-08 20:28 ` [Qemu-devel] [PATCH 23/50] sh4: include cpu-qom.h in files that require SuperHCPU Paolo Bonzini
                   ` (29 subsequent siblings)
  51 siblings, 0 replies; 72+ messages in thread
From: Paolo Bonzini @ 2016-04-08 20:28 UTC (permalink / raw)
  To: qemu-devel

This will keep things working when cpu.h will not be included
indirectly almost everywhere (either directly or through
qemu-common.h).

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 include/hw/m68k/mcf.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/include/hw/m68k/mcf.h b/include/hw/m68k/mcf.h
index fbc8dc2..0f0d228 100644
--- a/include/hw/m68k/mcf.h
+++ b/include/hw/m68k/mcf.h
@@ -2,6 +2,8 @@
 #define HW_MCF_H
 /* Motorola ColdFire device prototypes.  */
 
+#include "target-m68k/cpu-qom.h"
+
 struct MemoryRegion;
 
 /* mcf_uart.c */
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 72+ messages in thread

* [Qemu-devel] [PATCH 23/50] sh4: include cpu-qom.h in files that require SuperHCPU
  2016-04-08 20:28 [Qemu-devel] [PATCH for-2.7 00/49] NEED_CPU_H / cpu.h / hw/hw.h cleanups Paolo Bonzini
                   ` (21 preceding siblings ...)
  2016-04-08 20:28 ` [Qemu-devel] [PATCH 22/50] m68k: include cpu-qom.h in files that require M68KCPU Paolo Bonzini
@ 2016-04-08 20:28 ` Paolo Bonzini
  2016-04-08 20:28 ` [Qemu-devel] [PATCH 24/50] alpha: include cpu-qom.h in files that require AlphaCPU Paolo Bonzini
                   ` (28 subsequent siblings)
  51 siblings, 0 replies; 72+ messages in thread
From: Paolo Bonzini @ 2016-04-08 20:28 UTC (permalink / raw)
  To: qemu-devel

This will keep things working when cpu.h will not be included
indirectly almost everywhere (either directly or through
qemu-common.h).

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 include/hw/sh4/sh.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/hw/sh4/sh.h b/include/hw/sh4/sh.h
index e61de9a..070312d 100644
--- a/include/hw/sh4/sh.h
+++ b/include/hw/sh4/sh.h
@@ -3,6 +3,7 @@
 /* Definitions for SH board emulation.  */
 
 #include "hw/sh4/sh_intc.h"
+#include "target-sh4/cpu-qom.h"
 
 #define A7ADDR(x) ((x) & 0x1fffffff)
 #define P4ADDR(x) ((x) | 0xe0000000)
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 72+ messages in thread

* [Qemu-devel] [PATCH 24/50] alpha: include cpu-qom.h in files that require AlphaCPU
  2016-04-08 20:28 [Qemu-devel] [PATCH for-2.7 00/49] NEED_CPU_H / cpu.h / hw/hw.h cleanups Paolo Bonzini
                   ` (22 preceding siblings ...)
  2016-04-08 20:28 ` [Qemu-devel] [PATCH 23/50] sh4: include cpu-qom.h in files that require SuperHCPU Paolo Bonzini
@ 2016-04-08 20:28 ` Paolo Bonzini
  2016-04-08 20:28 ` [Qemu-devel] [PATCH 25/50] mips: use MIPSCPU instead of CPUMIPSState Paolo Bonzini
                   ` (27 subsequent siblings)
  51 siblings, 0 replies; 72+ messages in thread
From: Paolo Bonzini @ 2016-04-08 20:28 UTC (permalink / raw)
  To: qemu-devel

This will keep things working when cpu.h will not be included
indirectly almost everywhere (either directly or through
qemu-common.h).

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 hw/alpha/alpha_sys.h | 1 +
 hw/alpha/pci.c       | 1 -
 2 files changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/alpha/alpha_sys.h b/hw/alpha/alpha_sys.h
index e11025b..fcaeb2b 100644
--- a/hw/alpha/alpha_sys.h
+++ b/hw/alpha/alpha_sys.h
@@ -3,6 +3,7 @@
 #ifndef HW_ALPHA_H
 #define HW_ALPHA_H 1
 
+#include "target-alpha/cpu-qom.h"
 #include "hw/pci/pci.h"
 #include "hw/pci/pci_host.h"
 #include "hw/ide.h"
diff --git a/hw/alpha/pci.c b/hw/alpha/pci.c
index 5baa0ea..8dde637 100644
--- a/hw/alpha/pci.c
+++ b/hw/alpha/pci.c
@@ -8,7 +8,6 @@
 
 #include "qemu/osdep.h"
 #include "qemu-common.h"
-#include "cpu.h"
 #include "alpha_sys.h"
 #include "qemu/log.h"
 #include "sysemu/sysemu.h"
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 72+ messages in thread

* [Qemu-devel] [PATCH 25/50] mips: use MIPSCPU instead of CPUMIPSState
  2016-04-08 20:28 [Qemu-devel] [PATCH for-2.7 00/49] NEED_CPU_H / cpu.h / hw/hw.h cleanups Paolo Bonzini
                   ` (23 preceding siblings ...)
  2016-04-08 20:28 ` [Qemu-devel] [PATCH 24/50] alpha: include cpu-qom.h in files that require AlphaCPU Paolo Bonzini
@ 2016-04-08 20:28 ` Paolo Bonzini
  2016-04-08 20:28 ` [Qemu-devel] [PATCH 26/50] ppc: use PowerPCCPU instead of CPUPPCState Paolo Bonzini
                   ` (26 subsequent siblings)
  51 siblings, 0 replies; 72+ messages in thread
From: Paolo Bonzini @ 2016-04-08 20:28 UTC (permalink / raw)
  To: qemu-devel

This changes a cpu.h dependency into a cpu-qom.h dependency.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 hw/mips/cps.c             | 7 ++++---
 hw/mips/cputimer.c        | 4 +++-
 hw/mips/mips_fulong2e.c   | 4 ++--
 hw/mips/mips_int.c        | 3 ++-
 hw/mips/mips_jazz.c       | 4 ++--
 hw/mips/mips_malta.c      | 5 ++---
 hw/mips/mips_mipssim.c    | 4 ++--
 hw/mips/mips_r4k.c        | 4 ++--
 include/hw/mips/cpudevs.h | 7 +++++--
 9 files changed, 24 insertions(+), 18 deletions(-)

diff --git a/hw/mips/cps.c b/hw/mips/cps.c
index 1bafbbb..61208f8 100644
--- a/hw/mips/cps.c
+++ b/hw/mips/cps.c
@@ -81,11 +81,12 @@ static void mips_cps_realize(DeviceState *dev, Error **errp)
             error_setg(errp, "%s: CPU initialization failed\n",  __func__);
             return;
         }
-        env = &cpu->env;
 
         /* Init internal devices */
-        cpu_mips_irq_init_cpu(env);
-        cpu_mips_clock_init(env);
+        cpu_mips_irq_init_cpu(cpu);
+        cpu_mips_clock_init(cpu);
+
+        env = &cpu->env;
         if (cpu_mips_itu_supported(env)) {
             itu_present = true;
             /* Attach ITC Tag to the VP */
diff --git a/hw/mips/cputimer.c b/hw/mips/cputimer.c
index efb227d..8a166b3 100644
--- a/hw/mips/cputimer.c
+++ b/hw/mips/cputimer.c
@@ -151,8 +151,10 @@ static void mips_timer_cb (void *opaque)
     env->CP0_Count--;
 }
 
-void cpu_mips_clock_init (CPUMIPSState *env)
+void cpu_mips_clock_init (MIPSCPU *cpu)
 {
+    CPUMIPSState *env = &cpu->env;
+
     /*
      * If we're in KVM mode, don't create the periodic timer, that is handled in
      * kernel.
diff --git a/hw/mips/mips_fulong2e.c b/hw/mips/mips_fulong2e.c
index bdb716e7..889cdc7 100644
--- a/hw/mips/mips_fulong2e.c
+++ b/hw/mips/mips_fulong2e.c
@@ -334,8 +334,8 @@ static void mips_fulong2e_init(MachineState *machine)
     }
 
     /* Init internal devices */
-    cpu_mips_irq_init_cpu(env);
-    cpu_mips_clock_init(env);
+    cpu_mips_irq_init_cpu(cpu);
+    cpu_mips_clock_init(cpu);
 
     /* North bridge, Bonito --> IP2 */
     pci_bus = bonito_init((qemu_irq *)&(env->irq[2]));
diff --git a/hw/mips/mips_int.c b/hw/mips/mips_int.c
index 59081f9..48192d2 100644
--- a/hw/mips/mips_int.c
+++ b/hw/mips/mips_int.c
@@ -58,8 +58,9 @@ static void cpu_mips_irq_request(void *opaque, int irq, int level)
     }
 }
 
-void cpu_mips_irq_init_cpu(CPUMIPSState *env)
+void cpu_mips_irq_init_cpu(MIPSCPU *cpu)
 {
+    CPUMIPSState *env = &cpu->env;
     qemu_irq *qi;
     int i;
 
diff --git a/hw/mips/mips_jazz.c b/hw/mips/mips_jazz.c
index ac7c641..73f6c9f 100644
--- a/hw/mips/mips_jazz.c
+++ b/hw/mips/mips_jazz.c
@@ -201,8 +201,8 @@ static void mips_jazz_init(MachineState *machine,
     }
 
     /* Init CPU internal devices */
-    cpu_mips_irq_init_cpu(env);
-    cpu_mips_clock_init(env);
+    cpu_mips_irq_init_cpu(cpu);
+    cpu_mips_clock_init(cpu);
 
     /* Chipset */
     rc4030 = rc4030_init(&dmas, &rc4030_dma_mr);
diff --git a/hw/mips/mips_malta.c b/hw/mips/mips_malta.c
index fa769e5..5c8ba44 100644
--- a/hw/mips/mips_malta.c
+++ b/hw/mips/mips_malta.c
@@ -923,11 +923,10 @@ static void create_cpu_without_cps(const char *cpu_model,
             fprintf(stderr, "Unable to find CPU definition\n");
             exit(1);
         }
-        env = &cpu->env;
 
         /* Init internal devices */
-        cpu_mips_irq_init_cpu(env);
-        cpu_mips_clock_init(env);
+        cpu_mips_irq_init_cpu(cpu);
+        cpu_mips_clock_init(cpu);
         qemu_register_reset(main_cpu_reset, cpu);
     }
 
diff --git a/hw/mips/mips_mipssim.c b/hw/mips/mips_mipssim.c
index a2c2a16..1b91195 100644
--- a/hw/mips/mips_mipssim.c
+++ b/hw/mips/mips_mipssim.c
@@ -216,8 +216,8 @@ mips_mipssim_init(MachineState *machine)
     }
 
     /* Init CPU internal devices. */
-    cpu_mips_irq_init_cpu(env);
-    cpu_mips_clock_init(env);
+    cpu_mips_irq_init_cpu(cpu);
+    cpu_mips_clock_init(cpu);
 
     /* Register 64 KB of ISA IO space at 0x1fd00000. */
     memory_region_init_alias(isa, NULL, "isa_mmio",
diff --git a/hw/mips/mips_r4k.c b/hw/mips/mips_r4k.c
index 21aca98..16a59c7 100644
--- a/hw/mips/mips_r4k.c
+++ b/hw/mips/mips_r4k.c
@@ -267,8 +267,8 @@ void mips_r4k_init(MachineState *machine)
     }
 
     /* Init CPU internal devices */
-    cpu_mips_irq_init_cpu(env);
-    cpu_mips_clock_init(env);
+    cpu_mips_irq_init_cpu(cpu);
+    cpu_mips_clock_init(cpu);
 
     /* ISA bus: IO space at 0x14000000, mem space at 0x10000000 */
     memory_region_init_alias(isa_io, NULL, "isa-io",
diff --git a/include/hw/mips/cpudevs.h b/include/hw/mips/cpudevs.h
index b2626f2..8673daa 100644
--- a/include/hw/mips/cpudevs.h
+++ b/include/hw/mips/cpudevs.h
@@ -1,5 +1,8 @@
 #ifndef HW_MIPS_CPUDEVS_H
 #define HW_MIPS_CPUDEVS_H
+
+#include "target-mips/cpu-qom.h"
+
 /* Definitions for MIPS CPU internal devices.  */
 
 /* mips_addr.c */
@@ -9,9 +12,9 @@ uint64_t cpu_mips_kvm_um_phys_to_kseg0(void *opaque, uint64_t addr);
 
 
 /* mips_int.c */
-void cpu_mips_irq_init_cpu(CPUMIPSState *env);
+void cpu_mips_irq_init_cpu(MIPSCPU *cpu);
 
 /* mips_timer.c */
-void cpu_mips_clock_init(CPUMIPSState *);
+void cpu_mips_clock_init(MIPSCPU *cpu);
 
 #endif
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 72+ messages in thread

* [Qemu-devel] [PATCH 26/50] ppc: use PowerPCCPU instead of CPUPPCState
  2016-04-08 20:28 [Qemu-devel] [PATCH for-2.7 00/49] NEED_CPU_H / cpu.h / hw/hw.h cleanups Paolo Bonzini
                   ` (24 preceding siblings ...)
  2016-04-08 20:28 ` [Qemu-devel] [PATCH 25/50] mips: use MIPSCPU instead of CPUMIPSState Paolo Bonzini
@ 2016-04-08 20:28 ` Paolo Bonzini
  2016-04-08 20:28 ` [Qemu-devel] [PATCH 27/50] arm: remove useless cpu.h inclusion Paolo Bonzini
                   ` (25 subsequent siblings)
  51 siblings, 0 replies; 72+ messages in thread
From: Paolo Bonzini @ 2016-04-08 20:28 UTC (permalink / raw)
  To: qemu-devel

This changes a cpu.h dependency for hw/ppc/ppc.h into a cpu-qom.h
dependency.  For it to compile we also need to clean up a few unused
definitions.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 hw/ppc/ppc.c                | 20 +++++-----
 include/hw/ppc/ppc.h        | 24 +++++++-----
 target-ppc/translate_init.c | 92 +++++++++++++++++++--------------------------
 3 files changed, 63 insertions(+), 73 deletions(-)

diff --git a/hw/ppc/ppc.c b/hw/ppc/ppc.c
index 38ff2e1..cdf9f25 100644
--- a/hw/ppc/ppc.c
+++ b/hw/ppc/ppc.c
@@ -164,9 +164,9 @@ static void ppc6xx_set_irq(void *opaque, int pin, int level)
     }
 }
 
-void ppc6xx_irq_init(CPUPPCState *env)
+void ppc6xx_irq_init(PowerPCCPU *cpu)
 {
-    PowerPCCPU *cpu = ppc_env_get_cpu(env);
+    CPUPPCState *env = &cpu->env;
 
     env->irq_inputs = (void **)qemu_allocate_irqs(&ppc6xx_set_irq, cpu,
                                                   PPC6xx_INPUT_NB);
@@ -251,9 +251,9 @@ static void ppc970_set_irq(void *opaque, int pin, int level)
     }
 }
 
-void ppc970_irq_init(CPUPPCState *env)
+void ppc970_irq_init(PowerPCCPU *cpu)
 {
-    PowerPCCPU *cpu = ppc_env_get_cpu(env);
+    CPUPPCState *env = &cpu->env;
 
     env->irq_inputs = (void **)qemu_allocate_irqs(&ppc970_set_irq, cpu,
                                                   PPC970_INPUT_NB);
@@ -287,9 +287,9 @@ static void power7_set_irq(void *opaque, int pin, int level)
     }
 }
 
-void ppcPOWER7_irq_init(CPUPPCState *env)
+void ppcPOWER7_irq_init(PowerPCCPU *cpu)
 {
-    PowerPCCPU *cpu = ppc_env_get_cpu(env);
+    CPUPPCState *env = &cpu->env;
 
     env->irq_inputs = (void **)qemu_allocate_irqs(&power7_set_irq, cpu,
                                                   POWER7_INPUT_NB);
@@ -372,9 +372,9 @@ static void ppc40x_set_irq(void *opaque, int pin, int level)
     }
 }
 
-void ppc40x_irq_init(CPUPPCState *env)
+void ppc40x_irq_init(PowerPCCPU *cpu)
 {
-    PowerPCCPU *cpu = ppc_env_get_cpu(env);
+    CPUPPCState *env = &cpu->env;
 
     env->irq_inputs = (void **)qemu_allocate_irqs(&ppc40x_set_irq,
                                                   cpu, PPC40x_INPUT_NB);
@@ -436,9 +436,9 @@ static void ppce500_set_irq(void *opaque, int pin, int level)
     }
 }
 
-void ppce500_irq_init(CPUPPCState *env)
+void ppce500_irq_init(PowerPCCPU *cpu)
 {
-    PowerPCCPU *cpu = ppc_env_get_cpu(env);
+    CPUPPCState *env = &cpu->env;
 
     env->irq_inputs = (void **)qemu_allocate_irqs(&ppce500_set_irq,
                                                   cpu, PPCE500_INPUT_NB);
diff --git a/include/hw/ppc/ppc.h b/include/hw/ppc/ppc.h
index 14efd0c..5617dc4 100644
--- a/include/hw/ppc/ppc.h
+++ b/include/hw/ppc/ppc.h
@@ -1,6 +1,8 @@
 #ifndef HW_PPC_H
 #define HW_PPC_H 1
 
+#include "target-ppc/cpu-qom.h"
+
 void ppc_set_irq(PowerPCCPU *cpu, int n_IRQ, int level);
 
 /* PowerPC hardware exceptions management helpers */
@@ -64,17 +66,21 @@ clk_setup_cb ppc_40x_timers_init (CPUPPCState *env, uint32_t freq,
 void ppc40x_core_reset(PowerPCCPU *cpu);
 void ppc40x_chip_reset(PowerPCCPU *cpu);
 void ppc40x_system_reset(PowerPCCPU *cpu);
-void PREP_debug_write (void *opaque, uint32_t addr, uint32_t val);
-
-extern CPUWriteMemoryFunc * const PPC_io_write[];
-extern CPUReadMemoryFunc * const PPC_io_read[];
 void PPC_debug_write (void *opaque, uint32_t addr, uint32_t val);
 
-void ppc40x_irq_init (CPUPPCState *env);
-void ppce500_irq_init (CPUPPCState *env);
-void ppc6xx_irq_init (CPUPPCState *env);
-void ppc970_irq_init (CPUPPCState *env);
-void ppcPOWER7_irq_init (CPUPPCState *env);
+#if defined(CONFIG_USER_ONLY)
+static inline void ppc40x_irq_init(PowerPCCPU *cpu) {}
+static inline void ppc6xx_irq_init(PowerPCCPU *cpu) {}
+static inline void ppc970_irq_init(PowerPCCPU *cpu) {}
+static inline void ppcPOWER7_irq_init(PowerPCCPU *cpu) {}
+static inline void ppce500_irq_init(PowerPCCPU *cpu) {}
+#else
+void ppc40x_irq_init(PowerPCCPU *cpu);
+void ppce500_irq_init(PowerPCCPU *cpu);
+void ppc6xx_irq_init(PowerPCCPU *cpu);
+void ppc970_irq_init(PowerPCCPU *cpu);
+void ppcPOWER7_irq_init(PowerPCCPU *cpu);
+#endif
 
 /* PPC machines for OpenBIOS */
 enum {
diff --git a/target-ppc/translate_init.c b/target-ppc/translate_init.c
index f515725..954195f 100644
--- a/target-ppc/translate_init.c
+++ b/target-ppc/translate_init.c
@@ -31,29 +31,13 @@
 #include "qemu/error-report.h"
 #include "qapi/visitor.h"
 #include "hw/qdev-properties.h"
+#include "hw/ppc/ppc.h"
 
 //#define PPC_DUMP_CPU
 //#define PPC_DEBUG_SPR
 //#define PPC_DUMP_SPR_ACCESSES
 /* #define USE_APPLE_GDB */
 
-/* For user-mode emulation, we don't emulate any IRQ controller */
-#if defined(CONFIG_USER_ONLY)
-#define PPC_IRQ_INIT_FN(name)                                                 \
-static inline void glue(glue(ppc, name),_irq_init) (CPUPPCState *env)         \
-{                                                                             \
-}
-#else
-#define PPC_IRQ_INIT_FN(name)                                                 \
-void glue(glue(ppc, name),_irq_init) (CPUPPCState *env);
-#endif
-
-PPC_IRQ_INIT_FN(40x);
-PPC_IRQ_INIT_FN(6xx);
-PPC_IRQ_INIT_FN(970);
-PPC_IRQ_INIT_FN(POWER7);
-PPC_IRQ_INIT_FN(e500);
-
 /* Generic callbacks:
  * do nothing but store/retrieve spr value
  */
@@ -3275,7 +3259,7 @@ static void init_proc_401 (CPUPPCState *env)
     env->dcache_line_size = 32;
     env->icache_line_size = 32;
     /* Allocate hardware IRQ controller */
-    ppc40x_irq_init(env);
+    ppc40x_irq_init(ppc_env_get_cpu(env));
 
     SET_FIT_PERIOD(12, 16, 20, 24);
     SET_WDT_PERIOD(16, 20, 24, 28);
@@ -3329,7 +3313,7 @@ static void init_proc_401x2 (CPUPPCState *env)
     env->dcache_line_size = 32;
     env->icache_line_size = 32;
     /* Allocate hardware IRQ controller */
-    ppc40x_irq_init(env);
+    ppc40x_irq_init(ppc_env_get_cpu(env));
 
     SET_FIT_PERIOD(12, 16, 20, 24);
     SET_WDT_PERIOD(16, 20, 24, 28);
@@ -3381,7 +3365,7 @@ static void init_proc_401x3 (CPUPPCState *env)
     env->dcache_line_size = 32;
     env->icache_line_size = 32;
     /* Allocate hardware IRQ controller */
-    ppc40x_irq_init(env);
+    ppc40x_irq_init(ppc_env_get_cpu(env));
 
     SET_FIT_PERIOD(12, 16, 20, 24);
     SET_WDT_PERIOD(16, 20, 24, 28);
@@ -3440,7 +3424,7 @@ static void init_proc_IOP480 (CPUPPCState *env)
     env->dcache_line_size = 32;
     env->icache_line_size = 32;
     /* Allocate hardware IRQ controller */
-    ppc40x_irq_init(env);
+    ppc40x_irq_init(ppc_env_get_cpu(env));
 
     SET_FIT_PERIOD(8, 12, 16, 20);
     SET_WDT_PERIOD(16, 20, 24, 28);
@@ -3491,7 +3475,7 @@ static void init_proc_403 (CPUPPCState *env)
     env->dcache_line_size = 32;
     env->icache_line_size = 32;
     /* Allocate hardware IRQ controller */
-    ppc40x_irq_init(env);
+    ppc40x_irq_init(ppc_env_get_cpu(env));
 
     SET_FIT_PERIOD(8, 12, 16, 20);
     SET_WDT_PERIOD(16, 20, 24, 28);
@@ -3557,7 +3541,7 @@ static void init_proc_403GCX (CPUPPCState *env)
     env->dcache_line_size = 32;
     env->icache_line_size = 32;
     /* Allocate hardware IRQ controller */
-    ppc40x_irq_init(env);
+    ppc40x_irq_init(ppc_env_get_cpu(env));
 
     SET_FIT_PERIOD(8, 12, 16, 20);
     SET_WDT_PERIOD(16, 20, 24, 28);
@@ -3623,7 +3607,7 @@ static void init_proc_405 (CPUPPCState *env)
     env->dcache_line_size = 32;
     env->icache_line_size = 32;
     /* Allocate hardware IRQ controller */
-    ppc40x_irq_init(env);
+    ppc40x_irq_init(ppc_env_get_cpu(env));
 
     SET_FIT_PERIOD(8, 12, 16, 20);
     SET_WDT_PERIOD(16, 20, 24, 28);
@@ -3721,7 +3705,7 @@ static void init_proc_440EP (CPUPPCState *env)
     init_excp_BookE(env);
     env->dcache_line_size = 32;
     env->icache_line_size = 32;
-    ppc40x_irq_init(env);
+    ppc40x_irq_init(ppc_env_get_cpu(env));
 
     SET_FIT_PERIOD(12, 16, 20, 24);
     SET_WDT_PERIOD(20, 24, 28, 32);
@@ -3991,7 +3975,7 @@ static void init_proc_440x5 (CPUPPCState *env)
     init_excp_BookE(env);
     env->dcache_line_size = 32;
     env->icache_line_size = 32;
-    ppc40x_irq_init(env);
+    ppc40x_irq_init(ppc_env_get_cpu(env));
 
     SET_FIT_PERIOD(12, 16, 20, 24);
     SET_WDT_PERIOD(20, 24, 28, 32);
@@ -4413,7 +4397,7 @@ static void init_proc_G2 (CPUPPCState *env)
     env->dcache_line_size = 32;
     env->icache_line_size = 32;
     /* Allocate hardware IRQ controller */
-    ppc6xx_irq_init(env);
+    ppc6xx_irq_init(ppc_env_get_cpu(env));
 }
 
 POWERPC_FAMILY(G2)(ObjectClass *oc, void *data)
@@ -4492,7 +4476,7 @@ static void init_proc_G2LE (CPUPPCState *env)
     env->dcache_line_size = 32;
     env->icache_line_size = 32;
     /* Allocate hardware IRQ controller */
-    ppc6xx_irq_init(env);
+    ppc6xx_irq_init(ppc_env_get_cpu(env));
 }
 
 POWERPC_FAMILY(G2LE)(ObjectClass *oc, void *data)
@@ -4745,7 +4729,7 @@ static void init_proc_e300 (CPUPPCState *env)
     env->dcache_line_size = 32;
     env->icache_line_size = 32;
     /* Allocate hardware IRQ controller */
-    ppc6xx_irq_init(env);
+    ppc6xx_irq_init(ppc_env_get_cpu(env));
 }
 
 POWERPC_FAMILY(e300)(ObjectClass *oc, void *data)
@@ -5000,7 +4984,7 @@ static void init_proc_e500 (CPUPPCState *env, int version)
 
     init_excp_e200(env, ivpr_mask);
     /* Allocate hardware IRQ controller */
-    ppce500_irq_init(env);
+    ppce500_irq_init(ppc_env_get_cpu(env));
 }
 
 static void init_proc_e500v1(CPUPPCState *env)
@@ -5244,7 +5228,7 @@ static void init_proc_601 (CPUPPCState *env)
     env->dcache_line_size = 32;
     env->icache_line_size = 64;
     /* Allocate hardware IRQ controller */
-    ppc6xx_irq_init(env);
+    ppc6xx_irq_init(ppc_env_get_cpu(env));
 }
 
 POWERPC_FAMILY(601)(ObjectClass *oc, void *data)
@@ -5348,7 +5332,7 @@ static void init_proc_602 (CPUPPCState *env)
     env->dcache_line_size = 32;
     env->icache_line_size = 32;
     /* Allocate hardware IRQ controller */
-    ppc6xx_irq_init(env);
+    ppc6xx_irq_init(ppc_env_get_cpu(env));
 }
 
 POWERPC_FAMILY(602)(ObjectClass *oc, void *data)
@@ -5417,7 +5401,7 @@ static void init_proc_603 (CPUPPCState *env)
     env->dcache_line_size = 32;
     env->icache_line_size = 32;
     /* Allocate hardware IRQ controller */
-    ppc6xx_irq_init(env);
+    ppc6xx_irq_init(ppc_env_get_cpu(env));
 }
 
 POWERPC_FAMILY(603)(ObjectClass *oc, void *data)
@@ -5483,7 +5467,7 @@ static void init_proc_603E (CPUPPCState *env)
     env->dcache_line_size = 32;
     env->icache_line_size = 32;
     /* Allocate hardware IRQ controller */
-    ppc6xx_irq_init(env);
+    ppc6xx_irq_init(ppc_env_get_cpu(env));
 }
 
 POWERPC_FAMILY(603E)(ObjectClass *oc, void *data)
@@ -5543,7 +5527,7 @@ static void init_proc_604 (CPUPPCState *env)
     env->dcache_line_size = 32;
     env->icache_line_size = 32;
     /* Allocate hardware IRQ controller */
-    ppc6xx_irq_init(env);
+    ppc6xx_irq_init(ppc_env_get_cpu(env));
 }
 
 POWERPC_FAMILY(604)(ObjectClass *oc, void *data)
@@ -5626,7 +5610,7 @@ static void init_proc_604E (CPUPPCState *env)
     env->dcache_line_size = 32;
     env->icache_line_size = 32;
     /* Allocate hardware IRQ controller */
-    ppc6xx_irq_init(env);
+    ppc6xx_irq_init(ppc_env_get_cpu(env));
 }
 
 POWERPC_FAMILY(604E)(ObjectClass *oc, void *data)
@@ -5696,7 +5680,7 @@ static void init_proc_740 (CPUPPCState *env)
     env->dcache_line_size = 32;
     env->icache_line_size = 32;
     /* Allocate hardware IRQ controller */
-    ppc6xx_irq_init(env);
+    ppc6xx_irq_init(ppc_env_get_cpu(env));
 }
 
 POWERPC_FAMILY(740)(ObjectClass *oc, void *data)
@@ -5774,7 +5758,7 @@ static void init_proc_750 (CPUPPCState *env)
     env->dcache_line_size = 32;
     env->icache_line_size = 32;
     /* Allocate hardware IRQ controller */
-    ppc6xx_irq_init(env);
+    ppc6xx_irq_init(ppc_env_get_cpu(env));
 }
 
 POWERPC_FAMILY(750)(ObjectClass *oc, void *data)
@@ -5937,7 +5921,7 @@ static void init_proc_750cl (CPUPPCState *env)
     env->dcache_line_size = 32;
     env->icache_line_size = 32;
     /* Allocate hardware IRQ controller */
-    ppc6xx_irq_init(env);
+    ppc6xx_irq_init(ppc_env_get_cpu(env));
 }
 
 POWERPC_FAMILY(750cl)(ObjectClass *oc, void *data)
@@ -6057,7 +6041,7 @@ static void init_proc_750cx (CPUPPCState *env)
     env->dcache_line_size = 32;
     env->icache_line_size = 32;
     /* Allocate hardware IRQ controller */
-    ppc6xx_irq_init(env);
+    ppc6xx_irq_init(ppc_env_get_cpu(env));
 }
 
 POWERPC_FAMILY(750cx)(ObjectClass *oc, void *data)
@@ -6144,7 +6128,7 @@ static void init_proc_750fx (CPUPPCState *env)
     env->dcache_line_size = 32;
     env->icache_line_size = 32;
     /* Allocate hardware IRQ controller */
-    ppc6xx_irq_init(env);
+    ppc6xx_irq_init(ppc_env_get_cpu(env));
 }
 
 POWERPC_FAMILY(750fx)(ObjectClass *oc, void *data)
@@ -6231,7 +6215,7 @@ static void init_proc_750gx (CPUPPCState *env)
     env->dcache_line_size = 32;
     env->icache_line_size = 32;
     /* Allocate hardware IRQ controller */
-    ppc6xx_irq_init(env);
+    ppc6xx_irq_init(ppc_env_get_cpu(env));
 }
 
 POWERPC_FAMILY(750gx)(ObjectClass *oc, void *data)
@@ -6309,7 +6293,7 @@ static void init_proc_745 (CPUPPCState *env)
     env->dcache_line_size = 32;
     env->icache_line_size = 32;
     /* Allocate hardware IRQ controller */
-    ppc6xx_irq_init(env);
+    ppc6xx_irq_init(ppc_env_get_cpu(env));
 }
 
 POWERPC_FAMILY(745)(ObjectClass *oc, void *data)
@@ -6395,7 +6379,7 @@ static void init_proc_755 (CPUPPCState *env)
     env->dcache_line_size = 32;
     env->icache_line_size = 32;
     /* Allocate hardware IRQ controller */
-    ppc6xx_irq_init(env);
+    ppc6xx_irq_init(ppc_env_get_cpu(env));
 }
 
 POWERPC_FAMILY(755)(ObjectClass *oc, void *data)
@@ -6464,7 +6448,7 @@ static void init_proc_7400 (CPUPPCState *env)
     env->dcache_line_size = 32;
     env->icache_line_size = 32;
     /* Allocate hardware IRQ controller */
-    ppc6xx_irq_init(env);
+    ppc6xx_irq_init(ppc_env_get_cpu(env));
 }
 
 POWERPC_FAMILY(7400)(ObjectClass *oc, void *data)
@@ -6548,7 +6532,7 @@ static void init_proc_7410 (CPUPPCState *env)
     env->dcache_line_size = 32;
     env->icache_line_size = 32;
     /* Allocate hardware IRQ controller */
-    ppc6xx_irq_init(env);
+    ppc6xx_irq_init(ppc_env_get_cpu(env));
 }
 
 POWERPC_FAMILY(7410)(ObjectClass *oc, void *data)
@@ -6658,7 +6642,7 @@ static void init_proc_7440 (CPUPPCState *env)
     env->dcache_line_size = 32;
     env->icache_line_size = 32;
     /* Allocate hardware IRQ controller */
-    ppc6xx_irq_init(env);
+    ppc6xx_irq_init(ppc_env_get_cpu(env));
 }
 
 POWERPC_FAMILY(7440)(ObjectClass *oc, void *data)
@@ -6791,7 +6775,7 @@ static void init_proc_7450 (CPUPPCState *env)
     env->dcache_line_size = 32;
     env->icache_line_size = 32;
     /* Allocate hardware IRQ controller */
-    ppc6xx_irq_init(env);
+    ppc6xx_irq_init(ppc_env_get_cpu(env));
 }
 
 POWERPC_FAMILY(7450)(ObjectClass *oc, void *data)
@@ -6927,7 +6911,7 @@ static void init_proc_7445 (CPUPPCState *env)
     env->dcache_line_size = 32;
     env->icache_line_size = 32;
     /* Allocate hardware IRQ controller */
-    ppc6xx_irq_init(env);
+    ppc6xx_irq_init(ppc_env_get_cpu(env));
 }
 
 POWERPC_FAMILY(7445)(ObjectClass *oc, void *data)
@@ -7065,7 +7049,7 @@ static void init_proc_7455 (CPUPPCState *env)
     env->dcache_line_size = 32;
     env->icache_line_size = 32;
     /* Allocate hardware IRQ controller */
-    ppc6xx_irq_init(env);
+    ppc6xx_irq_init(ppc_env_get_cpu(env));
 }
 
 POWERPC_FAMILY(7455)(ObjectClass *oc, void *data)
@@ -7227,7 +7211,7 @@ static void init_proc_7457 (CPUPPCState *env)
     env->dcache_line_size = 32;
     env->icache_line_size = 32;
     /* Allocate hardware IRQ controller */
-    ppc6xx_irq_init(env);
+    ppc6xx_irq_init(ppc_env_get_cpu(env));
 }
 
 POWERPC_FAMILY(7457)(ObjectClass *oc, void *data)
@@ -7364,7 +7348,7 @@ static void init_proc_e600 (CPUPPCState *env)
     env->dcache_line_size = 32;
     env->icache_line_size = 32;
     /* Allocate hardware IRQ controller */
-    ppc6xx_irq_init(env);
+    ppc6xx_irq_init(ppc_env_get_cpu(env));
 }
 
 POWERPC_FAMILY(e600)(ObjectClass *oc, void *data)
@@ -8118,12 +8102,12 @@ static void init_proc_book3s_64(CPUPPCState *env, int version)
     case BOOK3S_CPU_970:
     case BOOK3S_CPU_POWER5PLUS:
         init_excp_970(env);
-        ppc970_irq_init(env);
+        ppc970_irq_init(ppc_env_get_cpu(env));
         break;
     case BOOK3S_CPU_POWER7:
     case BOOK3S_CPU_POWER8:
         init_excp_POWER7(env);
-        ppcPOWER7_irq_init(env);
+        ppcPOWER7_irq_init(ppc_env_get_cpu(env));
         break;
     default:
         g_assert_not_reached();
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 72+ messages in thread

* [Qemu-devel] [PATCH 27/50] arm: remove useless cpu.h inclusion
  2016-04-08 20:28 [Qemu-devel] [PATCH for-2.7 00/49] NEED_CPU_H / cpu.h / hw/hw.h cleanups Paolo Bonzini
                   ` (25 preceding siblings ...)
  2016-04-08 20:28 ` [Qemu-devel] [PATCH 26/50] ppc: use PowerPCCPU instead of CPUPPCState Paolo Bonzini
@ 2016-04-08 20:28 ` Paolo Bonzini
  2016-04-08 20:28 ` [Qemu-devel] [PATCH 28/50] explicitly include qom/cpu.h Paolo Bonzini
                   ` (24 subsequent siblings)
  51 siblings, 0 replies; 72+ messages in thread
From: Paolo Bonzini @ 2016-04-08 20:28 UTC (permalink / raw)
  To: qemu-devel

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 include/hw/arm/digic.h | 2 --
 1 file changed, 2 deletions(-)

diff --git a/include/hw/arm/digic.h b/include/hw/arm/digic.h
index a739d6a..aaefe0b 100644
--- a/include/hw/arm/digic.h
+++ b/include/hw/arm/digic.h
@@ -18,8 +18,6 @@
 #ifndef HW_ARM_DIGIC_H
 #define HW_ARM_DIGIC_H
 
-#include "cpu.h"
-
 #include "hw/timer/digic-timer.h"
 #include "hw/char/digic-uart.h"
 
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 72+ messages in thread

* [Qemu-devel] [PATCH 28/50] explicitly include qom/cpu.h
  2016-04-08 20:28 [Qemu-devel] [PATCH for-2.7 00/49] NEED_CPU_H / cpu.h / hw/hw.h cleanups Paolo Bonzini
                   ` (26 preceding siblings ...)
  2016-04-08 20:28 ` [Qemu-devel] [PATCH 27/50] arm: remove useless cpu.h inclusion Paolo Bonzini
@ 2016-04-08 20:28 ` Paolo Bonzini
  2016-04-08 20:28 ` [Qemu-devel] [PATCH 29/50] explicitly include hw/qdev-core.h Paolo Bonzini
                   ` (23 subsequent siblings)
  51 siblings, 0 replies; 72+ messages in thread
From: Paolo Bonzini @ 2016-04-08 20:28 UTC (permalink / raw)
  To: qemu-devel

exec/cpu-all.h includes qom/cpu.h.  Explicit inclusion
will keep things working when cpu.h will not be included
indirectly almost everywhere (either directly or through
qemu-common.h).

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 hw/acpi/piix4.c          | 1 +
 hw/arm/collie.c          | 1 +
 hw/cpu/a9mpcore.c        | 1 +
 hw/isa/lpc_ich9.c        | 1 +
 include/hw/ppc/openpic.h | 1 +
 5 files changed, 5 insertions(+)

diff --git a/hw/acpi/piix4.c b/hw/acpi/piix4.c
index 16abdf1..b3e3bb3 100644
--- a/hw/acpi/piix4.c
+++ b/hw/acpi/piix4.c
@@ -39,6 +39,7 @@
 #include "hw/acpi/memory_hotplug.h"
 #include "hw/acpi/acpi_dev_interface.h"
 #include "hw/xen/xen.h"
+#include "qom/cpu.h"
 
 //#define DEBUG
 
diff --git a/hw/arm/collie.c b/hw/arm/collie.c
index 8bb308a..2e69531 100644
--- a/hw/arm/collie.c
+++ b/hw/arm/collie.c
@@ -18,6 +18,7 @@
 #include "hw/block/flash.h"
 #include "sysemu/block-backend.h"
 #include "exec/address-spaces.h"
+#include "qom/cpu.h"
 
 static struct arm_boot_info collie_binfo = {
     .loader_start = SA_SDCS0,
diff --git a/hw/cpu/a9mpcore.c b/hw/cpu/a9mpcore.c
index 5459ae8..f17f292 100644
--- a/hw/cpu/a9mpcore.c
+++ b/hw/cpu/a9mpcore.c
@@ -11,6 +11,7 @@
 #include "qemu/osdep.h"
 #include "qapi/error.h"
 #include "hw/cpu/a9mpcore.h"
+#include "qom/cpu.h"
 
 static void a9mp_priv_set_irq(void *opaque, int irq, int level)
 {
diff --git a/hw/isa/lpc_ich9.c b/hw/isa/lpc_ich9.c
index 99cd3ba..4f8ca45 100644
--- a/hw/isa/lpc_ich9.c
+++ b/hw/isa/lpc_ich9.c
@@ -47,6 +47,7 @@
 #include "hw/pci/pci_bus.h"
 #include "exec/address-spaces.h"
 #include "sysemu/sysemu.h"
+#include "qom/cpu.h"
 
 static int ich9_lpc_sci_irq(ICH9LPCState *lpc);
 
diff --git a/include/hw/ppc/openpic.h b/include/hw/ppc/openpic.h
index ee67098..1cf188d 100644
--- a/include/hw/ppc/openpic.h
+++ b/include/hw/ppc/openpic.h
@@ -3,6 +3,7 @@
 
 #include "qemu-common.h"
 #include "hw/qdev.h"
+#include "qom/cpu.h"
 
 #define TYPE_OPENPIC "openpic"
 
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 72+ messages in thread

* [Qemu-devel] [PATCH 29/50] explicitly include hw/qdev-core.h
  2016-04-08 20:28 [Qemu-devel] [PATCH for-2.7 00/49] NEED_CPU_H / cpu.h / hw/hw.h cleanups Paolo Bonzini
                   ` (27 preceding siblings ...)
  2016-04-08 20:28 ` [Qemu-devel] [PATCH 28/50] explicitly include qom/cpu.h Paolo Bonzini
@ 2016-04-08 20:28 ` Paolo Bonzini
  2016-04-08 20:28 ` [Qemu-devel] [PATCH 30/50] explicitly include linux/kvm.h Paolo Bonzini
                   ` (22 subsequent siblings)
  51 siblings, 0 replies; 72+ messages in thread
From: Paolo Bonzini @ 2016-04-08 20:28 UTC (permalink / raw)
  To: qemu-devel

exec/cpu-all.h includes qom/cpu.h, which includes hw/qdev-core.h.
Explicit inclusion will keep things working when cpu.h will not be
included indirectly almost everywhere (either directly or through
qemu-common.h).

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 bootdevice.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/bootdevice.c b/bootdevice.c
index 2e83ff0..bb9c08e 100644
--- a/bootdevice.c
+++ b/bootdevice.c
@@ -28,6 +28,7 @@
 #include "qapi/visitor.h"
 #include "qemu/error-report.h"
 #include "hw/hw.h"
+#include "hw/qdev-core.h"
 
 typedef struct FWBootEntry FWBootEntry;
 
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 72+ messages in thread

* [Qemu-devel] [PATCH 30/50] explicitly include linux/kvm.h
  2016-04-08 20:28 [Qemu-devel] [PATCH for-2.7 00/49] NEED_CPU_H / cpu.h / hw/hw.h cleanups Paolo Bonzini
                   ` (28 preceding siblings ...)
  2016-04-08 20:28 ` [Qemu-devel] [PATCH 29/50] explicitly include hw/qdev-core.h Paolo Bonzini
@ 2016-04-08 20:28 ` Paolo Bonzini
  2016-04-08 20:28 ` [Qemu-devel] [PATCH 31/50] apic: move target-dependent definitions to cpu.h Paolo Bonzini
                   ` (21 subsequent siblings)
  51 siblings, 0 replies; 72+ messages in thread
From: Paolo Bonzini @ 2016-04-08 20:28 UTC (permalink / raw)
  To: qemu-devel

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 hw/i386/kvm/i8254.c      | 1 +
 hw/i386/kvm/pci-assign.c | 1 +
 hw/vfio/common.c         | 3 +++
 3 files changed, 5 insertions(+)

diff --git a/hw/i386/kvm/i8254.c b/hw/i386/kvm/i8254.c
index a4462e5..734992e 100644
--- a/hw/i386/kvm/i8254.c
+++ b/hw/i386/kvm/i8254.c
@@ -29,6 +29,7 @@
 #include "hw/timer/i8254.h"
 #include "hw/timer/i8254_internal.h"
 #include "sysemu/kvm.h"
+#include "linux/kvm.h"
 
 #define KVM_PIT_REINJECT_BIT 0
 
diff --git a/hw/i386/kvm/pci-assign.c b/hw/i386/kvm/pci-assign.c
index bf425a2..db2cbd2 100644
--- a/hw/i386/kvm/pci-assign.c
+++ b/hw/i386/kvm/pci-assign.c
@@ -33,6 +33,7 @@
 #include "sysemu/sysemu.h"
 #include "hw/pci/pci.h"
 #include "hw/pci/msi.h"
+#include "linux/kvm.h"
 #include "kvm_i386.h"
 #include "hw/pci/pci-assign.h"
 
diff --git a/hw/vfio/common.c b/hw/vfio/common.c
index f27db36..88154a1 100644
--- a/hw/vfio/common.c
+++ b/hw/vfio/common.c
@@ -30,6 +30,9 @@
 #include "hw/hw.h"
 #include "qemu/error-report.h"
 #include "sysemu/kvm.h"
+#ifdef CONFIG_KVM
+#include "linux/kvm.h"
+#endif
 #include "trace.h"
 
 struct vfio_group_head vfio_group_list =
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 72+ messages in thread

* [Qemu-devel] [PATCH 31/50] apic: move target-dependent definitions to cpu.h
  2016-04-08 20:28 [Qemu-devel] [PATCH for-2.7 00/49] NEED_CPU_H / cpu.h / hw/hw.h cleanups Paolo Bonzini
                   ` (29 preceding siblings ...)
  2016-04-08 20:28 ` [Qemu-devel] [PATCH 30/50] explicitly include linux/kvm.h Paolo Bonzini
@ 2016-04-08 20:28 ` Paolo Bonzini
  2016-04-08 20:28 ` [Qemu-devel] [PATCH 32/50] include: poison symbols in osdep.h Paolo Bonzini
                   ` (20 subsequent siblings)
  51 siblings, 0 replies; 72+ messages in thread
From: Paolo Bonzini @ 2016-04-08 20:28 UTC (permalink / raw)
  To: qemu-devel

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 hw/intc/ioapic.c       | 1 +
 include/hw/i386/apic.h | 5 -----
 target-i386/cpu.h      | 7 +++++++
 3 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/hw/intc/ioapic.c b/hw/intc/ioapic.c
index 378e663..4f42b91 100644
--- a/hw/intc/ioapic.c
+++ b/hw/intc/ioapic.c
@@ -24,6 +24,7 @@
 #include "monitor/monitor.h"
 #include "hw/hw.h"
 #include "hw/i386/pc.h"
+#include "hw/i386/apic.h"
 #include "hw/i386/ioapic.h"
 #include "hw/i386/ioapic_internal.h"
 #include "include/hw/pci/msi.h"
diff --git a/include/hw/i386/apic.h b/include/hw/i386/apic.h
index 51eb6d3..ea48ea9 100644
--- a/include/hw/i386/apic.h
+++ b/include/hw/i386/apic.h
@@ -18,15 +18,10 @@ void cpu_set_apic_tpr(DeviceState *s, uint8_t val);
 uint8_t cpu_get_apic_tpr(DeviceState *s);
 void apic_init_reset(DeviceState *s);
 void apic_sipi(DeviceState *s);
-void apic_handle_tpr_access_report(DeviceState *d, target_ulong ip,
-                                   TPRAccess access);
 void apic_poll_irq(DeviceState *d);
 void apic_designate_bsp(DeviceState *d, bool bsp);
 
 /* pc.c */
 DeviceState *cpu_get_current_apic(void);
 
-/* cpu.c */
-bool cpu_is_bsp(X86CPU *cpu);
-
 #endif
diff --git a/target-i386/cpu.h b/target-i386/cpu.h
index 9614c88..2200aeb 100644
--- a/target-i386/cpu.h
+++ b/target-i386/cpu.h
@@ -1455,7 +1455,11 @@ void do_interrupt_x86_hardirq(CPUX86State *env, int intno, int is_hw);
 void do_smm_enter(X86CPU *cpu);
 void cpu_smm_update(X86CPU *cpu);
 
+/* apic.c */
 void cpu_report_tpr_access(CPUX86State *env, TPRAccess access);
+void apic_handle_tpr_access_report(DeviceState *d, target_ulong ip,
+                                   TPRAccess access);
+
 
 /* Change the value of a KVM-specific default
  *
@@ -1481,4 +1485,7 @@ void enable_compat_apic_id_mode(void);
 void x86_cpu_dump_local_apic_state(CPUState *cs, FILE *f,
                                    fprintf_function cpu_fprintf, int flags);
 
+/* cpu.c */
+bool cpu_is_bsp(X86CPU *cpu);
+
 #endif /* CPU_I386_H */
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 72+ messages in thread

* [Qemu-devel] [PATCH 32/50] include: poison symbols in osdep.h
  2016-04-08 20:28 [Qemu-devel] [PATCH for-2.7 00/49] NEED_CPU_H / cpu.h / hw/hw.h cleanups Paolo Bonzini
                   ` (30 preceding siblings ...)
  2016-04-08 20:28 ` [Qemu-devel] [PATCH 31/50] apic: move target-dependent definitions to cpu.h Paolo Bonzini
@ 2016-04-08 20:28 ` Paolo Bonzini
  2016-04-08 20:28 ` [Qemu-devel] [PATCH 33/50] hw: do not use VMSTATE_*TL Paolo Bonzini
                   ` (19 subsequent siblings)
  51 siblings, 0 replies; 72+ messages in thread
From: Paolo Bonzini @ 2016-04-08 20:28 UTC (permalink / raw)
  To: qemu-devel

Ensure that all target-independent files ignore poisoned symbols,
and fix the fallout.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 hw/core/Makefile.objs      |  2 +-
 include/exec/cpu-common.h  |  4 ----
 include/exec/helper-head.h | 23 +++++++++++++----------
 include/qemu/osdep.h       |  2 ++
 scripts/create_config      |  2 +-
 5 files changed, 17 insertions(+), 16 deletions(-)

diff --git a/hw/core/Makefile.objs b/hw/core/Makefile.objs
index abb3560..70951d4 100644
--- a/hw/core/Makefile.objs
+++ b/hw/core/Makefile.objs
@@ -4,7 +4,7 @@ common-obj-y += fw-path-provider.o
 # irq.o needed for qdev GPIO handling:
 common-obj-y += irq.o
 common-obj-y += hotplug.o
-common-obj-y += nmi.o
+obj-y += nmi.o
 
 common-obj-$(CONFIG_EMPTY_SLOT) += empty_slot.o
 common-obj-$(CONFIG_XILINX_AXI) += stream.o
diff --git a/include/exec/cpu-common.h b/include/exec/cpu-common.h
index 9e839e5..4f59034 100644
--- a/include/exec/cpu-common.h
+++ b/include/exec/cpu-common.h
@@ -7,10 +7,6 @@
 #include "exec/hwaddr.h"
 #endif
 
-#ifndef NEED_CPU_H
-#include "exec/poison.h"
-#endif
-
 #include "qemu/bswap.h"
 #include "qemu/queue.h"
 #include "qemu/fprintf-fn.h"
diff --git a/include/exec/helper-head.h b/include/exec/helper-head.h
index ec79043..74f8f03 100644
--- a/include/exec/helper-head.h
+++ b/include/exec/helper-head.h
@@ -33,17 +33,9 @@
 #define dh_alias_s64 i64
 #define dh_alias_f32 i32
 #define dh_alias_f64 i64
-#ifdef TARGET_LONG_BITS
-# if TARGET_LONG_BITS == 32
-#  define dh_alias_tl i32
-# else
-#  define dh_alias_tl i64
-# endif
-#endif
 #define dh_alias_ptr ptr
 #define dh_alias_void void
 #define dh_alias_noreturn noreturn
-#define dh_alias_env ptr
 #define dh_alias(t) glue(dh_alias_, t)
 
 #define dh_ctype_i32 uint32_t
@@ -53,13 +45,24 @@
 #define dh_ctype_s64 int64_t
 #define dh_ctype_f32 float32
 #define dh_ctype_f64 float64
-#define dh_ctype_tl target_ulong
 #define dh_ctype_ptr void *
 #define dh_ctype_void void
 #define dh_ctype_noreturn void QEMU_NORETURN
-#define dh_ctype_env CPUArchState *
 #define dh_ctype(t) dh_ctype_##t
 
+#ifdef NEED_CPU_H
+# ifdef TARGET_LONG_BITS
+#  if TARGET_LONG_BITS == 32
+#   define dh_alias_tl i32
+#  else
+#   define dh_alias_tl i64
+#  endif
+# endif
+# define dh_alias_env ptr
+# define dh_ctype_tl target_ulong
+# define dh_ctype_env CPUArchState *
+#endif
+
 /* We can't use glue() here because it falls foul of C preprocessor
    recursive expansion rules.  */
 #define dh_retvar_decl0_void void
diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h
index 408783f..7fe7b76 100644
--- a/include/qemu/osdep.h
+++ b/include/qemu/osdep.h
@@ -30,6 +30,8 @@
 #include "config-host.h"
 #ifdef NEED_CPU_H
 #include "config-target.h"
+#else
+#include "exec/poison.h"
 #endif
 #include "qemu/compiler.h"
 
diff --git a/scripts/create_config b/scripts/create_config
index 9cb176f..b2d2ebb 100755
--- a/scripts/create_config
+++ b/scripts/create_config
@@ -52,7 +52,7 @@ case $line in
     done
     echo "    NULL"
     ;;
- CONFIG_*=y) # configuration
+ CONFIG_*='$(CONFIG_SOFTMMU)'|CONFIG_*=y) # configuration
     name=${line%=*}
     echo "#define $name 1"
     ;;
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 72+ messages in thread

* [Qemu-devel] [PATCH 33/50] hw: do not use VMSTATE_*TL
  2016-04-08 20:28 [Qemu-devel] [PATCH for-2.7 00/49] NEED_CPU_H / cpu.h / hw/hw.h cleanups Paolo Bonzini
                   ` (31 preceding siblings ...)
  2016-04-08 20:28 ` [Qemu-devel] [PATCH 32/50] include: poison symbols in osdep.h Paolo Bonzini
@ 2016-04-08 20:28 ` Paolo Bonzini
  2016-04-08 20:28 ` [Qemu-devel] [PATCH 34/50] hw: move CPU state serialization to migration/cpu.h Paolo Bonzini
                   ` (18 subsequent siblings)
  51 siblings, 0 replies; 72+ messages in thread
From: Paolo Bonzini @ 2016-04-08 20:28 UTC (permalink / raw)
  To: qemu-devel

Reserve this to CPU state serialization.

Luckily, they were only used by sPAPR devices and these are ppc64
only.  So there is no change to migration format.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 hw/net/spapr_llan.c        | 8 ++++----
 hw/ppc/spapr_vio.c         | 2 +-
 include/hw/ppc/spapr_vio.h | 2 +-
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/hw/net/spapr_llan.c b/hw/net/spapr_llan.c
index a647f25..db97da3 100644
--- a/hw/net/spapr_llan.c
+++ b/hw/net/spapr_llan.c
@@ -106,9 +106,9 @@ typedef struct VIOsPAPRVLANDevice {
     NICConf nicconf;
     NICState *nic;
     bool isopen;
-    target_ulong buf_list;
+    hwaddr buf_list;
     uint32_t add_buf_ptr, use_buf_ptr, rx_bufs;
-    target_ulong rxq_ptr;
+    hwaddr rxq_ptr;
     uint32_t compat_flags;             /* Compatability flags for migration */
     RxBufPool *rx_pool[RX_MAX_POOLS];  /* Receive buffer descriptor pools */
 } VIOsPAPRVLANDevice;
@@ -765,11 +765,11 @@ static const VMStateDescription vmstate_spapr_llan = {
         VMSTATE_SPAPR_VIO(sdev, VIOsPAPRVLANDevice),
         /* LLAN state */
         VMSTATE_BOOL(isopen, VIOsPAPRVLANDevice),
-        VMSTATE_UINTTL(buf_list, VIOsPAPRVLANDevice),
+        VMSTATE_UINT64(buf_list, VIOsPAPRVLANDevice),
         VMSTATE_UINT32(add_buf_ptr, VIOsPAPRVLANDevice),
         VMSTATE_UINT32(use_buf_ptr, VIOsPAPRVLANDevice),
         VMSTATE_UINT32(rx_bufs, VIOsPAPRVLANDevice),
-        VMSTATE_UINTTL(rxq_ptr, VIOsPAPRVLANDevice),
+        VMSTATE_UINT64(rxq_ptr, VIOsPAPRVLANDevice),
 
         VMSTATE_END_OF_LIST()
     },
diff --git a/hw/ppc/spapr_vio.c b/hw/ppc/spapr_vio.c
index 8aa021f..6b20b40 100644
--- a/hw/ppc/spapr_vio.c
+++ b/hw/ppc/spapr_vio.c
@@ -584,7 +584,7 @@ const VMStateDescription vmstate_spapr_vio = {
         VMSTATE_UINT32_EQUAL(irq, VIOsPAPRDevice),
 
         /* General VIO device state */
-        VMSTATE_UINTTL(signal_state, VIOsPAPRDevice),
+        VMSTATE_UINT64(signal_state, VIOsPAPRDevice),
         VMSTATE_UINT64(crq.qladdr, VIOsPAPRDevice),
         VMSTATE_UINT32(crq.qsize, VIOsPAPRDevice),
         VMSTATE_UINT32(crq.qnext, VIOsPAPRDevice),
diff --git a/include/hw/ppc/spapr_vio.h b/include/hw/ppc/spapr_vio.h
index c9733e7..5f8b042 100644
--- a/include/hw/ppc/spapr_vio.h
+++ b/include/hw/ppc/spapr_vio.h
@@ -61,7 +61,7 @@ struct VIOsPAPRDevice {
     DeviceState qdev;
     uint32_t reg;
     uint32_t irq;
-    target_ulong signal_state;
+    uint64_t signal_state;
     VIOsPAPR_CRQ crq;
     AddressSpace as;
     MemoryRegion mrroot;
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 72+ messages in thread

* [Qemu-devel] [PATCH 34/50] hw: move CPU state serialization to migration/cpu.h
  2016-04-08 20:28 [Qemu-devel] [PATCH for-2.7 00/49] NEED_CPU_H / cpu.h / hw/hw.h cleanups Paolo Bonzini
                   ` (32 preceding siblings ...)
  2016-04-08 20:28 ` [Qemu-devel] [PATCH 33/50] hw: do not use VMSTATE_*TL Paolo Bonzini
@ 2016-04-08 20:28 ` Paolo Bonzini
  2016-04-08 20:28 ` [Qemu-devel] [PATCH 35/50] hw: cannot include hw/hw.h from user emulation Paolo Bonzini
                   ` (17 subsequent siblings)
  51 siblings, 0 replies; 72+ messages in thread
From: Paolo Bonzini @ 2016-04-08 20:28 UTC (permalink / raw)
  To: qemu-devel

Remove usage of NEED_CPU_H from hw/hw.h.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 include/hw/hw.h           | 49 -----------------------------------------------
 include/migration/cpu.h   | 48 ++++++++++++++++++++++++++++++++++++++++++++++
 target-alpha/machine.c    |  1 +
 target-arm/machine.c      |  1 +
 target-cris/machine.c     |  1 +
 target-i386/machine.c     |  1 +
 target-lm32/machine.c     |  1 +
 target-mips/machine.c     |  2 +-
 target-moxie/machine.c    |  1 +
 target-openrisc/machine.c |  1 +
 target-ppc/machine.c      |  1 +
 target-sparc/machine.c    |  1 +
 12 files changed, 58 insertions(+), 50 deletions(-)
 create mode 100644 include/migration/cpu.h

diff --git a/include/hw/hw.h b/include/hw/hw.h
index 2cb69d5..0456fc3 100644
--- a/include/hw/hw.h
+++ b/include/hw/hw.h
@@ -14,28 +14,6 @@
 #include "qemu/log.h"
 #include "qemu/module.h"
 
-#ifdef NEED_CPU_H
-#if TARGET_LONG_BITS == 64
-#define qemu_put_betl qemu_put_be64
-#define qemu_get_betl qemu_get_be64
-#define qemu_put_betls qemu_put_be64s
-#define qemu_get_betls qemu_get_be64s
-#define qemu_put_sbetl qemu_put_sbe64
-#define qemu_get_sbetl qemu_get_sbe64
-#define qemu_put_sbetls qemu_put_sbe64s
-#define qemu_get_sbetls qemu_get_sbe64s
-#else
-#define qemu_put_betl qemu_put_be32
-#define qemu_get_betl qemu_get_be32
-#define qemu_put_betls qemu_put_be32s
-#define qemu_get_betls qemu_get_be32s
-#define qemu_put_sbetl qemu_put_sbe32
-#define qemu_get_sbetl qemu_get_sbe32
-#define qemu_put_sbetls qemu_put_sbe32s
-#define qemu_get_sbetls qemu_get_sbe32s
-#endif
-#endif
-
 typedef void QEMUResetHandler(void *opaque);
 
 void qemu_register_reset(QEMUResetHandler *func, void *opaque);
@@ -43,31 +21,4 @@ void qemu_unregister_reset(QEMUResetHandler *func, void *opaque);
 
 void QEMU_NORETURN hw_error(const char *fmt, ...) GCC_FMT_ATTR(1, 2);
 
-#ifdef NEED_CPU_H
-#if TARGET_LONG_BITS == 64
-#define VMSTATE_UINTTL_V(_f, _s, _v)                                  \
-    VMSTATE_UINT64_V(_f, _s, _v)
-#define VMSTATE_UINTTL_EQUAL_V(_f, _s, _v)                            \
-    VMSTATE_UINT64_EQUAL_V(_f, _s, _v)
-#define VMSTATE_UINTTL_ARRAY_V(_f, _s, _n, _v)                        \
-    VMSTATE_UINT64_ARRAY_V(_f, _s, _n, _v)
-#define vmstate_info_uinttl vmstate_info_uint64
-#else
-#define VMSTATE_UINTTL_V(_f, _s, _v)                                  \
-    VMSTATE_UINT32_V(_f, _s, _v)
-#define VMSTATE_UINTTL_EQUAL_V(_f, _s, _v)                            \
-    VMSTATE_UINT32_EQUAL_V(_f, _s, _v)
-#define VMSTATE_UINTTL_ARRAY_V(_f, _s, _n, _v)                        \
-    VMSTATE_UINT32_ARRAY_V(_f, _s, _n, _v)
-#define vmstate_info_uinttl vmstate_info_uint32
-#endif
-#define VMSTATE_UINTTL(_f, _s)                                        \
-    VMSTATE_UINTTL_V(_f, _s, 0)
-#define VMSTATE_UINTTL_EQUAL(_f, _s)                                  \
-    VMSTATE_UINTTL_EQUAL_V(_f, _s, 0)
-#define VMSTATE_UINTTL_ARRAY(_f, _s, _n)                              \
-    VMSTATE_UINTTL_ARRAY_V(_f, _s, _n, 0)
-
-#endif
-
 #endif
diff --git a/include/migration/cpu.h b/include/migration/cpu.h
new file mode 100644
index 0000000..f3abbab
--- /dev/null
+++ b/include/migration/cpu.h
@@ -0,0 +1,48 @@
+/* Declarations for use for CPU state serialization.  */
+#ifndef MIGRATION_CPU_H
+#define MIGRATION_CPU_H
+
+#if TARGET_LONG_BITS == 64
+#define qemu_put_betl qemu_put_be64
+#define qemu_get_betl qemu_get_be64
+#define qemu_put_betls qemu_put_be64s
+#define qemu_get_betls qemu_get_be64s
+#define qemu_put_sbetl qemu_put_sbe64
+#define qemu_get_sbetl qemu_get_sbe64
+#define qemu_put_sbetls qemu_put_sbe64s
+#define qemu_get_sbetls qemu_get_sbe64s
+
+#define VMSTATE_UINTTL_V(_f, _s, _v)                                  \
+    VMSTATE_UINT64_V(_f, _s, _v)
+#define VMSTATE_UINTTL_EQUAL_V(_f, _s, _v)                            \
+    VMSTATE_UINT64_EQUAL_V(_f, _s, _v)
+#define VMSTATE_UINTTL_ARRAY_V(_f, _s, _n, _v)                        \
+    VMSTATE_UINT64_ARRAY_V(_f, _s, _n, _v)
+#define vmstate_info_uinttl vmstate_info_uint64
+#else
+#define qemu_put_betl qemu_put_be32
+#define qemu_get_betl qemu_get_be32
+#define qemu_put_betls qemu_put_be32s
+#define qemu_get_betls qemu_get_be32s
+#define qemu_put_sbetl qemu_put_sbe32
+#define qemu_get_sbetl qemu_get_sbe32
+#define qemu_put_sbetls qemu_put_sbe32s
+#define qemu_get_sbetls qemu_get_sbe32s
+
+#define VMSTATE_UINTTL_V(_f, _s, _v)                                  \
+    VMSTATE_UINT32_V(_f, _s, _v)
+#define VMSTATE_UINTTL_EQUAL_V(_f, _s, _v)                            \
+    VMSTATE_UINT32_EQUAL_V(_f, _s, _v)
+#define VMSTATE_UINTTL_ARRAY_V(_f, _s, _n, _v)                        \
+    VMSTATE_UINT32_ARRAY_V(_f, _s, _n, _v)
+#define vmstate_info_uinttl vmstate_info_uint32
+#endif
+
+#define VMSTATE_UINTTL(_f, _s)                                        \
+    VMSTATE_UINTTL_V(_f, _s, 0)
+#define VMSTATE_UINTTL_EQUAL(_f, _s)                                  \
+    VMSTATE_UINTTL_EQUAL_V(_f, _s, 0)
+#define VMSTATE_UINTTL_ARRAY(_f, _s, _n)                              \
+    VMSTATE_UINTTL_ARRAY_V(_f, _s, _n, 0)
+
+#endif
diff --git a/target-alpha/machine.c b/target-alpha/machine.c
index 9ab0928..3f72943 100644
--- a/target-alpha/machine.c
+++ b/target-alpha/machine.c
@@ -1,6 +1,7 @@
 #include "qemu/osdep.h"
 #include "hw/hw.h"
 #include "hw/boards.h"
+#include "migration/cpu.h"
 
 static int get_fpcr(QEMUFile *f, void *opaque, size_t size)
 {
diff --git a/target-arm/machine.c b/target-arm/machine.c
index 03a73d9..c23feb1 100644
--- a/target-arm/machine.c
+++ b/target-arm/machine.c
@@ -5,6 +5,7 @@
 #include "sysemu/kvm.h"
 #include "kvm_arm.h"
 #include "internals.h"
+#include "migration/cpu.h"
 
 static bool vfp_needed(void *opaque)
 {
diff --git a/target-cris/machine.c b/target-cris/machine.c
index 9cc2820..4c9287f 100644
--- a/target-cris/machine.c
+++ b/target-cris/machine.c
@@ -20,6 +20,7 @@
 
 #include "qemu/osdep.h"
 #include "hw/hw.h"
+#include "migration/cpu.h"
 
 static const VMStateDescription vmstate_tlbset = {
     .name = "cpu/tlbset",
diff --git a/target-i386/machine.c b/target-i386/machine.c
index ee5b949..57203b2 100644
--- a/target-i386/machine.c
+++ b/target-i386/machine.c
@@ -3,6 +3,7 @@
 #include "hw/boards.h"
 #include "hw/i386/pc.h"
 #include "hw/isa/isa.h"
+#include "migration/cpu.h"
 
 #include "cpu.h"
 #include "sysemu/kvm.h"
diff --git a/target-lm32/machine.c b/target-lm32/machine.c
index 91c943d..6f56216 100644
--- a/target-lm32/machine.c
+++ b/target-lm32/machine.c
@@ -1,6 +1,7 @@
 #include "qemu/osdep.h"
 #include "hw/hw.h"
 #include "hw/boards.h"
+#include "migration/cpu.h"
 
 static const VMStateDescription vmstate_env = {
     .name = "env",
diff --git a/target-mips/machine.c b/target-mips/machine.c
index 22bca18..eb3d916 100644
--- a/target-mips/machine.c
+++ b/target-mips/machine.c
@@ -1,7 +1,7 @@
 #include "qemu/osdep.h"
 #include "hw/hw.h"
-
 #include "cpu.h"
+#include "migration/cpu.h"
 
 static int cpu_post_load(void *opaque, int version_id)
 {
diff --git a/target-moxie/machine.c b/target-moxie/machine.c
index 912b791..7810e1c 100644
--- a/target-moxie/machine.c
+++ b/target-moxie/machine.c
@@ -2,6 +2,7 @@
 #include "hw/hw.h"
 #include "hw/boards.h"
 #include "machine.h"
+#include "migration/cpu.h"
 
 const VMStateDescription vmstate_moxie_cpu = {
     .name = "cpu",
diff --git a/target-openrisc/machine.c b/target-openrisc/machine.c
index b4dc08d..bd5d50f 100644
--- a/target-openrisc/machine.c
+++ b/target-openrisc/machine.c
@@ -20,6 +20,7 @@
 #include "qemu/osdep.h"
 #include "hw/hw.h"
 #include "hw/boards.h"
+#include "migration/cpu.h"
 
 static const VMStateDescription vmstate_env = {
     .name = "env",
diff --git a/target-ppc/machine.c b/target-ppc/machine.c
index 692121e..2ea29dd 100644
--- a/target-ppc/machine.c
+++ b/target-ppc/machine.c
@@ -4,6 +4,7 @@
 #include "sysemu/kvm.h"
 #include "helper_regs.h"
 #include "mmu-hash64.h"
+#include "migration/cpu.h"
 
 static int cpu_load_old(QEMUFile *f, void *opaque, int version_id)
 {
diff --git a/target-sparc/machine.c b/target-sparc/machine.c
index 1046016..04806f6 100644
--- a/target-sparc/machine.c
+++ b/target-sparc/machine.c
@@ -4,6 +4,7 @@
 #include "qemu/timer.h"
 
 #include "cpu.h"
+#include "migration/cpu.h"
 
 #ifdef TARGET_SPARC64
 static const VMStateDescription vmstate_cpu_timer = {
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 72+ messages in thread

* [Qemu-devel] [PATCH 35/50] hw: cannot include hw/hw.h from user emulation
  2016-04-08 20:28 [Qemu-devel] [PATCH for-2.7 00/49] NEED_CPU_H / cpu.h / hw/hw.h cleanups Paolo Bonzini
                   ` (33 preceding siblings ...)
  2016-04-08 20:28 ` [Qemu-devel] [PATCH 34/50] hw: move CPU state serialization to migration/cpu.h Paolo Bonzini
@ 2016-04-08 20:28 ` Paolo Bonzini
  2016-04-08 20:28 ` [Qemu-devel] [PATCH 36/50] cpu: move endian-dependent load/store functions to cpu-all.h Paolo Bonzini
                   ` (16 subsequent siblings)
  51 siblings, 0 replies; 72+ messages in thread
From: Paolo Bonzini @ 2016-04-08 20:28 UTC (permalink / raw)
  To: qemu-devel

All qdev definitions are available from other headers, user-mode
emulation does not need hw/hw.h.

By considering system emulation only, it is simpler to disentangle
hw/hw.h from NEED_CPU_H.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 exec.c                     | 21 +++++++++++----------
 include/hw/hw.h            |  5 +++--
 include/hw/ppc/openpic.h   |  2 +-
 kvm-stub.c                 |  1 -
 target-i386/cpu.c          |  2 +-
 target-s390x/cpu.c         |  3 ++-
 target-s390x/mem_helper.c  |  3 +++
 target-s390x/misc_helper.c |  2 +-
 8 files changed, 22 insertions(+), 17 deletions(-)

diff --git a/exec.c b/exec.c
index c4f9036..fbfa02e 100644
--- a/exec.c
+++ b/exec.c
@@ -25,23 +25,23 @@
 #include "qemu/cutils.h"
 #include "cpu.h"
 #include "tcg.h"
-#include "hw/hw.h"
+#include "hw/qdev-core.h"
 #if !defined(CONFIG_USER_ONLY)
 #include "hw/boards.h"
 #endif
-#include "hw/qdev.h"
 #include "sysemu/kvm.h"
 #include "sysemu/sysemu.h"
 #include "hw/xen/xen.h"
 #include "qemu/timer.h"
 #include "qemu/config-file.h"
 #include "qemu/error-report.h"
-#include "exec/memory.h"
-#include "sysemu/dma.h"
-#include "exec/address-spaces.h"
 #if defined(CONFIG_USER_ONLY)
 #include <qemu.h>
 #else /* !CONFIG_USER_ONLY */
+#include "hw/hw.h"
+#include "exec/memory.h"
+#include "sysemu/dma.h"
+#include "exec/address-spaces.h"
 #include "sysemu/xen-mapcache.h"
 #include "trace.h"
 #endif
@@ -641,7 +641,6 @@ void cpu_exec_exit(CPUState *cpu)
 void cpu_exec_init(CPUState *cpu, Error **errp)
 {
     CPUClass *cc = CPU_GET_CLASS(cpu);
-    int cpu_index;
     Error *local_err = NULL;
 
     cpu->as = NULL;
@@ -668,7 +667,7 @@ void cpu_exec_init(CPUState *cpu, Error **errp)
 #if defined(CONFIG_USER_ONLY)
     cpu_list_lock();
 #endif
-    cpu_index = cpu->cpu_index = cpu_get_free_index(&local_err);
+    cpu->cpu_index = cpu_get_free_index(&local_err);
     if (local_err) {
         error_propagate(errp, local_err);
 #if defined(CONFIG_USER_ONLY)
@@ -678,14 +677,16 @@ void cpu_exec_init(CPUState *cpu, Error **errp)
     }
     QTAILQ_INSERT_TAIL(&cpus, cpu, node);
 #if defined(CONFIG_USER_ONLY)
+    (void) cc;
     cpu_list_unlock();
-#endif
+#else
     if (qdev_get_vmsd(DEVICE(cpu)) == NULL) {
-        vmstate_register(NULL, cpu_index, &vmstate_cpu_common, cpu);
+        vmstate_register(NULL, cpu->cpu_index, &vmstate_cpu_common, cpu);
     }
     if (cc->vmsd != NULL) {
-        vmstate_register(NULL, cpu_index, cc->vmsd, cpu);
+        vmstate_register(NULL, cpu->cpu_index, cc->vmsd, cpu);
     }
+#endif
 }
 
 #if defined(CONFIG_USER_ONLY)
diff --git a/include/hw/hw.h b/include/hw/hw.h
index 0456fc3..29931d1 100644
--- a/include/hw/hw.h
+++ b/include/hw/hw.h
@@ -3,10 +3,11 @@
 #define QEMU_HW_H
 
 
-#if !defined(CONFIG_USER_ONLY) && !defined(NEED_CPU_H)
-#include "exec/cpu-common.h"
+#ifdef CONFIG_USER_ONLY
+#error Cannot include hw/hw.h from user emulation
 #endif
 
+#include "exec/cpu-common.h"
 #include "exec/ioport.h"
 #include "hw/irq.h"
 #include "block/aio.h"
diff --git a/include/hw/ppc/openpic.h b/include/hw/ppc/openpic.h
index 1cf188d..afe950b 100644
--- a/include/hw/ppc/openpic.h
+++ b/include/hw/ppc/openpic.h
@@ -2,7 +2,7 @@
 #define __OPENPIC_H__
 
 #include "qemu-common.h"
-#include "hw/qdev.h"
+#include "hw/qdev-core.h"
 #include "qom/cpu.h"
 
 #define TYPE_OPENPIC "openpic"
diff --git a/kvm-stub.c b/kvm-stub.c
index b962b24..63735a8 100644
--- a/kvm-stub.c
+++ b/kvm-stub.c
@@ -12,7 +12,6 @@
 
 #include "qemu/osdep.h"
 #include "qemu-common.h"
-#include "hw/hw.h"
 #include "cpu.h"
 #include "sysemu/kvm.h"
 
diff --git a/target-i386/cpu.c b/target-i386/cpu.c
index ddae932..fdef6ed 100644
--- a/target-i386/cpu.c
+++ b/target-i386/cpu.c
@@ -34,7 +34,6 @@
 #include "qapi/visitor.h"
 #include "sysemu/arch_init.h"
 
-#include "hw/hw.h"
 #if defined(CONFIG_KVM)
 #include <linux/kvm_para.h>
 #endif
@@ -43,6 +42,7 @@
 #include "hw/qdev-properties.h"
 #ifndef CONFIG_USER_ONLY
 #include "exec/address-spaces.h"
+#include "hw/hw.h"
 #include "hw/xen/xen.h"
 #include "hw/i386/apic_internal.h"
 #endif
diff --git a/target-s390x/cpu.c b/target-s390x/cpu.c
index 4bfff34..e665165 100644
--- a/target-s390x/cpu.c
+++ b/target-s390x/cpu.c
@@ -30,10 +30,11 @@
 #include "qemu/cutils.h"
 #include "qemu/timer.h"
 #include "qemu/error-report.h"
-#include "hw/hw.h"
 #include "trace.h"
 #include "qapi/visitor.h"
+#include "migration/vmstate.h"
 #ifndef CONFIG_USER_ONLY
+#include "hw/hw.h"
 #include "sysemu/arch_init.h"
 #include "sysemu/sysemu.h"
 #include "hw/s390x/sclp.h"
diff --git a/target-s390x/mem_helper.c b/target-s390x/mem_helper.c
index 7078622..9d206a9 100644
--- a/target-s390x/mem_helper.c
+++ b/target-s390x/mem_helper.c
@@ -22,7 +22,10 @@
 #include "cpu.h"
 #include "exec/helper-proto.h"
 #include "exec/cpu_ldst.h"
+
+#if !defined(CONFIG_USER_ONLY)
 #include "hw/s390x/storage-keys.h"
+#endif
 
 /*****************************************************************************/
 /* Softmmu support */
diff --git a/target-s390x/misc_helper.c b/target-s390x/misc_helper.c
index 71cbe34..762dc21 100644
--- a/target-s390x/misc_helper.c
+++ b/target-s390x/misc_helper.c
@@ -30,9 +30,9 @@
 #include <linux/kvm.h>
 #endif
 #include "exec/cpu_ldst.h"
-#include "hw/watchdog/wdt_diag288.h"
 
 #if !defined(CONFIG_USER_ONLY)
+#include "hw/watchdog/wdt_diag288.h"
 #include "sysemu/cpus.h"
 #include "sysemu/sysemu.h"
 #include "hw/s390x/ebcdic.h"
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 72+ messages in thread

* [Qemu-devel] [PATCH 36/50] cpu: move endian-dependent load/store functions to cpu-all.h
  2016-04-08 20:28 [Qemu-devel] [PATCH for-2.7 00/49] NEED_CPU_H / cpu.h / hw/hw.h cleanups Paolo Bonzini
                   ` (34 preceding siblings ...)
  2016-04-08 20:28 ` [Qemu-devel] [PATCH 35/50] hw: cannot include hw/hw.h from user emulation Paolo Bonzini
@ 2016-04-08 20:28 ` Paolo Bonzini
  2016-04-08 20:28 ` [Qemu-devel] [PATCH 37/50] qemu-common: stop including qemu/bswap.h from qemu-common.h Paolo Bonzini
                   ` (15 subsequent siblings)
  51 siblings, 0 replies; 72+ messages in thread
From: Paolo Bonzini @ 2016-04-08 20:28 UTC (permalink / raw)
  To: qemu-devel

Disentangle cpu-common.h and memory.h from NEED_CPU_H.  Prototypes are
not defined for !NEED_CPU_H, so remove them from poison.h too.  Only
macros need poisoning.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 include/exec/cpu-all.h    | 25 +++++++++++++++++++++++++
 include/exec/cpu-common.h | 10 ----------
 include/exec/memory.h     | 17 -----------------
 include/exec/poison.h     |  8 --------
 4 files changed, 25 insertions(+), 35 deletions(-)

diff --git a/include/exec/cpu-all.h b/include/exec/cpu-all.h
index 08e5093..3911576 100644
--- a/include/exec/cpu-all.h
+++ b/include/exec/cpu-all.h
@@ -165,6 +165,31 @@ extern unsigned long reserved_va;
 
 #define GUEST_ADDR_MAX (reserved_va ? reserved_va : \
                                     (1ul << TARGET_VIRT_ADDR_SPACE_BITS) - 1)
+#else
+
+#include "exec/hwaddr.h"
+uint32_t lduw_phys(AddressSpace *as, hwaddr addr);
+uint32_t ldl_phys(AddressSpace *as, hwaddr addr);
+uint64_t ldq_phys(AddressSpace *as, hwaddr addr);
+void stl_phys_notdirty(AddressSpace *as, hwaddr addr, uint32_t val);
+void stw_phys(AddressSpace *as, hwaddr addr, uint32_t val);
+void stl_phys(AddressSpace *as, hwaddr addr, uint32_t val);
+void stq_phys(AddressSpace *as, hwaddr addr, uint64_t val);
+
+uint32_t address_space_lduw(AddressSpace *as, hwaddr addr,
+                            MemTxAttrs attrs, MemTxResult *result);
+uint32_t address_space_ldl(AddressSpace *as, hwaddr addr,
+                            MemTxAttrs attrs, MemTxResult *result);
+uint64_t address_space_ldq(AddressSpace *as, hwaddr addr,
+                            MemTxAttrs attrs, MemTxResult *result);
+void address_space_stl_notdirty(AddressSpace *as, hwaddr addr, uint32_t val,
+                            MemTxAttrs attrs, MemTxResult *result);
+void address_space_stw(AddressSpace *as, hwaddr addr, uint32_t val,
+                            MemTxAttrs attrs, MemTxResult *result);
+void address_space_stl(AddressSpace *as, hwaddr addr, uint32_t val,
+                            MemTxAttrs attrs, MemTxResult *result);
+void address_space_stq(AddressSpace *as, hwaddr addr, uint64_t val,
+                            MemTxAttrs attrs, MemTxResult *result);
 #endif
 
 /* page related stuff */
diff --git a/include/exec/cpu-common.h b/include/exec/cpu-common.h
index 4f59034..04eade5 100644
--- a/include/exec/cpu-common.h
+++ b/include/exec/cpu-common.h
@@ -109,16 +109,6 @@ void stl_be_phys(AddressSpace *as, hwaddr addr, uint32_t val);
 void stq_le_phys(AddressSpace *as, hwaddr addr, uint64_t val);
 void stq_be_phys(AddressSpace *as, hwaddr addr, uint64_t val);
 
-#ifdef NEED_CPU_H
-uint32_t lduw_phys(AddressSpace *as, hwaddr addr);
-uint32_t ldl_phys(AddressSpace *as, hwaddr addr);
-uint64_t ldq_phys(AddressSpace *as, hwaddr addr);
-void stl_phys_notdirty(AddressSpace *as, hwaddr addr, uint32_t val);
-void stw_phys(AddressSpace *as, hwaddr addr, uint32_t val);
-void stl_phys(AddressSpace *as, hwaddr addr, uint32_t val);
-void stq_phys(AddressSpace *as, hwaddr addr, uint64_t val);
-#endif
-
 void cpu_physical_memory_write_rom(AddressSpace *as, hwaddr addr,
                                    const uint8_t *buf, int len);
 void cpu_flush_icache_range(hwaddr start, int len);
diff --git a/include/exec/memory.h b/include/exec/memory.h
index e2a3e99..7fb9188 100644
--- a/include/exec/memory.h
+++ b/include/exec/memory.h
@@ -1292,23 +1292,6 @@ void address_space_stq_le(AddressSpace *as, hwaddr addr, uint64_t val,
 void address_space_stq_be(AddressSpace *as, hwaddr addr, uint64_t val,
                             MemTxAttrs attrs, MemTxResult *result);
 
-#ifdef NEED_CPU_H
-uint32_t address_space_lduw(AddressSpace *as, hwaddr addr,
-                            MemTxAttrs attrs, MemTxResult *result);
-uint32_t address_space_ldl(AddressSpace *as, hwaddr addr,
-                            MemTxAttrs attrs, MemTxResult *result);
-uint64_t address_space_ldq(AddressSpace *as, hwaddr addr,
-                            MemTxAttrs attrs, MemTxResult *result);
-void address_space_stl_notdirty(AddressSpace *as, hwaddr addr, uint32_t val,
-                            MemTxAttrs attrs, MemTxResult *result);
-void address_space_stw(AddressSpace *as, hwaddr addr, uint32_t val,
-                            MemTxAttrs attrs, MemTxResult *result);
-void address_space_stl(AddressSpace *as, hwaddr addr, uint32_t val,
-                            MemTxAttrs attrs, MemTxResult *result);
-void address_space_stq(AddressSpace *as, hwaddr addr, uint64_t val,
-                            MemTxAttrs attrs, MemTxResult *result);
-#endif
-
 /* address_space_translate: translate an address range into an address space
  * into a MemoryRegion and an address range into that section.  Should be
  * called from an RCU critical section, to avoid that the last reference
diff --git a/include/exec/poison.h b/include/exec/poison.h
index a4b1eca..3ca7929 100644
--- a/include/exec/poison.h
+++ b/include/exec/poison.h
@@ -37,14 +37,6 @@
 
 #pragma GCC poison CPUArchState
 
-#pragma GCC poison lduw_phys
-#pragma GCC poison ldl_phys
-#pragma GCC poison ldq_phys
-#pragma GCC poison stl_phys_notdirty
-#pragma GCC poison stw_phys
-#pragma GCC poison stl_phys
-#pragma GCC poison stq_phys
-
 #pragma GCC poison CPU_INTERRUPT_HARD
 #pragma GCC poison CPU_INTERRUPT_EXITTB
 #pragma GCC poison CPU_INTERRUPT_HALT
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 72+ messages in thread

* [Qemu-devel] [PATCH 37/50] qemu-common: stop including qemu/bswap.h from qemu-common.h
  2016-04-08 20:28 [Qemu-devel] [PATCH for-2.7 00/49] NEED_CPU_H / cpu.h / hw/hw.h cleanups Paolo Bonzini
                   ` (35 preceding siblings ...)
  2016-04-08 20:28 ` [Qemu-devel] [PATCH 36/50] cpu: move endian-dependent load/store functions to cpu-all.h Paolo Bonzini
@ 2016-04-08 20:28 ` Paolo Bonzini
  2016-04-08 20:28 ` [Qemu-devel] [PATCH 38/50] qemu-common: stop including qemu/host-utils.h " Paolo Bonzini
                   ` (14 subsequent siblings)
  51 siblings, 0 replies; 72+ messages in thread
From: Paolo Bonzini @ 2016-04-08 20:28 UTC (permalink / raw)
  To: qemu-devel

Move it to the actual users.  There are still a few includes of
qemu/bswap.h in headers; removing them is left for future work.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 audio/mixeng.c         | 1 +
 block/bochs.c          | 1 +
 block/cloop.c          | 1 +
 block/parallels.c      | 1 +
 block/qcow.c           | 1 +
 block/qcow2-cluster.c  | 1 +
 block/qcow2-refcount.c | 1 +
 block/qcow2-snapshot.c | 1 +
 block/qcow2.c          | 1 +
 block/qed-table.c      | 1 +
 block/qed.c            | 1 +
 block/vdi.c            | 1 +
 block/vhdx-endian.c    | 1 +
 block/vhdx-log.c       | 1 +
 block/vhdx.c           | 1 +
 block/vmdk.c           | 1 +
 block/vpc.c            | 1 +
 block/vvfat.c          | 1 +
 crypto/afsplit.c       | 1 +
 crypto/block-luks.c    | 1 +
 device_tree.c          | 1 +
 hw/arm/nseries.c       | 1 +
 hw/block/hd-geometry.c | 1 +
 hw/bt/hci-csr.c        | 1 +
 hw/bt/l2cap.c          | 1 +
 include/qemu-common.h  | 2 --
 io/channel-websock.c   | 1 +
 nbd/nbd-internal.h     | 1 +
 qemu-nbd.c             | 1 +
 tests/ide-test.c       | 1 +
 ui/vnc-ws.c            | 1 +
 31 files changed, 30 insertions(+), 2 deletions(-)

diff --git a/audio/mixeng.c b/audio/mixeng.c
index 981b97a..b4b3a4a 100644
--- a/audio/mixeng.c
+++ b/audio/mixeng.c
@@ -24,6 +24,7 @@
  */
 #include "qemu/osdep.h"
 #include "qemu-common.h"
+#include "qemu/bswap.h"
 #include "audio.h"
 
 #define AUDIO_CAP "mixeng"
diff --git a/block/bochs.c b/block/bochs.c
index af8b7ab..42d7c33 100644
--- a/block/bochs.c
+++ b/block/bochs.c
@@ -27,6 +27,7 @@
 #include "qemu-common.h"
 #include "block/block_int.h"
 #include "qemu/module.h"
+#include "qemu/bswap.h"
 
 /**************************************************************/
 
diff --git a/block/cloop.c b/block/cloop.c
index a84f140..f5d3123 100644
--- a/block/cloop.c
+++ b/block/cloop.c
@@ -26,6 +26,7 @@
 #include "qemu-common.h"
 #include "block/block_int.h"
 #include "qemu/module.h"
+#include "qemu/bswap.h"
 #include <zlib.h>
 
 /* Maximum compressed block size */
diff --git a/block/parallels.c b/block/parallels.c
index 324ed43..5be8165 100644
--- a/block/parallels.c
+++ b/block/parallels.c
@@ -33,6 +33,7 @@
 #include "block/block_int.h"
 #include "sysemu/block-backend.h"
 #include "qemu/module.h"
+#include "qemu/bswap.h"
 #include "qemu/bitmap.h"
 #include "qapi/util.h"
 
diff --git a/block/qcow.c b/block/qcow.c
index 60ddb12..f70dc58 100644
--- a/block/qcow.c
+++ b/block/qcow.c
@@ -28,6 +28,7 @@
 #include "block/block_int.h"
 #include "sysemu/block-backend.h"
 #include "qemu/module.h"
+#include "qemu/bswap.h"
 #include <zlib.h>
 #include "qapi/qmp/qerror.h"
 #include "crypto/cipher.h"
diff --git a/block/qcow2-cluster.c b/block/qcow2-cluster.c
index 31ecc10..892e0fb 100644
--- a/block/qcow2-cluster.c
+++ b/block/qcow2-cluster.c
@@ -29,6 +29,7 @@
 #include "qemu-common.h"
 #include "block/block_int.h"
 #include "block/qcow2.h"
+#include "qemu/bswap.h"
 #include "trace.h"
 
 int qcow2_grow_l1_table(BlockDriverState *bs, uint64_t min_size,
diff --git a/block/qcow2-refcount.c b/block/qcow2-refcount.c
index ca6094f..7fa972a 100644
--- a/block/qcow2-refcount.c
+++ b/block/qcow2-refcount.c
@@ -28,6 +28,7 @@
 #include "block/block_int.h"
 #include "block/qcow2.h"
 #include "qemu/range.h"
+#include "qemu/bswap.h"
 
 static int64_t alloc_clusters_noref(BlockDriverState *bs, uint64_t size);
 static int QEMU_WARN_UNUSED_RESULT update_refcount(BlockDriverState *bs,
diff --git a/block/qcow2-snapshot.c b/block/qcow2-snapshot.c
index 5f4a17e..242fb21 100644
--- a/block/qcow2-snapshot.c
+++ b/block/qcow2-snapshot.c
@@ -26,6 +26,7 @@
 #include "qapi/error.h"
 #include "block/block_int.h"
 #include "block/qcow2.h"
+#include "qemu/bswap.h"
 #include "qemu/error-report.h"
 #include "qemu/cutils.h"
 
diff --git a/block/qcow2.c b/block/qcow2.c
index 056525c..5e457ae 100644
--- a/block/qcow2.c
+++ b/block/qcow2.c
@@ -36,6 +36,7 @@
 #include "trace.h"
 #include "qemu/option_int.h"
 #include "qemu/cutils.h"
+#include "qemu/bswap.h"
 
 /*
   Differences with QCOW:
diff --git a/block/qed-table.c b/block/qed-table.c
index 802945f..c841ad1 100644
--- a/block/qed-table.c
+++ b/block/qed-table.c
@@ -16,6 +16,7 @@
 #include "trace.h"
 #include "qemu/sockets.h" /* for EINPROGRESS on Windows */
 #include "qed.h"
+#include "qemu/bswap.h"
 
 typedef struct {
     GenericCB gencb;
diff --git a/block/qed.c b/block/qed.c
index 0af5274..b07d5bb 100644
--- a/block/qed.c
+++ b/block/qed.c
@@ -15,6 +15,7 @@
 #include "qemu/osdep.h"
 #include "qapi/error.h"
 #include "qemu/timer.h"
+#include "qemu/bswap.h"
 #include "trace.h"
 #include "qed.h"
 #include "qapi/qmp/qerror.h"
diff --git a/block/vdi.c b/block/vdi.c
index 75d4819..49b87b6 100644
--- a/block/vdi.c
+++ b/block/vdi.c
@@ -54,6 +54,7 @@
 #include "block/block_int.h"
 #include "sysemu/block-backend.h"
 #include "qemu/module.h"
+#include "qemu/bswap.h"
 #include "migration/migration.h"
 #include "qemu/coroutine.h"
 #include "qemu/cutils.h"
diff --git a/block/vhdx-endian.c b/block/vhdx-endian.c
index da33cd3..c306b90 100644
--- a/block/vhdx-endian.c
+++ b/block/vhdx-endian.c
@@ -18,6 +18,7 @@
 #include "qemu/osdep.h"
 #include "qemu-common.h"
 #include "block/block_int.h"
+#include "qemu/bswap.h"
 #include "block/vhdx.h"
 
 #include <uuid/uuid.h>
diff --git a/block/vhdx-log.c b/block/vhdx-log.c
index 7ea7187..8ab7d22 100644
--- a/block/vhdx-log.c
+++ b/block/vhdx-log.c
@@ -23,6 +23,7 @@
 #include "block/block_int.h"
 #include "qemu/error-report.h"
 #include "qemu/module.h"
+#include "qemu/bswap.h"
 #include "block/vhdx.h"
 
 
diff --git a/block/vhdx.c b/block/vhdx.c
index 2b7b332..1415442 100644
--- a/block/vhdx.c
+++ b/block/vhdx.c
@@ -22,6 +22,7 @@
 #include "sysemu/block-backend.h"
 #include "qemu/module.h"
 #include "qemu/crc32c.h"
+#include "qemu/bswap.h"
 #include "block/vhdx.h"
 #include "migration/migration.h"
 
diff --git a/block/vmdk.c b/block/vmdk.c
index 45f9d3c..38bdf1c 100644
--- a/block/vmdk.c
+++ b/block/vmdk.c
@@ -30,6 +30,7 @@
 #include "qapi/qmp/qerror.h"
 #include "qemu/error-report.h"
 #include "qemu/module.h"
+#include "qemu/bswap.h"
 #include "migration/migration.h"
 #include "qemu/cutils.h"
 #include <zlib.h>
diff --git a/block/vpc.c b/block/vpc.c
index 8830b5b..66b83d2 100644
--- a/block/vpc.c
+++ b/block/vpc.c
@@ -29,6 +29,7 @@
 #include "sysemu/block-backend.h"
 #include "qemu/module.h"
 #include "migration/migration.h"
+#include "qemu/bswap.h"
 #if defined(CONFIG_UUID)
 #include <uuid/uuid.h>
 #endif
diff --git a/block/vvfat.c b/block/vvfat.c
index 6b85314..a013796 100644
--- a/block/vvfat.c
+++ b/block/vvfat.c
@@ -27,6 +27,7 @@
 #include "qapi/error.h"
 #include "block/block_int.h"
 #include "qemu/module.h"
+#include "qemu/bswap.h"
 #include "migration/migration.h"
 #include "qapi/qmp/qint.h"
 #include "qapi/qmp/qbool.h"
diff --git a/crypto/afsplit.c b/crypto/afsplit.c
index 8074913..825e2cf 100644
--- a/crypto/afsplit.c
+++ b/crypto/afsplit.c
@@ -24,6 +24,7 @@
  */
 
 #include "qemu/osdep.h"
+#include "qemu/bswap.h"
 #include "crypto/afsplit.h"
 #include "crypto/random.h"
 
diff --git a/crypto/block-luks.c b/crypto/block-luks.c
index 439f892..17c4300 100644
--- a/crypto/block-luks.c
+++ b/crypto/block-luks.c
@@ -20,6 +20,7 @@
 
 #include "qemu/osdep.h"
 #include "qapi/error.h"
+#include "qemu/bswap.h"
 
 #include "crypto/block-luks.h"
 
diff --git a/device_tree.c b/device_tree.c
index ccba1fd..6e06320 100644
--- a/device_tree.c
+++ b/device_tree.c
@@ -20,6 +20,7 @@
 #include "qapi/error.h"
 #include "qemu-common.h"
 #include "qemu/error-report.h"
+#include "qemu/bswap.h"
 #include "sysemu/device_tree.h"
 #include "sysemu/sysemu.h"
 #include "hw/loader.h"
diff --git a/hw/arm/nseries.c b/hw/arm/nseries.c
index 5382505..d331d69 100644
--- a/hw/arm/nseries.c
+++ b/hw/arm/nseries.c
@@ -21,6 +21,7 @@
 #include "qemu/osdep.h"
 #include "qapi/error.h"
 #include "qemu/cutils.h"
+#include "qemu/bswap.h"
 #include "sysemu/sysemu.h"
 #include "hw/arm/omap.h"
 #include "hw/arm/arm.h"
diff --git a/hw/block/hd-geometry.c b/hw/block/hd-geometry.c
index 6d02192..be7503a 100644
--- a/hw/block/hd-geometry.c
+++ b/hw/block/hd-geometry.c
@@ -32,6 +32,7 @@
 
 #include "qemu/osdep.h"
 #include "sysemu/block-backend.h"
+#include "qemu/bswap.h"
 #include "hw/block/block.h"
 #include "trace.h"
 
diff --git a/hw/bt/hci-csr.c b/hw/bt/hci-csr.c
index 2e970b6..e6b8998 100644
--- a/hw/bt/hci-csr.c
+++ b/hw/bt/hci-csr.c
@@ -22,6 +22,7 @@
 #include "qemu-common.h"
 #include "sysemu/char.h"
 #include "qemu/timer.h"
+#include "qemu/bswap.h"
 #include "hw/irq.h"
 #include "sysemu/bt.h"
 #include "hw/bt.h"
diff --git a/hw/bt/l2cap.c b/hw/bt/l2cap.c
index 8065251..dfc95ed 100644
--- a/hw/bt/l2cap.c
+++ b/hw/bt/l2cap.c
@@ -20,6 +20,7 @@
 #include "qemu/osdep.h"
 #include "qemu-common.h"
 #include "qemu/timer.h"
+#include "qemu/bswap.h"
 #include "hw/bt.h"
 
 #define L2CAP_CID_MAX	0x100	/* Between 0x40 and 0x10000 */
diff --git a/include/qemu-common.h b/include/qemu-common.h
index f0d74076..dc041fc 100644
--- a/include/qemu-common.h
+++ b/include/qemu-common.h
@@ -23,8 +23,6 @@
 #include "qemu/option.h"
 #include "qemu/host-utils.h"
 
-#include "qemu/bswap.h"
-
 /* FIXME: Remove NEED_CPU_H.  */
 #ifdef NEED_CPU_H
 #include "cpu.h"
diff --git a/io/channel-websock.c b/io/channel-websock.c
index 7081787..239c75a 100644
--- a/io/channel-websock.c
+++ b/io/channel-websock.c
@@ -20,6 +20,7 @@
 
 #include "qemu/osdep.h"
 #include "qapi/error.h"
+#include "qemu/bswap.h"
 #include "io/channel-websock.h"
 #include "crypto/hash.h"
 #include "trace.h"
diff --git a/nbd/nbd-internal.h b/nbd/nbd-internal.h
index d09b4ee..32d0b62 100644
--- a/nbd/nbd-internal.h
+++ b/nbd/nbd-internal.h
@@ -27,6 +27,7 @@
 #include <linux/fs.h>
 #endif
 
+#include "qemu/bswap.h"
 #include "qemu/queue.h"
 #include "qemu/main-loop.h"
 
diff --git a/qemu-nbd.c b/qemu-nbd.c
index ca4a724..ffa584b 100644
--- a/qemu-nbd.c
+++ b/qemu-nbd.c
@@ -26,6 +26,7 @@
 #include "qemu/main-loop.h"
 #include "qemu/error-report.h"
 #include "qemu/config-file.h"
+#include "qemu/bswap.h"
 #include "block/snapshot.h"
 #include "qapi/util.h"
 #include "qapi/qmp/qstring.h"
diff --git a/tests/ide-test.c b/tests/ide-test.c
index 0d9ab4d..67e5c1f 100644
--- a/tests/ide-test.c
+++ b/tests/ide-test.c
@@ -32,6 +32,7 @@
 #include "libqos/malloc-pc.h"
 
 #include "qemu-common.h"
+#include "qemu/bswap.h"
 #include "hw/pci/pci_ids.h"
 #include "hw/pci/pci_regs.h"
 
diff --git a/ui/vnc-ws.c b/ui/vnc-ws.c
index 7c79a4c..3bac46e 100644
--- a/ui/vnc-ws.c
+++ b/ui/vnc-ws.c
@@ -22,6 +22,7 @@
 #include "qapi/error.h"
 #include "vnc.h"
 #include "io/channel-websock.h"
+#include "qemu/bswap.h"
 
 static void vncws_tls_handshake_done(Object *source,
                                      Error *err,
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 72+ messages in thread

* [Qemu-devel] [PATCH 38/50] qemu-common: stop including qemu/host-utils.h from qemu-common.h
  2016-04-08 20:28 [Qemu-devel] [PATCH for-2.7 00/49] NEED_CPU_H / cpu.h / hw/hw.h cleanups Paolo Bonzini
                   ` (36 preceding siblings ...)
  2016-04-08 20:28 ` [Qemu-devel] [PATCH 37/50] qemu-common: stop including qemu/bswap.h from qemu-common.h Paolo Bonzini
@ 2016-04-08 20:28 ` Paolo Bonzini
  2016-04-21 10:46   ` Alex Bennée
  2016-04-08 20:28 ` [Qemu-devel] [PATCH 39/50] gdbstub: remove includes from gdbstub-xml.c Paolo Bonzini
                   ` (13 subsequent siblings)
  51 siblings, 1 reply; 72+ messages in thread
From: Paolo Bonzini @ 2016-04-08 20:28 UTC (permalink / raw)
  To: qemu-devel

Move it to the actual users.  There are some inclusions of
qemu/host-utils.h in headers, but they are all necessary.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 audio/noaudio.c                         | 1 +
 audio/wavaudio.c                        | 2 +-
 contrib/ivshmem-server/ivshmem-server.c | 1 +
 hw/acpi/core.c                          | 6 ++++++
 hw/bt/sdp.c                             | 1 +
 hw/display/tc6393xb.c                   | 1 +
 include/exec/cpu-defs.h                 | 1 +
 include/hw/acpi/acpi.h                  | 7 -------
 include/qemu-common.h                   | 1 -
 include/qemu/timer.h                    | 1 -
 page_cache.c                            | 1 +
 slirp/slirp.h                           | 1 +
 stubs/slirp.c                           | 1 +
 tests/libqos/malloc.c                   | 1 +
 util/buffer.c                           | 1 +
 15 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/audio/noaudio.c b/audio/noaudio.c
index b360c19..9ca9eaf 100644
--- a/audio/noaudio.c
+++ b/audio/noaudio.c
@@ -23,6 +23,7 @@
  */
 #include "qemu/osdep.h"
 #include "qemu-common.h"
+#include "qemu/host-utils.h"
 #include "audio.h"
 #include "qemu/timer.h"
 
diff --git a/audio/wavaudio.c b/audio/wavaudio.c
index 345952e..341eec3 100644
--- a/audio/wavaudio.c
+++ b/audio/wavaudio.c
@@ -22,7 +22,7 @@
  * THE SOFTWARE.
  */
 #include "qemu/osdep.h"
-#include "hw/hw.h"
+#include "qemu/host-utils.h"
 #include "qemu/timer.h"
 #include "audio.h"
 
diff --git a/contrib/ivshmem-server/ivshmem-server.c b/contrib/ivshmem-server/ivshmem-server.c
index 172db78..bf4ee0b 100644
--- a/contrib/ivshmem-server/ivshmem-server.c
+++ b/contrib/ivshmem-server/ivshmem-server.c
@@ -7,6 +7,7 @@
  */
 #include "qemu/osdep.h"
 #include "qemu-common.h"
+#include "qemu/host-utils.h"
 #include "qemu/sockets.h"
 
 #include <sys/mman.h>
diff --git a/hw/acpi/core.c b/hw/acpi/core.c
index 7925a1a..f0808c1 100644
--- a/hw/acpi/core.c
+++ b/hw/acpi/core.c
@@ -491,6 +491,12 @@ void acpi_pm_tmr_update(ACPIREGS *ar, bool enable)
     }
 }
 
+static inline int64_t acpi_pm_tmr_get_clock(void)
+{
+    return muldiv64(qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL), PM_TIMER_FREQUENCY,
+                    NANOSECONDS_PER_SECOND);
+}
+
 void acpi_pm_tmr_calc_overflow_time(ACPIREGS *ar)
 {
     int64_t d = acpi_pm_tmr_get_clock();
diff --git a/hw/bt/sdp.c b/hw/bt/sdp.c
index be26009..f67b3b8 100644
--- a/hw/bt/sdp.c
+++ b/hw/bt/sdp.c
@@ -19,6 +19,7 @@
 
 #include "qemu/osdep.h"
 #include "qemu-common.h"
+#include "qemu/host-utils.h"
 #include "hw/bt.h"
 
 struct bt_l2cap_sdp_state_s {
diff --git a/hw/display/tc6393xb.c b/hw/display/tc6393xb.c
index da3cece..92f7120 100644
--- a/hw/display/tc6393xb.c
+++ b/hw/display/tc6393xb.c
@@ -12,6 +12,7 @@
  */
 #include "qemu/osdep.h"
 #include "qapi/error.h"
+#include "qemu/host-utils.h"
 #include "hw/hw.h"
 #include "hw/devices.h"
 #include "hw/block/flash.h"
diff --git a/include/exec/cpu-defs.h b/include/exec/cpu-defs.h
index 854e7e3..5f4e303 100644
--- a/include/exec/cpu-defs.h
+++ b/include/exec/cpu-defs.h
@@ -23,6 +23,7 @@
 #error cpu.h included from common code
 #endif
 
+#include "qemu/host-utils.h"
 #include "qemu/queue.h"
 #include "tcg-target.h"
 #ifndef CONFIG_USER_ONLY
diff --git a/include/hw/acpi/acpi.h b/include/hw/acpi/acpi.h
index e0978c8..dc6ee00 100644
--- a/include/hw/acpi/acpi.h
+++ b/include/hw/acpi/acpi.h
@@ -150,13 +150,6 @@ void acpi_pm_tmr_init(ACPIREGS *ar, acpi_update_sci_fn update_sci,
                       MemoryRegion *parent);
 void acpi_pm_tmr_reset(ACPIREGS *ar);
 
-#include "qemu/timer.h"
-static inline int64_t acpi_pm_tmr_get_clock(void)
-{
-    return muldiv64(qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL), PM_TIMER_FREQUENCY,
-                    NANOSECONDS_PER_SECOND);
-}
-
 /* PM1a_EVT: piix and ich9 don't implement PM1b. */
 uint16_t acpi_pm1_evt_get_sts(ACPIREGS *ar);
 void acpi_pm1_evt_power_down(ACPIREGS *ar);
diff --git a/include/qemu-common.h b/include/qemu-common.h
index dc041fc..cd3139b 100644
--- a/include/qemu-common.h
+++ b/include/qemu-common.h
@@ -21,7 +21,6 @@
 #define TFR(expr) do { if ((expr) != -1) break; } while (errno == EINTR)
 
 #include "qemu/option.h"
-#include "qemu/host-utils.h"
 
 /* FIXME: Remove NEED_CPU_H.  */
 #ifdef NEED_CPU_H
diff --git a/include/qemu/timer.h b/include/qemu/timer.h
index 309f3d0..d97ddfb 100644
--- a/include/qemu/timer.h
+++ b/include/qemu/timer.h
@@ -3,7 +3,6 @@
 
 #include "qemu-common.h"
 #include "qemu/notify.h"
-#include "qemu/host-utils.h"
 #include "sysemu/cpus.h"
 
 #define NANOSECONDS_PER_SECOND 1000000000LL
diff --git a/page_cache.c b/page_cache.c
index cb8a69e..37a66e4 100644
--- a/page_cache.c
+++ b/page_cache.c
@@ -16,6 +16,7 @@
 #include <glib.h>
 
 #include "qemu-common.h"
+#include "qemu/host-utils.h"
 #include "migration/page_cache.h"
 
 #ifdef DEBUG_CACHE
diff --git a/slirp/slirp.h b/slirp/slirp.h
index c99ebb9..223da91 100644
--- a/slirp/slirp.h
+++ b/slirp/slirp.h
@@ -1,6 +1,7 @@
 #ifndef __COMMON_H__
 #define __COMMON_H__
 
+#include "qemu/host-utils.h"
 #include "slirp_config.h"
 
 #ifdef _WIN32
diff --git a/stubs/slirp.c b/stubs/slirp.c
index dcae51f..42f7e1a 100644
--- a/stubs/slirp.c
+++ b/stubs/slirp.c
@@ -1,5 +1,6 @@
 #include "qemu/osdep.h"
 #include "qemu-common.h"
+#include "qemu/host-utils.h"
 #include "slirp/slirp.h"
 
 void slirp_pollfds_fill(GArray *pollfds, uint32_t *timeout)
diff --git a/tests/libqos/malloc.c b/tests/libqos/malloc.c
index c0df52f..793fe69 100644
--- a/tests/libqos/malloc.c
+++ b/tests/libqos/malloc.c
@@ -13,6 +13,7 @@
 #include "qemu/osdep.h"
 #include "libqos/malloc.h"
 #include "qemu-common.h"
+#include "qemu/host-utils.h"
 #include <glib.h>
 
 typedef QTAILQ_HEAD(MemList, MemBlock) MemList;
diff --git a/util/buffer.c b/util/buffer.c
index a6118bf..f59bacc 100644
--- a/util/buffer.c
+++ b/util/buffer.c
@@ -19,6 +19,7 @@
  */
 
 #include "qemu/osdep.h"
+#include "qemu/host-utils.h"
 #include "qemu/buffer.h"
 #include "trace.h"
 
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 72+ messages in thread

* [Qemu-devel] [PATCH 39/50] gdbstub: remove includes from gdbstub-xml.c
  2016-04-08 20:28 [Qemu-devel] [PATCH for-2.7 00/49] NEED_CPU_H / cpu.h / hw/hw.h cleanups Paolo Bonzini
                   ` (37 preceding siblings ...)
  2016-04-08 20:28 ` [Qemu-devel] [PATCH 38/50] qemu-common: stop including qemu/host-utils.h " Paolo Bonzini
@ 2016-04-08 20:28 ` Paolo Bonzini
  2016-04-18 13:54   ` Markus Armbruster
  2016-04-08 20:29 ` [Qemu-devel] [PATCH 40/50] dma: do not depend on kvm_enabled() Paolo Bonzini
                   ` (12 subsequent siblings)
  51 siblings, 1 reply; 72+ messages in thread
From: Paolo Bonzini @ 2016-04-08 20:28 UTC (permalink / raw)
  To: qemu-devel

gdbstub-xml.c defines a bunch of arrays of strings; there is no
need to include anything.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 scripts/feature_to_c.sh | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/scripts/feature_to_c.sh b/scripts/feature_to_c.sh
index fb1f336..0994d95 100644
--- a/scripts/feature_to_c.sh
+++ b/scripts/feature_to_c.sh
@@ -36,9 +36,6 @@ for input; do
   arrayname=xml_feature_`echo $input | sed 's,.*/,,; s/[-.]/_/g'`
 
   ${AWK:-awk} 'BEGIN { n = 0
-      printf "#include \"qemu/osdep.h\"\n"
-      printf "#include \"qemu-common.h\"\n"
-      printf "#include \"exec/gdbstub.h\"\n"
       print "static const char '$arrayname'[] = {"
       for (i = 0; i < 255; i++)
         _ord_[sprintf("%c", i)] = i
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 72+ messages in thread

* [Qemu-devel] [PATCH 40/50] dma: do not depend on kvm_enabled()
  2016-04-08 20:28 [Qemu-devel] [PATCH for-2.7 00/49] NEED_CPU_H / cpu.h / hw/hw.h cleanups Paolo Bonzini
                   ` (38 preceding siblings ...)
  2016-04-08 20:28 ` [Qemu-devel] [PATCH 39/50] gdbstub: remove includes from gdbstub-xml.c Paolo Bonzini
@ 2016-04-08 20:29 ` Paolo Bonzini
  2016-04-08 20:29 ` [Qemu-devel] [PATCH 41/50] s390x: move stuff out of cpu.h Paolo Bonzini
                   ` (11 subsequent siblings)
  51 siblings, 0 replies; 72+ messages in thread
From: Paolo Bonzini @ 2016-04-08 20:29 UTC (permalink / raw)
  To: qemu-devel

Memory barriers are needed also by Xen and, when the ioeventfd
bugs are fixed, by TCG as well.

sysemu/kvm.h is not anymore needed in sysemu/dma.h, move it to
the actual users.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 hw/intc/arm_gicv2m.c | 1 +
 hw/ppc/e500plat.c    | 1 +
 hw/ppc/spapr_hcall.c | 1 +
 hw/ppc/spapr_rtas.c  | 1 +
 include/sysemu/dma.h | 5 +----
 5 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/hw/intc/arm_gicv2m.c b/hw/intc/arm_gicv2m.c
index e8b5177..589d315 100644
--- a/hw/intc/arm_gicv2m.c
+++ b/hw/intc/arm_gicv2m.c
@@ -29,6 +29,7 @@
 #include "qapi/error.h"
 #include "hw/sysbus.h"
 #include "hw/pci/msi.h"
+#include "sysemu/kvm.h"
 
 #define TYPE_ARM_GICV2M "arm-gicv2m"
 #define ARM_GICV2M(obj) OBJECT_CHECK(ARMGICv2mState, (obj), TYPE_ARM_GICV2M)
diff --git a/hw/ppc/e500plat.c b/hw/ppc/e500plat.c
index b00565c..94b4545 100644
--- a/hw/ppc/e500plat.c
+++ b/hw/ppc/e500plat.c
@@ -14,6 +14,7 @@
 #include "e500.h"
 #include "hw/boards.h"
 #include "sysemu/device_tree.h"
+#include "sysemu/kvm.h"
 #include "hw/pci/pci.h"
 #include "hw/ppc/openpic.h"
 #include "kvm_ppc.h"
diff --git a/hw/ppc/spapr_hcall.c b/hw/ppc/spapr_hcall.c
index 8f40602..4426a50 100644
--- a/hw/ppc/spapr_hcall.c
+++ b/hw/ppc/spapr_hcall.c
@@ -7,6 +7,7 @@
 #include "mmu-hash64.h"
 #include "cpu-models.h"
 #include "trace.h"
+#include "sysemu/kvm.h"
 #include "kvm_ppc.h"
 
 struct SPRSyncState {
diff --git a/hw/ppc/spapr_rtas.c b/hw/ppc/spapr_rtas.c
index 2db2292..5352767 100644
--- a/hw/ppc/spapr_rtas.c
+++ b/hw/ppc/spapr_rtas.c
@@ -31,6 +31,7 @@
 #include "hw/qdev.h"
 #include "sysemu/device_tree.h"
 #include "sysemu/cpus.h"
+#include "sysemu/kvm.h"
 
 #include "hw/ppc/spapr.h"
 #include "hw/ppc/spapr_vio.h"
diff --git a/include/sysemu/dma.h b/include/sysemu/dma.h
index b0fbb9b..8a06f7a 100644
--- a/include/sysemu/dma.h
+++ b/include/sysemu/dma.h
@@ -15,7 +15,6 @@
 #include "hw/hw.h"
 #include "block/block.h"
 #include "block/accounting.h"
-#include "sysemu/kvm.h"
 
 typedef struct ScatterGatherEntry ScatterGatherEntry;
 
@@ -67,9 +66,7 @@ static inline void dma_barrier(AddressSpace *as, DMADirection dir)
      * use lighter barriers based on the direction of the
      * transfer, the DMA context, etc...
      */
-    if (kvm_enabled()) {
-        smp_mb();
-    }
+    smp_mb();
 }
 
 /* Checks that the given range of addresses is valid for DMA.  This is
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 72+ messages in thread

* [Qemu-devel] [PATCH 41/50] s390x: move stuff out of cpu.h
  2016-04-08 20:28 [Qemu-devel] [PATCH for-2.7 00/49] NEED_CPU_H / cpu.h / hw/hw.h cleanups Paolo Bonzini
                   ` (39 preceding siblings ...)
  2016-04-08 20:29 ` [Qemu-devel] [PATCH 40/50] dma: do not depend on kvm_enabled() Paolo Bonzini
@ 2016-04-08 20:29 ` Paolo Bonzini
  2016-04-11  8:24   ` Cornelia Huck
  2016-04-08 20:29 ` [Qemu-devel] [PATCH 42/50] acpi: do not use TARGET_PAGE_SIZE Paolo Bonzini
                   ` (10 subsequent siblings)
  51 siblings, 1 reply; 72+ messages in thread
From: Paolo Bonzini @ 2016-04-08 20:29 UTC (permalink / raw)
  To: qemu-devel

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 hw/s390x/css.c                              |   4 +-
 hw/s390x/s390-skeys.c                       |   1 +
 hw/s390x/s390-virtio-ccw.c                  |   4 +-
 hw/s390x/virtio-ccw.c                       |   5 +-
 hw/s390x/virtio-ccw.h                       |   3 +-
 {hw => include/hw}/s390x/css.h              |  31 +++++++-
 {target-s390x => include/hw/s390x}/ioinst.h |  16 +---
 target-s390x/cpu.h                          | 117 ++++++----------------------
 target-s390x/helper.c                       |   1 +
 target-s390x/interrupt.c                    |  64 +++++++++++++++
 target-s390x/ioinst.c                       |   2 +-
 11 files changed, 131 insertions(+), 117 deletions(-)
 rename {hw => include/hw}/s390x/css.h (76%)
 rename {target-s390x => include/hw/s390x}/ioinst.h (87%)

diff --git a/hw/s390x/css.c b/hw/s390x/css.c
index 3a1d919..1675a19 100644
--- a/hw/s390x/css.c
+++ b/hw/s390x/css.c
@@ -14,8 +14,8 @@
 #include "qemu/bitops.h"
 #include "exec/address-spaces.h"
 #include "cpu.h"
-#include "ioinst.h"
-#include "css.h"
+#include "hw/s390x/ioinst.h"
+#include "hw/s390x/css.h"
 #include "trace.h"
 #include "hw/s390x/s390_flic.h"
 
diff --git a/hw/s390x/s390-skeys.c b/hw/s390x/s390-skeys.c
index 6528ffe..d772cfc 100644
--- a/hw/s390x/s390-skeys.c
+++ b/hw/s390x/s390-skeys.c
@@ -15,6 +15,7 @@
 #include "migration/qemu-file.h"
 #include "hw/s390x/storage-keys.h"
 #include "qemu/error-report.h"
+#include "sysemu/kvm.h"
 
 #define S390_SKEYS_BUFFER_SIZE 131072  /* Room for 128k storage keys */
 #define S390_SKEYS_SAVE_FLAG_EOS 0x01
diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c
index e3df9c7..8bbaccb 100644
--- a/hw/s390x/s390-virtio-ccw.c
+++ b/hw/s390x/s390-virtio-ccw.c
@@ -18,8 +18,8 @@
 #include "s390-virtio.h"
 #include "hw/s390x/sclp.h"
 #include "hw/s390x/s390_flic.h"
-#include "ioinst.h"
-#include "css.h"
+#include "hw/s390x/ioinst.h"
+#include "hw/s390x/css.h"
 #include "virtio-ccw.h"
 #include "qemu/config-file.h"
 #include "s390-pci-bus.h"
diff --git a/hw/s390x/virtio-ccw.c b/hw/s390x/virtio-ccw.c
index d51642d..a1c1ed9 100644
--- a/hw/s390x/virtio-ccw.c
+++ b/hw/s390x/virtio-ccw.c
@@ -16,6 +16,7 @@
 #include "sysemu/block-backend.h"
 #include "sysemu/blockdev.h"
 #include "sysemu/sysemu.h"
+#include "sysemu/kvm.h"
 #include "net/net.h"
 #include "hw/virtio/virtio.h"
 #include "hw/virtio/virtio-serial.h"
@@ -28,8 +29,8 @@
 #include "hw/s390x/adapter.h"
 #include "hw/s390x/s390_flic.h"
 
-#include "ioinst.h"
-#include "css.h"
+#include "hw/s390x/ioinst.h"
+#include "hw/s390x/css.h"
 #include "virtio-ccw.h"
 #include "trace.h"
 
diff --git a/hw/s390x/virtio-ccw.h b/hw/s390x/virtio-ccw.h
index 66c831b..86b9edb 100644
--- a/hw/s390x/virtio-ccw.h
+++ b/hw/s390x/virtio-ccw.h
@@ -24,7 +24,8 @@
 #include <hw/virtio/virtio-rng.h>
 #include <hw/virtio/virtio-bus.h>
 
-#include "css.h"
+#include <hw/s390x/s390_flic.h>
+#include <hw/s390x/css.h>
 
 #define VIRTUAL_CSSID 0xfe
 
diff --git a/hw/s390x/css.h b/include/hw/s390x/css.h
similarity index 76%
rename from hw/s390x/css.h
rename to include/hw/s390x/css.h
index a320eea..98b2e2c 100644
--- a/hw/s390x/css.h
+++ b/include/hw/s390x/css.h
@@ -14,7 +14,7 @@
 
 #include "hw/s390x/adapter.h"
 #include "hw/s390x/s390_flic.h"
-#include "ioinst.h"
+#include "hw/s390x/ioinst.h"
 
 /* Channel subsystem constants. */
 #define MAX_SCHID 65535
@@ -67,6 +67,7 @@ typedef struct CMBE {
     uint32_t reserved[7];
 } QEMU_PACKED CMBE;
 
+typedef struct SubchDev SubchDev;
 struct SubchDev {
     /* channel-subsystem related things: */
     uint8_t cssid;
@@ -123,4 +124,32 @@ void css_adapter_interrupt(uint8_t isc);
 #define CSS_IO_ADAPTER_VIRTIO 1
 int css_register_io_adapter(uint8_t type, uint8_t isc, bool swap,
                             bool maskable, uint32_t *id);
+
+#ifndef CONFIG_USER_ONLY
+SubchDev *css_find_subch(uint8_t m, uint8_t cssid, uint8_t ssid,
+                         uint16_t schid);
+bool css_subch_visible(SubchDev *sch);
+void css_conditional_io_interrupt(SubchDev *sch);
+int css_do_stsch(SubchDev *sch, SCHIB *schib);
+bool css_schid_final(int m, uint8_t cssid, uint8_t ssid, uint16_t schid);
+int css_do_msch(SubchDev *sch, const SCHIB *schib);
+int css_do_xsch(SubchDev *sch);
+int css_do_csch(SubchDev *sch);
+int css_do_hsch(SubchDev *sch);
+int css_do_ssch(SubchDev *sch, ORB *orb);
+int css_do_tsch_get_irb(SubchDev *sch, IRB *irb, int *irb_len);
+void css_do_tsch_update_subch(SubchDev *sch);
+int css_do_stcrw(CRW *crw);
+void css_undo_stcrw(CRW *crw);
+int css_do_tpi(IOIntCode *int_code, int lowcore);
+int css_collect_chp_desc(int m, uint8_t cssid, uint8_t f_chpid, uint8_t l_chpid,
+                         int rfmt, void *buf);
+void css_do_schm(uint8_t mbk, int update, int dct, uint64_t mbo);
+int css_enable_mcsse(void);
+int css_enable_mss(void);
+int css_do_rsch(SubchDev *sch);
+int css_do_rchp(uint8_t cssid, uint8_t chpid);
+bool css_present(uint8_t cssid);
+#endif
+
 #endif
diff --git a/target-s390x/ioinst.h b/include/hw/s390x/ioinst.h
similarity index 87%
rename from target-s390x/ioinst.h
rename to include/hw/s390x/ioinst.h
index 013cc91..12d44c8 100644
--- a/target-s390x/ioinst.h
+++ b/include/hw/s390x/ioinst.h
@@ -11,6 +11,7 @@
 
 #ifndef IOINST_S390X_H
 #define IOINST_S390X_H
+
 /*
  * Channel I/O related definitions, as defined in the Principles
  * Of Operation (and taken from the Linux implementation).
@@ -227,20 +228,5 @@ typedef struct IOIntCode {
 
 int ioinst_disassemble_sch_ident(uint32_t value, int *m, int *cssid, int *ssid,
                                  int *schid);
-void ioinst_handle_xsch(S390CPU *cpu, uint64_t reg1);
-void ioinst_handle_csch(S390CPU *cpu, uint64_t reg1);
-void ioinst_handle_hsch(S390CPU *cpu, uint64_t reg1);
-void ioinst_handle_msch(S390CPU *cpu, uint64_t reg1, uint32_t ipb);
-void ioinst_handle_ssch(S390CPU *cpu, uint64_t reg1, uint32_t ipb);
-void ioinst_handle_stcrw(S390CPU *cpu, uint32_t ipb);
-void ioinst_handle_stsch(S390CPU *cpu, uint64_t reg1, uint32_t ipb);
-int ioinst_handle_tsch(S390CPU *cpu, uint64_t reg1, uint32_t ipb);
-void ioinst_handle_chsc(S390CPU *cpu, uint32_t ipb);
-int ioinst_handle_tpi(S390CPU *cpu, uint32_t ipb);
-void ioinst_handle_schm(S390CPU *cpu, uint64_t reg1, uint64_t reg2,
-                        uint32_t ipb);
-void ioinst_handle_rsch(S390CPU *cpu, uint64_t reg1);
-void ioinst_handle_rchp(S390CPU *cpu, uint64_t reg1);
-void ioinst_handle_sal(S390CPU *cpu, uint64_t reg1);
 
 #endif
diff --git a/target-s390x/cpu.h b/target-s390x/cpu.h
index 760eadf..cb7cbed 100644
--- a/target-s390x/cpu.h
+++ b/target-s390x/cpu.h
@@ -471,8 +471,6 @@ int cpu_s390x_signal_handler(int host_signum, void *pinfo,
 int s390_cpu_handle_mmu_fault(CPUState *cpu, vaddr address, int rw,
                               int mmu_idx);
 
-#include "ioinst.h"
-
 
 #ifndef CONFIG_USER_ONLY
 void do_restart_interrupt(CPUS390XState *env);
@@ -583,6 +581,30 @@ static inline uint8_t s390_cpu_get_state(S390CPU *cpu)
 void gtod_save(QEMUFile *f, void *opaque);
 int gtod_load(QEMUFile *f, void *opaque, int version_id);
 
+void cpu_inject_ext(S390CPU *cpu, uint32_t code, uint32_t param,
+                    uint64_t param64);
+void cpu_inject_io(S390CPU *cpu, uint16_t subchannel_id,
+                   uint16_t subchannel_number,
+                   uint32_t io_int_parm, uint32_t io_int_word);
+void cpu_inject_crw_mchk(S390CPU *cpu);
+
+/* ioinst.c */
+void ioinst_handle_xsch(S390CPU *cpu, uint64_t reg1);
+void ioinst_handle_csch(S390CPU *cpu, uint64_t reg1);
+void ioinst_handle_hsch(S390CPU *cpu, uint64_t reg1);
+void ioinst_handle_msch(S390CPU *cpu, uint64_t reg1, uint32_t ipb);
+void ioinst_handle_ssch(S390CPU *cpu, uint64_t reg1, uint32_t ipb);
+void ioinst_handle_stcrw(S390CPU *cpu, uint32_t ipb);
+void ioinst_handle_stsch(S390CPU *cpu, uint64_t reg1, uint32_t ipb);
+int ioinst_handle_tsch(S390CPU *cpu, uint64_t reg1, uint32_t ipb);
+void ioinst_handle_chsc(S390CPU *cpu, uint32_t ipb);
+int ioinst_handle_tpi(S390CPU *cpu, uint32_t ipb);
+void ioinst_handle_schm(S390CPU *cpu, uint64_t reg1, uint64_t reg2,
+                        uint32_t ipb);
+void ioinst_handle_rsch(S390CPU *cpu, uint64_t reg1);
+void ioinst_handle_rchp(S390CPU *cpu, uint64_t reg1);
+void ioinst_handle_sal(S390CPU *cpu, uint64_t reg1);
+
 /* service interrupts are floating therefore we must not pass an cpustate */
 void s390_sclp_extint(uint32_t parm);
 
@@ -604,35 +626,7 @@ static inline unsigned int s390_cpu_set_state(uint8_t cpu_state, S390CPU *cpu)
 void cpu_lock(void);
 void cpu_unlock(void);
 
-typedef struct SubchDev SubchDev;
-
-#ifndef CONFIG_USER_ONLY
 extern void subsystem_reset(void);
-SubchDev *css_find_subch(uint8_t m, uint8_t cssid, uint8_t ssid,
-                         uint16_t schid);
-bool css_subch_visible(SubchDev *sch);
-void css_conditional_io_interrupt(SubchDev *sch);
-int css_do_stsch(SubchDev *sch, SCHIB *schib);
-bool css_schid_final(int m, uint8_t cssid, uint8_t ssid, uint16_t schid);
-int css_do_msch(SubchDev *sch, const SCHIB *schib);
-int css_do_xsch(SubchDev *sch);
-int css_do_csch(SubchDev *sch);
-int css_do_hsch(SubchDev *sch);
-int css_do_ssch(SubchDev *sch, ORB *orb);
-int css_do_tsch_get_irb(SubchDev *sch, IRB *irb, int *irb_len);
-void css_do_tsch_update_subch(SubchDev *sch);
-int css_do_stcrw(CRW *crw);
-void css_undo_stcrw(CRW *crw);
-int css_do_tpi(IOIntCode *int_code, int lowcore);
-int css_collect_chp_desc(int m, uint8_t cssid, uint8_t f_chpid, uint8_t l_chpid,
-                         int rfmt, void *buf);
-void css_do_schm(uint8_t mbk, int update, int dct, uint64_t mbo);
-int css_enable_mcsse(void);
-int css_enable_mss(void);
-int css_do_rsch(SubchDev *sch);
-int css_do_rchp(uint8_t cssid, uint8_t chpid);
-bool css_present(uint8_t cssid);
-#endif
 
 #define cpu_init(model) CPU(cpu_s390x_init(model))
 #define cpu_exec cpu_s390x_exec
@@ -1107,69 +1101,6 @@ static inline uint64_t tod2time(uint64_t t) {
     return (t * 125) >> 9;
 }
 
-static inline void cpu_inject_ext(S390CPU *cpu, uint32_t code, uint32_t param,
-                                  uint64_t param64)
-{
-    CPUS390XState *env = &cpu->env;
-
-    if (env->ext_index == MAX_EXT_QUEUE - 1) {
-        /* ugh - can't queue anymore. Let's drop. */
-        return;
-    }
-
-    env->ext_index++;
-    assert(env->ext_index < MAX_EXT_QUEUE);
-
-    env->ext_queue[env->ext_index].code = code;
-    env->ext_queue[env->ext_index].param = param;
-    env->ext_queue[env->ext_index].param64 = param64;
-
-    env->pending_int |= INTERRUPT_EXT;
-    cpu_interrupt(CPU(cpu), CPU_INTERRUPT_HARD);
-}
-
-static inline void cpu_inject_io(S390CPU *cpu, uint16_t subchannel_id,
-                                 uint16_t subchannel_number,
-                                 uint32_t io_int_parm, uint32_t io_int_word)
-{
-    CPUS390XState *env = &cpu->env;
-    int isc = IO_INT_WORD_ISC(io_int_word);
-
-    if (env->io_index[isc] == MAX_IO_QUEUE - 1) {
-        /* ugh - can't queue anymore. Let's drop. */
-        return;
-    }
-
-    env->io_index[isc]++;
-    assert(env->io_index[isc] < MAX_IO_QUEUE);
-
-    env->io_queue[env->io_index[isc]][isc].id = subchannel_id;
-    env->io_queue[env->io_index[isc]][isc].nr = subchannel_number;
-    env->io_queue[env->io_index[isc]][isc].parm = io_int_parm;
-    env->io_queue[env->io_index[isc]][isc].word = io_int_word;
-
-    env->pending_int |= INTERRUPT_IO;
-    cpu_interrupt(CPU(cpu), CPU_INTERRUPT_HARD);
-}
-
-static inline void cpu_inject_crw_mchk(S390CPU *cpu)
-{
-    CPUS390XState *env = &cpu->env;
-
-    if (env->mchk_index == MAX_MCHK_QUEUE - 1) {
-        /* ugh - can't queue anymore. Let's drop. */
-        return;
-    }
-
-    env->mchk_index++;
-    assert(env->mchk_index < MAX_MCHK_QUEUE);
-
-    env->mchk_queue[env->mchk_index].type = 1;
-
-    env->pending_int |= INTERRUPT_MCHK;
-    cpu_interrupt(CPU(cpu), CPU_INTERRUPT_HARD);
-}
-
 /* from s390-virtio-ccw */
 #define MEM_SECTION_SIZE             0x10000000UL
 #define MAX_AVAIL_SLOTS              32
diff --git a/target-s390x/helper.c b/target-s390x/helper.c
index 92abe7e..423dd72 100644
--- a/target-s390x/helper.c
+++ b/target-s390x/helper.c
@@ -24,6 +24,7 @@
 #include "exec/gdbstub.h"
 #include "qemu/timer.h"
 #include "exec/cpu_ldst.h"
+#include "hw/s390x/ioinst.h"
 #ifndef CONFIG_USER_ONLY
 #include "sysemu/sysemu.h"
 #endif
diff --git a/target-s390x/interrupt.c b/target-s390x/interrupt.c
index bad60a7..a13fd26 100644
--- a/target-s390x/interrupt.c
+++ b/target-s390x/interrupt.c
@@ -10,6 +10,7 @@
 #include "qemu/osdep.h"
 #include "cpu.h"
 #include "sysemu/kvm.h"
+#include "hw/s390x/ioinst.h"
 
 /*
  * All of the following interrupts are floating, i.e. not per-vcpu.
@@ -17,6 +18,69 @@
  * non-kvm case.
  */
 #if !defined(CONFIG_USER_ONLY)
+void cpu_inject_ext(S390CPU *cpu, uint32_t code, uint32_t param,
+                    uint64_t param64)
+{
+    CPUS390XState *env = &cpu->env;
+
+    if (env->ext_index == MAX_EXT_QUEUE - 1) {
+        /* ugh - can't queue anymore. Let's drop. */
+        return;
+    }
+
+    env->ext_index++;
+    assert(env->ext_index < MAX_EXT_QUEUE);
+
+    env->ext_queue[env->ext_index].code = code;
+    env->ext_queue[env->ext_index].param = param;
+    env->ext_queue[env->ext_index].param64 = param64;
+
+    env->pending_int |= INTERRUPT_EXT;
+    cpu_interrupt(CPU(cpu), CPU_INTERRUPT_HARD);
+}
+
+void cpu_inject_io(S390CPU *cpu, uint16_t subchannel_id,
+                   uint16_t subchannel_number,
+                   uint32_t io_int_parm, uint32_t io_int_word)
+{
+    CPUS390XState *env = &cpu->env;
+    int isc = IO_INT_WORD_ISC(io_int_word);
+
+    if (env->io_index[isc] == MAX_IO_QUEUE - 1) {
+        /* ugh - can't queue anymore. Let's drop. */
+        return;
+    }
+
+    env->io_index[isc]++;
+    assert(env->io_index[isc] < MAX_IO_QUEUE);
+
+    env->io_queue[env->io_index[isc]][isc].id = subchannel_id;
+    env->io_queue[env->io_index[isc]][isc].nr = subchannel_number;
+    env->io_queue[env->io_index[isc]][isc].parm = io_int_parm;
+    env->io_queue[env->io_index[isc]][isc].word = io_int_word;
+
+    env->pending_int |= INTERRUPT_IO;
+    cpu_interrupt(CPU(cpu), CPU_INTERRUPT_HARD);
+}
+
+void cpu_inject_crw_mchk(S390CPU *cpu)
+{
+    CPUS390XState *env = &cpu->env;
+
+    if (env->mchk_index == MAX_MCHK_QUEUE - 1) {
+        /* ugh - can't queue anymore. Let's drop. */
+        return;
+    }
+
+    env->mchk_index++;
+    assert(env->mchk_index < MAX_MCHK_QUEUE);
+
+    env->mchk_queue[env->mchk_index].type = 1;
+
+    env->pending_int |= INTERRUPT_MCHK;
+    cpu_interrupt(CPU(cpu), CPU_INTERRUPT_HARD);
+}
+
 void s390_sclp_extint(uint32_t parm)
 {
     if (kvm_enabled()) {
diff --git a/target-s390x/ioinst.c b/target-s390x/ioinst.c
index 142ff93..5b4cd0a 100644
--- a/target-s390x/ioinst.c
+++ b/target-s390x/ioinst.c
@@ -12,7 +12,7 @@
 #include "qemu/osdep.h"
 
 #include "cpu.h"
-#include "ioinst.h"
+#include "hw/s390x/ioinst.h"
 #include "trace.h"
 #include "hw/s390x/s390-pci-bus.h"
 
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 72+ messages in thread

* [Qemu-devel] [PATCH 42/50] acpi: do not use TARGET_PAGE_SIZE
  2016-04-08 20:28 [Qemu-devel] [PATCH for-2.7 00/49] NEED_CPU_H / cpu.h / hw/hw.h cleanups Paolo Bonzini
                   ` (40 preceding siblings ...)
  2016-04-08 20:29 ` [Qemu-devel] [PATCH 41/50] s390x: move stuff out of cpu.h Paolo Bonzini
@ 2016-04-08 20:29 ` Paolo Bonzini
  2016-04-08 20:29 ` [Qemu-devel] [PATCH 43/50] qemu-common: push cpu.h inclusion out of qemu-common.h Paolo Bonzini
                   ` (9 subsequent siblings)
  51 siblings, 0 replies; 72+ messages in thread
From: Paolo Bonzini @ 2016-04-08 20:29 UTC (permalink / raw)
  To: qemu-devel

This is a #define used by the CPU.  NVDIMM can just use 4K
unconditionally.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 hw/acpi/nvdimm.c | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/hw/acpi/nvdimm.c b/hw/acpi/nvdimm.c
index 9531340..fb925dc 100644
--- a/hw/acpi/nvdimm.c
+++ b/hw/acpi/nvdimm.c
@@ -378,17 +378,19 @@ struct NvdimmDsmIn {
     uint32_t function;
     /* the remaining size in the page is used by arg3. */
     union {
-        uint8_t arg3[0];
+        uint8_t arg3[4084];
     };
 } QEMU_PACKED;
 typedef struct NvdimmDsmIn NvdimmDsmIn;
+QEMU_BUILD_BUG_ON(sizeof(NvdimmDsmIn) != 4096);
 
 struct NvdimmDsmOut {
     /* the size of buffer filled by QEMU. */
     uint32_t len;
-    uint8_t data[0];
+    uint8_t data[4092];
 } QEMU_PACKED;
 typedef struct NvdimmDsmOut NvdimmDsmOut;
+QEMU_BUILD_BUG_ON(sizeof(NvdimmDsmOut) != 4096);
 
 struct NvdimmDsmFunc0Out {
     /* the size of buffer filled by QEMU. */
@@ -424,8 +426,8 @@ nvdimm_dsm_write(void *opaque, hwaddr addr, uint64_t val, unsigned size)
      * can change its content while we are doing DSM emulation. Avoid
      * this by copying DSM memory to QEMU local memory.
      */
-    in = g_malloc(TARGET_PAGE_SIZE);
-    cpu_physical_memory_read(dsm_mem_addr, in, TARGET_PAGE_SIZE);
+    in = g_new(NvdimmDsmIn, 1);
+    cpu_physical_memory_read(dsm_mem_addr, in, sizeof(*in));
 
     le32_to_cpus(&in->revision);
     le32_to_cpus(&in->function);
@@ -475,7 +477,7 @@ void nvdimm_init_acpi_state(AcpiNVDIMMState *state, MemoryRegion *io,
     memory_region_add_subregion(io, NVDIMM_ACPI_IO_BASE, &state->io_mr);
 
     state->dsm_mem = g_array_new(false, true /* clear */, 1);
-    acpi_data_push(state->dsm_mem, TARGET_PAGE_SIZE);
+    acpi_data_push(state->dsm_mem, sizeof(NvdimmDsmIn));
     fw_cfg_add_file(fw_cfg, NVDIMM_DSM_MEM_FILE, state->dsm_mem->data,
                     state->dsm_mem->len);
 }
@@ -608,7 +610,7 @@ static void nvdimm_build_ssdt(GSList *device_list, GArray *table_offsets,
     aml_append(dev, aml_operation_region("NPIO", AML_SYSTEM_IO,
                aml_int(NVDIMM_ACPI_IO_BASE), NVDIMM_ACPI_IO_LEN));
     aml_append(dev, aml_operation_region("NRAM", AML_SYSTEM_MEMORY,
-               aml_name(NVDIMM_ACPI_MEM_ADDR), TARGET_PAGE_SIZE));
+               aml_name(NVDIMM_ACPI_MEM_ADDR), sizeof(NvdimmDsmIn)));
 
     /*
      * DSM notifier:
@@ -642,8 +644,7 @@ static void nvdimm_build_ssdt(GSList *device_list, GArray *table_offsets,
     aml_append(field, aml_named_field("FUNC",
                sizeof(typeof_field(NvdimmDsmIn, function)) * BITS_PER_BYTE));
     aml_append(field, aml_named_field("ARG3",
-               (TARGET_PAGE_SIZE - offsetof(NvdimmDsmIn, arg3)) *
-                BITS_PER_BYTE));
+               (sizeof(NvdimmDsmIn) - offsetof(NvdimmDsmIn, arg3)) * BITS_PER_BYTE));
     aml_append(dev, field);
 
     /*
@@ -659,8 +660,7 @@ static void nvdimm_build_ssdt(GSList *device_list, GArray *table_offsets,
     aml_append(field, aml_named_field("RLEN",
                sizeof(typeof_field(NvdimmDsmOut, len)) * BITS_PER_BYTE));
     aml_append(field, aml_named_field("ODAT",
-               (TARGET_PAGE_SIZE - offsetof(NvdimmDsmOut, data)) *
-                     BITS_PER_BYTE));
+               (sizeof(NvdimmDsmOut) - offsetof(NvdimmDsmOut, data)) * BITS_PER_BYTE));
     aml_append(dev, field);
 
     nvdimm_build_common_dsm(dev);
@@ -678,7 +678,7 @@ static void nvdimm_build_ssdt(GSList *device_list, GArray *table_offsets,
     mem_addr_offset = build_append_named_dword(table_data,
                                                NVDIMM_ACPI_MEM_ADDR);
 
-    bios_linker_loader_alloc(linker, NVDIMM_DSM_MEM_FILE, TARGET_PAGE_SIZE,
+    bios_linker_loader_alloc(linker, NVDIMM_DSM_MEM_FILE, sizeof(NvdimmDsmIn),
                              false /* high memory */);
     bios_linker_loader_add_pointer(linker, ACPI_BUILD_TABLE_FILE,
                                    NVDIMM_DSM_MEM_FILE, table_data,
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 72+ messages in thread

* [Qemu-devel] [PATCH 43/50] qemu-common: push cpu.h inclusion out of qemu-common.h
  2016-04-08 20:28 [Qemu-devel] [PATCH for-2.7 00/49] NEED_CPU_H / cpu.h / hw/hw.h cleanups Paolo Bonzini
                   ` (41 preceding siblings ...)
  2016-04-08 20:29 ` [Qemu-devel] [PATCH 42/50] acpi: do not use TARGET_PAGE_SIZE Paolo Bonzini
@ 2016-04-08 20:29 ` Paolo Bonzini
  2016-04-08 20:29 ` [Qemu-devel] [PATCH 44/50] arm: move arm_log_exception into .c file Paolo Bonzini
                   ` (8 subsequent siblings)
  51 siblings, 0 replies; 72+ messages in thread
From: Paolo Bonzini @ 2016-04-08 20:29 UTC (permalink / raw)
  To: qemu-devel

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 arch_init.c                              |  2 ++
 cpus.c                                   |  3 ++-
 exec.c                                   |  2 +-
 gdbstub.c                                |  2 +-
 hw/arm/nseries.c                         |  1 +
 hw/arm/pxa2xx_gpio.c                     |  1 +
 hw/core/nmi.c                            |  5 +++++
 hw/display/cg3.c                         |  1 +
 hw/i386/kvm/apic.c                       |  2 ++
 hw/i386/kvm/clock.c                      |  1 +
 hw/i386/kvmvapic.c                       |  2 ++
 hw/intc/apic.c                           |  2 ++
 hw/intc/apic_common.c                    |  2 ++
 hw/intc/arm_gic_kvm.c                    |  2 ++
 hw/intc/armv7m_nvic.c                    |  1 +
 hw/intc/openpic_kvm.c                    |  2 ++
 hw/intc/s390_flic_kvm.c                  |  2 ++
 hw/misc/mips_cpc.c                       |  1 +
 hw/misc/mips_itu.c                       |  1 +
 hw/ppc/ppc4xx_devs.c                     |  1 +
 hw/ppc/prep.c                            |  1 +
 hw/ppc/virtex_ml507.c                    |  1 +
 hw/xtensa/pic_cpu.c                      |  1 +
 include/disas/disas.h                    |  2 ++
 include/exec/gdbstub.h                   |  2 ++
 include/exec/hwaddr.h                    |  2 ++
 include/hw/arm/digic.h                   |  1 +
 include/hw/arm/virt-acpi-build.h         |  1 +
 include/hw/arm/virt.h                    |  1 +
 include/hw/hw.h                          |  1 -
 include/hw/sd/sd.h                       |  2 ++
 include/hw/xen/xen.h                     |  7 ++++---
 include/qemu-common.h                    |  5 -----
 include/sysemu/kvm.h                     |  1 +
 ioport.c                                 |  2 ++
 memory.c                                 |  2 ++
 migration/ram.c                          |  2 ++
 migration/savevm.c                       |  1 +
 monitor.c                                |  2 ++
 qtest.c                                  |  2 ++
 scripts/tracetool/format/tcg_helper_c.py |  1 +
 target-alpha/gdbstub.c                   |  1 +
 target-alpha/machine.c                   |  2 ++
 target-arm/gdbstub.c                     |  1 +
 target-arm/gdbstub64.c                   |  1 +
 target-arm/kvm-stub.c                    |  1 +
 target-arm/kvm32.c                       |  2 +-
 target-arm/kvm64.c                       |  2 +-
 target-arm/machine.c                     |  2 ++
 target-cris/gdbstub.c                    |  1 +
 target-cris/machine.c                    |  2 ++
 target-i386/gdbstub.c                    |  1 +
 target-i386/kvm-stub.c                   |  1 +
 target-i386/kvm.c                        |  2 +-
 target-i386/machine.c                    |  2 ++
 target-lm32/gdbstub.c                    |  1 +
 target-lm32/machine.c                    |  2 ++
 target-m68k/gdbstub.c                    |  1 +
 target-microblaze/gdbstub.c              |  1 +
 target-mips/cpu.h                        | 18 ++----------------
 target-mips/gdbstub.c                    |  1 +
 target-mips/helper.c                     | 17 +++++++++++++++++
 target-mips/kvm.c                        |  2 +-
 target-mips/machine.c                    |  2 ++
 target-moxie/machine.c                   |  2 ++
 target-openrisc/gdbstub.c                |  1 +
 target-openrisc/machine.c                |  2 ++
 target-ppc/gdbstub.c                     |  1 +
 target-ppc/kvm-stub.c                    |  1 +
 target-ppc/kvm.c                         |  2 +-
 target-ppc/machine.c                     |  2 ++
 target-s390x/gdbstub.c                   |  1 +
 target-s390x/kvm.c                       |  2 +-
 target-sh4/gdbstub.c                     |  1 +
 target-sparc/gdbstub.c                   |  1 +
 target-sparc/machine.c                   |  2 ++
 target-xtensa/gdbstub.c                  |  1 +
 tcg/optimize.c                           |  3 +--
 tcg/tcg-op.c                             |  2 ++
 tcg/tcg.h                                |  1 +
 80 files changed, 131 insertions(+), 36 deletions(-)

diff --git a/arch_init.c b/arch_init.c
index e3bb1b3..07f047f 100644
--- a/arch_init.c
+++ b/arch_init.c
@@ -22,6 +22,8 @@
  * THE SOFTWARE.
  */
 #include "qemu/osdep.h"
+#include "qemu-common.h"
+#include "cpu.h"
 #include "sysemu/sysemu.h"
 #include "sysemu/arch_init.h"
 #include "hw/pci/pci.h"
diff --git a/cpus.c b/cpus.c
index cbeb1f6..7b6ebeb 100644
--- a/cpus.c
+++ b/cpus.c
@@ -24,7 +24,8 @@
 
 /* Needed early for CONFIG_BSD etc. */
 #include "qemu/osdep.h"
-
+#include "qemu-common.h"
+#include "cpu.h"
 #include "monitor/monitor.h"
 #include "qapi/qmp/qerror.h"
 #include "qemu/error-report.h"
diff --git a/exec.c b/exec.c
index fbfa02e..dee542b 100644
--- a/exec.c
+++ b/exec.c
@@ -28,10 +28,10 @@
 #include "hw/qdev-core.h"
 #if !defined(CONFIG_USER_ONLY)
 #include "hw/boards.h"
+#include "hw/xen/xen.h"
 #endif
 #include "sysemu/kvm.h"
 #include "sysemu/sysemu.h"
-#include "hw/xen/xen.h"
 #include "qemu/timer.h"
 #include "qemu/config-file.h"
 #include "qemu/error-report.h"
diff --git a/gdbstub.c b/gdbstub.c
index 0e431fd..c19ce39 100644
--- a/gdbstub.c
+++ b/gdbstub.c
@@ -19,7 +19,7 @@
 #include "qemu/osdep.h"
 #include "qapi/error.h"
 #include "qemu/cutils.h"
-
+#include "cpu.h"
 #ifdef CONFIG_USER_ONLY
 #include "qemu.h"
 #else
diff --git a/hw/arm/nseries.c b/hw/arm/nseries.c
index d331d69..43a78c2 100644
--- a/hw/arm/nseries.c
+++ b/hw/arm/nseries.c
@@ -20,6 +20,7 @@
 
 #include "qemu/osdep.h"
 #include "qapi/error.h"
+#include "cpu.h"
 #include "qemu/cutils.h"
 #include "qemu/bswap.h"
 #include "sysemu/sysemu.h"
diff --git a/hw/arm/pxa2xx_gpio.c b/hw/arm/pxa2xx_gpio.c
index 67e7e70..8c9626e 100644
--- a/hw/arm/pxa2xx_gpio.c
+++ b/hw/arm/pxa2xx_gpio.c
@@ -8,6 +8,7 @@
  */
 
 #include "qemu/osdep.h"
+#include "cpu.h"
 #include "hw/hw.h"
 #include "hw/sysbus.h"
 #include "hw/arm/pxa.h"
diff --git a/hw/core/nmi.c b/hw/core/nmi.c
index e8bcc41..f616a79 100644
--- a/hw/core/nmi.c
+++ b/hw/core/nmi.c
@@ -20,11 +20,16 @@
  */
 
 #include "qemu/osdep.h"
+#include "qom/cpu.h"
 #include "hw/nmi.h"
 #include "qapi/error.h"
 #include "qapi/qmp/qerror.h"
 #include "monitor/monitor.h"
 
+#if defined(TARGET_I386)
+#include "cpu.h"
+#endif
+
 struct do_nmi_s {
     int cpu_index;
     Error *err;
diff --git a/hw/display/cg3.c b/hw/display/cg3.c
index fc0d97f..eb0e71a 100644
--- a/hw/display/cg3.c
+++ b/hw/display/cg3.c
@@ -26,6 +26,7 @@
 #include "qemu/osdep.h"
 #include "qapi/error.h"
 #include "qemu-common.h"
+#include "cpu.h"
 #include "qemu/error-report.h"
 #include "ui/console.h"
 #include "hw/sysbus.h"
diff --git a/hw/i386/kvm/apic.c b/hw/i386/kvm/apic.c
index 3c7c8fa..c5983c7 100644
--- a/hw/i386/kvm/apic.c
+++ b/hw/i386/kvm/apic.c
@@ -10,6 +10,8 @@
  * See the COPYING file in the top-level directory.
  */
 #include "qemu/osdep.h"
+#include "qemu-common.h"
+#include "cpu.h"
 #include "hw/i386/apic_internal.h"
 #include "hw/pci/msi.h"
 #include "sysemu/kvm.h"
diff --git a/hw/i386/kvm/clock.c b/hw/i386/kvm/clock.c
index a3b300c..0f75dd3 100644
--- a/hw/i386/kvm/clock.c
+++ b/hw/i386/kvm/clock.c
@@ -15,6 +15,7 @@
 
 #include "qemu/osdep.h"
 #include "qemu-common.h"
+#include "cpu.h"
 #include "qemu/host-utils.h"
 #include "sysemu/sysemu.h"
 #include "sysemu/kvm.h"
diff --git a/hw/i386/kvmvapic.c b/hw/i386/kvmvapic.c
index c69f374..315857e 100644
--- a/hw/i386/kvmvapic.c
+++ b/hw/i386/kvmvapic.c
@@ -9,6 +9,8 @@
  * top-level directory.
  */
 #include "qemu/osdep.h"
+#include "qemu-common.h"
+#include "cpu.h"
 #include "sysemu/sysemu.h"
 #include "sysemu/cpus.h"
 #include "sysemu/kvm.h"
diff --git a/hw/intc/apic.c b/hw/intc/apic.c
index 28c2ea5..e1ab935 100644
--- a/hw/intc/apic.c
+++ b/hw/intc/apic.c
@@ -17,6 +17,8 @@
  * 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 "qemu/thread.h"
 #include "hw/i386/apic_internal.h"
 #include "hw/i386/apic.h"
diff --git a/hw/intc/apic_common.c b/hw/intc/apic_common.c
index 4abe145..e6eb694 100644
--- a/hw/intc/apic_common.c
+++ b/hw/intc/apic_common.c
@@ -19,6 +19,8 @@
  */
 #include "qemu/osdep.h"
 #include "qapi/error.h"
+#include "qemu-common.h"
+#include "cpu.h"
 #include "hw/i386/apic.h"
 #include "hw/i386/apic_internal.h"
 #include "trace.h"
diff --git a/hw/intc/arm_gic_kvm.c b/hw/intc/arm_gic_kvm.c
index bc85ab7..5593cdb 100644
--- a/hw/intc/arm_gic_kvm.c
+++ b/hw/intc/arm_gic_kvm.c
@@ -21,6 +21,8 @@
 
 #include "qemu/osdep.h"
 #include "qapi/error.h"
+#include "qemu-common.h"
+#include "cpu.h"
 #include "hw/sysbus.h"
 #include "migration/migration.h"
 #include "sysemu/kvm.h"
diff --git a/hw/intc/armv7m_nvic.c b/hw/intc/armv7m_nvic.c
index 669e82a..4d584ef 100644
--- a/hw/intc/armv7m_nvic.c
+++ b/hw/intc/armv7m_nvic.c
@@ -13,6 +13,7 @@
 #include "qemu/osdep.h"
 #include "qapi/error.h"
 #include "qemu-common.h"
+#include "cpu.h"
 #include "hw/sysbus.h"
 #include "qemu/timer.h"
 #include "hw/arm/arm.h"
diff --git a/hw/intc/openpic_kvm.c b/hw/intc/openpic_kvm.c
index e47e94f..0518e01 100644
--- a/hw/intc/openpic_kvm.c
+++ b/hw/intc/openpic_kvm.c
@@ -24,6 +24,8 @@
 
 #include "qemu/osdep.h"
 #include "qapi/error.h"
+#include "qemu-common.h"
+#include "cpu.h"
 #include <sys/ioctl.h>
 #include "exec/address-spaces.h"
 #include "hw/hw.h"
diff --git a/hw/intc/s390_flic_kvm.c b/hw/intc/s390_flic_kvm.c
index 02449b3..eed6325 100644
--- a/hw/intc/s390_flic_kvm.c
+++ b/hw/intc/s390_flic_kvm.c
@@ -11,6 +11,8 @@
  */
 
 #include "qemu/osdep.h"
+#include "qemu-common.h"
+#include "cpu.h"
 #include <sys/ioctl.h>
 #include "qemu/error-report.h"
 #include "hw/sysbus.h"
diff --git a/hw/misc/mips_cpc.c b/hw/misc/mips_cpc.c
index d2b8e42..05688b7 100644
--- a/hw/misc/mips_cpc.c
+++ b/hw/misc/mips_cpc.c
@@ -19,6 +19,7 @@
 
 #include "qemu/osdep.h"
 #include "qapi/error.h"
+#include "cpu.h"
 #include "hw/sysbus.h"
 
 #include "hw/misc/mips_cpc.h"
diff --git a/hw/misc/mips_itu.c b/hw/misc/mips_itu.c
index 8461d23..c75ce7b 100644
--- a/hw/misc/mips_itu.c
+++ b/hw/misc/mips_itu.c
@@ -19,6 +19,7 @@
 
 #include "qemu/osdep.h"
 #include "qapi/error.h"
+#include "cpu.h"
 #include "hw/hw.h"
 #include "hw/sysbus.h"
 #include "sysemu/sysemu.h"
diff --git a/hw/ppc/ppc4xx_devs.c b/hw/ppc/ppc4xx_devs.c
index 7d59018..e7f413e 100644
--- a/hw/ppc/ppc4xx_devs.c
+++ b/hw/ppc/ppc4xx_devs.c
@@ -22,6 +22,7 @@
  * THE SOFTWARE.
  */
 #include "qemu/osdep.h"
+#include "cpu.h"
 #include "hw/hw.h"
 #include "hw/ppc/ppc.h"
 #include "hw/ppc/ppc4xx.h"
diff --git a/hw/ppc/prep.c b/hw/ppc/prep.c
index 3ffb85e..07ffe72 100644
--- a/hw/ppc/prep.c
+++ b/hw/ppc/prep.c
@@ -22,6 +22,7 @@
  * THE SOFTWARE.
  */
 #include "qemu/osdep.h"
+#include "cpu.h"
 #include "hw/hw.h"
 #include "hw/timer/m48t59.h"
 #include "hw/i386/pc.h"
diff --git a/hw/ppc/virtex_ml507.c b/hw/ppc/virtex_ml507.c
index b807a08..b97d966 100644
--- a/hw/ppc/virtex_ml507.c
+++ b/hw/ppc/virtex_ml507.c
@@ -23,6 +23,7 @@
  */
 
 #include "qemu/osdep.h"
+#include "cpu.h"
 #include "hw/sysbus.h"
 #include "hw/hw.h"
 #include "hw/char/serial.h"
diff --git a/hw/xtensa/pic_cpu.c b/hw/xtensa/pic_cpu.c
index c835bd0..ccf65fd 100644
--- a/hw/xtensa/pic_cpu.c
+++ b/hw/xtensa/pic_cpu.c
@@ -26,6 +26,7 @@
  */
 
 #include "qemu/osdep.h"
+#include "cpu.h"
 #include "hw/hw.h"
 #include "qemu/log.h"
 #include "qemu/timer.h"
diff --git a/include/disas/disas.h b/include/disas/disas.h
index 2b9293b..4930d78 100644
--- a/include/disas/disas.h
+++ b/include/disas/disas.h
@@ -4,6 +4,8 @@
 #include "qemu-common.h"
 
 #ifdef NEED_CPU_H
+#include "cpu.h"
+
 /* Disassemble this for me please... (debugging). */
 void disas(FILE *out, void *code, unsigned long size);
 void target_disas(FILE *out, CPUState *cpu, target_ulong code,
diff --git a/include/exec/gdbstub.h b/include/exec/gdbstub.h
index d9e8cf7..8e3f8d8 100644
--- a/include/exec/gdbstub.h
+++ b/include/exec/gdbstub.h
@@ -11,6 +11,8 @@
 #define GDB_WATCHPOINT_ACCESS    4
 
 #ifdef NEED_CPU_H
+#include "cpu.h"
+
 typedef void (*gdb_syscall_complete_cb)(CPUState *cpu,
                                         target_ulong ret, target_ulong err);
 
diff --git a/include/exec/hwaddr.h b/include/exec/hwaddr.h
index c9eb78f..bb41588 100644
--- a/include/exec/hwaddr.h
+++ b/include/exec/hwaddr.h
@@ -3,6 +3,8 @@
 #ifndef HWADDR_H
 #define HWADDR_H
 
+#include <inttypes.h>
+
 #define HWADDR_BITS 64
 /* hwaddr is the type of a physical address (its size can
    be different from 'target_ulong').  */
diff --git a/include/hw/arm/digic.h b/include/hw/arm/digic.h
index aaefe0b..63785ba 100644
--- a/include/hw/arm/digic.h
+++ b/include/hw/arm/digic.h
@@ -18,6 +18,7 @@
 #ifndef HW_ARM_DIGIC_H
 #define HW_ARM_DIGIC_H
 
+#include "cpu.h"
 #include "hw/timer/digic-timer.h"
 #include "hw/char/digic-uart.h"
 
diff --git a/include/hw/arm/virt-acpi-build.h b/include/hw/arm/virt-acpi-build.h
index 7d3700e..e43330a 100644
--- a/include/hw/arm/virt-acpi-build.h
+++ b/include/hw/arm/virt-acpi-build.h
@@ -22,6 +22,7 @@
 
 #include "qemu-common.h"
 #include "hw/arm/virt.h"
+#include "qemu/notify.h"
 
 #define ACPI_GICC_ENABLED 1
 
diff --git a/include/hw/arm/virt.h b/include/hw/arm/virt.h
index ecd8589..82703d2 100644
--- a/include/hw/arm/virt.h
+++ b/include/hw/arm/virt.h
@@ -31,6 +31,7 @@
 #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/hw.h b/include/hw/hw.h
index 29931d1..a20321b 100644
--- a/include/hw/hw.h
+++ b/include/hw/hw.h
@@ -2,7 +2,6 @@
 #ifndef QEMU_HW_H
 #define QEMU_HW_H
 
-
 #ifdef CONFIG_USER_ONLY
 #error Cannot include hw/hw.h from user emulation
 #endif
diff --git a/include/hw/sd/sd.h b/include/hw/sd/sd.h
index d5d273a..c8a4b98 100644
--- a/include/hw/sd/sd.h
+++ b/include/hw/sd/sd.h
@@ -29,6 +29,8 @@
 #ifndef __hw_sd_h
 #define __hw_sd_h		1
 
+#include "hw/qdev.h"
+
 #define OUT_OF_RANGE		(1 << 31)
 #define ADDRESS_ERROR		(1 << 30)
 #define BLOCK_LEN_ERROR		(1 << 29)
diff --git a/include/hw/xen/xen.h b/include/hw/xen/xen.h
index 6eb815a..6365483 100644
--- a/include/hw/xen/xen.h
+++ b/include/hw/xen/xen.h
@@ -7,8 +7,10 @@
  *   /usr/include/xen, so it can be included unconditionally.
  */
 
-#include "hw/irq.h"
 #include "qemu-common.h"
+#include "qemu/typedefs.h"
+#include "exec/cpu-common.h"
+#include "hw/irq.h"
 
 /* xen-machine.c */
 enum xen_mode {
@@ -37,12 +39,11 @@ qemu_irq *xen_interrupt_controller_init(void);
 
 void xenstore_store_pv_console_info(int i, struct CharDriverState *chr);
 
-#if defined(NEED_CPU_H) && !defined(CONFIG_USER_ONLY)
 void xen_hvm_init(PCMachineState *pcms, MemoryRegion **ram_memory);
+
 void xen_ram_alloc(ram_addr_t ram_addr, ram_addr_t size,
                    struct MemoryRegion *mr, Error **errp);
 void xen_modified_memory(ram_addr_t start, ram_addr_t length);
-#endif
 
 void xen_register_framebuffer(struct MemoryRegion *mr);
 
diff --git a/include/qemu-common.h b/include/qemu-common.h
index cd3139b..835cbc6 100644
--- a/include/qemu-common.h
+++ b/include/qemu-common.h
@@ -22,11 +22,6 @@
 
 #include "qemu/option.h"
 
-/* FIXME: Remove NEED_CPU_H.  */
-#ifdef NEED_CPU_H
-#include "cpu.h"
-#endif /* !defined(NEED_CPU_H) */
-
 /* main function, renamed */
 #if defined(CONFIG_COCOA)
 int qemu_main(int argc, char **argv, char **envp);
diff --git a/include/sysemu/kvm.h b/include/sysemu/kvm.h
index 0e18f15..f9f00e2 100644
--- a/include/sysemu/kvm.h
+++ b/include/sysemu/kvm.h
@@ -218,6 +218,7 @@ int kvm_init_vcpu(CPUState *cpu);
 int kvm_cpu_exec(CPUState *cpu);
 
 #ifdef NEED_CPU_H
+#include "cpu.h"
 
 void kvm_setup_guest_memory(void *start, size_t size);
 void kvm_flush_coalesced_mmio_buffer(void);
diff --git a/ioport.c b/ioport.c
index 7a84d54..901a997 100644
--- a/ioport.c
+++ b/ioport.c
@@ -26,6 +26,8 @@
  */
 
 #include "qemu/osdep.h"
+#include "qemu-common.h"
+#include "cpu.h"
 #include "exec/ioport.h"
 #include "trace.h"
 #include "exec/memory.h"
diff --git a/memory.c b/memory.c
index f76f85d..a8ef852 100644
--- a/memory.c
+++ b/memory.c
@@ -15,6 +15,8 @@
 
 #include "qemu/osdep.h"
 #include "qapi/error.h"
+#include "qemu-common.h"
+#include "cpu.h"
 #include "exec/memory.h"
 #include "exec/address-spaces.h"
 #include "exec/ioport.h"
diff --git a/migration/ram.c b/migration/ram.c
index 3f05738..3f82506 100644
--- a/migration/ram.c
+++ b/migration/ram.c
@@ -26,6 +26,8 @@
  * THE SOFTWARE.
  */
 #include "qemu/osdep.h"
+#include "qemu-common.h"
+#include "cpu.h"
 #include <zlib.h>
 #include "qapi-event.h"
 #include "qemu/cutils.h"
diff --git a/migration/savevm.c b/migration/savevm.c
index 16ba443..bfb3d91 100644
--- a/migration/savevm.c
+++ b/migration/savevm.c
@@ -27,6 +27,7 @@
  */
 
 #include "qemu/osdep.h"
+#include "cpu.h"
 #include "hw/boards.h"
 #include "hw/hw.h"
 #include "hw/qdev.h"
diff --git a/monitor.c b/monitor.c
index d1c1930..812383f 100644
--- a/monitor.c
+++ b/monitor.c
@@ -23,6 +23,8 @@
  */
 #include "qemu/osdep.h"
 #include <dirent.h>
+#include "qemu-common.h"
+#include "cpu.h"
 #include "hw/hw.h"
 #include "monitor/qdev.h"
 #include "hw/usb.h"
diff --git a/qtest.c b/qtest.c
index 87575bc..da4826c 100644
--- a/qtest.c
+++ b/qtest.c
@@ -13,6 +13,8 @@
 
 #include "qemu/osdep.h"
 #include "qapi/error.h"
+#include "qemu-common.h"
+#include "cpu.h"
 #include "sysemu/qtest.h"
 #include "hw/qdev.h"
 #include "sysemu/char.h"
diff --git a/scripts/tracetool/format/tcg_helper_c.py b/scripts/tracetool/format/tcg_helper_c.py
index a089b0b..e3485b7 100644
--- a/scripts/tracetool/format/tcg_helper_c.py
+++ b/scripts/tracetool/format/tcg_helper_c.py
@@ -48,6 +48,7 @@ def generate(events, backend):
         '',
         '#include "qemu/osdep.h"',
         '#include "qemu-common.h"',
+        '#include "cpu.h"',
         '#include "trace.h"',
         '#include "exec/helper-proto.h"',
         '',
diff --git a/target-alpha/gdbstub.c b/target-alpha/gdbstub.c
index 199f028..d64bccc 100644
--- a/target-alpha/gdbstub.c
+++ b/target-alpha/gdbstub.c
@@ -19,6 +19,7 @@
  */
 #include "qemu/osdep.h"
 #include "qemu-common.h"
+#include "cpu.h"
 #include "exec/gdbstub.h"
 
 int alpha_cpu_gdb_read_register(CPUState *cs, uint8_t *mem_buf, int n)
diff --git a/target-alpha/machine.c b/target-alpha/machine.c
index 3f72943..710b783 100644
--- a/target-alpha/machine.c
+++ b/target-alpha/machine.c
@@ -1,4 +1,6 @@
 #include "qemu/osdep.h"
+#include "qemu-common.h"
+#include "cpu.h"
 #include "hw/hw.h"
 #include "hw/boards.h"
 #include "migration/cpu.h"
diff --git a/target-arm/gdbstub.c b/target-arm/gdbstub.c
index 3ba9aad..04c1208 100644
--- a/target-arm/gdbstub.c
+++ b/target-arm/gdbstub.c
@@ -19,6 +19,7 @@
  */
 #include "qemu/osdep.h"
 #include "qemu-common.h"
+#include "cpu.h"
 #include "exec/gdbstub.h"
 
 /* Old gdb always expect FPA registers.  Newer (xml-aware) gdb only expect
diff --git a/target-arm/gdbstub64.c b/target-arm/gdbstub64.c
index 634c6bc..49bc3fc 100644
--- a/target-arm/gdbstub64.c
+++ b/target-arm/gdbstub64.c
@@ -18,6 +18,7 @@
  */
 #include "qemu/osdep.h"
 #include "qemu-common.h"
+#include "cpu.h"
 #include "exec/gdbstub.h"
 
 int aarch64_cpu_gdb_read_register(CPUState *cs, uint8_t *mem_buf, int n)
diff --git a/target-arm/kvm-stub.c b/target-arm/kvm-stub.c
index 38bf433..b2c66df 100644
--- a/target-arm/kvm-stub.c
+++ b/target-arm/kvm-stub.c
@@ -11,6 +11,7 @@
  */
 #include "qemu/osdep.h"
 #include "qemu-common.h"
+#include "cpu.h"
 #include "kvm_arm.h"
 
 bool write_kvmstate_to_list(ARMCPU *cpu)
diff --git a/target-arm/kvm32.c b/target-arm/kvm32.c
index d44a7f9..7f5935a 100644
--- a/target-arm/kvm32.c
+++ b/target-arm/kvm32.c
@@ -15,11 +15,11 @@
 #include <linux/kvm.h>
 
 #include "qemu-common.h"
+#include "cpu.h"
 #include "qemu/timer.h"
 #include "sysemu/sysemu.h"
 #include "sysemu/kvm.h"
 #include "kvm_arm.h"
-#include "cpu.h"
 #include "internals.h"
 #include "hw/arm/arm.h"
 
diff --git a/target-arm/kvm64.c b/target-arm/kvm64.c
index e8527bf..e2a34f6 100644
--- a/target-arm/kvm64.c
+++ b/target-arm/kvm64.c
@@ -18,6 +18,7 @@
 #include <linux/kvm.h>
 
 #include "qemu-common.h"
+#include "cpu.h"
 #include "qemu/timer.h"
 #include "qemu/error-report.h"
 #include "qemu/host-utils.h"
@@ -25,7 +26,6 @@
 #include "sysemu/sysemu.h"
 #include "sysemu/kvm.h"
 #include "kvm_arm.h"
-#include "cpu.h"
 #include "internals.h"
 #include "hw/arm/arm.h"
 
diff --git a/target-arm/machine.c b/target-arm/machine.c
index c23feb1..2f45260 100644
--- a/target-arm/machine.c
+++ b/target-arm/machine.c
@@ -1,4 +1,6 @@
 #include "qemu/osdep.h"
+#include "qemu-common.h"
+#include "cpu.h"
 #include "hw/hw.h"
 #include "hw/boards.h"
 #include "qemu/error-report.h"
diff --git a/target-cris/gdbstub.c b/target-cris/gdbstub.c
index 1bbf17b..3a72ee2 100644
--- a/target-cris/gdbstub.c
+++ b/target-cris/gdbstub.c
@@ -19,6 +19,7 @@
  */
 #include "qemu/osdep.h"
 #include "qemu-common.h"
+#include "cpu.h"
 #include "exec/gdbstub.h"
 
 int crisv10_cpu_gdb_read_register(CPUState *cs, uint8_t *mem_buf, int n)
diff --git a/target-cris/machine.c b/target-cris/machine.c
index 4c9287f..6b797e8 100644
--- a/target-cris/machine.c
+++ b/target-cris/machine.c
@@ -19,6 +19,8 @@
  */
 
 #include "qemu/osdep.h"
+#include "qemu-common.h"
+#include "cpu.h"
 #include "hw/hw.h"
 #include "migration/cpu.h"
 
diff --git a/target-i386/gdbstub.c b/target-i386/gdbstub.c
index 4b50713..c494535 100644
--- a/target-i386/gdbstub.c
+++ b/target-i386/gdbstub.c
@@ -19,6 +19,7 @@
  */
 #include "qemu/osdep.h"
 #include "qemu-common.h"
+#include "cpu.h"
 #include "exec/gdbstub.h"
 
 #ifdef TARGET_X86_64
diff --git a/target-i386/kvm-stub.c b/target-i386/kvm-stub.c
index 8df9c59..cdf1506 100644
--- a/target-i386/kvm-stub.c
+++ b/target-i386/kvm-stub.c
@@ -11,6 +11,7 @@
  */
 #include "qemu/osdep.h"
 #include "qemu-common.h"
+#include "cpu.h"
 #include "kvm_i386.h"
 
 bool kvm_allows_irq0_override(void)
diff --git a/target-i386/kvm.c b/target-i386/kvm.c
index 799fdfa..c76e7bb 100644
--- a/target-i386/kvm.c
+++ b/target-i386/kvm.c
@@ -22,10 +22,10 @@
 #include <linux/kvm_para.h>
 
 #include "qemu-common.h"
+#include "cpu.h"
 #include "sysemu/sysemu.h"
 #include "sysemu/kvm_int.h"
 #include "kvm_i386.h"
-#include "cpu.h"
 #include "hyperv.h"
 
 #include "exec/gdbstub.h"
diff --git a/target-i386/machine.c b/target-i386/machine.c
index 57203b2..658b066 100644
--- a/target-i386/machine.c
+++ b/target-i386/machine.c
@@ -1,4 +1,6 @@
 #include "qemu/osdep.h"
+#include "qemu-common.h"
+#include "cpu.h"
 #include "hw/hw.h"
 #include "hw/boards.h"
 #include "hw/i386/pc.h"
diff --git a/target-lm32/gdbstub.c b/target-lm32/gdbstub.c
index 8ac1288..cf929dd 100644
--- a/target-lm32/gdbstub.c
+++ b/target-lm32/gdbstub.c
@@ -19,6 +19,7 @@
  */
 #include "qemu/osdep.h"
 #include "qemu-common.h"
+#include "cpu.h"
 #include "exec/gdbstub.h"
 #include "hw/lm32/lm32_pic.h"
 
diff --git a/target-lm32/machine.c b/target-lm32/machine.c
index 6f56216..3c258a4 100644
--- a/target-lm32/machine.c
+++ b/target-lm32/machine.c
@@ -1,4 +1,6 @@
 #include "qemu/osdep.h"
+#include "qemu-common.h"
+#include "cpu.h"
 #include "hw/hw.h"
 #include "hw/boards.h"
 #include "migration/cpu.h"
diff --git a/target-m68k/gdbstub.c b/target-m68k/gdbstub.c
index f02bb5c..c7f44c9 100644
--- a/target-m68k/gdbstub.c
+++ b/target-m68k/gdbstub.c
@@ -19,6 +19,7 @@
  */
 #include "qemu/osdep.h"
 #include "qemu-common.h"
+#include "cpu.h"
 #include "exec/gdbstub.h"
 
 int m68k_cpu_gdb_read_register(CPUState *cs, uint8_t *mem_buf, int n)
diff --git a/target-microblaze/gdbstub.c b/target-microblaze/gdbstub.c
index 89d3898..7fb076c 100644
--- a/target-microblaze/gdbstub.c
+++ b/target-microblaze/gdbstub.c
@@ -19,6 +19,7 @@
  */
 #include "qemu/osdep.h"
 #include "qemu-common.h"
+#include "cpu.h"
 #include "exec/gdbstub.h"
 
 int mb_cpu_gdb_read_register(CPUState *cs, uint8_t *mem_buf, int n)
diff --git a/target-mips/cpu.h b/target-mips/cpu.h
index 078fabc..0636327 100644
--- a/target-mips/cpu.h
+++ b/target-mips/cpu.h
@@ -1145,22 +1145,8 @@ static inline void cpu_mips_store_cause(CPUMIPSState *env, target_ulong val)
 }
 #endif
 
-static inline void QEMU_NORETURN do_raise_exception_err(CPUMIPSState *env,
-                                                        uint32_t exception,
-                                                        int error_code,
-                                                        uintptr_t pc)
-{
-    CPUState *cs = CPU(mips_env_get_cpu(env));
-
-    if (exception < EXCP_SC) {
-        qemu_log_mask(CPU_LOG_INT, "%s: %d %d\n",
-                      __func__, exception, error_code);
-    }
-    cs->exception_index = exception;
-    env->error_code = error_code;
-
-    cpu_loop_exit_restore(cs, pc);
-}
+void QEMU_NORETURN do_raise_exception_err(CPUMIPSState *env, uint32_t exception,
+                                          int error_code, uintptr_t pc);
 
 static inline void QEMU_NORETURN do_raise_exception(CPUMIPSState *env,
                                                     uint32_t exception,
diff --git a/target-mips/gdbstub.c b/target-mips/gdbstub.c
index b0b4a32..2707ff5 100644
--- a/target-mips/gdbstub.c
+++ b/target-mips/gdbstub.c
@@ -19,6 +19,7 @@
  */
 #include "qemu/osdep.h"
 #include "qemu-common.h"
+#include "cpu.h"
 #include "exec/gdbstub.h"
 
 int mips_cpu_gdb_read_register(CPUState *cs, uint8_t *mem_buf, int n)
diff --git a/target-mips/helper.c b/target-mips/helper.c
index 1004ede..0fabfec 100644
--- a/target-mips/helper.c
+++ b/target-mips/helper.c
@@ -840,3 +840,20 @@ void r4k_invalidate_tlb (CPUMIPSState *env, int idx, int use_extra)
     }
 }
 #endif
+
+void QEMU_NORETURN do_raise_exception_err(CPUMIPSState *env,
+                                          uint32_t exception,
+                                          int error_code,
+                                          uintptr_t pc)
+{
+    CPUState *cs = CPU(mips_env_get_cpu(env));
+
+    if (exception < EXCP_SC) {
+        qemu_log_mask(CPU_LOG_INT, "%s: %d %d\n",
+                      __func__, exception, error_code);
+    }
+    cs->exception_index = exception;
+    env->error_code = error_code;
+
+    cpu_loop_exit_restore(cs, pc);
+}
diff --git a/target-mips/kvm.c b/target-mips/kvm.c
index 950bc05..a854e4d 100644
--- a/target-mips/kvm.c
+++ b/target-mips/kvm.c
@@ -16,11 +16,11 @@
 #include <linux/kvm.h>
 
 #include "qemu-common.h"
+#include "cpu.h"
 #include "qemu/error-report.h"
 #include "qemu/timer.h"
 #include "sysemu/sysemu.h"
 #include "sysemu/kvm.h"
-#include "cpu.h"
 #include "sysemu/cpus.h"
 #include "kvm_mips.h"
 #include "exec/memattrs.h"
diff --git a/target-mips/machine.c b/target-mips/machine.c
index eb3d916..7314cfe 100644
--- a/target-mips/machine.c
+++ b/target-mips/machine.c
@@ -1,4 +1,6 @@
 #include "qemu/osdep.h"
+#include "qemu-common.h"
+#include "cpu.h"
 #include "hw/hw.h"
 #include "cpu.h"
 #include "migration/cpu.h"
diff --git a/target-moxie/machine.c b/target-moxie/machine.c
index 7810e1c..282dcd8 100644
--- a/target-moxie/machine.c
+++ b/target-moxie/machine.c
@@ -1,4 +1,6 @@
 #include "qemu/osdep.h"
+#include "qemu-common.h"
+#include "cpu.h"
 #include "hw/hw.h"
 #include "hw/boards.h"
 #include "machine.h"
diff --git a/target-openrisc/gdbstub.c b/target-openrisc/gdbstub.c
index edc301a..cb16e76 100644
--- a/target-openrisc/gdbstub.c
+++ b/target-openrisc/gdbstub.c
@@ -19,6 +19,7 @@
  */
 #include "qemu/osdep.h"
 #include "qemu-common.h"
+#include "cpu.h"
 #include "exec/gdbstub.h"
 
 int openrisc_cpu_gdb_read_register(CPUState *cs, uint8_t *mem_buf, int n)
diff --git a/target-openrisc/machine.c b/target-openrisc/machine.c
index bd5d50f..17b0c77 100644
--- a/target-openrisc/machine.c
+++ b/target-openrisc/machine.c
@@ -18,6 +18,8 @@
  */
 
 #include "qemu/osdep.h"
+#include "qemu-common.h"
+#include "cpu.h"
 #include "hw/hw.h"
 #include "hw/boards.h"
 #include "migration/cpu.h"
diff --git a/target-ppc/gdbstub.c b/target-ppc/gdbstub.c
index 569c380..7a33813 100644
--- a/target-ppc/gdbstub.c
+++ b/target-ppc/gdbstub.c
@@ -19,6 +19,7 @@
  */
 #include "qemu/osdep.h"
 #include "qemu-common.h"
+#include "cpu.h"
 #include "exec/gdbstub.h"
 
 static int ppc_gdb_register_len_apple(int n)
diff --git a/target-ppc/kvm-stub.c b/target-ppc/kvm-stub.c
index 627bcb4..efeafca 100644
--- a/target-ppc/kvm-stub.c
+++ b/target-ppc/kvm-stub.c
@@ -11,6 +11,7 @@
  */
 #include "qemu/osdep.h"
 #include "qemu-common.h"
+#include "cpu.h"
 #include "hw/ppc/openpic.h"
 
 int kvm_openpic_connect_vcpu(DeviceState *d, CPUState *cs)
diff --git a/target-ppc/kvm.c b/target-ppc/kvm.c
index c4c8146..24d6032 100644
--- a/target-ppc/kvm.c
+++ b/target-ppc/kvm.c
@@ -24,11 +24,11 @@
 
 #include "qemu-common.h"
 #include "qemu/error-report.h"
+#include "cpu.h"
 #include "qemu/timer.h"
 #include "sysemu/sysemu.h"
 #include "sysemu/kvm.h"
 #include "kvm_ppc.h"
-#include "cpu.h"
 #include "sysemu/cpus.h"
 #include "sysemu/device_tree.h"
 #include "mmu-hash64.h"
diff --git a/target-ppc/machine.c b/target-ppc/machine.c
index 2ea29dd..7a9995d 100644
--- a/target-ppc/machine.c
+++ b/target-ppc/machine.c
@@ -1,4 +1,6 @@
 #include "qemu/osdep.h"
+#include "qemu-common.h"
+#include "cpu.h"
 #include "hw/hw.h"
 #include "hw/boards.h"
 #include "sysemu/kvm.h"
diff --git a/target-s390x/gdbstub.c b/target-s390x/gdbstub.c
index 9fc36cb..0992ae7 100644
--- a/target-s390x/gdbstub.c
+++ b/target-s390x/gdbstub.c
@@ -19,6 +19,7 @@
  */
 #include "qemu/osdep.h"
 #include "qemu-common.h"
+#include "cpu.h"
 #include "exec/gdbstub.h"
 #include "qemu/bitops.h"
 
diff --git a/target-s390x/kvm.c b/target-s390x/kvm.c
index e1859ca..4d563e3 100644
--- a/target-s390x/kvm.c
+++ b/target-s390x/kvm.c
@@ -29,12 +29,12 @@
 #include <asm/ptrace.h>
 
 #include "qemu-common.h"
+#include "cpu.h"
 #include "qemu/error-report.h"
 #include "qemu/timer.h"
 #include "sysemu/sysemu.h"
 #include "sysemu/kvm.h"
 #include "hw/hw.h"
-#include "cpu.h"
 #include "sysemu/device_tree.h"
 #include "qapi/qmp/qjson.h"
 #include "exec/gdbstub.h"
diff --git a/target-sh4/gdbstub.c b/target-sh4/gdbstub.c
index 1b59ea8..13bea00 100644
--- a/target-sh4/gdbstub.c
+++ b/target-sh4/gdbstub.c
@@ -19,6 +19,7 @@
  */
 #include "qemu/osdep.h"
 #include "qemu-common.h"
+#include "cpu.h"
 #include "exec/gdbstub.h"
 
 /* Hint: Use "set architecture sh4" in GDB to see fpu registers */
diff --git a/target-sparc/gdbstub.c b/target-sparc/gdbstub.c
index e530dc5..ffc2baa 100644
--- a/target-sparc/gdbstub.c
+++ b/target-sparc/gdbstub.c
@@ -19,6 +19,7 @@
  */
 #include "qemu/osdep.h"
 #include "qemu-common.h"
+#include "cpu.h"
 #include "exec/gdbstub.h"
 
 #ifdef TARGET_ABI32
diff --git a/target-sparc/machine.c b/target-sparc/machine.c
index 04806f6..c8823af 100644
--- a/target-sparc/machine.c
+++ b/target-sparc/machine.c
@@ -1,4 +1,6 @@
 #include "qemu/osdep.h"
+#include "qemu-common.h"
+#include "cpu.h"
 #include "hw/hw.h"
 #include "hw/boards.h"
 #include "qemu/timer.h"
diff --git a/target-xtensa/gdbstub.c b/target-xtensa/gdbstub.c
index 51d4db0..bfcd591 100644
--- a/target-xtensa/gdbstub.c
+++ b/target-xtensa/gdbstub.c
@@ -19,6 +19,7 @@
  */
 #include "qemu/osdep.h"
 #include "qemu-common.h"
+#include "cpu.h"
 #include "exec/gdbstub.h"
 
 int xtensa_cpu_gdb_read_register(CPUState *cs, uint8_t *mem_buf, int n)
diff --git a/tcg/optimize.c b/tcg/optimize.c
index 6d68f57..701f552 100644
--- a/tcg/optimize.c
+++ b/tcg/optimize.c
@@ -24,9 +24,8 @@
  */
 
 #include "qemu/osdep.h"
-
-
 #include "qemu-common.h"
+#include "cpu.h"
 #include "tcg-op.h"
 
 #define CASE_OP_32_64(x)                        \
diff --git a/tcg/tcg-op.c b/tcg/tcg-op.c
index f554b86..7a15914 100644
--- a/tcg/tcg-op.c
+++ b/tcg/tcg-op.c
@@ -23,6 +23,8 @@
  */
 
 #include "qemu/osdep.h"
+#include "qemu-common.h"
+#include "cpu.h"
 #include "tcg.h"
 #include "tcg-op.h"
 
diff --git a/tcg/tcg.h b/tcg/tcg.h
index 40c8fbe..50d6a0f 100644
--- a/tcg/tcg.h
+++ b/tcg/tcg.h
@@ -26,6 +26,7 @@
 #define TCG_H
 
 #include "qemu-common.h"
+#include "cpu.h"
 #include "qemu/bitops.h"
 #include "tcg-target.h"
 
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 72+ messages in thread

* [Qemu-devel] [PATCH 44/50] arm: move arm_log_exception into .c file
  2016-04-08 20:28 [Qemu-devel] [PATCH for-2.7 00/49] NEED_CPU_H / cpu.h / hw/hw.h cleanups Paolo Bonzini
                   ` (42 preceding siblings ...)
  2016-04-08 20:29 ` [Qemu-devel] [PATCH 43/50] qemu-common: push cpu.h inclusion out of qemu-common.h Paolo Bonzini
@ 2016-04-08 20:29 ` Paolo Bonzini
  2016-04-21 10:48   ` Alex Bennée
  2016-04-08 20:29 ` [Qemu-devel] [PATCH 45/50] mips: move CP0 functions out of cpu.h Paolo Bonzini
                   ` (7 subsequent siblings)
  51 siblings, 1 reply; 72+ messages in thread
From: Paolo Bonzini @ 2016-04-08 20:29 UTC (permalink / raw)
  To: qemu-devel

Avoid need for qemu/log.h inclusion, and make the function static too.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 target-arm/helper.c    | 15 +++++++++++++++
 target-arm/internals.h | 15 ---------------
 2 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/target-arm/helper.c b/target-arm/helper.c
index 09638b2..41abdff 100644
--- a/target-arm/helper.c
+++ b/target-arm/helper.c
@@ -5815,6 +5815,21 @@ static void do_v7m_exception_exit(CPUARMState *env)
        pointer.  */
 }
 
+static void arm_log_exception(int idx)
+{
+    if (qemu_loglevel_mask(CPU_LOG_INT)) {
+        const char *exc = NULL;
+
+        if (idx >= 0 && idx < ARRAY_SIZE(excnames)) {
+            exc = excnames[idx];
+        }
+        if (!exc) {
+            exc = "unknown";
+        }
+        qemu_log_mask(CPU_LOG_INT, "Taking exception %d [%s]\n", idx, exc);
+    }
+}
+
 void arm_v7m_cpu_do_interrupt(CPUState *cs)
 {
     ARMCPU *cpu = ARM_CPU(cs);
diff --git a/target-arm/internals.h b/target-arm/internals.h
index 2e70272..c484700 100644
--- a/target-arm/internals.h
+++ b/target-arm/internals.h
@@ -72,21 +72,6 @@ static const char * const excnames[] = {
     [EXCP_SEMIHOST] = "Semihosting call",
 };
 
-static inline void arm_log_exception(int idx)
-{
-    if (qemu_loglevel_mask(CPU_LOG_INT)) {
-        const char *exc = NULL;
-
-        if (idx >= 0 && idx < ARRAY_SIZE(excnames)) {
-            exc = excnames[idx];
-        }
-        if (!exc) {
-            exc = "unknown";
-        }
-        qemu_log_mask(CPU_LOG_INT, "Taking exception %d [%s]\n", idx, exc);
-    }
-}
-
 /* Scale factor for generic timers, ie number of ns per tick.
  * This gives a 62.5MHz timer.
  */
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 72+ messages in thread

* [Qemu-devel] [PATCH 45/50] mips: move CP0 functions out of cpu.h
  2016-04-08 20:28 [Qemu-devel] [PATCH for-2.7 00/49] NEED_CPU_H / cpu.h / hw/hw.h cleanups Paolo Bonzini
                   ` (43 preceding siblings ...)
  2016-04-08 20:29 ` [Qemu-devel] [PATCH 44/50] arm: move arm_log_exception into .c file Paolo Bonzini
@ 2016-04-08 20:29 ` Paolo Bonzini
  2016-04-08 20:29 ` [Qemu-devel] [PATCH 46/50] hw: explicitly include qemu/log.h Paolo Bonzini
                   ` (6 subsequent siblings)
  51 siblings, 0 replies; 72+ messages in thread
From: Paolo Bonzini @ 2016-04-08 20:29 UTC (permalink / raw)
  To: qemu-devel

These are here for historical reasons: they are needed from both gdbstub.c
and op_helper.c, and the latter was compiled with fixed AREG0.  It is
not needed anymore, so uninline them.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 target-mips/cpu.h    | 113 ++-------------------------------------------------
 target-mips/helper.c | 108 ++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 112 insertions(+), 109 deletions(-)

diff --git a/target-mips/cpu.h b/target-mips/cpu.h
index 0636327..951267a 100644
--- a/target-mips/cpu.h
+++ b/target-mips/cpu.h
@@ -1035,115 +1035,10 @@ static inline void compute_hflags(CPUMIPSState *env)
     }
 }
 
-#ifndef CONFIG_USER_ONLY
-static inline void cpu_mips_tlb_flush(CPUMIPSState *env, int flush_global)
-{
-    MIPSCPU *cpu = mips_env_get_cpu(env);
-
-    /* Flush qemu's TLB and discard all shadowed entries.  */
-    tlb_flush(CPU(cpu), flush_global);
-    env->tlb->tlb_in_use = env->tlb->nb_tlb;
-}
-
-/* Called for updates to CP0_Status.  */
-static inline void sync_c0_status(CPUMIPSState *env, CPUMIPSState *cpu, int tc)
-{
-    int32_t tcstatus, *tcst;
-    uint32_t v = cpu->CP0_Status;
-    uint32_t cu, mx, asid, ksu;
-    uint32_t mask = ((1 << CP0TCSt_TCU3)
-                       | (1 << CP0TCSt_TCU2)
-                       | (1 << CP0TCSt_TCU1)
-                       | (1 << CP0TCSt_TCU0)
-                       | (1 << CP0TCSt_TMX)
-                       | (3 << CP0TCSt_TKSU)
-                       | (0xff << CP0TCSt_TASID));
-
-    cu = (v >> CP0St_CU0) & 0xf;
-    mx = (v >> CP0St_MX) & 0x1;
-    ksu = (v >> CP0St_KSU) & 0x3;
-    asid = env->CP0_EntryHi & 0xff;
-
-    tcstatus = cu << CP0TCSt_TCU0;
-    tcstatus |= mx << CP0TCSt_TMX;
-    tcstatus |= ksu << CP0TCSt_TKSU;
-    tcstatus |= asid;
-
-    if (tc == cpu->current_tc) {
-        tcst = &cpu->active_tc.CP0_TCStatus;
-    } else {
-        tcst = &cpu->tcs[tc].CP0_TCStatus;
-    }
-
-    *tcst &= ~mask;
-    *tcst |= tcstatus;
-    compute_hflags(cpu);
-}
-
-static inline void cpu_mips_store_status(CPUMIPSState *env, target_ulong val)
-{
-    uint32_t mask = env->CP0_Status_rw_bitmask;
-    target_ulong old = env->CP0_Status;
-
-    if (env->insn_flags & ISA_MIPS32R6) {
-        bool has_supervisor = extract32(mask, CP0St_KSU, 2) == 0x3;
-#if defined(TARGET_MIPS64)
-        uint32_t ksux = (1 << CP0St_KX) & val;
-        ksux |= (ksux >> 1) & val; /* KX = 0 forces SX to be 0 */
-        ksux |= (ksux >> 1) & val; /* SX = 0 forces UX to be 0 */
-        val = (val & ~(7 << CP0St_UX)) | ksux;
-#endif
-        if (has_supervisor && extract32(val, CP0St_KSU, 2) == 0x3) {
-            mask &= ~(3 << CP0St_KSU);
-        }
-        mask &= ~(((1 << CP0St_SR) | (1 << CP0St_NMI)) & val);
-    }
-
-    env->CP0_Status = (old & ~mask) | (val & mask);
-#if defined(TARGET_MIPS64)
-    if ((env->CP0_Status ^ old) & (old & (7 << CP0St_UX))) {
-        /* Access to at least one of the 64-bit segments has been disabled */
-        cpu_mips_tlb_flush(env, 1);
-    }
-#endif
-    if (env->CP0_Config3 & (1 << CP0C3_MT)) {
-        sync_c0_status(env, env, env->current_tc);
-    } else {
-        compute_hflags(env);
-    }
-}
-
-static inline void cpu_mips_store_cause(CPUMIPSState *env, target_ulong val)
-{
-    uint32_t mask = 0x00C00300;
-    uint32_t old = env->CP0_Cause;
-    int i;
-
-    if (env->insn_flags & ISA_MIPS32R2) {
-        mask |= 1 << CP0Ca_DC;
-    }
-    if (env->insn_flags & ISA_MIPS32R6) {
-        mask &= ~((1 << CP0Ca_WP) & val);
-    }
-
-    env->CP0_Cause = (env->CP0_Cause & ~mask) | (val & mask);
-
-    if ((old ^ env->CP0_Cause) & (1 << CP0Ca_DC)) {
-        if (env->CP0_Cause & (1 << CP0Ca_DC)) {
-            cpu_mips_stop_count(env);
-        } else {
-            cpu_mips_start_count(env);
-        }
-    }
-
-    /* Set/reset software interrupts */
-    for (i = 0 ; i < 2 ; i++) {
-        if ((old ^ env->CP0_Cause) & (1 << (CP0Ca_IP + i))) {
-            cpu_mips_soft_irq(env, i, env->CP0_Cause & (1 << (CP0Ca_IP + i)));
-        }
-    }
-}
-#endif
+void cpu_mips_tlb_flush(CPUMIPSState *env, int flush_global);
+void sync_c0_status(CPUMIPSState *env, CPUMIPSState *cpu, int tc);
+void cpu_mips_store_status(CPUMIPSState *env, target_ulong val);
+void cpu_mips_store_cause(CPUMIPSState *env, target_ulong val);
 
 void QEMU_NORETURN do_raise_exception_err(CPUMIPSState *env, uint32_t exception,
                                           int error_code, uintptr_t pc);
diff --git a/target-mips/helper.c b/target-mips/helper.c
index 0fabfec..ac5771e 100644
--- a/target-mips/helper.c
+++ b/target-mips/helper.c
@@ -221,6 +221,114 @@ static int get_physical_address (CPUMIPSState *env, hwaddr *physical,
     }
     return ret;
 }
+
+void cpu_mips_tlb_flush(CPUMIPSState *env, int flush_global)
+{
+    MIPSCPU *cpu = mips_env_get_cpu(env);
+
+    /* Flush qemu's TLB and discard all shadowed entries.  */
+    tlb_flush(CPU(cpu), flush_global);
+    env->tlb->tlb_in_use = env->tlb->nb_tlb;
+}
+
+/* Called for updates to CP0_Status.  */
+void sync_c0_status(CPUMIPSState *env, CPUMIPSState *cpu, int tc)
+{
+    int32_t tcstatus, *tcst;
+    uint32_t v = cpu->CP0_Status;
+    uint32_t cu, mx, asid, ksu;
+    uint32_t mask = ((1 << CP0TCSt_TCU3)
+                       | (1 << CP0TCSt_TCU2)
+                       | (1 << CP0TCSt_TCU1)
+                       | (1 << CP0TCSt_TCU0)
+                       | (1 << CP0TCSt_TMX)
+                       | (3 << CP0TCSt_TKSU)
+                       | (0xff << CP0TCSt_TASID));
+
+    cu = (v >> CP0St_CU0) & 0xf;
+    mx = (v >> CP0St_MX) & 0x1;
+    ksu = (v >> CP0St_KSU) & 0x3;
+    asid = env->CP0_EntryHi & 0xff;
+
+    tcstatus = cu << CP0TCSt_TCU0;
+    tcstatus |= mx << CP0TCSt_TMX;
+    tcstatus |= ksu << CP0TCSt_TKSU;
+    tcstatus |= asid;
+
+    if (tc == cpu->current_tc) {
+        tcst = &cpu->active_tc.CP0_TCStatus;
+    } else {
+        tcst = &cpu->tcs[tc].CP0_TCStatus;
+    }
+
+    *tcst &= ~mask;
+    *tcst |= tcstatus;
+    compute_hflags(cpu);
+}
+
+void cpu_mips_store_status(CPUMIPSState *env, target_ulong val)
+{
+    uint32_t mask = env->CP0_Status_rw_bitmask;
+    target_ulong old = env->CP0_Status;
+
+    if (env->insn_flags & ISA_MIPS32R6) {
+        bool has_supervisor = extract32(mask, CP0St_KSU, 2) == 0x3;
+#if defined(TARGET_MIPS64)
+        uint32_t ksux = (1 << CP0St_KX) & val;
+        ksux |= (ksux >> 1) & val; /* KX = 0 forces SX to be 0 */
+        ksux |= (ksux >> 1) & val; /* SX = 0 forces UX to be 0 */
+        val = (val & ~(7 << CP0St_UX)) | ksux;
+#endif
+        if (has_supervisor && extract32(val, CP0St_KSU, 2) == 0x3) {
+            mask &= ~(3 << CP0St_KSU);
+        }
+        mask &= ~(((1 << CP0St_SR) | (1 << CP0St_NMI)) & val);
+    }
+
+    env->CP0_Status = (old & ~mask) | (val & mask);
+#if defined(TARGET_MIPS64)
+    if ((env->CP0_Status ^ old) & (old & (7 << CP0St_UX))) {
+        /* Access to at least one of the 64-bit segments has been disabled */
+        cpu_mips_tlb_flush(env, 1);
+    }
+#endif
+    if (env->CP0_Config3 & (1 << CP0C3_MT)) {
+        sync_c0_status(env, env, env->current_tc);
+    } else {
+        compute_hflags(env);
+    }
+}
+
+void cpu_mips_store_cause(CPUMIPSState *env, target_ulong val)
+{
+    uint32_t mask = 0x00C00300;
+    uint32_t old = env->CP0_Cause;
+    int i;
+
+    if (env->insn_flags & ISA_MIPS32R2) {
+        mask |= 1 << CP0Ca_DC;
+    }
+    if (env->insn_flags & ISA_MIPS32R6) {
+        mask &= ~((1 << CP0Ca_WP) & val);
+    }
+
+    env->CP0_Cause = (env->CP0_Cause & ~mask) | (val & mask);
+
+    if ((old ^ env->CP0_Cause) & (1 << CP0Ca_DC)) {
+        if (env->CP0_Cause & (1 << CP0Ca_DC)) {
+            cpu_mips_stop_count(env);
+        } else {
+            cpu_mips_start_count(env);
+        }
+    }
+
+    /* Set/reset software interrupts */
+    for (i = 0 ; i < 2 ; i++) {
+        if ((old ^ env->CP0_Cause) & (1 << (CP0Ca_IP + i))) {
+            cpu_mips_soft_irq(env, i, env->CP0_Cause & (1 << (CP0Ca_IP + i)));
+        }
+    }
+}
 #endif
 
 static void raise_mmu_exception(CPUMIPSState *env, target_ulong address,
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 72+ messages in thread

* [Qemu-devel] [PATCH 46/50] hw: explicitly include qemu/log.h
  2016-04-08 20:28 [Qemu-devel] [PATCH for-2.7 00/49] NEED_CPU_H / cpu.h / hw/hw.h cleanups Paolo Bonzini
                   ` (44 preceding siblings ...)
  2016-04-08 20:29 ` [Qemu-devel] [PATCH 45/50] mips: move CP0 functions out of cpu.h Paolo Bonzini
@ 2016-04-08 20:29 ` Paolo Bonzini
  2016-04-20 18:30   ` Alex Bennée
  2016-04-08 20:29 ` [Qemu-devel] [PATCH 47/50] exec: extract exec/tb-context.h Paolo Bonzini
                   ` (5 subsequent siblings)
  51 siblings, 1 reply; 72+ messages in thread
From: Paolo Bonzini @ 2016-04-08 20:29 UTC (permalink / raw)
  To: qemu-devel

Move the inclusion out of hw/hw.h, most files do not need it.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 hw/arm/ast2400.c               | 1 +
 hw/arm/nseries.c               | 1 +
 hw/arm/palmetto-bmc.c          | 1 +
 hw/arm/pxa2xx_gpio.c           | 1 +
 hw/arm/stellaris.c             | 1 +
 hw/arm/strongarm.c             | 1 +
 hw/arm/xlnx-ep108.c            | 1 +
 hw/audio/pl041.c               | 1 +
 hw/block/m25p80.c              | 1 +
 hw/block/pflash_cfi01.c        | 1 +
 hw/char/bcm2835_aux.c          | 1 +
 hw/char/cadence_uart.c         | 4 ++++
 hw/char/digic-uart.c           | 1 +
 hw/char/imx_serial.c           | 1 +
 hw/char/pl011.c                | 1 +
 hw/char/stm32f2xx_usart.c      | 1 +
 hw/display/bcm2835_fb.c        | 1 +
 hw/display/cg3.c               | 1 +
 hw/display/pl110.c             | 1 +
 hw/display/virtio-gpu.c        | 1 +
 hw/dma/bcm2835_dma.c           | 1 +
 hw/dma/pl080.c                 | 1 +
 hw/dma/pl330.c                 | 1 +
 hw/dma/rc4030.c                | 1 +
 hw/gpio/imx_gpio.c             | 1 +
 hw/gpio/pl061.c                | 1 +
 hw/i2c/imx_i2c.c               | 1 +
 hw/i2c/versatile_i2c.c         | 1 +
 hw/input/pl050.c               | 1 +
 hw/intc/allwinner-a10-pic.c    | 1 +
 hw/intc/arm_gic.c              | 1 +
 hw/intc/arm_gicv2m.c           | 1 +
 hw/intc/armv7m_nvic.c          | 1 +
 hw/intc/bcm2835_ic.c           | 1 +
 hw/intc/bcm2836_control.c      | 1 +
 hw/intc/i8259.c                | 1 +
 hw/intc/imx_avic.c             | 1 +
 hw/intc/openpic.c              | 1 +
 hw/intc/pl190.c                | 1 +
 hw/misc/arm11scu.c             | 1 +
 hw/misc/arm_integrator_debug.c | 1 +
 hw/misc/arm_l2x0.c             | 1 +
 hw/misc/arm_sysctl.c           | 1 +
 hw/misc/bcm2835_mbox.c         | 1 +
 hw/misc/bcm2835_property.c     | 1 +
 hw/misc/imx25_ccm.c            | 1 +
 hw/misc/imx31_ccm.c            | 1 +
 hw/misc/imx6_ccm.c             | 1 +
 hw/misc/imx_ccm.c              | 1 +
 hw/misc/macio/cuda.c           | 1 +
 hw/misc/macio/mac_dbdma.c      | 1 +
 hw/misc/mips_cmgcr.c           | 1 +
 hw/misc/mips_cpc.c             | 1 +
 hw/misc/mips_itu.c             | 1 +
 hw/misc/stm32f2xx_syscfg.c     | 1 +
 hw/misc/zynq-xadc.c            | 1 +
 hw/misc/zynq_slcr.c            | 1 +
 hw/net/allwinner_emac.c        | 1 +
 hw/net/fsl_etsec/etsec.c       | 1 +
 hw/net/fsl_etsec/rings.c       | 2 +-
 hw/net/imx_fec.c               | 1 +
 hw/net/lan9118.c               | 1 +
 hw/net/spapr_llan.c            | 1 +
 hw/pci-host/apb.c              | 1 +
 hw/pci-host/versatile.c        | 1 +
 hw/ppc/spapr.c                 | 1 +
 hw/ppc/spapr_hcall.c           | 1 +
 hw/ppc/spapr_iommu.c           | 1 +
 hw/ppc/spapr_rtas.c            | 1 +
 hw/ppc/spapr_vio.c             | 1 +
 hw/sd/pl181.c                  | 1 +
 hw/sd/sd.c                     | 1 +
 hw/sd/sdhci.c                  | 1 +
 hw/ssi/pl022.c                 | 1 +
 hw/timer/allwinner-a10-pit.c   | 1 +
 hw/timer/arm_timer.c           | 1 +
 hw/timer/digic-timer.c         | 1 +
 hw/timer/imx_epit.c            | 1 +
 hw/timer/imx_gpt.c             | 1 +
 hw/timer/pl031.c               | 1 +
 hw/timer/stm32f2xx_timer.c     | 1 +
 hw/watchdog/wdt_diag288.c      | 1 +
 include/hw/hw.h                | 1 -
 monitor.c                      | 1 +
 vl.c                           | 1 +
 85 files changed, 87 insertions(+), 2 deletions(-)

diff --git a/hw/arm/ast2400.c b/hw/arm/ast2400.c
index 03f9938..5510a8a 100644
--- a/hw/arm/ast2400.c
+++ b/hw/arm/ast2400.c
@@ -17,6 +17,7 @@
 #include "exec/address-spaces.h"
 #include "hw/arm/ast2400.h"
 #include "hw/char/serial.h"
+#include "qemu/log.h"
 
 #define AST2400_UART_5_BASE      0x00184000
 #define AST2400_IOMEM_SIZE       0x00200000
diff --git a/hw/arm/nseries.c b/hw/arm/nseries.c
index 43a78c2..6ed3dd3 100644
--- a/hw/arm/nseries.c
+++ b/hw/arm/nseries.c
@@ -37,6 +37,7 @@
 #include "hw/loader.h"
 #include "sysemu/block-backend.h"
 #include "hw/sysbus.h"
+#include "qemu/log.h"
 #include "exec/address-spaces.h"
 
 /* Nokia N8x0 support */
diff --git a/hw/arm/palmetto-bmc.c b/hw/arm/palmetto-bmc.c
index 89ebd92..a51d960 100644
--- a/hw/arm/palmetto-bmc.c
+++ b/hw/arm/palmetto-bmc.c
@@ -17,6 +17,7 @@
 #include "hw/arm/arm.h"
 #include "hw/arm/ast2400.h"
 #include "hw/boards.h"
+#include "qemu/log.h"
 
 static struct arm_boot_info palmetto_bmc_binfo = {
     .loader_start = AST2400_SDRAM_BASE,
diff --git a/hw/arm/pxa2xx_gpio.c b/hw/arm/pxa2xx_gpio.c
index 8c9626e..576a8eb 100644
--- a/hw/arm/pxa2xx_gpio.c
+++ b/hw/arm/pxa2xx_gpio.c
@@ -12,6 +12,7 @@
 #include "hw/hw.h"
 #include "hw/sysbus.h"
 #include "hw/arm/pxa.h"
+#include "qemu/log.h"
 
 #define PXA2XX_GPIO_BANKS	4
 
diff --git a/hw/arm/stellaris.c b/hw/arm/stellaris.c
index c1766f8..54f7010 100644
--- a/hw/arm/stellaris.c
+++ b/hw/arm/stellaris.c
@@ -17,6 +17,7 @@
 #include "hw/i2c/i2c.h"
 #include "net/net.h"
 #include "hw/boards.h"
+#include "qemu/log.h"
 #include "exec/address-spaces.h"
 #include "sysemu/sysemu.h"
 
diff --git a/hw/arm/strongarm.c b/hw/arm/strongarm.c
index 1eeb1ab..aa5ddbf 100644
--- a/hw/arm/strongarm.c
+++ b/hw/arm/strongarm.c
@@ -38,6 +38,7 @@
 #include "sysemu/sysemu.h"
 #include "hw/ssi/ssi.h"
 #include "qemu/cutils.h"
+#include "qemu/log.h"
 
 //#define DEBUG
 
diff --git a/hw/arm/xlnx-ep108.c b/hw/arm/xlnx-ep108.c
index 5f48018..40f7cc1 100644
--- a/hw/arm/xlnx-ep108.c
+++ b/hw/arm/xlnx-ep108.c
@@ -23,6 +23,7 @@
 #include "hw/boards.h"
 #include "qemu/error-report.h"
 #include "exec/address-spaces.h"
+#include "qemu/log.h"
 
 typedef struct XlnxEP108 {
     XlnxZynqMPState soc;
diff --git a/hw/audio/pl041.c b/hw/audio/pl041.c
index 4717bc9..6e9c104 100644
--- a/hw/audio/pl041.c
+++ b/hw/audio/pl041.c
@@ -22,6 +22,7 @@
 
 #include "qemu/osdep.h"
 #include "hw/sysbus.h"
+#include "qemu/log.h"
 
 #include "pl041.h"
 #include "lm4549.h"
diff --git a/hw/block/m25p80.c b/hw/block/m25p80.c
index 906b712..05f864f 100644
--- a/hw/block/m25p80.c
+++ b/hw/block/m25p80.c
@@ -27,6 +27,7 @@
 #include "sysemu/blockdev.h"
 #include "hw/ssi/ssi.h"
 #include "qemu/bitops.h"
+#include "qemu/log.h"
 
 #ifndef M25P80_ERR_DEBUG
 #define M25P80_ERR_DEBUG 0
diff --git a/hw/block/pflash_cfi01.c b/hw/block/pflash_cfi01.c
index c475c2a..43cb0b6 100644
--- a/hw/block/pflash_cfi01.c
+++ b/hw/block/pflash_cfi01.c
@@ -45,6 +45,7 @@
 #include "qemu/bitops.h"
 #include "exec/address-spaces.h"
 #include "qemu/host-utils.h"
+#include "qemu/log.h"
 #include "hw/sysbus.h"
 
 #define PFLASH_BUG(fmt, ...) \
diff --git a/hw/char/bcm2835_aux.c b/hw/char/bcm2835_aux.c
index 0394d11..319f165 100644
--- a/hw/char/bcm2835_aux.c
+++ b/hw/char/bcm2835_aux.c
@@ -22,6 +22,7 @@
 
 #include "qemu/osdep.h"
 #include "hw/char/bcm2835_aux.h"
+#include "qemu/log.h"
 
 #define AUX_IRQ         0x0
 #define AUX_ENABLES     0x4
diff --git a/hw/char/cadence_uart.c b/hw/char/cadence_uart.c
index 486591b..0e53210 100644
--- a/hw/char/cadence_uart.c
+++ b/hw/char/cadence_uart.c
@@ -17,6 +17,10 @@
  */
 
 #include "qemu/osdep.h"
+#include "hw/sysbus.h"
+#include "sysemu/char.h"
+#include "qemu/timer.h"
+#include "qemu/log.h"
 #include "hw/char/cadence_uart.h"
 
 #ifdef CADENCE_UART_ERR_DEBUG
diff --git a/hw/char/digic-uart.c b/hw/char/digic-uart.c
index d3bc533..0e44878 100644
--- a/hw/char/digic-uart.c
+++ b/hw/char/digic-uart.c
@@ -30,6 +30,7 @@
 #include "hw/hw.h"
 #include "hw/sysbus.h"
 #include "sysemu/char.h"
+#include "qemu/log.h"
 
 #include "hw/char/digic-uart.h"
 
diff --git a/hw/char/imx_serial.c b/hw/char/imx_serial.c
index 6df74ac..44856d6 100644
--- a/hw/char/imx_serial.c
+++ b/hw/char/imx_serial.c
@@ -22,6 +22,7 @@
 #include "hw/char/imx_serial.h"
 #include "sysemu/sysemu.h"
 #include "sysemu/char.h"
+#include "qemu/log.h"
 
 #ifndef DEBUG_IMX_UART
 #define DEBUG_IMX_UART 0
diff --git a/hw/char/pl011.c b/hw/char/pl011.c
index 210c87b..6876ea6 100644
--- a/hw/char/pl011.c
+++ b/hw/char/pl011.c
@@ -10,6 +10,7 @@
 #include "qemu/osdep.h"
 #include "hw/sysbus.h"
 #include "sysemu/char.h"
+#include "qemu/log.h"
 
 #define TYPE_PL011 "pl011"
 #define PL011(obj) OBJECT_CHECK(PL011State, (obj), TYPE_PL011)
diff --git a/hw/char/stm32f2xx_usart.c b/hw/char/stm32f2xx_usart.c
index a94d61c..72305ec 100644
--- a/hw/char/stm32f2xx_usart.c
+++ b/hw/char/stm32f2xx_usart.c
@@ -24,6 +24,7 @@
 
 #include "qemu/osdep.h"
 #include "hw/char/stm32f2xx_usart.h"
+#include "qemu/log.h"
 
 #ifndef STM_USART_ERR_DEBUG
 #define STM_USART_ERR_DEBUG 0
diff --git a/hw/display/bcm2835_fb.c b/hw/display/bcm2835_fb.c
index 506f1d3..7eab927 100644
--- a/hw/display/bcm2835_fb.c
+++ b/hw/display/bcm2835_fb.c
@@ -29,6 +29,7 @@
 #include "hw/display/framebuffer.h"
 #include "ui/pixel_ops.h"
 #include "hw/misc/bcm2835_mbox_defs.h"
+#include "qemu/log.h"
 
 #define DEFAULT_VCRAM_SIZE 0x4000000
 #define BCM2835_FB_OFFSET  0x00100000
diff --git a/hw/display/cg3.c b/hw/display/cg3.c
index eb0e71a..1174220 100644
--- a/hw/display/cg3.c
+++ b/hw/display/cg3.c
@@ -31,6 +31,7 @@
 #include "ui/console.h"
 #include "hw/sysbus.h"
 #include "hw/loader.h"
+#include "qemu/log.h"
 
 /* Change to 1 to enable debugging */
 #define DEBUG_CG3 0
diff --git a/hw/display/pl110.c b/hw/display/pl110.c
index d589959..c069c0b 100644
--- a/hw/display/pl110.c
+++ b/hw/display/pl110.c
@@ -12,6 +12,7 @@
 #include "ui/console.h"
 #include "framebuffer.h"
 #include "ui/pixel_ops.h"
+#include "qemu/log.h"
 
 #define PL110_CR_EN   0x001
 #define PL110_CR_BGR  0x100
diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c
index ddf3bfb..50978a6 100644
--- a/hw/display/virtio-gpu.c
+++ b/hw/display/virtio-gpu.c
@@ -19,6 +19,7 @@
 #include "hw/virtio/virtio.h"
 #include "hw/virtio/virtio-gpu.h"
 #include "hw/virtio/virtio-bus.h"
+#include "qemu/log.h"
 
 static struct virtio_gpu_simple_resource*
 virtio_gpu_find_resource(VirtIOGPU *g, uint32_t resource_id);
diff --git a/hw/dma/bcm2835_dma.c b/hw/dma/bcm2835_dma.c
index 5421175..5d144a2 100644
--- a/hw/dma/bcm2835_dma.c
+++ b/hw/dma/bcm2835_dma.c
@@ -6,6 +6,7 @@
 #include "qemu/osdep.h"
 #include "qapi/error.h"
 #include "hw/dma/bcm2835_dma.h"
+#include "qemu/log.h"
 
 /* DMA CS Control and Status bits */
 #define BCM2708_DMA_ACTIVE      (1 << 0)
diff --git a/hw/dma/pl080.c b/hw/dma/pl080.c
index 9318108..3bed5c3 100644
--- a/hw/dma/pl080.c
+++ b/hw/dma/pl080.c
@@ -10,6 +10,7 @@
 #include "qemu/osdep.h"
 #include "hw/sysbus.h"
 #include "exec/address-spaces.h"
+#include "qemu/log.h"
 
 #define PL080_MAX_CHANNELS 8
 #define PL080_CONF_E    0x1
diff --git a/hw/dma/pl330.c b/hw/dma/pl330.c
index ea89ecb..c0bd9fe 100644
--- a/hw/dma/pl330.c
+++ b/hw/dma/pl330.c
@@ -19,6 +19,7 @@
 #include "qapi/error.h"
 #include "qemu/timer.h"
 #include "sysemu/dma.h"
+#include "qemu/log.h"
 
 #ifndef PL330_ERR_DEBUG
 #define PL330_ERR_DEBUG 0
diff --git a/hw/dma/rc4030.c b/hw/dma/rc4030.c
index a06c235..2f2576f 100644
--- a/hw/dma/rc4030.c
+++ b/hw/dma/rc4030.c
@@ -27,6 +27,7 @@
 #include "hw/mips/mips.h"
 #include "hw/sysbus.h"
 #include "qemu/timer.h"
+#include "qemu/log.h"
 #include "exec/address-spaces.h"
 #include "trace.h"
 
diff --git a/hw/gpio/imx_gpio.c b/hw/gpio/imx_gpio.c
index ed7e247..f3574aa 100644
--- a/hw/gpio/imx_gpio.c
+++ b/hw/gpio/imx_gpio.c
@@ -19,6 +19,7 @@
 
 #include "qemu/osdep.h"
 #include "hw/gpio/imx_gpio.h"
+#include "qemu/log.h"
 
 #ifndef DEBUG_IMX_GPIO
 #define DEBUG_IMX_GPIO 0
diff --git a/hw/gpio/pl061.c b/hw/gpio/pl061.c
index 29dc7fc..44faeb2 100644
--- a/hw/gpio/pl061.c
+++ b/hw/gpio/pl061.c
@@ -10,6 +10,7 @@
 
 #include "qemu/osdep.h"
 #include "hw/sysbus.h"
+#include "qemu/log.h"
 
 //#define DEBUG_PL061 1
 
diff --git a/hw/i2c/imx_i2c.c b/hw/i2c/imx_i2c.c
index a01e43e..7830056 100644
--- a/hw/i2c/imx_i2c.c
+++ b/hw/i2c/imx_i2c.c
@@ -21,6 +21,7 @@
 #include "qemu/osdep.h"
 #include "hw/i2c/imx_i2c.h"
 #include "hw/i2c/i2c.h"
+#include "qemu/log.h"
 
 #ifndef DEBUG_IMX_I2C
 #define DEBUG_IMX_I2C 0
diff --git a/hw/i2c/versatile_i2c.c b/hw/i2c/versatile_i2c.c
index fee3bc7..0bce524 100644
--- a/hw/i2c/versatile_i2c.c
+++ b/hw/i2c/versatile_i2c.c
@@ -24,6 +24,7 @@
 #include "qemu/osdep.h"
 #include "hw/sysbus.h"
 #include "bitbang_i2c.h"
+#include "qemu/log.h"
 
 #define TYPE_VERSATILE_I2C "versatile_i2c"
 #define VERSATILE_I2C(obj) \
diff --git a/hw/input/pl050.c b/hw/input/pl050.c
index 3092b0f..be9cd57 100644
--- a/hw/input/pl050.c
+++ b/hw/input/pl050.c
@@ -10,6 +10,7 @@
 #include "qemu/osdep.h"
 #include "hw/sysbus.h"
 #include "hw/input/ps2.h"
+#include "qemu/log.h"
 
 #define TYPE_PL050 "pl050"
 #define PL050(obj) OBJECT_CHECK(PL050State, (obj), TYPE_PL050)
diff --git a/hw/intc/allwinner-a10-pic.c b/hw/intc/allwinner-a10-pic.c
index dc971a1..11f1366 100644
--- a/hw/intc/allwinner-a10-pic.c
+++ b/hw/intc/allwinner-a10-pic.c
@@ -20,6 +20,7 @@
 #include "hw/devices.h"
 #include "sysemu/sysemu.h"
 #include "hw/intc/allwinner-a10-pic.h"
+#include "qemu/log.h"
 
 static void aw_a10_pic_update(AwA10PICState *s)
 {
diff --git a/hw/intc/arm_gic.c b/hw/intc/arm_gic.c
index f551241..62429b1 100644
--- a/hw/intc/arm_gic.c
+++ b/hw/intc/arm_gic.c
@@ -23,6 +23,7 @@
 #include "gic_internal.h"
 #include "qapi/error.h"
 #include "qom/cpu.h"
+#include "qemu/log.h"
 
 //#define DEBUG_GIC
 
diff --git a/hw/intc/arm_gicv2m.c b/hw/intc/arm_gicv2m.c
index 589d315..3922fbc 100644
--- a/hw/intc/arm_gicv2m.c
+++ b/hw/intc/arm_gicv2m.c
@@ -30,6 +30,7 @@
 #include "hw/sysbus.h"
 #include "hw/pci/msi.h"
 #include "sysemu/kvm.h"
+#include "qemu/log.h"
 
 #define TYPE_ARM_GICV2M "arm-gicv2m"
 #define ARM_GICV2M(obj) OBJECT_CHECK(ARMGICv2mState, (obj), TYPE_ARM_GICV2M)
diff --git a/hw/intc/armv7m_nvic.c b/hw/intc/armv7m_nvic.c
index 4d584ef..890d5d7 100644
--- a/hw/intc/armv7m_nvic.c
+++ b/hw/intc/armv7m_nvic.c
@@ -19,6 +19,7 @@
 #include "hw/arm/arm.h"
 #include "exec/address-spaces.h"
 #include "gic_internal.h"
+#include "qemu/log.h"
 
 typedef struct {
     GICState gic;
diff --git a/hw/intc/bcm2835_ic.c b/hw/intc/bcm2835_ic.c
index 80513b2..00d2530 100644
--- a/hw/intc/bcm2835_ic.c
+++ b/hw/intc/bcm2835_ic.c
@@ -14,6 +14,7 @@
 
 #include "qemu/osdep.h"
 #include "hw/intc/bcm2835_ic.h"
+#include "qemu/log.h"
 
 #define GPU_IRQS 64
 #define ARM_IRQS 8
diff --git a/hw/intc/bcm2836_control.c b/hw/intc/bcm2836_control.c
index d027181..cfa5bc7 100644
--- a/hw/intc/bcm2836_control.c
+++ b/hw/intc/bcm2836_control.c
@@ -15,6 +15,7 @@
 
 #include "qemu/osdep.h"
 #include "hw/intc/bcm2836_control.h"
+#include "qemu/log.h"
 
 #define REG_GPU_ROUTE           0x0c
 #define REG_TIMERCONTROL        0x40
diff --git a/hw/intc/i8259.c b/hw/intc/i8259.c
index bb43669..c2607a5 100644
--- a/hw/intc/i8259.c
+++ b/hw/intc/i8259.c
@@ -27,6 +27,7 @@
 #include "hw/isa/isa.h"
 #include "monitor/monitor.h"
 #include "qemu/timer.h"
+#include "qemu/log.h"
 #include "hw/isa/i8259_internal.h"
 
 /* debug PIC */
diff --git a/hw/intc/imx_avic.c b/hw/intc/imx_avic.c
index 7027655..63e5340 100644
--- a/hw/intc/imx_avic.c
+++ b/hw/intc/imx_avic.c
@@ -17,6 +17,7 @@
 
 #include "qemu/osdep.h"
 #include "hw/intc/imx_avic.h"
+#include "qemu/log.h"
 
 #ifndef DEBUG_IMX_AVIC
 #define DEBUG_IMX_AVIC 0
diff --git a/hw/intc/openpic.c b/hw/intc/openpic.c
index 2d37693..4349e45 100644
--- a/hw/intc/openpic.c
+++ b/hw/intc/openpic.c
@@ -44,6 +44,7 @@
 #include "qapi/error.h"
 #include "qemu/bitops.h"
 #include "qapi/qmp/qerror.h"
+#include "qemu/log.h"
 
 //#define DEBUG_OPENPIC
 
diff --git a/hw/intc/pl190.c b/hw/intc/pl190.c
index 5ecbc4a..ed0a98c 100644
--- a/hw/intc/pl190.c
+++ b/hw/intc/pl190.c
@@ -9,6 +9,7 @@
 
 #include "qemu/osdep.h"
 #include "hw/sysbus.h"
+#include "qemu/log.h"
 
 /* The number of virtual priority levels.  16 user vectors plus the
    unvectored IRQ.  Chained interrupts would require an additional level
diff --git a/hw/misc/arm11scu.c b/hw/misc/arm11scu.c
index 5e54b49..7042ce1 100644
--- a/hw/misc/arm11scu.c
+++ b/hw/misc/arm11scu.c
@@ -10,6 +10,7 @@
 
 #include "qemu/osdep.h"
 #include "hw/misc/arm11scu.h"
+#include "qemu/log.h"
 
 static uint64_t mpcore_scu_read(void *opaque, hwaddr offset,
                                 unsigned size)
diff --git a/hw/misc/arm_integrator_debug.c b/hw/misc/arm_integrator_debug.c
index 902605f..8a5f295 100644
--- a/hw/misc/arm_integrator_debug.c
+++ b/hw/misc/arm_integrator_debug.c
@@ -19,6 +19,7 @@
 #include "hw/sysbus.h"
 #include "exec/address-spaces.h"
 #include "hw/misc/arm_integrator_debug.h"
+#include "qemu/log.h"
 
 #define INTEGRATOR_DEBUG(obj) \
     OBJECT_CHECK(IntegratorDebugState, (obj), TYPE_INTEGRATOR_DEBUG)
diff --git a/hw/misc/arm_l2x0.c b/hw/misc/arm_l2x0.c
index 7e179f1..4442227 100644
--- a/hw/misc/arm_l2x0.c
+++ b/hw/misc/arm_l2x0.c
@@ -20,6 +20,7 @@
 
 #include "qemu/osdep.h"
 #include "hw/sysbus.h"
+#include "qemu/log.h"
 
 /* L2C-310 r3p2 */
 #define CACHE_ID 0x410000c8
diff --git a/hw/misc/arm_sysctl.c b/hw/misc/arm_sysctl.c
index 34d90d5..8524008 100644
--- a/hw/misc/arm_sysctl.c
+++ b/hw/misc/arm_sysctl.c
@@ -14,6 +14,7 @@
 #include "hw/sysbus.h"
 #include "hw/arm/primecell.h"
 #include "sysemu/sysemu.h"
+#include "qemu/log.h"
 
 #define LOCK_VALUE 0xa05f
 
diff --git a/hw/misc/bcm2835_mbox.c b/hw/misc/bcm2835_mbox.c
index 263280f..e97cc81 100644
--- a/hw/misc/bcm2835_mbox.c
+++ b/hw/misc/bcm2835_mbox.c
@@ -11,6 +11,7 @@
 #include "qemu/osdep.h"
 #include "qapi/error.h"
 #include "hw/misc/bcm2835_mbox.h"
+#include "qemu/log.h"
 
 #define MAIL0_PEEK   0x90
 #define MAIL0_SENDER 0x94
diff --git a/hw/misc/bcm2835_property.c b/hw/misc/bcm2835_property.c
index 530411f..21a18c8 100644
--- a/hw/misc/bcm2835_property.c
+++ b/hw/misc/bcm2835_property.c
@@ -8,6 +8,7 @@
 #include "hw/misc/bcm2835_property.h"
 #include "hw/misc/bcm2835_mbox_defs.h"
 #include "sysemu/dma.h"
+#include "qemu/log.h"
 
 /* https://github.com/raspberrypi/firmware/wiki/Mailbox-property-interface */
 
diff --git a/hw/misc/imx25_ccm.c b/hw/misc/imx25_ccm.c
index 225604d..5cd8c0a 100644
--- a/hw/misc/imx25_ccm.c
+++ b/hw/misc/imx25_ccm.c
@@ -13,6 +13,7 @@
 
 #include "qemu/osdep.h"
 #include "hw/misc/imx25_ccm.h"
+#include "qemu/log.h"
 
 #ifndef DEBUG_IMX25_CCM
 #define DEBUG_IMX25_CCM 0
diff --git a/hw/misc/imx31_ccm.c b/hw/misc/imx31_ccm.c
index 80c1647..1c03e52 100644
--- a/hw/misc/imx31_ccm.c
+++ b/hw/misc/imx31_ccm.c
@@ -13,6 +13,7 @@
 
 #include "qemu/osdep.h"
 #include "hw/misc/imx31_ccm.h"
+#include "qemu/log.h"
 
 #define CKIH_FREQ 26000000 /* 26MHz crystal input */
 
diff --git a/hw/misc/imx6_ccm.c b/hw/misc/imx6_ccm.c
index 4e1d49d..ec58eef 100644
--- a/hw/misc/imx6_ccm.c
+++ b/hw/misc/imx6_ccm.c
@@ -12,6 +12,7 @@
 
 #include "qemu/osdep.h"
 #include "hw/misc/imx6_ccm.h"
+#include "qemu/log.h"
 
 #ifndef DEBUG_IMX6_CCM
 #define DEBUG_IMX6_CCM 0
diff --git a/hw/misc/imx_ccm.c b/hw/misc/imx_ccm.c
index 986d890..7f239a4 100644
--- a/hw/misc/imx_ccm.c
+++ b/hw/misc/imx_ccm.c
@@ -13,6 +13,7 @@
 
 #include "qemu/osdep.h"
 #include "hw/misc/imx_ccm.h"
+#include "qemu/log.h"
 
 #ifndef DEBUG_IMX_CCM
 #define DEBUG_IMX_CCM 0
diff --git a/hw/misc/macio/cuda.c b/hw/misc/macio/cuda.c
index c7472aa..0648979 100644
--- a/hw/misc/macio/cuda.c
+++ b/hw/misc/macio/cuda.c
@@ -29,6 +29,7 @@
 #include "qemu/timer.h"
 #include "sysemu/sysemu.h"
 #include "qemu/cutils.h"
+#include "qemu/log.h"
 
 /* XXX: implement all timer modes */
 
diff --git a/hw/misc/macio/mac_dbdma.c b/hw/misc/macio/mac_dbdma.c
index 6051f17..5632743 100644
--- a/hw/misc/macio/mac_dbdma.c
+++ b/hw/misc/macio/mac_dbdma.c
@@ -41,6 +41,7 @@
 #include "hw/isa/isa.h"
 #include "hw/ppc/mac_dbdma.h"
 #include "qemu/main-loop.h"
+#include "qemu/log.h"
 
 /* debug DBDMA */
 //#define DEBUG_DBDMA
diff --git a/hw/misc/mips_cmgcr.c b/hw/misc/mips_cmgcr.c
index 37be239..40f3464 100644
--- a/hw/misc/mips_cmgcr.c
+++ b/hw/misc/mips_cmgcr.c
@@ -11,6 +11,7 @@
 
 #include "qemu/osdep.h"
 #include "qapi/error.h"
+#include "qemu/log.h"
 #include "hw/hw.h"
 #include "hw/sysbus.h"
 #include "sysemu/sysemu.h"
diff --git a/hw/misc/mips_cpc.c b/hw/misc/mips_cpc.c
index 05688b7..e6a35dd 100644
--- a/hw/misc/mips_cpc.c
+++ b/hw/misc/mips_cpc.c
@@ -20,6 +20,7 @@
 #include "qemu/osdep.h"
 #include "qapi/error.h"
 #include "cpu.h"
+#include "qemu/log.h"
 #include "hw/sysbus.h"
 
 #include "hw/misc/mips_cpc.h"
diff --git a/hw/misc/mips_itu.c b/hw/misc/mips_itu.c
index c75ce7b..8aa5dee 100644
--- a/hw/misc/mips_itu.c
+++ b/hw/misc/mips_itu.c
@@ -20,6 +20,7 @@
 #include "qemu/osdep.h"
 #include "qapi/error.h"
 #include "cpu.h"
+#include "qemu/log.h"
 #include "hw/hw.h"
 #include "hw/sysbus.h"
 #include "sysemu/sysemu.h"
diff --git a/hw/misc/stm32f2xx_syscfg.c b/hw/misc/stm32f2xx_syscfg.c
index d0d7076..7c45833 100644
--- a/hw/misc/stm32f2xx_syscfg.c
+++ b/hw/misc/stm32f2xx_syscfg.c
@@ -24,6 +24,7 @@
 
 #include "qemu/osdep.h"
 #include "hw/misc/stm32f2xx_syscfg.h"
+#include "qemu/log.h"
 
 #ifndef STM_SYSCFG_ERR_DEBUG
 #define STM_SYSCFG_ERR_DEBUG 0
diff --git a/hw/misc/zynq-xadc.c b/hw/misc/zynq-xadc.c
index 71fbccd..1490610 100644
--- a/hw/misc/zynq-xadc.c
+++ b/hw/misc/zynq-xadc.c
@@ -18,6 +18,7 @@
 #include "hw/misc/zynq-xadc.h"
 #include "qemu/timer.h"
 #include "sysemu/sysemu.h"
+#include "qemu/log.h"
 
 enum {
     CFG                = 0x000 / 4,
diff --git a/hw/misc/zynq_slcr.c b/hw/misc/zynq_slcr.c
index b1b7591..7891219 100644
--- a/hw/misc/zynq_slcr.c
+++ b/hw/misc/zynq_slcr.c
@@ -19,6 +19,7 @@
 #include "qemu/timer.h"
 #include "hw/sysbus.h"
 #include "sysemu/sysemu.h"
+#include "qemu/log.h"
 
 #ifndef ZYNQ_SLCR_ERR_DEBUG
 #define ZYNQ_SLCR_ERR_DEBUG 0
diff --git a/hw/net/allwinner_emac.c b/hw/net/allwinner_emac.c
index 16d4b63..d575023 100644
--- a/hw/net/allwinner_emac.c
+++ b/hw/net/allwinner_emac.c
@@ -21,6 +21,7 @@
 #include "net/net.h"
 #include "qemu/fifo8.h"
 #include "hw/net/allwinner_emac.h"
+#include "qemu/log.h"
 #include <zlib.h>
 
 static uint8_t padding[60];
diff --git a/hw/net/fsl_etsec/etsec.c b/hw/net/fsl_etsec/etsec.c
index 1e35f7f..98250e0 100644
--- a/hw/net/fsl_etsec/etsec.c
+++ b/hw/net/fsl_etsec/etsec.c
@@ -33,6 +33,7 @@
 #include "hw/ptimer.h"
 #include "etsec.h"
 #include "registers.h"
+#include "qemu/log.h"
 
 /* #define HEX_DUMP */
 /* #define DEBUG_REGISTER */
diff --git a/hw/net/fsl_etsec/rings.c b/hw/net/fsl_etsec/rings.c
index ed1de7d..79d2f14 100644
--- a/hw/net/fsl_etsec/rings.c
+++ b/hw/net/fsl_etsec/rings.c
@@ -23,7 +23,7 @@
  */
 #include "qemu/osdep.h"
 #include "net/checksum.h"
-
+#include "qemu/log.h"
 #include "etsec.h"
 #include "registers.h"
 
diff --git a/hw/net/imx_fec.c b/hw/net/imx_fec.c
index e60e338..9055ea8 100644
--- a/hw/net/imx_fec.c
+++ b/hw/net/imx_fec.c
@@ -24,6 +24,7 @@
 #include "qemu/osdep.h"
 #include "hw/net/imx_fec.h"
 #include "sysemu/dma.h"
+#include "qemu/log.h"
 
 /* For crc32 */
 #include <zlib.h>
diff --git a/hw/net/lan9118.c b/hw/net/lan9118.c
index 08dc474..2052073 100644
--- a/hw/net/lan9118.c
+++ b/hw/net/lan9118.c
@@ -16,6 +16,7 @@
 #include "hw/devices.h"
 #include "sysemu/sysemu.h"
 #include "hw/ptimer.h"
+#include "qemu/log.h"
 /* For crc32 */
 #include <zlib.h>
 
diff --git a/hw/net/spapr_llan.c b/hw/net/spapr_llan.c
index db97da3..a8266f8 100644
--- a/hw/net/spapr_llan.c
+++ b/hw/net/spapr_llan.c
@@ -28,6 +28,7 @@
 #include "qemu-common.h"
 #include "cpu.h"
 #include "hw/hw.h"
+#include "qemu/log.h"
 #include "net/net.h"
 #include "hw/qdev.h"
 #include "hw/ppc/spapr.h"
diff --git a/hw/pci-host/apb.c b/hw/pci-host/apb.c
index aaef7bb..babbbef 100644
--- a/hw/pci-host/apb.c
+++ b/hw/pci-host/apb.c
@@ -36,6 +36,7 @@
 #include "hw/pci-host/apb.h"
 #include "sysemu/sysemu.h"
 #include "exec/address-spaces.h"
+#include "qemu/log.h"
 
 /* debug APB */
 //#define DEBUG_APB
diff --git a/hw/pci-host/versatile.c b/hw/pci-host/versatile.c
index 339ec2c..0792c45 100644
--- a/hw/pci-host/versatile.c
+++ b/hw/pci-host/versatile.c
@@ -13,6 +13,7 @@
 #include "hw/pci/pci_bus.h"
 #include "hw/pci/pci_host.h"
 #include "exec/address-spaces.h"
+#include "qemu/log.h"
 
 /* Old and buggy versions of QEMU used the wrong mapping from
  * PCI IRQs to system interrupt lines. Unfortunately the Linux
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index e7be21e..32404cf 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -29,6 +29,7 @@
 #include "sysemu/sysemu.h"
 #include "sysemu/numa.h"
 #include "hw/hw.h"
+#include "qemu/log.h"
 #include "hw/fw-path-provider.h"
 #include "elf.h"
 #include "net/net.h"
diff --git a/hw/ppc/spapr_hcall.c b/hw/ppc/spapr_hcall.c
index 4426a50..c5fecb5 100644
--- a/hw/ppc/spapr_hcall.c
+++ b/hw/ppc/spapr_hcall.c
@@ -1,6 +1,7 @@
 #include "qemu/osdep.h"
 #include "qapi/error.h"
 #include "sysemu/sysemu.h"
+#include "qemu/log.h"
 #include "cpu.h"
 #include "helper_regs.h"
 #include "hw/ppc/spapr.h"
diff --git a/hw/ppc/spapr_iommu.c b/hw/ppc/spapr_iommu.c
index 7dd4588..722db91 100644
--- a/hw/ppc/spapr_iommu.c
+++ b/hw/ppc/spapr_iommu.c
@@ -18,6 +18,7 @@
  */
 #include "qemu/osdep.h"
 #include "hw/hw.h"
+#include "qemu/log.h"
 #include "sysemu/kvm.h"
 #include "hw/qdev.h"
 #include "kvm_ppc.h"
diff --git a/hw/ppc/spapr_rtas.c b/hw/ppc/spapr_rtas.c
index 5352767..9c9fe55 100644
--- a/hw/ppc/spapr_rtas.c
+++ b/hw/ppc/spapr_rtas.c
@@ -26,6 +26,7 @@
  */
 #include "qemu/osdep.h"
 #include "cpu.h"
+#include "qemu/log.h"
 #include "sysemu/sysemu.h"
 #include "sysemu/char.h"
 #include "hw/qdev.h"
diff --git a/hw/ppc/spapr_vio.c b/hw/ppc/spapr_vio.c
index 6b20b40..d084aed 100644
--- a/hw/ppc/spapr_vio.c
+++ b/hw/ppc/spapr_vio.c
@@ -22,6 +22,7 @@
 #include "qemu/osdep.h"
 #include "qapi/error.h"
 #include "hw/hw.h"
+#include "qemu/log.h"
 #include "sysemu/sysemu.h"
 #include "hw/boards.h"
 #include "hw/loader.h"
diff --git a/hw/sd/pl181.c b/hw/sd/pl181.c
index e87abb2..eb783c6 100644
--- a/hw/sd/pl181.c
+++ b/hw/sd/pl181.c
@@ -12,6 +12,7 @@
 #include "sysemu/blockdev.h"
 #include "hw/sysbus.h"
 #include "hw/sd/sd.h"
+#include "qemu/log.h"
 
 //#define DEBUG_PL181 1
 
diff --git a/hw/sd/sd.c b/hw/sd/sd.c
index b66e5d2..3372870 100644
--- a/hw/sd/sd.c
+++ b/hw/sd/sd.c
@@ -39,6 +39,7 @@
 #include "hw/qdev-properties.h"
 #include "qemu/error-report.h"
 #include "qemu/timer.h"
+#include "qemu/log.h"
 
 //#define DEBUG_SD 1
 
diff --git a/hw/sd/sdhci.c b/hw/sd/sdhci.c
index d28b587..01fbf22 100644
--- a/hw/sd/sdhci.c
+++ b/hw/sd/sdhci.c
@@ -30,6 +30,7 @@
 #include "qemu/timer.h"
 #include "qemu/bitops.h"
 #include "sdhci-internal.h"
+#include "qemu/log.h"
 
 /* host controller debug messages */
 #ifndef SDHC_DEBUG
diff --git a/hw/ssi/pl022.c b/hw/ssi/pl022.c
index 564a0d3..c136801 100644
--- a/hw/ssi/pl022.c
+++ b/hw/ssi/pl022.c
@@ -10,6 +10,7 @@
 #include "qemu/osdep.h"
 #include "hw/sysbus.h"
 #include "hw/ssi/ssi.h"
+#include "qemu/log.h"
 
 //#define DEBUG_PL022 1
 
diff --git a/hw/timer/allwinner-a10-pit.c b/hw/timer/allwinner-a10-pit.c
index 51cdc98..3385e5d 100644
--- a/hw/timer/allwinner-a10-pit.c
+++ b/hw/timer/allwinner-a10-pit.c
@@ -19,6 +19,7 @@
 #include "hw/sysbus.h"
 #include "sysemu/sysemu.h"
 #include "hw/timer/allwinner-a10-pit.h"
+#include "qemu/log.h"
 
 static void a10_pit_update_irq(AwA10PITState *s)
 {
diff --git a/hw/timer/arm_timer.c b/hw/timer/arm_timer.c
index f1ede5f..111a16d 100644
--- a/hw/timer/arm_timer.c
+++ b/hw/timer/arm_timer.c
@@ -14,6 +14,7 @@
 #include "hw/qdev.h"
 #include "hw/ptimer.h"
 #include "qemu/main-loop.h"
+#include "qemu/log.h"
 
 /* Common timer implementation.  */
 
diff --git a/hw/timer/digic-timer.c b/hw/timer/digic-timer.c
index 5b97e1e..0f21faf 100644
--- a/hw/timer/digic-timer.c
+++ b/hw/timer/digic-timer.c
@@ -30,6 +30,7 @@
 #include "hw/sysbus.h"
 #include "hw/ptimer.h"
 #include "qemu/main-loop.h"
+#include "qemu/log.h"
 
 #include "hw/timer/digic-timer.h"
 
diff --git a/hw/timer/imx_epit.c b/hw/timer/imx_epit.c
index f5836e2..eddf348 100644
--- a/hw/timer/imx_epit.c
+++ b/hw/timer/imx_epit.c
@@ -16,6 +16,7 @@
 #include "hw/timer/imx_epit.h"
 #include "hw/misc/imx_ccm.h"
 #include "qemu/main-loop.h"
+#include "qemu/log.h"
 
 #ifndef DEBUG_IMX_EPIT
 #define DEBUG_IMX_EPIT 0
diff --git a/hw/timer/imx_gpt.c b/hw/timer/imx_gpt.c
index ab2e213..3c2f01a 100644
--- a/hw/timer/imx_gpt.c
+++ b/hw/timer/imx_gpt.c
@@ -16,6 +16,7 @@
 #include "hw/timer/imx_gpt.h"
 #include "hw/misc/imx_ccm.h"
 #include "qemu/main-loop.h"
+#include "qemu/log.h"
 
 #ifndef DEBUG_IMX_GPT
 #define DEBUG_IMX_GPT 0
diff --git a/hw/timer/pl031.c b/hw/timer/pl031.c
index 38e0cb5..dbbeb9b 100644
--- a/hw/timer/pl031.c
+++ b/hw/timer/pl031.c
@@ -16,6 +16,7 @@
 #include "qemu/timer.h"
 #include "sysemu/sysemu.h"
 #include "qemu/cutils.h"
+#include "qemu/log.h"
 
 //#define DEBUG_PL031
 
diff --git a/hw/timer/stm32f2xx_timer.c b/hw/timer/stm32f2xx_timer.c
index 55dacbb..bf0fb28 100644
--- a/hw/timer/stm32f2xx_timer.c
+++ b/hw/timer/stm32f2xx_timer.c
@@ -24,6 +24,7 @@
 
 #include "qemu/osdep.h"
 #include "hw/timer/stm32f2xx_timer.h"
+#include "qemu/log.h"
 
 #ifndef STM_TIMER_ERR_DEBUG
 #define STM_TIMER_ERR_DEBUG 0
diff --git a/hw/watchdog/wdt_diag288.c b/hw/watchdog/wdt_diag288.c
index f54a35a..a7b64e2 100644
--- a/hw/watchdog/wdt_diag288.c
+++ b/hw/watchdog/wdt_diag288.c
@@ -16,6 +16,7 @@
 #include "hw/sysbus.h"
 #include "qemu/timer.h"
 #include "hw/watchdog/wdt_diag288.h"
+#include "qemu/log.h"
 
 static WatchdogTimerModel model = {
     .wdt_name = TYPE_WDT_DIAG288,
diff --git a/include/hw/hw.h b/include/hw/hw.h
index a20321b..029b1e8 100644
--- a/include/hw/hw.h
+++ b/include/hw/hw.h
@@ -11,7 +11,6 @@
 #include "hw/irq.h"
 #include "block/aio.h"
 #include "migration/vmstate.h"
-#include "qemu/log.h"
 #include "qemu/module.h"
 
 typedef void QEMUResetHandler(void *opaque);
diff --git a/monitor.c b/monitor.c
index 812383f..a2c1ad2 100644
--- a/monitor.c
+++ b/monitor.c
@@ -71,6 +71,7 @@
 #include "trace/simple.h"
 #endif
 #include "exec/memory.h"
+#include "qemu/log.h"
 #include "qmp-commands.h"
 #include "hmp.h"
 #include "qemu/thread.h"
diff --git a/vl.c b/vl.c
index b83d275..f366115 100644
--- a/vl.c
+++ b/vl.c
@@ -80,6 +80,7 @@ int main(int argc, char **argv)
 #include "qemu/timer.h"
 #include "sysemu/char.h"
 #include "qemu/bitmap.h"
+#include "qemu/log.h"
 #include "sysemu/blockdev.h"
 #include "hw/block/block.h"
 #include "migration/block.h"
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 72+ messages in thread

* [Qemu-devel] [PATCH 47/50] exec: extract exec/tb-context.h
  2016-04-08 20:28 [Qemu-devel] [PATCH for-2.7 00/49] NEED_CPU_H / cpu.h / hw/hw.h cleanups Paolo Bonzini
                   ` (45 preceding siblings ...)
  2016-04-08 20:29 ` [Qemu-devel] [PATCH 46/50] hw: explicitly include qemu/log.h Paolo Bonzini
@ 2016-04-08 20:29 ` Paolo Bonzini
  2016-04-08 20:29 ` [Qemu-devel] [PATCH 48/50] cpu: move exec-all.h inclusion out of cpu.h Paolo Bonzini
                   ` (4 subsequent siblings)
  51 siblings, 0 replies; 72+ messages in thread
From: Paolo Bonzini @ 2016-04-08 20:29 UTC (permalink / raw)
  To: qemu-devel

TCG backends do not need most of exec-all.h; extract what they actually
need to a separate file or move it directly to tcg.h.  The next patch
will stop including exec-all.h from everywhere.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 include/exec/exec-all.h   | 47 +----------------------------------------------
 include/exec/tb-context.h | 46 ++++++++++++++++++++++++++++++++++++++++++++++
 tcg/optimize.c            |  2 +-
 tcg/tcg-common.c          |  2 ++
 tcg/tcg.h                 | 22 ++++++++++++++++++++++
 5 files changed, 72 insertions(+), 47 deletions(-)
 create mode 100644 include/exec/tb-context.h

diff --git a/include/exec/exec-all.h b/include/exec/exec-all.h
index 7362095..bcc678a 100644
--- a/include/exec/exec-all.h
+++ b/include/exec/exec-all.h
@@ -21,6 +21,7 @@
 #define _EXEC_ALL_H_
 
 #include "qemu-common.h"
+#include "exec/tb-context.h"
 
 /* allow to see translation results - the slowdown should be negligible, so we leave it */
 #define DEBUG_DISAS
@@ -40,30 +41,6 @@ typedef ram_addr_t tb_page_addr_t;
 #define DISAS_UPDATE  2 /* cpu state was modified dynamically */
 #define DISAS_TB_JUMP 3 /* only pc was modified statically */
 
-struct TranslationBlock;
-typedef struct TranslationBlock TranslationBlock;
-
-/* XXX: make safe guess about sizes */
-#define MAX_OP_PER_INSTR 266
-
-#if HOST_LONG_BITS == 32
-#define MAX_OPC_PARAM_PER_ARG 2
-#else
-#define MAX_OPC_PARAM_PER_ARG 1
-#endif
-#define MAX_OPC_PARAM_IARGS 5
-#define MAX_OPC_PARAM_OARGS 1
-#define MAX_OPC_PARAM_ARGS (MAX_OPC_PARAM_IARGS + MAX_OPC_PARAM_OARGS)
-
-/* A Call op needs up to 4 + 2N parameters on 32-bit archs,
- * and up to 4 + N parameters on 64-bit archs
- * (N = number of input arguments + output arguments).  */
-#define MAX_OPC_PARAM (4 + (MAX_OPC_PARAM_PER_ARG * MAX_OPC_PARAM_ARGS))
-#define OPC_BUF_SIZE 640
-#define OPC_MAX_SIZE (OPC_BUF_SIZE - MAX_OP_PER_INSTR)
-
-#define OPPARAM_BUF_SIZE (OPC_BUF_SIZE * MAX_OPC_PARAM)
-
 #include "qemu/log.h"
 
 void gen_intermediate_code(CPUArchState *env, struct TranslationBlock *tb);
@@ -211,9 +188,6 @@ static inline void tlb_flush_by_mmuidx(CPUState *cpu, ...)
 
 #define CODE_GEN_ALIGN           16 /* must be >= of the size of a icache line */
 
-#define CODE_GEN_PHYS_HASH_BITS     15
-#define CODE_GEN_PHYS_HASH_SIZE     (1 << CODE_GEN_PHYS_HASH_BITS)
-
 /* Estimated block size for TB allocation.  */
 /* ??? The following is based on a 2015 survey of x86_64 host output.
    Better would seem to be some sort of dynamically sized TB array,
@@ -273,25 +247,6 @@ struct TranslationBlock {
     struct TranslationBlock *jmp_first;
 };
 
-#include "qemu/thread.h"
-
-typedef struct TBContext TBContext;
-
-struct TBContext {
-
-    TranslationBlock *tbs;
-    TranslationBlock *tb_phys_hash[CODE_GEN_PHYS_HASH_SIZE];
-    int nb_tbs;
-    /* any access to the tbs or the page table must use this lock */
-    QemuMutex tb_lock;
-
-    /* statistics */
-    int tb_flush_count;
-    int tb_phys_invalidate_count;
-
-    int tb_invalidated_flag;
-};
-
 void tb_free(TranslationBlock *tb);
 void tb_flush(CPUState *cpu);
 void tb_phys_invalidate(TranslationBlock *tb, tb_page_addr_t page_addr);
diff --git a/include/exec/tb-context.h b/include/exec/tb-context.h
new file mode 100644
index 0000000..c06204a
--- /dev/null
+++ b/include/exec/tb-context.h
@@ -0,0 +1,46 @@
+/*
+ * Internal structs that QEMU exports to TCG
+ *
+ *  Copyright (c) 2003 Fabrice Bellard
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * 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/>.
+ */
+
+#ifndef QEMU_TB_CONTEXT_H_
+#define QEMU_TB_CONTEXT_H_
+
+#include "qemu/thread.h"
+
+#define CODE_GEN_PHYS_HASH_BITS     15
+#define CODE_GEN_PHYS_HASH_SIZE     (1 << CODE_GEN_PHYS_HASH_BITS)
+
+typedef struct TranslationBlock TranslationBlock;
+typedef struct TBContext TBContext;
+
+struct TBContext {
+
+    TranslationBlock *tbs;
+    TranslationBlock *tb_phys_hash[CODE_GEN_PHYS_HASH_SIZE];
+    int nb_tbs;
+    /* any access to the tbs or the page table must use this lock */
+    QemuMutex tb_lock;
+
+    /* statistics */
+    int tb_flush_count;
+    int tb_phys_invalidate_count;
+
+    int tb_invalidated_flag;
+};
+
+#endif
diff --git a/tcg/optimize.c b/tcg/optimize.c
index 701f552..1d867f4 100644
--- a/tcg/optimize.c
+++ b/tcg/optimize.c
@@ -25,7 +25,7 @@
 
 #include "qemu/osdep.h"
 #include "qemu-common.h"
-#include "cpu.h"
+#include "exec/cpu-common.h"
 #include "tcg-op.h"
 
 #define CASE_OP_32_64(x)                        \
diff --git a/tcg/tcg-common.c b/tcg/tcg-common.c
index 97305a3..2f139de 100644
--- a/tcg/tcg-common.c
+++ b/tcg/tcg-common.c
@@ -23,6 +23,8 @@
  */
 
 #include "qemu/osdep.h"
+#include "qemu-common.h"
+#include "exec/cpu-common.h"
 #include "tcg/tcg.h"
 
 #if defined(CONFIG_TCG_INTERPRETER)
diff --git a/tcg/tcg.h b/tcg/tcg.h
index 50d6a0f..13e7f01 100644
--- a/tcg/tcg.h
+++ b/tcg/tcg.h
@@ -27,9 +27,31 @@
 
 #include "qemu-common.h"
 #include "cpu.h"
+#include "exec/tb-context.h"
 #include "qemu/bitops.h"
 #include "tcg-target.h"
 
+/* XXX: make safe guess about sizes */
+#define MAX_OP_PER_INSTR 266
+
+#if HOST_LONG_BITS == 32
+#define MAX_OPC_PARAM_PER_ARG 2
+#else
+#define MAX_OPC_PARAM_PER_ARG 1
+#endif
+#define MAX_OPC_PARAM_IARGS 5
+#define MAX_OPC_PARAM_OARGS 1
+#define MAX_OPC_PARAM_ARGS (MAX_OPC_PARAM_IARGS + MAX_OPC_PARAM_OARGS)
+
+/* A Call op needs up to 4 + 2N parameters on 32-bit archs,
+ * and up to 4 + N parameters on 64-bit archs
+ * (N = number of input arguments + output arguments).  */
+#define MAX_OPC_PARAM (4 + (MAX_OPC_PARAM_PER_ARG * MAX_OPC_PARAM_ARGS))
+#define OPC_BUF_SIZE 640
+#define OPC_MAX_SIZE (OPC_BUF_SIZE - MAX_OP_PER_INSTR)
+
+#define OPPARAM_BUF_SIZE (OPC_BUF_SIZE * MAX_OPC_PARAM)
+
 #define CPU_TEMP_BUF_NLONGS 128
 
 /* Default target word size to pointer size.  */
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 72+ messages in thread

* [Qemu-devel] [PATCH 48/50] cpu: move exec-all.h inclusion out of cpu.h
  2016-04-08 20:28 [Qemu-devel] [PATCH for-2.7 00/49] NEED_CPU_H / cpu.h / hw/hw.h cleanups Paolo Bonzini
                   ` (46 preceding siblings ...)
  2016-04-08 20:29 ` [Qemu-devel] [PATCH 47/50] exec: extract exec/tb-context.h Paolo Bonzini
@ 2016-04-08 20:29 ` Paolo Bonzini
  2016-04-08 20:29 ` [Qemu-devel] [PATCH 49/50] hw: remove pio_addr_t Paolo Bonzini
                   ` (3 subsequent siblings)
  51 siblings, 0 replies; 72+ messages in thread
From: Paolo Bonzini @ 2016-04-08 20:29 UTC (permalink / raw)
  To: qemu-devel

exec-all.h contains TCG-specific definitions.  It is not needed outside
TCG-specific files such as translate.c, exec.c or *helper.c.

One generic function had snuck into include/exec/exec-all.h; move it to
include/qom/cpu.h.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 bsd-user/main.c                    |  1 +
 bsd-user/qemu.h                    |  1 +
 cpu-exec-common.c                  |  1 +
 cpu-exec.c                         |  1 +
 cpus.c                             |  1 +
 cputlb.c                           |  1 +
 disas/tci.c                        |  1 +
 exec.c                             |  1 +
 gdbstub.c                          |  1 +
 hw/i386/kvmvapic.c                 |  1 +
 hw/misc/mips_itu.c                 |  1 +
 hw/ppc/spapr_hcall.c               |  1 +
 hw/sh4/sh7750.c                    |  1 +
 include/exec/exec-all.h            |  9 ---------
 include/qom/cpu.h                  | 10 ++++++++++
 linux-user/main.c                  |  1 +
 linux-user/qemu.h                  |  1 +
 monitor.c                          |  1 +
 target-alpha/cpu.c                 |  1 +
 target-alpha/cpu.h                 |  2 --
 target-alpha/fpu_helper.c          |  1 +
 target-alpha/helper.c              |  1 +
 target-alpha/int_helper.c          |  1 +
 target-alpha/mem_helper.c          |  1 +
 target-alpha/sys_helper.c          |  1 +
 target-alpha/translate.c           |  1 +
 target-alpha/vax_helper.c          |  1 +
 target-arm/arm_ldst.h              |  1 +
 target-arm/cpu.c                   |  1 +
 target-arm/cpu.h                   |  2 --
 target-arm/helper-a64.c            |  1 +
 target-arm/helper.c                |  1 +
 target-arm/op_helper.c             |  1 +
 target-arm/psci.c                  |  1 +
 target-arm/translate-a64.c         |  1 +
 target-arm/translate.c             |  1 +
 target-cris/cpu.c                  |  1 +
 target-cris/cpu.h                  |  2 --
 target-cris/helper.c               |  1 +
 target-cris/mmu.c                  |  1 +
 target-cris/op_helper.c            |  1 +
 target-cris/translate.c            |  1 +
 target-i386/bpt_helper.c           |  1 +
 target-i386/cpu.c                  |  1 +
 target-i386/cpu.h                  |  2 --
 target-i386/excp_helper.c          |  1 +
 target-i386/fpu_helper.c           |  1 +
 target-i386/helper.c               |  1 +
 target-i386/int_helper.c           |  1 +
 target-i386/machine.c              |  3 +++
 target-i386/mem_helper.c           |  1 +
 target-i386/misc_helper.c          |  1 +
 target-i386/mpx_helper.c           |  1 +
 target-i386/seg_helper.c           |  1 +
 target-i386/svm_helper.c           |  1 +
 target-i386/translate.c            |  1 +
 target-lm32/cpu.c                  |  1 +
 target-lm32/cpu.h                  |  2 --
 target-lm32/helper.c               |  1 +
 target-lm32/op_helper.c            |  1 +
 target-lm32/translate.c            |  1 +
 target-m68k/cpu.c                  |  1 +
 target-m68k/cpu.h                  |  2 --
 target-m68k/helper.c               |  1 +
 target-m68k/m68k-semi.c            |  1 +
 target-m68k/op_helper.c            |  1 +
 target-m68k/translate.c            |  1 +
 target-microblaze/cpu.c            |  1 +
 target-microblaze/cpu.h            |  2 --
 target-microblaze/helper.c         |  1 +
 target-microblaze/mmu.c            |  1 +
 target-microblaze/op_helper.c      |  1 +
 target-microblaze/translate.c      |  1 +
 target-mips/cpu.c                  |  1 +
 target-mips/cpu.h                  |  2 --
 target-mips/helper.c               |  1 +
 target-mips/mips-semi.c            |  1 +
 target-mips/msa_helper.c           |  1 +
 target-mips/op_helper.c            |  1 +
 target-mips/translate.c            |  1 +
 target-moxie/cpu.c                 |  1 +
 target-moxie/cpu.h                 |  1 -
 target-openrisc/cpu.c              |  1 +
 target-openrisc/cpu.h              |  2 --
 target-openrisc/exception.c        |  1 +
 target-openrisc/interrupt.c        |  1 +
 target-openrisc/interrupt_helper.c |  1 +
 target-openrisc/mmu.c              |  1 +
 target-openrisc/mmu_helper.c       |  1 +
 target-openrisc/sys_helper.c       |  1 +
 target-ppc/cpu.h                   |  2 --
 target-ppc/excp_helper.c           |  1 +
 target-ppc/int_helper.c            |  1 +
 target-ppc/machine.c               |  2 ++
 target-ppc/mem_helper.c            |  2 ++
 target-ppc/misc_helper.c           |  1 +
 target-ppc/mmu-hash32.c            |  1 +
 target-ppc/mmu-hash64.c            |  1 +
 target-ppc/mmu_helper.c            |  1 +
 target-ppc/timebase_helper.c       |  1 +
 target-ppc/translate.c             |  1 +
 target-s390x/cc_helper.c           |  1 +
 target-s390x/cpu.c                 |  1 +
 target-s390x/cpu.h                 |  2 --
 target-s390x/fpu_helper.c          |  1 +
 target-s390x/gdbstub.c             |  1 +
 target-s390x/helper.c              |  1 +
 target-s390x/int_helper.c          |  1 +
 target-s390x/mem_helper.c          |  1 +
 target-s390x/misc_helper.c         |  1 +
 target-s390x/translate.c           |  1 +
 target-sh4/cpu.c                   |  1 +
 target-sh4/cpu.h                   |  2 --
 target-sh4/helper.c                |  1 +
 target-sh4/op_helper.c             |  1 +
 target-sh4/translate.c             |  1 +
 target-sparc/cpu.c                 |  1 +
 target-sparc/cpu.h                 |  2 --
 target-sparc/helper.c              |  1 +
 target-sparc/ldst_helper.c         |  1 +
 target-sparc/machine.c             |  3 +++
 target-sparc/mmu_helper.c          |  1 +
 target-sparc/translate.c           |  1 +
 target-tilegx/cpu.c                |  1 +
 target-tilegx/cpu.h                |  2 --
 target-tilegx/helper.c             |  1 +
 target-tilegx/translate.c          |  1 +
 target-tricore/cpu.c               |  1 +
 target-tricore/cpu.h               |  2 --
 target-tricore/helper.c            |  1 +
 target-tricore/op_helper.c         |  1 +
 target-tricore/translate.c         |  1 +
 target-unicore32/cpu.c             |  1 +
 target-unicore32/cpu.h             |  1 -
 target-unicore32/helper.c          |  1 +
 target-unicore32/op_helper.c       |  1 +
 target-unicore32/softmmu.c         |  1 +
 target-unicore32/translate.c       |  1 +
 target-xtensa/cpu.c                |  1 +
 target-xtensa/cpu.h                |  1 -
 target-xtensa/gdbstub.c            |  1 +
 target-xtensa/op_helper.c          |  1 +
 target-xtensa/translate.c          |  1 +
 tcg/tcg-op.c                       |  1 +
 tcg/tcg.c                          |  5 +++++
 translate-all.c                    |  1 +
 user-exec.c                        |  1 +
 147 files changed, 147 insertions(+), 42 deletions(-)

diff --git a/bsd-user/main.c b/bsd-user/main.c
index 058eaca..8e338c7 100644
--- a/bsd-user/main.c
+++ b/bsd-user/main.c
@@ -25,6 +25,7 @@
 #include "qemu/help_option.h"
 /* For tb_lock */
 #include "cpu.h"
+#include "exec/exec-all.h"
 #include "tcg.h"
 #include "qemu/timer.h"
 #include "qemu/envlist.h"
diff --git a/bsd-user/qemu.h b/bsd-user/qemu.h
index 03b502a..53163b8 100644
--- a/bsd-user/qemu.h
+++ b/bsd-user/qemu.h
@@ -19,6 +19,7 @@
 
 
 #include "cpu.h"
+#include "exec/exec-all.h"
 #include "exec/cpu_ldst.h"
 
 #undef DEBUG_REMAP
diff --git a/cpu-exec-common.c b/cpu-exec-common.c
index 1b1731c..df60eb7 100644
--- a/cpu-exec-common.c
+++ b/cpu-exec-common.c
@@ -20,6 +20,7 @@
 #include "qemu/osdep.h"
 #include "cpu.h"
 #include "sysemu/cpus.h"
+#include "exec/exec-all.h"
 #include "exec/memory-internal.h"
 
 bool exit_request;
diff --git a/cpu-exec.c b/cpu-exec.c
index bbfcbfb..ce55fa4 100644
--- a/cpu-exec.c
+++ b/cpu-exec.c
@@ -20,6 +20,7 @@
 #include "cpu.h"
 #include "trace.h"
 #include "disas/disas.h"
+#include "exec/exec-all.h"
 #include "tcg.h"
 #include "qemu/atomic.h"
 #include "sysemu/qtest.h"
diff --git a/cpus.c b/cpus.c
index 7b6ebeb..eb34b4f 100644
--- a/cpus.c
+++ b/cpus.c
@@ -35,6 +35,7 @@
 #include "sysemu/dma.h"
 #include "sysemu/kvm.h"
 #include "qmp-commands.h"
+#include "exec/exec-all.h"
 
 #include "qemu/thread.h"
 #include "sysemu/cpus.h"
diff --git a/cputlb.c b/cputlb.c
index 466663b..a668dbb 100644
--- a/cputlb.c
+++ b/cputlb.c
@@ -28,6 +28,7 @@
 
 #include "exec/memory-internal.h"
 #include "exec/ram_addr.h"
+#include "exec/exec-all.h"
 #include "tcg/tcg.h"
 
 /* DEBUG defines, enable DEBUG_TLB_LOG to log to the CPU_LOG_MMU target */
diff --git a/disas/tci.c b/disas/tci.c
index 1cdf5ee..7233343 100644
--- a/disas/tci.c
+++ b/disas/tci.c
@@ -20,6 +20,7 @@
 #include "qemu/osdep.h"
 #include "qemu-common.h"
 #include "disas/bfd.h"
+#include "exec/exec-all.h"
 #include "tcg/tcg.h"
 
 /* Disassemble TCI bytecode. */
diff --git a/exec.c b/exec.c
index dee542b..29877b0 100644
--- a/exec.c
+++ b/exec.c
@@ -24,6 +24,7 @@
 
 #include "qemu/cutils.h"
 #include "cpu.h"
+#include "exec/exec-all.h"
 #include "tcg.h"
 #include "hw/qdev-core.h"
 #if !defined(CONFIG_USER_ONLY)
diff --git a/gdbstub.c b/gdbstub.c
index c19ce39..b9e3710 100644
--- a/gdbstub.c
+++ b/gdbstub.c
@@ -35,6 +35,7 @@
 #include "qemu/sockets.h"
 #include "sysemu/kvm.h"
 #include "exec/semihost.h"
+#include "exec/exec-all.h"
 
 #ifdef CONFIG_USER_ONLY
 #define GDB_ATTACHED "0"
diff --git a/hw/i386/kvmvapic.c b/hw/i386/kvmvapic.c
index 315857e..220cec8 100644
--- a/hw/i386/kvmvapic.c
+++ b/hw/i386/kvmvapic.c
@@ -11,6 +11,7 @@
 #include "qemu/osdep.h"
 #include "qemu-common.h"
 #include "cpu.h"
+#include "exec/exec-all.h"
 #include "sysemu/sysemu.h"
 #include "sysemu/cpus.h"
 #include "sysemu/kvm.h"
diff --git a/hw/misc/mips_itu.c b/hw/misc/mips_itu.c
index 8aa5dee..3cb1e82 100644
--- a/hw/misc/mips_itu.c
+++ b/hw/misc/mips_itu.c
@@ -21,6 +21,7 @@
 #include "qapi/error.h"
 #include "cpu.h"
 #include "qemu/log.h"
+#include "exec/exec-all.h"
 #include "hw/hw.h"
 #include "hw/sysbus.h"
 #include "sysemu/sysemu.h"
diff --git a/hw/ppc/spapr_hcall.c b/hw/ppc/spapr_hcall.c
index c5fecb5..feb3629 100644
--- a/hw/ppc/spapr_hcall.c
+++ b/hw/ppc/spapr_hcall.c
@@ -3,6 +3,7 @@
 #include "sysemu/sysemu.h"
 #include "qemu/log.h"
 #include "cpu.h"
+#include "exec/exec-all.h"
 #include "helper_regs.h"
 #include "hw/ppc/spapr.h"
 #include "mmu-hash64.h"
diff --git a/hw/sh4/sh7750.c b/hw/sh4/sh7750.c
index a1ea760..3132d55 100644
--- a/hw/sh4/sh7750.c
+++ b/hw/sh4/sh7750.c
@@ -30,6 +30,7 @@
 #include "sh7750_regnames.h"
 #include "hw/sh4/sh_intc.h"
 #include "cpu.h"
+#include "exec/exec-all.h"
 #include "exec/address-spaces.h"
 
 #define NB_DEVICES 4
diff --git a/include/exec/exec-all.h b/include/exec/exec-all.h
index bcc678a..1282934 100644
--- a/include/exec/exec-all.h
+++ b/include/exec/exec-all.h
@@ -80,15 +80,6 @@ void cpu_reloading_memory_map(void);
  * Note that with KVM only one address space is supported.
  */
 void cpu_address_space_init(CPUState *cpu, AddressSpace *as, int asidx);
-/**
- * cpu_get_address_space:
- * @cpu: CPU to get address space from
- * @asidx: index identifying which address space to get
- *
- * Return the requested address space of this CPU. @asidx
- * specifies which address space to read.
- */
-AddressSpace *cpu_get_address_space(CPUState *cpu, int asidx);
 /* cputlb.c */
 /**
  * tlb_flush_page:
diff --git a/include/qom/cpu.h b/include/qom/cpu.h
index ab38ce1..2d9197a 100644
--- a/include/qom/cpu.h
+++ b/include/qom/cpu.h
@@ -824,6 +824,16 @@ int cpu_watchpoint_remove(CPUState *cpu, vaddr addr,
 void cpu_watchpoint_remove_by_ref(CPUState *cpu, CPUWatchpoint *watchpoint);
 void cpu_watchpoint_remove_all(CPUState *cpu, int mask);
 
+/**
+ * cpu_get_address_space:
+ * @cpu: CPU to get address space from
+ * @asidx: index identifying which address space to get
+ *
+ * Return the requested address space of this CPU. @asidx
+ * specifies which address space to read.
+ */
+AddressSpace *cpu_get_address_space(CPUState *cpu, int asidx);
+
 void QEMU_NORETURN cpu_abort(CPUState *cpu, const char *fmt, ...)
     GCC_FMT_ATTR(2, 3);
 void cpu_exec_exit(CPUState *cpu);
diff --git a/linux-user/main.c b/linux-user/main.c
index 2b7fa9c..ba38aed 100644
--- a/linux-user/main.c
+++ b/linux-user/main.c
@@ -26,6 +26,7 @@
 #include "qemu/cutils.h"
 #include "qemu/help_option.h"
 #include "cpu.h"
+#include "exec/exec-all.h"
 #include "tcg.h"
 #include "qemu/timer.h"
 #include "qemu/envlist.h"
diff --git a/linux-user/qemu.h b/linux-user/qemu.h
index 26b0ba2..208c63e 100644
--- a/linux-user/qemu.h
+++ b/linux-user/qemu.h
@@ -3,6 +3,7 @@
 
 
 #include "cpu.h"
+#include "exec/exec-all.h"
 #include "exec/cpu_ldst.h"
 
 #undef DEBUG_REMAP
diff --git a/monitor.c b/monitor.c
index a2c1ad2..0129936 100644
--- a/monitor.c
+++ b/monitor.c
@@ -71,6 +71,7 @@
 #include "trace/simple.h"
 #endif
 #include "exec/memory.h"
+#include "exec/exec-all.h"
 #include "qemu/log.h"
 #include "qmp-commands.h"
 #include "hmp.h"
diff --git a/target-alpha/cpu.c b/target-alpha/cpu.c
index 8a155ca..6d01d7f 100644
--- a/target-alpha/cpu.c
+++ b/target-alpha/cpu.c
@@ -24,6 +24,7 @@
 #include "cpu.h"
 #include "qemu-common.h"
 #include "migration/vmstate.h"
+#include "exec/exec-all.h"
 
 
 static void alpha_cpu_set_pc(CPUState *cs, vaddr value)
diff --git a/target-alpha/cpu.h b/target-alpha/cpu.h
index 8353bda..08c6300 100644
--- a/target-alpha/cpu.h
+++ b/target-alpha/cpu.h
@@ -525,6 +525,4 @@ static inline void cpu_get_tb_cpu_state(CPUAlphaState *env, target_ulong *pc,
     *pflags = flags;
 }
 
-#include "exec/exec-all.h"
-
 #endif /* !defined (__CPU_ALPHA_H__) */
diff --git a/target-alpha/fpu_helper.c b/target-alpha/fpu_helper.c
index 5ab7d5e..9645978 100644
--- a/target-alpha/fpu_helper.c
+++ b/target-alpha/fpu_helper.c
@@ -19,6 +19,7 @@
 
 #include "qemu/osdep.h"
 #include "cpu.h"
+#include "exec/exec-all.h"
 #include "exec/helper-proto.h"
 #include "fpu/softfloat.h"
 
diff --git a/target-alpha/helper.c b/target-alpha/helper.c
index 6dec263..85168b7 100644
--- a/target-alpha/helper.c
+++ b/target-alpha/helper.c
@@ -20,6 +20,7 @@
 #include "qemu/osdep.h"
 
 #include "cpu.h"
+#include "exec/exec-all.h"
 #include "fpu/softfloat.h"
 #include "exec/helper-proto.h"
 
diff --git a/target-alpha/int_helper.c b/target-alpha/int_helper.c
index 777e48d..19bebfe 100644
--- a/target-alpha/int_helper.c
+++ b/target-alpha/int_helper.c
@@ -19,6 +19,7 @@
 
 #include "qemu/osdep.h"
 #include "cpu.h"
+#include "exec/exec-all.h"
 #include "exec/helper-proto.h"
 #include "qemu/host-utils.h"
 
diff --git a/target-alpha/mem_helper.c b/target-alpha/mem_helper.c
index 7fee9a6..7f4d15f 100644
--- a/target-alpha/mem_helper.c
+++ b/target-alpha/mem_helper.c
@@ -20,6 +20,7 @@
 #include "qemu/osdep.h"
 #include "cpu.h"
 #include "exec/helper-proto.h"
+#include "exec/exec-all.h"
 #include "exec/cpu_ldst.h"
 
 /* Softmmu support */
diff --git a/target-alpha/sys_helper.c b/target-alpha/sys_helper.c
index e2dec15..bec1e17 100644
--- a/target-alpha/sys_helper.c
+++ b/target-alpha/sys_helper.c
@@ -19,6 +19,7 @@
 
 #include "qemu/osdep.h"
 #include "cpu.h"
+#include "exec/exec-all.h"
 #include "exec/helper-proto.h"
 #include "sysemu/sysemu.h"
 #include "qemu/timer.h"
diff --git a/target-alpha/translate.c b/target-alpha/translate.c
index 5b86992..6a5fa96 100644
--- a/target-alpha/translate.c
+++ b/target-alpha/translate.c
@@ -21,6 +21,7 @@
 #include "cpu.h"
 #include "disas/disas.h"
 #include "qemu/host-utils.h"
+#include "exec/exec-all.h"
 #include "tcg-op.h"
 #include "exec/cpu_ldst.h"
 
diff --git a/target-alpha/vax_helper.c b/target-alpha/vax_helper.c
index e74ac3e..2b0c178 100644
--- a/target-alpha/vax_helper.c
+++ b/target-alpha/vax_helper.c
@@ -19,6 +19,7 @@
 
 #include "qemu/osdep.h"
 #include "cpu.h"
+#include "exec/exec-all.h"
 #include "exec/helper-proto.h"
 #include "fpu/softfloat.h"
 
diff --git a/target-arm/arm_ldst.h b/target-arm/arm_ldst.h
index 35c2c43..a76d89f 100644
--- a/target-arm/arm_ldst.h
+++ b/target-arm/arm_ldst.h
@@ -20,6 +20,7 @@
 #ifndef ARM_LDST_H
 #define ARM_LDST_H
 
+#include "exec/exec-all.h"
 #include "exec/cpu_ldst.h"
 #include "qemu/bswap.h"
 
diff --git a/target-arm/cpu.c b/target-arm/cpu.c
index e48e83a..3fd0743 100644
--- a/target-arm/cpu.c
+++ b/target-arm/cpu.c
@@ -23,6 +23,7 @@
 #include "cpu.h"
 #include "internals.h"
 #include "qemu-common.h"
+#include "exec/exec-all.h"
 #include "hw/qdev-properties.h"
 #if !defined(CONFIG_USER_ONLY)
 #include "hw/loader.h"
diff --git a/target-arm/cpu.h b/target-arm/cpu.h
index bf6904c..f06a2b5 100644
--- a/target-arm/cpu.h
+++ b/target-arm/cpu.h
@@ -2341,8 +2341,6 @@ static inline void cpu_get_tb_cpu_state(CPUARMState *env, target_ulong *pc,
     *cs_base = 0;
 }
 
-#include "exec/exec-all.h"
-
 enum {
     QEMU_PSCI_CONDUIT_DISABLED = 0,
     QEMU_PSCI_CONDUIT_SMC = 1,
diff --git a/target-arm/helper-a64.c b/target-arm/helper-a64.c
index c7bfb4d..7c63556 100644
--- a/target-arm/helper-a64.c
+++ b/target-arm/helper-a64.c
@@ -22,6 +22,7 @@
 #include "exec/gdbstub.h"
 #include "exec/helper-proto.h"
 #include "qemu/host-utils.h"
+#include "qemu/log.h"
 #include "sysemu/sysemu.h"
 #include "qemu/bitops.h"
 #include "internals.h"
diff --git a/target-arm/helper.c b/target-arm/helper.c
index 41abdff..2bb3c3d 100644
--- a/target-arm/helper.c
+++ b/target-arm/helper.c
@@ -8,6 +8,7 @@
 #include "sysemu/sysemu.h"
 #include "qemu/bitops.h"
 #include "qemu/crc32c.h"
+#include "exec/exec-all.h"
 #include "exec/cpu_ldst.h"
 #include "arm_ldst.h"
 #include <zlib.h> /* For crc32 */
diff --git a/target-arm/op_helper.c b/target-arm/op_helper.c
index d626ff1..96a6a3b 100644
--- a/target-arm/op_helper.c
+++ b/target-arm/op_helper.c
@@ -20,6 +20,7 @@
 #include "cpu.h"
 #include "exec/helper-proto.h"
 #include "internals.h"
+#include "exec/exec-all.h"
 #include "exec/cpu_ldst.h"
 
 #define SIGNBIT (uint32_t)0x80000000
diff --git a/target-arm/psci.c b/target-arm/psci.c
index 2b624b9..72eed55 100644
--- a/target-arm/psci.c
+++ b/target-arm/psci.c
@@ -21,6 +21,7 @@
 #include <kvm-consts.h>
 #include <sysemu/sysemu.h>
 #include "internals.h"
+#include "exec/exec-all.h"
 
 bool arm_is_psci_call(ARMCPU *cpu, int excp_type)
 {
diff --git a/target-arm/translate-a64.c b/target-arm/translate-a64.c
index b13cff7..540326e 100644
--- a/target-arm/translate-a64.c
+++ b/target-arm/translate-a64.c
@@ -19,6 +19,7 @@
 #include "qemu/osdep.h"
 
 #include "cpu.h"
+#include "exec/exec-all.h"
 #include "tcg-op.h"
 #include "qemu/log.h"
 #include "arm_ldst.h"
diff --git a/target-arm/translate.c b/target-arm/translate.c
index 940ec8d..7d35b66 100644
--- a/target-arm/translate.c
+++ b/target-arm/translate.c
@@ -23,6 +23,7 @@
 #include "cpu.h"
 #include "internals.h"
 #include "disas/disas.h"
+#include "exec/exec-all.h"
 #include "tcg-op.h"
 #include "qemu/log.h"
 #include "qemu/bitops.h"
diff --git a/target-cris/cpu.c b/target-cris/cpu.c
index 1cb79dd..c5a656b 100644
--- a/target-cris/cpu.c
+++ b/target-cris/cpu.c
@@ -26,6 +26,7 @@
 #include "cpu.h"
 #include "qemu-common.h"
 #include "mmu.h"
+#include "exec/exec-all.h"
 
 
 static void cris_cpu_set_pc(CPUState *cs, vaddr value)
diff --git a/target-cris/cpu.h b/target-cris/cpu.h
index e3411687..ea3a88c 100644
--- a/target-cris/cpu.h
+++ b/target-cris/cpu.h
@@ -300,6 +300,4 @@ static inline void cpu_get_tb_cpu_state(CPUCRISState *env, target_ulong *pc,
 #define cpu_list cris_cpu_list
 void cris_cpu_list(FILE *f, fprintf_function cpu_fprintf);
 
-#include "exec/exec-all.h"
-
 #endif
diff --git a/target-cris/helper.c b/target-cris/helper.c
index 1eb9fd9..af78cca 100644
--- a/target-cris/helper.c
+++ b/target-cris/helper.c
@@ -22,6 +22,7 @@
 #include "cpu.h"
 #include "mmu.h"
 #include "qemu/host-utils.h"
+#include "exec/exec-all.h"
 #include "exec/cpu_ldst.h"
 
 
diff --git a/target-cris/mmu.c b/target-cris/mmu.c
index 4278d2d..b8db908 100644
--- a/target-cris/mmu.c
+++ b/target-cris/mmu.c
@@ -20,6 +20,7 @@
 
 #include "qemu/osdep.h"
 #include "cpu.h"
+#include "exec/exec-all.h"
 #include "mmu.h"
 
 #ifdef DEBUG
diff --git a/target-cris/op_helper.c b/target-cris/op_helper.c
index 320f2b8..675ab86 100644
--- a/target-cris/op_helper.c
+++ b/target-cris/op_helper.c
@@ -23,6 +23,7 @@
 #include "mmu.h"
 #include "exec/helper-proto.h"
 #include "qemu/host-utils.h"
+#include "exec/exec-all.h"
 #include "exec/cpu_ldst.h"
 
 //#define CRIS_OP_HELPER_DEBUG
diff --git a/target-cris/translate.c b/target-cris/translate.c
index a73176c..8e4a6fa 100644
--- a/target-cris/translate.c
+++ b/target-cris/translate.c
@@ -26,6 +26,7 @@
 #include "qemu/osdep.h"
 #include "cpu.h"
 #include "disas/disas.h"
+#include "exec/exec-all.h"
 #include "tcg-op.h"
 #include "exec/helper-proto.h"
 #include "mmu.h"
diff --git a/target-i386/bpt_helper.c b/target-i386/bpt_helper.c
index f47df19..499a277 100644
--- a/target-i386/bpt_helper.c
+++ b/target-i386/bpt_helper.c
@@ -19,6 +19,7 @@
 
 #include "qemu/osdep.h"
 #include "cpu.h"
+#include "exec/exec-all.h"
 #include "exec/helper-proto.h"
 
 
diff --git a/target-i386/cpu.c b/target-i386/cpu.c
index fdef6ed..09e2698 100644
--- a/target-i386/cpu.c
+++ b/target-i386/cpu.c
@@ -20,6 +20,7 @@
 #include "qemu/cutils.h"
 
 #include "cpu.h"
+#include "exec/exec-all.h"
 #include "sysemu/kvm.h"
 #include "sysemu/cpus.h"
 #include "kvm_i386.h"
diff --git a/target-i386/cpu.h b/target-i386/cpu.h
index 2200aeb..3c907d5 100644
--- a/target-i386/cpu.h
+++ b/target-i386/cpu.h
@@ -1362,8 +1362,6 @@ void tcg_x86_init(void);
 #include "hw/i386/apic.h"
 #endif
 
-#include "exec/exec-all.h"
-
 static inline void cpu_get_tb_cpu_state(CPUX86State *env, target_ulong *pc,
                                         target_ulong *cs_base, int *flags)
 {
diff --git a/target-i386/excp_helper.c b/target-i386/excp_helper.c
index ef37f42..f0dc499 100644
--- a/target-i386/excp_helper.c
+++ b/target-i386/excp_helper.c
@@ -19,6 +19,7 @@
 
 #include "qemu/osdep.h"
 #include "cpu.h"
+#include "exec/exec-all.h"
 #include "qemu/log.h"
 #include "sysemu/sysemu.h"
 #include "exec/helper-proto.h"
diff --git a/target-i386/fpu_helper.c b/target-i386/fpu_helper.c
index fee5573..206e60f 100644
--- a/target-i386/fpu_helper.c
+++ b/target-i386/fpu_helper.c
@@ -22,6 +22,7 @@
 #include "cpu.h"
 #include "exec/helper-proto.h"
 #include "qemu/host-utils.h"
+#include "exec/exec-all.h"
 #include "exec/cpu_ldst.h"
 
 #define FPU_RC_MASK         0xc00
diff --git a/target-i386/helper.c b/target-i386/helper.c
index 5755839..9e0b9b9 100644
--- a/target-i386/helper.c
+++ b/target-i386/helper.c
@@ -19,6 +19,7 @@
 
 #include "qemu/osdep.h"
 #include "cpu.h"
+#include "exec/exec-all.h"
 #include "sysemu/kvm.h"
 #include "kvm_i386.h"
 #ifndef CONFIG_USER_ONLY
diff --git a/target-i386/int_helper.c b/target-i386/int_helper.c
index cf5bbb0..9e873ac 100644
--- a/target-i386/int_helper.c
+++ b/target-i386/int_helper.c
@@ -19,6 +19,7 @@
 
 #include "qemu/osdep.h"
 #include "cpu.h"
+#include "exec/exec-all.h"
 #include "qemu/host-utils.h"
 #include "exec/helper-proto.h"
 
diff --git a/target-i386/machine.c b/target-i386/machine.c
index 658b066..cb9adf2 100644
--- a/target-i386/machine.c
+++ b/target-i386/machine.c
@@ -1,13 +1,16 @@
 #include "qemu/osdep.h"
 #include "qemu-common.h"
 #include "cpu.h"
+#include "exec/exec-all.h"
 #include "hw/hw.h"
 #include "hw/boards.h"
 #include "hw/i386/pc.h"
 #include "hw/isa/isa.h"
 #include "migration/cpu.h"
+#include "exec/exec-all.h"
 
 #include "cpu.h"
+#include "exec/exec-all.h"
 #include "sysemu/kvm.h"
 
 #include "qemu/error-report.h"
diff --git a/target-i386/mem_helper.c b/target-i386/mem_helper.c
index 85e7516..c2f4769 100644
--- a/target-i386/mem_helper.c
+++ b/target-i386/mem_helper.c
@@ -20,6 +20,7 @@
 #include "qemu/osdep.h"
 #include "cpu.h"
 #include "exec/helper-proto.h"
+#include "exec/exec-all.h"
 #include "exec/cpu_ldst.h"
 
 /* broken thread support */
diff --git a/target-i386/misc_helper.c b/target-i386/misc_helper.c
index e31ec97..3f666b4 100644
--- a/target-i386/misc_helper.c
+++ b/target-i386/misc_helper.c
@@ -20,6 +20,7 @@
 #include "qemu/osdep.h"
 #include "cpu.h"
 #include "exec/helper-proto.h"
+#include "exec/exec-all.h"
 #include "exec/cpu_ldst.h"
 #include "exec/address-spaces.h"
 
diff --git a/target-i386/mpx_helper.c b/target-i386/mpx_helper.c
index 4d1785e..7e44820 100644
--- a/target-i386/mpx_helper.c
+++ b/target-i386/mpx_helper.c
@@ -21,6 +21,7 @@
 #include "cpu.h"
 #include "exec/helper-proto.h"
 #include "exec/cpu_ldst.h"
+#include "exec/exec-all.h"
 
 
 void cpu_sync_bndcs_hflags(CPUX86State *env)
diff --git a/target-i386/seg_helper.c b/target-i386/seg_helper.c
index b5f3d72..97aee09 100644
--- a/target-i386/seg_helper.c
+++ b/target-i386/seg_helper.c
@@ -22,6 +22,7 @@
 #include "cpu.h"
 #include "qemu/log.h"
 #include "exec/helper-proto.h"
+#include "exec/exec-all.h"
 #include "exec/cpu_ldst.h"
 #include "exec/log.h"
 
diff --git a/target-i386/svm_helper.c b/target-i386/svm_helper.c
index ab472f6..782b3f1 100644
--- a/target-i386/svm_helper.c
+++ b/target-i386/svm_helper.c
@@ -21,6 +21,7 @@
 #include "cpu.h"
 #include "exec/cpu-all.h"
 #include "exec/helper-proto.h"
+#include "exec/exec-all.h"
 #include "exec/cpu_ldst.h"
 
 /* Secure Virtual Machine helpers */
diff --git a/target-i386/translate.c b/target-i386/translate.c
index 1a1214d..bc5fbf4 100644
--- a/target-i386/translate.c
+++ b/target-i386/translate.c
@@ -21,6 +21,7 @@
 #include "qemu/host-utils.h"
 #include "cpu.h"
 #include "disas/disas.h"
+#include "exec/exec-all.h"
 #include "tcg-op.h"
 #include "exec/cpu_ldst.h"
 
diff --git a/target-lm32/cpu.c b/target-lm32/cpu.c
index 6e7e1b8..a783d46 100644
--- a/target-lm32/cpu.c
+++ b/target-lm32/cpu.c
@@ -22,6 +22,7 @@
 #include "qapi/error.h"
 #include "cpu.h"
 #include "qemu-common.h"
+#include "exec/exec-all.h"
 
 
 static void lm32_cpu_set_pc(CPUState *cs, vaddr value)
diff --git a/target-lm32/cpu.h b/target-lm32/cpu.h
index 22ffa68..ea02794 100644
--- a/target-lm32/cpu.h
+++ b/target-lm32/cpu.h
@@ -273,6 +273,4 @@ static inline void cpu_get_tb_cpu_state(CPULM32State *env, target_ulong *pc,
     *flags = 0;
 }
 
-#include "exec/exec-all.h"
-
 #endif
diff --git a/target-lm32/helper.c b/target-lm32/helper.c
index 655248f..b8f4ed9 100644
--- a/target-lm32/helper.c
+++ b/target-lm32/helper.c
@@ -19,6 +19,7 @@
 
 #include "qemu/osdep.h"
 #include "cpu.h"
+#include "exec/exec-all.h"
 #include "qemu/host-utils.h"
 #include "sysemu/sysemu.h"
 #include "exec/semihost.h"
diff --git a/target-lm32/op_helper.c b/target-lm32/op_helper.c
index b6759e0..7a550d1 100644
--- a/target-lm32/op_helper.c
+++ b/target-lm32/op_helper.c
@@ -6,6 +6,7 @@
 #include "hw/lm32/lm32_pic.h"
 #include "hw/char/lm32_juart.h"
 
+#include "exec/exec-all.h"
 #include "exec/cpu_ldst.h"
 
 #ifndef CONFIG_USER_ONLY
diff --git a/target-lm32/translate.c b/target-lm32/translate.c
index 256a51f..2c8d276 100644
--- a/target-lm32/translate.c
+++ b/target-lm32/translate.c
@@ -21,6 +21,7 @@
 #include "cpu.h"
 #include "disas/disas.h"
 #include "exec/helper-proto.h"
+#include "exec/exec-all.h"
 #include "tcg-op.h"
 
 #include "exec/cpu_ldst.h"
diff --git a/target-m68k/cpu.c b/target-m68k/cpu.c
index 0b5f9a5..116b784 100644
--- a/target-m68k/cpu.c
+++ b/target-m68k/cpu.c
@@ -23,6 +23,7 @@
 #include "cpu.h"
 #include "qemu-common.h"
 #include "migration/vmstate.h"
+#include "exec/exec-all.h"
 
 
 static void m68k_cpu_set_pc(CPUState *cs, vaddr value)
diff --git a/target-m68k/cpu.h b/target-m68k/cpu.h
index 57c2c8d..a7d81c9 100644
--- a/target-m68k/cpu.h
+++ b/target-m68k/cpu.h
@@ -271,6 +271,4 @@ static inline void cpu_get_tb_cpu_state(CPUM68KState *env, target_ulong *pc,
             | ((env->macsr >> 4) & 0xf);        /* Bits 0-3 */
 }
 
-#include "exec/exec-all.h"
-
 #endif
diff --git a/target-m68k/helper.c b/target-m68k/helper.c
index a8f6d9d..427cbed 100644
--- a/target-m68k/helper.c
+++ b/target-m68k/helper.c
@@ -20,6 +20,7 @@
 
 #include "qemu/osdep.h"
 #include "cpu.h"
+#include "exec/exec-all.h"
 #include "exec/gdbstub.h"
 
 #include "exec/helper-proto.h"
diff --git a/target-m68k/m68k-semi.c b/target-m68k/m68k-semi.c
index f360ef3..1402145 100644
--- a/target-m68k/m68k-semi.c
+++ b/target-m68k/m68k-semi.c
@@ -28,6 +28,7 @@
 #include "exec/gdbstub.h"
 #include "exec/softmmu-semi.h"
 #endif
+#include "qemu/log.h"
 #include "sysemu/sysemu.h"
 
 #define HOSTED_EXIT  0
diff --git a/target-m68k/op_helper.c b/target-m68k/op_helper.c
index 17d0a11..ff32e35 100644
--- a/target-m68k/op_helper.c
+++ b/target-m68k/op_helper.c
@@ -19,6 +19,7 @@
 #include "qemu/osdep.h"
 #include "cpu.h"
 #include "exec/helper-proto.h"
+#include "exec/exec-all.h"
 #include "exec/cpu_ldst.h"
 #include "exec/semihost.h"
 
diff --git a/target-m68k/translate.c b/target-m68k/translate.c
index 7560c3a..5ff3185 100644
--- a/target-m68k/translate.c
+++ b/target-m68k/translate.c
@@ -21,6 +21,7 @@
 #include "qemu/osdep.h"
 #include "cpu.h"
 #include "disas/disas.h"
+#include "exec/exec-all.h"
 #include "tcg-op.h"
 #include "qemu/log.h"
 #include "exec/cpu_ldst.h"
diff --git a/target-microblaze/cpu.c b/target-microblaze/cpu.c
index fdfb019..8edc00a 100644
--- a/target-microblaze/cpu.c
+++ b/target-microblaze/cpu.c
@@ -27,6 +27,7 @@
 #include "qemu-common.h"
 #include "hw/qdev-properties.h"
 #include "migration/vmstate.h"
+#include "exec/exec-all.h"
 
 static const struct {
     const char *name;
diff --git a/target-microblaze/cpu.h b/target-microblaze/cpu.h
index 4c4db7f..7fff2e0 100644
--- a/target-microblaze/cpu.h
+++ b/target-microblaze/cpu.h
@@ -379,6 +379,4 @@ void mb_cpu_unassigned_access(CPUState *cpu, hwaddr addr,
                               unsigned size);
 #endif
 
-#include "exec/exec-all.h"
-
 #endif
diff --git a/target-microblaze/helper.c b/target-microblaze/helper.c
index 4de6bdb..da394d1 100644
--- a/target-microblaze/helper.c
+++ b/target-microblaze/helper.c
@@ -20,6 +20,7 @@
 
 #include "qemu/osdep.h"
 #include "cpu.h"
+#include "exec/exec-all.h"
 #include "qemu/host-utils.h"
 #include "exec/log.h"
 
diff --git a/target-microblaze/mmu.c b/target-microblaze/mmu.c
index 4ac3040..a22a496 100644
--- a/target-microblaze/mmu.c
+++ b/target-microblaze/mmu.c
@@ -20,6 +20,7 @@
 
 #include "qemu/osdep.h"
 #include "cpu.h"
+#include "exec/exec-all.h"
 
 #define D(x)
 
diff --git a/target-microblaze/op_helper.c b/target-microblaze/op_helper.c
index 9733388..0533939 100644
--- a/target-microblaze/op_helper.c
+++ b/target-microblaze/op_helper.c
@@ -22,6 +22,7 @@
 #include "cpu.h"
 #include "exec/helper-proto.h"
 #include "qemu/host-utils.h"
+#include "exec/exec-all.h"
 #include "exec/cpu_ldst.h"
 
 #define D(x)
diff --git a/target-microblaze/translate.c b/target-microblaze/translate.c
index f944965..a5ea626 100644
--- a/target-microblaze/translate.c
+++ b/target-microblaze/translate.c
@@ -21,6 +21,7 @@
 #include "qemu/osdep.h"
 #include "cpu.h"
 #include "disas/disas.h"
+#include "exec/exec-all.h"
 #include "tcg-op.h"
 #include "exec/helper-proto.h"
 #include "microblaze-decode.h"
diff --git a/target-mips/cpu.c b/target-mips/cpu.c
index 0e2ecbe..64ad112 100644
--- a/target-mips/cpu.c
+++ b/target-mips/cpu.c
@@ -24,6 +24,7 @@
 #include "kvm_mips.h"
 #include "qemu-common.h"
 #include "sysemu/kvm.h"
+#include "exec/exec-all.h"
 
 
 static void mips_cpu_set_pc(CPUState *cs, vaddr value)
diff --git a/target-mips/cpu.h b/target-mips/cpu.h
index 951267a..78618e8 100644
--- a/target-mips/cpu.h
+++ b/target-mips/cpu.h
@@ -934,8 +934,6 @@ static inline int mips_vp_active(CPUMIPSState *env)
     return 1;
 }
 
-#include "exec/exec-all.h"
-
 static inline void compute_hflags(CPUMIPSState *env)
 {
     env->hflags &= ~(MIPS_HFLAG_COP1X | MIPS_HFLAG_64 | MIPS_HFLAG_CP0 |
diff --git a/target-mips/helper.c b/target-mips/helper.c
index ac5771e..b920d2c 100644
--- a/target-mips/helper.c
+++ b/target-mips/helper.c
@@ -20,6 +20,7 @@
 
 #include "cpu.h"
 #include "sysemu/kvm.h"
+#include "exec/exec-all.h"
 #include "exec/cpu_ldst.h"
 #include "exec/log.h"
 
diff --git a/target-mips/mips-semi.c b/target-mips/mips-semi.c
index ed235de..a7aefba 100644
--- a/target-mips/mips-semi.c
+++ b/target-mips/mips-semi.c
@@ -19,6 +19,7 @@
 
 #include "qemu/osdep.h"
 #include "cpu.h"
+#include "qemu/log.h"
 #include "exec/helper-proto.h"
 #include "exec/softmmu-semi.h"
 #include "exec/semihost.h"
diff --git a/target-mips/msa_helper.c b/target-mips/msa_helper.c
index 654a0d2..ae92fcb 100644
--- a/target-mips/msa_helper.c
+++ b/target-mips/msa_helper.c
@@ -19,6 +19,7 @@
 
 #include "qemu/osdep.h"
 #include "cpu.h"
+#include "exec/exec-all.h"
 #include "exec/helper-proto.h"
 
 /* Data format min and max values */
diff --git a/target-mips/op_helper.c b/target-mips/op_helper.c
index 8ec1bef..66c754f 100644
--- a/target-mips/op_helper.c
+++ b/target-mips/op_helper.c
@@ -20,6 +20,7 @@
 #include "cpu.h"
 #include "qemu/host-utils.h"
 #include "exec/helper-proto.h"
+#include "exec/exec-all.h"
 #include "exec/cpu_ldst.h"
 #include "sysemu/kvm.h"
 
diff --git a/target-mips/translate.c b/target-mips/translate.c
index a3a05ec..23793b3 100644
--- a/target-mips/translate.c
+++ b/target-mips/translate.c
@@ -24,6 +24,7 @@
 #include "qemu/osdep.h"
 #include "cpu.h"
 #include "disas/disas.h"
+#include "exec/exec-all.h"
 #include "tcg-op.h"
 #include "exec/cpu_ldst.h"
 
diff --git a/target-moxie/cpu.c b/target-moxie/cpu.c
index b4ee84e..50a0899 100644
--- a/target-moxie/cpu.c
+++ b/target-moxie/cpu.c
@@ -23,6 +23,7 @@
 #include "qemu-common.h"
 #include "migration/vmstate.h"
 #include "machine.h"
+#include "exec/exec-all.h"
 
 static void moxie_cpu_set_pc(CPUState *cs, vaddr value)
 {
diff --git a/target-moxie/cpu.h b/target-moxie/cpu.h
index 4ee2077..2ec55d3 100644
--- a/target-moxie/cpu.h
+++ b/target-moxie/cpu.h
@@ -129,7 +129,6 @@ static inline int cpu_mmu_index(CPUMoxieState *env, bool ifetch)
 }
 
 #include "exec/cpu-all.h"
-#include "exec/exec-all.h"
 
 static inline void cpu_get_tb_cpu_state(CPUMoxieState *env, target_ulong *pc,
                                         target_ulong *cs_base, int *flags)
diff --git a/target-openrisc/cpu.c b/target-openrisc/cpu.c
index ae6ed9e..155913f 100644
--- a/target-openrisc/cpu.c
+++ b/target-openrisc/cpu.c
@@ -21,6 +21,7 @@
 #include "qapi/error.h"
 #include "cpu.h"
 #include "qemu-common.h"
+#include "exec/exec-all.h"
 
 static void openrisc_cpu_set_pc(CPUState *cs, vaddr value)
 {
diff --git a/target-openrisc/cpu.h b/target-openrisc/cpu.h
index 4b63f25..2862dde 100644
--- a/target-openrisc/cpu.h
+++ b/target-openrisc/cpu.h
@@ -410,6 +410,4 @@ static inline int cpu_mmu_index(CPUOpenRISCState *env, bool ifetch)
 
 #define CPU_INTERRUPT_TIMER   CPU_INTERRUPT_TGT_INT_0
 
-#include "exec/exec-all.h"
-
 #endif /* CPU_OPENRISC_H */
diff --git a/target-openrisc/exception.c b/target-openrisc/exception.c
index ace3184..49470be 100644
--- a/target-openrisc/exception.c
+++ b/target-openrisc/exception.c
@@ -19,6 +19,7 @@
 
 #include "qemu/osdep.h"
 #include "cpu.h"
+#include "exec/exec-all.h"
 #include "exception.h"
 
 void QEMU_NORETURN raise_exception(OpenRISCCPU *cpu, uint32_t excp)
diff --git a/target-openrisc/interrupt.c b/target-openrisc/interrupt.c
index 963eb14..5fe3f11 100644
--- a/target-openrisc/interrupt.c
+++ b/target-openrisc/interrupt.c
@@ -19,6 +19,7 @@
 
 #include "qemu/osdep.h"
 #include "cpu.h"
+#include "exec/exec-all.h"
 #include "qemu-common.h"
 #include "exec/gdbstub.h"
 #include "qemu/host-utils.h"
diff --git a/target-openrisc/interrupt_helper.c b/target-openrisc/interrupt_helper.c
index 11b4b20..116f910 100644
--- a/target-openrisc/interrupt_helper.c
+++ b/target-openrisc/interrupt_helper.c
@@ -20,6 +20,7 @@
 
 #include "qemu/osdep.h"
 #include "cpu.h"
+#include "exec/exec-all.h"
 #include "exec/helper-proto.h"
 
 void HELPER(rfe)(CPUOpenRISCState *env)
diff --git a/target-openrisc/mmu.c b/target-openrisc/mmu.c
index 4ab414a..505dcdc 100644
--- a/target-openrisc/mmu.c
+++ b/target-openrisc/mmu.c
@@ -20,6 +20,7 @@
 
 #include "qemu/osdep.h"
 #include "cpu.h"
+#include "exec/exec-all.h"
 #include "qemu-common.h"
 #include "exec/gdbstub.h"
 #include "qemu/host-utils.h"
diff --git a/target-openrisc/mmu_helper.c b/target-openrisc/mmu_helper.c
index d7952d4..c0658c3 100644
--- a/target-openrisc/mmu_helper.c
+++ b/target-openrisc/mmu_helper.c
@@ -20,6 +20,7 @@
 
 #include "qemu/osdep.h"
 #include "cpu.h"
+#include "exec/exec-all.h"
 #include "exec/cpu_ldst.h"
 
 #ifndef CONFIG_USER_ONLY
diff --git a/target-openrisc/sys_helper.c b/target-openrisc/sys_helper.c
index f917be6..a719e45 100644
--- a/target-openrisc/sys_helper.c
+++ b/target-openrisc/sys_helper.c
@@ -20,6 +20,7 @@
 
 #include "qemu/osdep.h"
 #include "cpu.h"
+#include "exec/exec-all.h"
 #include "exec/helper-proto.h"
 
 #define TO_SPR(group, number) (((group) << 11) + (number))
diff --git a/target-ppc/cpu.h b/target-ppc/cpu.h
index bcd29d1..2e1c4f8 100644
--- a/target-ppc/cpu.h
+++ b/target-ppc/cpu.h
@@ -2357,8 +2357,6 @@ static inline bool msr_is_64bit(CPUPPCState *env, target_ulong msr)
 
 extern void (*cpu_ppc_hypercall)(PowerPCCPU *);
 
-#include "exec/exec-all.h"
-
 void dump_mmu(FILE *f, fprintf_function cpu_fprintf, CPUPPCState *env);
 
 /**
diff --git a/target-ppc/excp_helper.c b/target-ppc/excp_helper.c
index ca4ffe8..288903e 100644
--- a/target-ppc/excp_helper.c
+++ b/target-ppc/excp_helper.c
@@ -19,6 +19,7 @@
 #include "qemu/osdep.h"
 #include "cpu.h"
 #include "exec/helper-proto.h"
+#include "exec/exec-all.h"
 #include "exec/cpu_ldst.h"
 
 #include "helper_regs.h"
diff --git a/target-ppc/int_helper.c b/target-ppc/int_helper.c
index 27b0258..7445376 100644
--- a/target-ppc/int_helper.c
+++ b/target-ppc/int_helper.c
@@ -18,6 +18,7 @@
  */
 #include "qemu/osdep.h"
 #include "cpu.h"
+#include "exec/exec-all.h"
 #include "qemu/host-utils.h"
 #include "exec/helper-proto.h"
 #include "crypto/aes.h"
diff --git a/target-ppc/machine.c b/target-ppc/machine.c
index 7a9995d..f2afe89 100644
--- a/target-ppc/machine.c
+++ b/target-ppc/machine.c
@@ -1,12 +1,14 @@
 #include "qemu/osdep.h"
 #include "qemu-common.h"
 #include "cpu.h"
+#include "exec/exec-all.h"
 #include "hw/hw.h"
 #include "hw/boards.h"
 #include "sysemu/kvm.h"
 #include "helper_regs.h"
 #include "mmu-hash64.h"
 #include "migration/cpu.h"
+#include "exec/exec-all.h"
 
 static int cpu_load_old(QEMUFile *f, void *opaque, int version_id)
 {
diff --git a/target-ppc/mem_helper.c b/target-ppc/mem_helper.c
index 581d9fa..02f1419 100644
--- a/target-ppc/mem_helper.c
+++ b/target-ppc/mem_helper.c
@@ -18,10 +18,12 @@
  */
 #include "qemu/osdep.h"
 #include "cpu.h"
+#include "exec/exec-all.h"
 #include "qemu/host-utils.h"
 #include "exec/helper-proto.h"
 
 #include "helper_regs.h"
+#include "exec/exec-all.h"
 #include "exec/cpu_ldst.h"
 
 //#define DEBUG_OP
diff --git a/target-ppc/misc_helper.c b/target-ppc/misc_helper.c
index 73e3b05..7d41b01 100644
--- a/target-ppc/misc_helper.c
+++ b/target-ppc/misc_helper.c
@@ -18,6 +18,7 @@
  */
 #include "qemu/osdep.h"
 #include "cpu.h"
+#include "exec/exec-all.h"
 #include "exec/helper-proto.h"
 
 #include "helper_regs.h"
diff --git a/target-ppc/mmu-hash32.c b/target-ppc/mmu-hash32.c
index 06ce4d6..29bace6 100644
--- a/target-ppc/mmu-hash32.c
+++ b/target-ppc/mmu-hash32.c
@@ -20,6 +20,7 @@
 
 #include "qemu/osdep.h"
 #include "cpu.h"
+#include "exec/exec-all.h"
 #include "exec/helper-proto.h"
 #include "sysemu/kvm.h"
 #include "kvm_ppc.h"
diff --git a/target-ppc/mmu-hash64.c b/target-ppc/mmu-hash64.c
index 5184626..04e6932 100644
--- a/target-ppc/mmu-hash64.c
+++ b/target-ppc/mmu-hash64.c
@@ -20,6 +20,7 @@
 #include "qemu/osdep.h"
 #include "qapi/error.h"
 #include "cpu.h"
+#include "exec/exec-all.h"
 #include "exec/helper-proto.h"
 #include "qemu/error-report.h"
 #include "sysemu/kvm.h"
diff --git a/target-ppc/mmu_helper.c b/target-ppc/mmu_helper.c
index ff21794..2e0e3ca 100644
--- a/target-ppc/mmu_helper.c
+++ b/target-ppc/mmu_helper.c
@@ -24,6 +24,7 @@
 #include "kvm_ppc.h"
 #include "mmu-hash64.h"
 #include "mmu-hash32.h"
+#include "exec/exec-all.h"
 #include "exec/cpu_ldst.h"
 #include "exec/log.h"
 
diff --git a/target-ppc/timebase_helper.c b/target-ppc/timebase_helper.c
index 3b340d7..66de313 100644
--- a/target-ppc/timebase_helper.c
+++ b/target-ppc/timebase_helper.c
@@ -19,6 +19,7 @@
 #include "qemu/osdep.h"
 #include "cpu.h"
 #include "exec/helper-proto.h"
+#include "qemu/log.h"
 
 /*****************************************************************************/
 /* SPR accesses */
diff --git a/target-ppc/translate.c b/target-ppc/translate.c
index 6f0e7b4..a843142 100644
--- a/target-ppc/translate.c
+++ b/target-ppc/translate.c
@@ -21,6 +21,7 @@
 #include "qemu/osdep.h"
 #include "cpu.h"
 #include "disas/disas.h"
+#include "exec/exec-all.h"
 #include "tcg-op.h"
 #include "qemu/host-utils.h"
 #include "exec/cpu_ldst.h"
diff --git a/target-s390x/cc_helper.c b/target-s390x/cc_helper.c
index 0d9411b..1cf8551 100644
--- a/target-s390x/cc_helper.c
+++ b/target-s390x/cc_helper.c
@@ -20,6 +20,7 @@
 
 #include "qemu/osdep.h"
 #include "cpu.h"
+#include "exec/exec-all.h"
 #include "exec/helper-proto.h"
 #include "qemu/host-utils.h"
 
diff --git a/target-s390x/cpu.c b/target-s390x/cpu.c
index e665165..e43e2d6 100644
--- a/target-s390x/cpu.c
+++ b/target-s390x/cpu.c
@@ -33,6 +33,7 @@
 #include "trace.h"
 #include "qapi/visitor.h"
 #include "migration/vmstate.h"
+#include "exec/exec-all.h"
 #ifndef CONFIG_USER_ONLY
 #include "hw/hw.h"
 #include "sysemu/arch_init.h"
diff --git a/target-s390x/cpu.h b/target-s390x/cpu.h
index cb7cbed..6e3bc74 100644
--- a/target-s390x/cpu.h
+++ b/target-s390x/cpu.h
@@ -635,8 +635,6 @@ extern void subsystem_reset(void);
 void s390_cpu_list(FILE *f, fprintf_function cpu_fprintf);
 #define cpu_list s390_cpu_list
 
-#include "exec/exec-all.h"
-
 #define EXCP_EXT 1 /* external interrupt */
 #define EXCP_SVC 2 /* supervisor call (syscall) */
 #define EXCP_PGM 3 /* program interruption */
diff --git a/target-s390x/fpu_helper.c b/target-s390x/fpu_helper.c
index 1c7f673..4ddb388 100644
--- a/target-s390x/fpu_helper.c
+++ b/target-s390x/fpu_helper.c
@@ -20,6 +20,7 @@
 
 #include "qemu/osdep.h"
 #include "cpu.h"
+#include "exec/exec-all.h"
 #include "exec/cpu_ldst.h"
 #include "exec/helper-proto.h"
 
diff --git a/target-s390x/gdbstub.c b/target-s390x/gdbstub.c
index 0992ae7..3d223de 100644
--- a/target-s390x/gdbstub.c
+++ b/target-s390x/gdbstub.c
@@ -20,6 +20,7 @@
 #include "qemu/osdep.h"
 #include "qemu-common.h"
 #include "cpu.h"
+#include "exec/exec-all.h"
 #include "exec/gdbstub.h"
 #include "qemu/bitops.h"
 
diff --git a/target-s390x/helper.c b/target-s390x/helper.c
index 423dd72..ad8f797 100644
--- a/target-s390x/helper.c
+++ b/target-s390x/helper.c
@@ -23,6 +23,7 @@
 #include "cpu.h"
 #include "exec/gdbstub.h"
 #include "qemu/timer.h"
+#include "exec/exec-all.h"
 #include "exec/cpu_ldst.h"
 #include "hw/s390x/ioinst.h"
 #ifndef CONFIG_USER_ONLY
diff --git a/target-s390x/int_helper.c b/target-s390x/int_helper.c
index cc1071e..370c94d 100644
--- a/target-s390x/int_helper.c
+++ b/target-s390x/int_helper.c
@@ -20,6 +20,7 @@
 
 #include "qemu/osdep.h"
 #include "cpu.h"
+#include "exec/exec-all.h"
 #include "qemu/host-utils.h"
 #include "exec/helper-proto.h"
 
diff --git a/target-s390x/mem_helper.c b/target-s390x/mem_helper.c
index 9d206a9..ec8059a 100644
--- a/target-s390x/mem_helper.c
+++ b/target-s390x/mem_helper.c
@@ -21,6 +21,7 @@
 #include "qemu/osdep.h"
 #include "cpu.h"
 #include "exec/helper-proto.h"
+#include "exec/exec-all.h"
 #include "exec/cpu_ldst.h"
 
 #if !defined(CONFIG_USER_ONLY)
diff --git a/target-s390x/misc_helper.c b/target-s390x/misc_helper.c
index 762dc21..16ebf8b 100644
--- a/target-s390x/misc_helper.c
+++ b/target-s390x/misc_helper.c
@@ -29,6 +29,7 @@
 #ifdef CONFIG_KVM
 #include <linux/kvm.h>
 #endif
+#include "exec/exec-all.h"
 #include "exec/cpu_ldst.h"
 
 #if !defined(CONFIG_USER_ONLY)
diff --git a/target-s390x/translate.c b/target-s390x/translate.c
index c871ef2..8e51f55 100644
--- a/target-s390x/translate.c
+++ b/target-s390x/translate.c
@@ -31,6 +31,7 @@
 #include "qemu/osdep.h"
 #include "cpu.h"
 #include "disas/disas.h"
+#include "exec/exec-all.h"
 #include "tcg-op.h"
 #include "qemu/log.h"
 #include "qemu/host-utils.h"
diff --git a/target-sh4/cpu.c b/target-sh4/cpu.c
index 86ba388..794b625 100644
--- a/target-sh4/cpu.c
+++ b/target-sh4/cpu.c
@@ -24,6 +24,7 @@
 #include "cpu.h"
 #include "qemu-common.h"
 #include "migration/vmstate.h"
+#include "exec/exec-all.h"
 
 
 static void superh_cpu_set_pc(CPUState *cs, vaddr value)
diff --git a/target-sh4/cpu.h b/target-sh4/cpu.h
index 0acb60c..c20f70c 100644
--- a/target-sh4/cpu.h
+++ b/target-sh4/cpu.h
@@ -389,6 +389,4 @@ static inline void cpu_get_tb_cpu_state(CPUSH4State *env, target_ulong *pc,
             | (env->movcal_backup ? TB_FLAG_PENDING_MOVCA : 0); /* Bit 4 */
 }
 
-#include "exec/exec-all.h"
-
 #endif				/* _CPU_SH4_H */
diff --git a/target-sh4/helper.c b/target-sh4/helper.c
index 6438338..a33ac69 100644
--- a/target-sh4/helper.c
+++ b/target-sh4/helper.c
@@ -19,6 +19,7 @@
 #include "qemu/osdep.h"
 
 #include "cpu.h"
+#include "exec/exec-all.h"
 #include "exec/log.h"
 
 #if !defined(CONFIG_USER_ONLY)
diff --git a/target-sh4/op_helper.c b/target-sh4/op_helper.c
index 368e687..303e83e 100644
--- a/target-sh4/op_helper.c
+++ b/target-sh4/op_helper.c
@@ -19,6 +19,7 @@
 #include "qemu/osdep.h"
 #include "cpu.h"
 #include "exec/helper-proto.h"
+#include "exec/exec-all.h"
 #include "exec/cpu_ldst.h"
 
 #ifndef CONFIG_USER_ONLY
diff --git a/target-sh4/translate.c b/target-sh4/translate.c
index 7c18968..b0b2ad8 100644
--- a/target-sh4/translate.c
+++ b/target-sh4/translate.c
@@ -22,6 +22,7 @@
 #include "qemu/osdep.h"
 #include "cpu.h"
 #include "disas/disas.h"
+#include "exec/exec-all.h"
 #include "tcg-op.h"
 #include "exec/cpu_ldst.h"
 
diff --git a/target-sparc/cpu.c b/target-sparc/cpu.c
index fe4119e..5b74cfc 100644
--- a/target-sparc/cpu.c
+++ b/target-sparc/cpu.c
@@ -21,6 +21,7 @@
 #include "qapi/error.h"
 #include "cpu.h"
 #include "qemu/error-report.h"
+#include "exec/exec-all.h"
 
 //#define DEBUG_FEATURES
 
diff --git a/target-sparc/cpu.h b/target-sparc/cpu.h
index 55981b5..bcaf4e9 100644
--- a/target-sparc/cpu.h
+++ b/target-sparc/cpu.h
@@ -768,6 +768,4 @@ static inline bool tb_am_enabled(int tb_flags)
 #endif
 }
 
-#include "exec/exec-all.h"
-
 #endif
diff --git a/target-sparc/helper.c b/target-sparc/helper.c
index 8349cbe..bedc672 100644
--- a/target-sparc/helper.c
+++ b/target-sparc/helper.c
@@ -19,6 +19,7 @@
 
 #include "qemu/osdep.h"
 #include "cpu.h"
+#include "exec/exec-all.h"
 #include "qemu/host-utils.h"
 #include "exec/helper-proto.h"
 #include "sysemu/sysemu.h"
diff --git a/target-sparc/ldst_helper.c b/target-sparc/ldst_helper.c
index b0600fd..627ddf0 100644
--- a/target-sparc/ldst_helper.c
+++ b/target-sparc/ldst_helper.c
@@ -20,6 +20,7 @@
 #include "qemu/osdep.h"
 #include "cpu.h"
 #include "exec/helper-proto.h"
+#include "exec/exec-all.h"
 #include "exec/cpu_ldst.h"
 
 //#define DEBUG_MMU
diff --git a/target-sparc/machine.c b/target-sparc/machine.c
index c8823af..59c92f7 100644
--- a/target-sparc/machine.c
+++ b/target-sparc/machine.c
@@ -1,12 +1,15 @@
 #include "qemu/osdep.h"
 #include "qemu-common.h"
 #include "cpu.h"
+#include "exec/exec-all.h"
 #include "hw/hw.h"
 #include "hw/boards.h"
 #include "qemu/timer.h"
 
 #include "cpu.h"
+#include "exec/exec-all.h"
 #include "migration/cpu.h"
+#include "exec/exec-all.h"
 
 #ifdef TARGET_SPARC64
 static const VMStateDescription vmstate_cpu_timer = {
diff --git a/target-sparc/mmu_helper.c b/target-sparc/mmu_helper.c
index aa80c48..32b629f 100644
--- a/target-sparc/mmu_helper.c
+++ b/target-sparc/mmu_helper.c
@@ -19,6 +19,7 @@
 
 #include "qemu/osdep.h"
 #include "cpu.h"
+#include "exec/exec-all.h"
 #include "trace.h"
 #include "exec/address-spaces.h"
 
diff --git a/target-sparc/translate.c b/target-sparc/translate.c
index 58572c3..7497c52 100644
--- a/target-sparc/translate.c
+++ b/target-sparc/translate.c
@@ -23,6 +23,7 @@
 #include "cpu.h"
 #include "disas/disas.h"
 #include "exec/helper-proto.h"
+#include "exec/exec-all.h"
 #include "tcg-op.h"
 #include "exec/cpu_ldst.h"
 
diff --git a/target-tilegx/cpu.c b/target-tilegx/cpu.c
index d2d0912..7017cb6 100644
--- a/target-tilegx/cpu.c
+++ b/target-tilegx/cpu.c
@@ -25,6 +25,7 @@
 #include "hw/qdev-properties.h"
 #include "migration/vmstate.h"
 #include "linux-user/syscall_defs.h"
+#include "exec/exec-all.h"
 
 static void tilegx_cpu_dump_state(CPUState *cs, FILE *f,
                                   fprintf_function cpu_fprintf, int flags)
diff --git a/target-tilegx/cpu.h b/target-tilegx/cpu.h
index 022cad1..188674f 100644
--- a/target-tilegx/cpu.h
+++ b/target-tilegx/cpu.h
@@ -176,6 +176,4 @@ static inline void cpu_get_tb_cpu_state(CPUTLGState *env, target_ulong *pc,
     *flags = 0;
 }
 
-#include "exec/exec-all.h"
-
 #endif
diff --git a/target-tilegx/helper.c b/target-tilegx/helper.c
index 616c5c7..b4fba9c 100644
--- a/target-tilegx/helper.c
+++ b/target-tilegx/helper.c
@@ -20,6 +20,7 @@
 
 #include "qemu/osdep.h"
 #include "cpu.h"
+#include "exec/exec-all.h"
 #include "qemu-common.h"
 #include "exec/helper-proto.h"
 #include <zlib.h> /* For crc32 */
diff --git a/target-tilegx/translate.c b/target-tilegx/translate.c
index 03918eb..bdea673 100644
--- a/target-tilegx/translate.c
+++ b/target-tilegx/translate.c
@@ -23,6 +23,7 @@
 #include "qemu/log.h"
 #include "exec/log.h"
 #include "disas/disas.h"
+#include "exec/exec-all.h"
 #include "tcg-op.h"
 #include "exec/cpu_ldst.h"
 #include "linux-user/syscall_defs.h"
diff --git a/target-tricore/cpu.c b/target-tricore/cpu.c
index 69fca8c..35d4ee4 100644
--- a/target-tricore/cpu.c
+++ b/target-tricore/cpu.c
@@ -21,6 +21,7 @@
 #include "qapi/error.h"
 #include "cpu.h"
 #include "qemu-common.h"
+#include "exec/exec-all.h"
 
 static inline void set_feature(CPUTriCoreState *env, int feature)
 {
diff --git a/target-tricore/cpu.h b/target-tricore/cpu.h
index cd350b4..640eb64 100644
--- a/target-tricore/cpu.h
+++ b/target-tricore/cpu.h
@@ -422,6 +422,4 @@ int cpu_tricore_handle_mmu_fault(CPUState *cpu, target_ulong address,
                                  int rw, int mmu_idx);
 #define cpu_handle_mmu_fault cpu_tricore_handle_mmu_fault
 
-#include "exec/exec-all.h"
-
 #endif /*__TRICORE_CPU_H__ */
diff --git a/target-tricore/helper.c b/target-tricore/helper.c
index 71b31cd..3118905 100644
--- a/target-tricore/helper.c
+++ b/target-tricore/helper.c
@@ -18,6 +18,7 @@
 #include "qemu/osdep.h"
 
 #include "cpu.h"
+#include "exec/exec-all.h"
 
 enum {
     TLBRET_DIRTY = -4,
diff --git a/target-tricore/op_helper.c b/target-tricore/op_helper.c
index 40656c3..a73ed53 100644
--- a/target-tricore/op_helper.c
+++ b/target-tricore/op_helper.c
@@ -18,6 +18,7 @@
 #include "cpu.h"
 #include "qemu/host-utils.h"
 #include "exec/helper-proto.h"
+#include "exec/exec-all.h"
 #include "exec/cpu_ldst.h"
 #include <zlib.h> /* for crc32 */
 
diff --git a/target-tricore/translate.c b/target-tricore/translate.c
index 912bf22..f20900b 100644
--- a/target-tricore/translate.c
+++ b/target-tricore/translate.c
@@ -21,6 +21,7 @@
 #include "qemu/osdep.h"
 #include "cpu.h"
 #include "disas/disas.h"
+#include "exec/exec-all.h"
 #include "tcg-op.h"
 #include "exec/cpu_ldst.h"
 
diff --git a/target-unicore32/cpu.c b/target-unicore32/cpu.c
index 66f43ac..3990433 100644
--- a/target-unicore32/cpu.c
+++ b/target-unicore32/cpu.c
@@ -17,6 +17,7 @@
 #include "cpu.h"
 #include "qemu-common.h"
 #include "migration/vmstate.h"
+#include "exec/exec-all.h"
 
 static void uc32_cpu_set_pc(CPUState *cs, vaddr value)
 {
diff --git a/target-unicore32/cpu.h b/target-unicore32/cpu.h
index 22a0aef..b477623 100644
--- a/target-unicore32/cpu.h
+++ b/target-unicore32/cpu.h
@@ -164,7 +164,6 @@ static inline int cpu_mmu_index(CPUUniCore32State *env, bool ifetch)
 }
 
 #include "exec/cpu-all.h"
-#include "exec/exec-all.h"
 
 int uc32_cpu_exec(CPUState *s);
 
diff --git a/target-unicore32/helper.c b/target-unicore32/helper.c
index 21f5f35..d603bde 100644
--- a/target-unicore32/helper.c
+++ b/target-unicore32/helper.c
@@ -11,6 +11,7 @@
 
 #include "qemu/osdep.h"
 #include "cpu.h"
+#include "exec/exec-all.h"
 #include "exec/gdbstub.h"
 #include "exec/helper-proto.h"
 #include "qemu/host-utils.h"
diff --git a/target-unicore32/op_helper.c b/target-unicore32/op_helper.c
index f584730..a782d33 100644
--- a/target-unicore32/op_helper.c
+++ b/target-unicore32/op_helper.c
@@ -11,6 +11,7 @@
 #include "qemu/osdep.h"
 #include "cpu.h"
 #include "exec/helper-proto.h"
+#include "exec/exec-all.h"
 #include "exec/cpu_ldst.h"
 
 #define SIGNBIT (uint32_t)0x80000000
diff --git a/target-unicore32/softmmu.c b/target-unicore32/softmmu.c
index d267fed..a34026a 100644
--- a/target-unicore32/softmmu.c
+++ b/target-unicore32/softmmu.c
@@ -14,6 +14,7 @@
 
 #include "qemu/osdep.h"
 #include <cpu.h>
+#include "exec/exec-all.h"
 
 #undef DEBUG_UC32
 
diff --git a/target-unicore32/translate.c b/target-unicore32/translate.c
index 39af3af..6529375 100644
--- a/target-unicore32/translate.c
+++ b/target-unicore32/translate.c
@@ -12,6 +12,7 @@
 
 #include "cpu.h"
 #include "disas/disas.h"
+#include "exec/exec-all.h"
 #include "tcg-op.h"
 #include "qemu/log.h"
 #include "exec/cpu_ldst.h"
diff --git a/target-xtensa/cpu.c b/target-xtensa/cpu.c
index 01b251f..5ad08a2 100644
--- a/target-xtensa/cpu.c
+++ b/target-xtensa/cpu.c
@@ -33,6 +33,7 @@
 #include "cpu.h"
 #include "qemu-common.h"
 #include "migration/vmstate.h"
+#include "exec/exec-all.h"
 
 
 static void xtensa_cpu_set_pc(CPUState *cs, vaddr value)
diff --git a/target-xtensa/cpu.h b/target-xtensa/cpu.h
index b1958f0..7b35576 100644
--- a/target-xtensa/cpu.h
+++ b/target-xtensa/cpu.h
@@ -427,6 +427,5 @@ static inline void cpu_get_tb_cpu_state(CPUXtensaState *env, target_ulong *pc,
 }
 
 #include "exec/cpu-all.h"
-#include "exec/exec-all.h"
 
 #endif
diff --git a/target-xtensa/gdbstub.c b/target-xtensa/gdbstub.c
index bfcd591..fa5469a 100644
--- a/target-xtensa/gdbstub.c
+++ b/target-xtensa/gdbstub.c
@@ -21,6 +21,7 @@
 #include "qemu-common.h"
 #include "cpu.h"
 #include "exec/gdbstub.h"
+#include "qemu/log.h"
 
 int xtensa_cpu_gdb_read_register(CPUState *cs, uint8_t *mem_buf, int n)
 {
diff --git a/target-xtensa/op_helper.c b/target-xtensa/op_helper.c
index 62fa33d..bc3667f 100644
--- a/target-xtensa/op_helper.c
+++ b/target-xtensa/op_helper.c
@@ -29,6 +29,7 @@
 #include "cpu.h"
 #include "exec/helper-proto.h"
 #include "qemu/host-utils.h"
+#include "exec/exec-all.h"
 #include "exec/cpu_ldst.h"
 #include "exec/address-spaces.h"
 #include "qemu/timer.h"
diff --git a/target-xtensa/translate.c b/target-xtensa/translate.c
index 9894488..c7c051a 100644
--- a/target-xtensa/translate.c
+++ b/target-xtensa/translate.c
@@ -36,6 +36,7 @@
 #include "tcg-op.h"
 #include "qemu/log.h"
 #include "sysemu/sysemu.h"
+#include "exec/exec-all.h"
 #include "exec/cpu_ldst.h"
 #include "exec/semihost.h"
 
diff --git a/tcg/tcg-op.c b/tcg/tcg-op.c
index 7a15914..54c0277 100644
--- a/tcg/tcg-op.c
+++ b/tcg/tcg-op.c
@@ -25,6 +25,7 @@
 #include "qemu/osdep.h"
 #include "qemu-common.h"
 #include "cpu.h"
+#include "exec/exec-all.h"
 #include "tcg.h"
 #include "tcg-op.h"
 
diff --git a/tcg/tcg.c b/tcg/tcg.c
index b46bf1a..e92d41a 100644
--- a/tcg/tcg.c
+++ b/tcg/tcg.c
@@ -46,6 +46,11 @@
 #define NO_CPU_IO_DEFS
 #include "cpu.h"
 
+#include "qemu/host-utils.h"
+#include "qemu/timer.h"
+#include "exec/cpu-common.h"
+#include "exec/exec-all.h"
+
 #include "tcg-op.h"
 
 #if UINTPTR_MAX == UINT32_MAX
diff --git a/translate-all.c b/translate-all.c
index b4df1ec..80985ea 100644
--- a/translate-all.c
+++ b/translate-all.c
@@ -29,6 +29,7 @@
 #include "cpu.h"
 #include "trace.h"
 #include "disas/disas.h"
+#include "exec/exec-all.h"
 #include "tcg.h"
 #if defined(CONFIG_USER_ONLY)
 #include "qemu.h"
diff --git a/user-exec.c b/user-exec.c
index d8d597b..c809daa 100644
--- a/user-exec.c
+++ b/user-exec.c
@@ -19,6 +19,7 @@
 #include "qemu/osdep.h"
 #include "cpu.h"
 #include "disas/disas.h"
+#include "exec/exec-all.h"
 #include "tcg.h"
 #include "qemu/bitops.h"
 #include "exec/cpu_ldst.h"
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 72+ messages in thread

* [Qemu-devel] [PATCH 49/50] hw: remove pio_addr_t
  2016-04-08 20:28 [Qemu-devel] [PATCH for-2.7 00/49] NEED_CPU_H / cpu.h / hw/hw.h cleanups Paolo Bonzini
                   ` (47 preceding siblings ...)
  2016-04-08 20:29 ` [Qemu-devel] [PATCH 48/50] cpu: move exec-all.h inclusion out of cpu.h Paolo Bonzini
@ 2016-04-08 20:29 ` Paolo Bonzini
  2016-04-18 14:01   ` Markus Armbruster
  2016-04-08 20:29 ` [Qemu-devel] [PATCH 50/50] hw: clean up hw/hw.h includes Paolo Bonzini
                   ` (2 subsequent siblings)
  51 siblings, 1 reply; 72+ messages in thread
From: Paolo Bonzini @ 2016-04-08 20:29 UTC (permalink / raw)
  To: qemu-devel

pio_addr_t is almost unused, because these days I/O ports are simply
accessed through the address space.  cpu_{in,out}[bwl] themselves are
almost unused; monitor.c and xen-hvm.c could use address_space_read/write
directly, since they have an integer size at hand.  This leaves qtest as
the only user of those functions.

Not the other hand even portio_* functions use this type; the only
interesting use of pio_addr_t thus is include/hw/sysbus.h.  I guess I
could move it there, but I don't see much benefit in that either.  Using
uint32_t is enough and avoids the need to include ioport.h everywhere.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 hw/core/sysbus.c      |  4 ++--
 include/exec/ioport.h | 15 ++++++---------
 include/hw/sysbus.h   |  4 ++--
 ioport.c              | 12 ++++++------
 xen-hvm.c             |  8 ++++----
 5 files changed, 20 insertions(+), 23 deletions(-)

diff --git a/hw/core/sysbus.c b/hw/core/sysbus.c
index a7dbe2b..c0f560b 100644
--- a/hw/core/sysbus.c
+++ b/hw/core/sysbus.c
@@ -190,9 +190,9 @@ MemoryRegion *sysbus_mmio_get_region(SysBusDevice *dev, int n)
     return dev->mmio[n].memory;
 }
 
-void sysbus_init_ioports(SysBusDevice *dev, pio_addr_t ioport, pio_addr_t size)
+void sysbus_init_ioports(SysBusDevice *dev, uint32_t ioport, uint32_t size)
 {
-    pio_addr_t i;
+    uint32_t i;
 
     for (i = 0; i < size; i++) {
         assert(dev->num_pio < QDEV_MAX_PIO);
diff --git a/include/exec/ioport.h b/include/exec/ioport.h
index 3bd6722..6a9639c 100644
--- a/include/exec/ioport.h
+++ b/include/exec/ioport.h
@@ -28,9 +28,6 @@
 #include "qom/object.h"
 #include "exec/memory.h"
 
-typedef uint32_t pio_addr_t;
-#define FMT_pioaddr     PRIx32
-
 #define MAX_IOPORTS     (64 * 1024)
 #define IOPORTS_MASK    (MAX_IOPORTS - 1)
 
@@ -49,12 +46,12 @@ typedef struct MemoryRegionPortio {
 extern const MemoryRegionOps unassigned_io_ops;
 #endif
 
-void cpu_outb(pio_addr_t addr, uint8_t val);
-void cpu_outw(pio_addr_t addr, uint16_t val);
-void cpu_outl(pio_addr_t addr, uint32_t val);
-uint8_t cpu_inb(pio_addr_t addr);
-uint16_t cpu_inw(pio_addr_t addr);
-uint32_t cpu_inl(pio_addr_t addr);
+void cpu_outb(uint32_t addr, uint8_t val);
+void cpu_outw(uint32_t addr, uint16_t val);
+void cpu_outl(uint32_t addr, uint32_t val);
+uint8_t cpu_inb(uint32_t addr);
+uint16_t cpu_inw(uint32_t addr);
+uint32_t cpu_inl(uint32_t addr);
 
 typedef struct PortioList {
     const struct MemoryRegionPortio *ports;
diff --git a/include/hw/sysbus.h b/include/hw/sysbus.h
index cc1dba4..a495937 100644
--- a/include/hw/sysbus.h
+++ b/include/hw/sysbus.h
@@ -72,7 +72,7 @@ struct SysBusDevice {
         MemoryRegion *memory;
     } mmio[QDEV_MAX_MMIO];
     int num_pio;
-    pio_addr_t pio[QDEV_MAX_PIO];
+    uint32_t pio[QDEV_MAX_PIO];
 };
 
 typedef int FindSysbusDeviceFunc(SysBusDevice *sbdev, void *opaque);
@@ -81,7 +81,7 @@ void sysbus_init_mmio(SysBusDevice *dev, MemoryRegion *memory);
 MemoryRegion *sysbus_mmio_get_region(SysBusDevice *dev, int n);
 void sysbus_init_irq(SysBusDevice *dev, qemu_irq *p);
 void sysbus_pass_irq(SysBusDevice *dev, SysBusDevice *target);
-void sysbus_init_ioports(SysBusDevice *dev, pio_addr_t ioport, pio_addr_t size);
+void sysbus_init_ioports(SysBusDevice *dev, uint32_t ioport, uint32_t size);
 
 
 bool sysbus_has_irq(SysBusDevice *dev, int n);
diff --git a/ioport.c b/ioport.c
index 901a997..94e08ab 100644
--- a/ioport.c
+++ b/ioport.c
@@ -55,14 +55,14 @@ const MemoryRegionOps unassigned_io_ops = {
     .endianness = DEVICE_NATIVE_ENDIAN,
 };
 
-void cpu_outb(pio_addr_t addr, uint8_t val)
+void cpu_outb(uint32_t addr, uint8_t val)
 {
     trace_cpu_out(addr, 'b', val);
     address_space_write(&address_space_io, addr, MEMTXATTRS_UNSPECIFIED,
                         &val, 1);
 }
 
-void cpu_outw(pio_addr_t addr, uint16_t val)
+void cpu_outw(uint32_t addr, uint16_t val)
 {
     uint8_t buf[2];
 
@@ -72,7 +72,7 @@ void cpu_outw(pio_addr_t addr, uint16_t val)
                         buf, 2);
 }
 
-void cpu_outl(pio_addr_t addr, uint32_t val)
+void cpu_outl(uint32_t addr, uint32_t val)
 {
     uint8_t buf[4];
 
@@ -82,7 +82,7 @@ void cpu_outl(pio_addr_t addr, uint32_t val)
                         buf, 4);
 }
 
-uint8_t cpu_inb(pio_addr_t addr)
+uint8_t cpu_inb(uint32_t addr)
 {
     uint8_t val;
 
@@ -92,7 +92,7 @@ uint8_t cpu_inb(pio_addr_t addr)
     return val;
 }
 
-uint16_t cpu_inw(pio_addr_t addr)
+uint16_t cpu_inw(uint32_t addr)
 {
     uint8_t buf[2];
     uint16_t val;
@@ -103,7 +103,7 @@ uint16_t cpu_inw(pio_addr_t addr)
     return val;
 }
 
-uint32_t cpu_inl(pio_addr_t addr)
+uint32_t cpu_inl(uint32_t addr)
 {
     uint8_t buf[4];
     uint32_t val;
diff --git a/xen-hvm.c b/xen-hvm.c
index 039680a..76dd76f 100644
--- a/xen-hvm.c
+++ b/xen-hvm.c
@@ -725,7 +725,7 @@ static ioreq_t *cpu_get_ioreq(XenIOState *state)
     return NULL;
 }
 
-static uint32_t do_inp(pio_addr_t addr, unsigned long size)
+static uint32_t do_inp(uint32_t addr, unsigned long size)
 {
     switch (size) {
         case 1:
@@ -735,11 +735,11 @@ static uint32_t do_inp(pio_addr_t addr, unsigned long size)
         case 4:
             return cpu_inl(addr);
         default:
-            hw_error("inp: bad size: %04"FMT_pioaddr" %lx", addr, size);
+            hw_error("inp: bad size: %04x %lx", addr, size);
     }
 }
 
-static void do_outp(pio_addr_t addr,
+static void do_outp(uint32_t addr,
         unsigned long size, uint32_t val)
 {
     switch (size) {
@@ -750,7 +750,7 @@ static void do_outp(pio_addr_t addr,
         case 4:
             return cpu_outl(addr, val);
         default:
-            hw_error("outp: bad size: %04"FMT_pioaddr" %lx", addr, size);
+            hw_error("outp: bad size: %04x %lx", addr, size);
     }
 }
 
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 72+ messages in thread

* [Qemu-devel] [PATCH 50/50] hw: clean up hw/hw.h includes
  2016-04-08 20:28 [Qemu-devel] [PATCH for-2.7 00/49] NEED_CPU_H / cpu.h / hw/hw.h cleanups Paolo Bonzini
                   ` (48 preceding siblings ...)
  2016-04-08 20:29 ` [Qemu-devel] [PATCH 49/50] hw: remove pio_addr_t Paolo Bonzini
@ 2016-04-08 20:29 ` Paolo Bonzini
  2016-04-18  8:42 ` [Qemu-devel] [PATCH for-2.7 00/49] NEED_CPU_H / cpu.h / hw/hw.h cleanups Markus Armbruster
  2016-04-18 14:07 ` Markus Armbruster
  51 siblings, 0 replies; 72+ messages in thread
From: Paolo Bonzini @ 2016-04-08 20:29 UTC (permalink / raw)
  To: qemu-devel

Include qom/object.h and exec/memory.h instead of exec/ioport.h;
exec/ioport.h was almost everywhere required only for those two
includes, not for the content of the header itself.

Remove block/aio.h, everybody is already including it through
another path.

With this change, include/hw/hw.h is freed from qemu-common.h.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 exec.c                | 1 +
 hw/gpio/gpio_key.c    | 1 +
 include/exec/ioport.h | 4 ----
 include/hw/hw.h       | 4 ++--
 include/hw/isa/isa.h  | 2 +-
 5 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/exec.c b/exec.c
index 29877b0..64956a4 100644
--- a/exec.c
+++ b/exec.c
@@ -41,6 +41,7 @@
 #else /* !CONFIG_USER_ONLY */
 #include "hw/hw.h"
 #include "exec/memory.h"
+#include "exec/ioport.h"
 #include "sysemu/dma.h"
 #include "exec/address-spaces.h"
 #include "sysemu/xen-mapcache.h"
diff --git a/hw/gpio/gpio_key.c b/hw/gpio/gpio_key.c
index ef28772..b34aa49 100644
--- a/hw/gpio/gpio_key.c
+++ b/hw/gpio/gpio_key.c
@@ -24,6 +24,7 @@
 
 #include "qemu/osdep.h"
 #include "hw/sysbus.h"
+#include "qemu/timer.h"
 
 #define TYPE_GPIOKEY "gpio-key"
 #define GPIOKEY(obj) OBJECT_CHECK(GPIOKEYState, (obj), TYPE_GPIOKEY)
diff --git a/include/exec/ioport.h b/include/exec/ioport.h
index 6a9639c..a298b89 100644
--- a/include/exec/ioport.h
+++ b/include/exec/ioport.h
@@ -24,10 +24,6 @@
 #ifndef IOPORT_H
 #define IOPORT_H
 
-#include "qemu-common.h"
-#include "qom/object.h"
-#include "exec/memory.h"
-
 #define MAX_IOPORTS     (64 * 1024)
 #define IOPORTS_MASK    (MAX_IOPORTS - 1)
 
diff --git a/include/hw/hw.h b/include/hw/hw.h
index 029b1e8..3669ebd 100644
--- a/include/hw/hw.h
+++ b/include/hw/hw.h
@@ -7,9 +7,9 @@
 #endif
 
 #include "exec/cpu-common.h"
-#include "exec/ioport.h"
+#include "qom/object.h"
+#include "exec/memory.h"
 #include "hw/irq.h"
-#include "block/aio.h"
 #include "migration/vmstate.h"
 #include "qemu/module.h"
 
diff --git a/include/hw/isa/isa.h b/include/hw/isa/isa.h
index ffb2ea7..c87fbad 100644
--- a/include/hw/isa/isa.h
+++ b/include/hw/isa/isa.h
@@ -3,8 +3,8 @@
 
 /* ISA bus */
 
-#include "exec/ioport.h"
 #include "exec/memory.h"
+#include "exec/ioport.h"
 #include "hw/qdev.h"
 
 #define ISA_NUM_IRQS 16
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 72+ messages in thread

* Re: [Qemu-devel] [PATCH 41/50] s390x: move stuff out of cpu.h
  2016-04-08 20:29 ` [Qemu-devel] [PATCH 41/50] s390x: move stuff out of cpu.h Paolo Bonzini
@ 2016-04-11  8:24   ` Cornelia Huck
  2016-05-09  9:43     ` Paolo Bonzini
  0 siblings, 1 reply; 72+ messages in thread
From: Cornelia Huck @ 2016-04-11  8:24 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: qemu-devel

On Fri,  8 Apr 2016 22:29:01 +0200
Paolo Bonzini <pbonzini@redhat.com> wrote:

> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  hw/s390x/css.c                              |   4 +-
>  hw/s390x/s390-skeys.c                       |   1 +
>  hw/s390x/s390-virtio-ccw.c                  |   4 +-
>  hw/s390x/virtio-ccw.c                       |   5 +-
>  hw/s390x/virtio-ccw.h                       |   3 +-
>  {hw => include/hw}/s390x/css.h              |  31 +++++++-
>  {target-s390x => include/hw/s390x}/ioinst.h |  16 +---
>  target-s390x/cpu.h                          | 117 ++++++----------------------
>  target-s390x/helper.c                       |   1 +
>  target-s390x/interrupt.c                    |  64 +++++++++++++++
>  target-s390x/ioinst.c                       |   2 +-
>  11 files changed, 131 insertions(+), 117 deletions(-)
>  rename {hw => include/hw}/s390x/css.h (76%)
>  rename {target-s390x => include/hw/s390x}/ioinst.h (87%)
> 

<did not review, but noticed the below:>

> diff --git a/target-s390x/interrupt.c b/target-s390x/interrupt.c
> index bad60a7..a13fd26 100644
> --- a/target-s390x/interrupt.c
> +++ b/target-s390x/interrupt.c
> @@ -10,6 +10,7 @@
>  #include "qemu/osdep.h"
>  #include "cpu.h"
>  #include "sysemu/kvm.h"
> +#include "hw/s390x/ioinst.h"
> 
>  /*
>   * All of the following interrupts are floating, i.e. not per-vcpu.

This used to be true before...

> @@ -17,6 +18,69 @@
>   * non-kvm case.
>   */
>  #if !defined(CONFIG_USER_ONLY)
> +void cpu_inject_ext(S390CPU *cpu, uint32_t code, uint32_t param,
> +                    uint64_t param64)

...but this one can be both floating and per-vcpu. Need to adust the
comment above?

> +{
> +    CPUS390XState *env = &cpu->env;
> +
> +    if (env->ext_index == MAX_EXT_QUEUE - 1) {
> +        /* ugh - can't queue anymore. Let's drop. */
> +        return;
> +    }
> +
> +    env->ext_index++;
> +    assert(env->ext_index < MAX_EXT_QUEUE);
> +
> +    env->ext_queue[env->ext_index].code = code;
> +    env->ext_queue[env->ext_index].param = param;
> +    env->ext_queue[env->ext_index].param64 = param64;
> +
> +    env->pending_int |= INTERRUPT_EXT;
> +    cpu_interrupt(CPU(cpu), CPU_INTERRUPT_HARD);
> +}
> +
> +void cpu_inject_io(S390CPU *cpu, uint16_t subchannel_id,
> +                   uint16_t subchannel_number,
> +                   uint32_t io_int_parm, uint32_t io_int_word)
> +{

This one...

> +    CPUS390XState *env = &cpu->env;
> +    int isc = IO_INT_WORD_ISC(io_int_word);
> +
> +    if (env->io_index[isc] == MAX_IO_QUEUE - 1) {
> +        /* ugh - can't queue anymore. Let's drop. */
> +        return;
> +    }
> +
> +    env->io_index[isc]++;
> +    assert(env->io_index[isc] < MAX_IO_QUEUE);
> +
> +    env->io_queue[env->io_index[isc]][isc].id = subchannel_id;
> +    env->io_queue[env->io_index[isc]][isc].nr = subchannel_number;
> +    env->io_queue[env->io_index[isc]][isc].parm = io_int_parm;
> +    env->io_queue[env->io_index[isc]][isc].word = io_int_word;
> +
> +    env->pending_int |= INTERRUPT_IO;
> +    cpu_interrupt(CPU(cpu), CPU_INTERRUPT_HARD);
> +}
> +
> +void cpu_inject_crw_mchk(S390CPU *cpu)
> +{

...and this one are always floating and therefore should only be called
from this file anyway (so they can be made static).

> +    CPUS390XState *env = &cpu->env;
> +
> +    if (env->mchk_index == MAX_MCHK_QUEUE - 1) {
> +        /* ugh - can't queue anymore. Let's drop. */
> +        return;
> +    }
> +
> +    env->mchk_index++;
> +    assert(env->mchk_index < MAX_MCHK_QUEUE);
> +
> +    env->mchk_queue[env->mchk_index].type = 1;
> +
> +    env->pending_int |= INTERRUPT_MCHK;
> +    cpu_interrupt(CPU(cpu), CPU_INTERRUPT_HARD);
> +}
> +
>  void s390_sclp_extint(uint32_t parm)
>  {
>      if (kvm_enabled()) {

^ permalink raw reply	[flat|nested] 72+ messages in thread

* Re: [Qemu-devel] [PATCH for-2.7 00/49] NEED_CPU_H / cpu.h / hw/hw.h cleanups
  2016-04-08 20:28 [Qemu-devel] [PATCH for-2.7 00/49] NEED_CPU_H / cpu.h / hw/hw.h cleanups Paolo Bonzini
                   ` (49 preceding siblings ...)
  2016-04-08 20:29 ` [Qemu-devel] [PATCH 50/50] hw: clean up hw/hw.h includes Paolo Bonzini
@ 2016-04-18  8:42 ` Markus Armbruster
  2016-04-18 14:07 ` Markus Armbruster
  51 siblings, 0 replies; 72+ messages in thread
From: Markus Armbruster @ 2016-04-18  8:42 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: qemu-devel, peter.maydell

Needs a rebase, but better delay rebasing until later, because this
stuff goes stale quickly.  What's your base commit?  Got a branch I can
pull?

^ permalink raw reply	[flat|nested] 72+ messages in thread

* Re: [Qemu-devel] [PATCH 01/50] scripts: add script to build QEMU and analyze inclusions
  2016-04-08 20:28 ` [Qemu-devel] [PATCH 01/50] scripts: add script to build QEMU and analyze inclusions Paolo Bonzini
@ 2016-04-18 13:10   ` Markus Armbruster
  2016-05-09 10:07     ` Paolo Bonzini
  2016-04-20 19:47   ` Alex Bennée
  1 sibling, 1 reply; 72+ messages in thread
From: Markus Armbruster @ 2016-04-18 13:10 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: qemu-devel

Paolo Bonzini <pbonzini@redhat.com> writes:

> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  scripts/analyze-inclusions | 89 ++++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 89 insertions(+)
>  create mode 100644 scripts/analyze-inclusions
>
> diff --git a/scripts/analyze-inclusions b/scripts/analyze-inclusions
> new file mode 100644
> index 0000000..e241bd4
> --- /dev/null
> +++ b/scripts/analyze-inclusions
> @@ -0,0 +1,89 @@
> +#! /bin/sh
> +#
> +# Copyright (C) 2016 Red Hat, Inc.
> +#
> +# Author: Paolo Bonzini <pbonzini@redhat.com>
> +#
> +# Print statistics about header file inclusions.
> +# The script configures and builds QEMU itself in a "+build"
> +# subdirectory which is left around when the script exits.
> +# To run the statistics on a pre-existing "+build" directory,
> +# pass "--no-build" as the first argument on the command line.
> +# Any other command line is passed directly to "make" (so
> +# you can for example pass a "-j" argument suitable for your
> +# system).
> +#
> +# Inspired by a post by Markus Armbruster.
> +
> +mkdir -p +build
> +cd +build
> +if test "x$1" != "x--no-build"; then
> +  test -f Makefile && make distclean
> +  ../configure
> +  make "$@"
> +fi

Instead of hardcoding +build, I'd require the user to run this in a
build tree of his choice.

Hardcoding +build is harder to misuse, though, since you get a clean
build by default.

Your choice.

Unfortunate: "mkdir -p +build" clobbers an existing symbolic link from
+build to the build tree of my choice.

> +
> +QEMU_CFLAGS=$(sed -n s/^QEMU_CFLAGS=//p config-host.mak)
> +QEMU_INCLUDES=$(sed -n s/^QEMU_INCLUDES=//p config-host.mak | \
> +    sed 's/$(SRC_PATH)/../g' )
> +CFLAGS=$(sed -n s/^CFLAGS=//p config-host.mak)
> +
> +grep_include() {
> +  find . -name "*.d" | xargs grep -l "$@" | wc -l

More robust against funny names would be:

     find . -name "*.d" -exec grep -l {} + | wc -l

Also slightly more efficient.  Neither matters much here, though.

> +}
> +
> +echo Found $(find . -name "*.d" | wc -l) object files
> +echo $(grep_include -F 'include/qemu-common.h') files include qemu-common.h
> +echo $(grep_include -F 'hw/hw.h') files include hw/hw.h
> +echo $(grep_include 'target-[a-z0-9]*/cpu\.h') files include cpu.h
> +echo $(grep_include -F 'qapi-types.h') files include qapi-types.h
> +echo $(grep_include -F 'trace/generated-tracers.h') files include generated-tracers.h
> +echo $(grep_include -F 'qapi/error.h') files include qapi/error.h
> +echo $(grep_include -F 'qom/object.h') files include qom/object.h
> +echo $(grep_include -F 'block/aio.h') files include block/aio.h
> +echo $(grep_include -F 'exec/memory.h') files include exec/memory.h
> +echo $(grep_include -F 'fpu/softfloat.h') files include fpu/softfloat.h
> +echo $(grep_include -F 'qemu/bswap.h') files include qemu/bswap.h
> +echo

How did you select these headers?

Instead of hardcoding a few well-known headers, we could count
everything.  We'd probably want to suppress the long tail by default.

Here's the ad hoc bash hackery I used for that (assumes source tree in
..):

    for i in `find . -name \*.d`
    do
        sed -n 's/\.h:$/.h/p' $i | sort -u
    done | sort | uniq -c | {
        declare -A h
        while read n f
        do
            [ -e $f ] || f=${f#../}
            [ -e $f ] || f=x86_64-softmmu/$f
            [ -e $f ]
            let 'h[$f] += n'
        done
        for f in ${!h[@]}
        do
            n=${h[$f]}
            s=`wc -c $f | sed 's/ .*//'`
            printf "%9d %7d %6d %s\n" $((s*n)) $s $n $f
        done
    } | sort -nr

Prints four columns: header size * number of inclusions, header size,
number of inclusions, header file name.

> +
> +awk1='
> +    /^# / { file = $3;next }
> +    NR>1 { bytes[file]+=length; lines[file]++ }

Your #bytes is off by one, because AWK chops off the newlines.  I think
you want length() + 1.

>From the gawk docs:

          NOTE: In older versions of 'awk', the 'length()' function
          could be called without any parentheses.  Doing so is
          considered poor practice, although the 2008 POSIX standard
          explicitly allows it, to support historical practice.  For
          programs to be maximally portable, always supply the
          parentheses.

> +    END { for(i in lines) print i,lines[i],bytes[i] }'
> +
> +awk2='
> +    {tot_l+=$2;tot_b+=$3;tot_f++}
> +    /\/usr.*\/glib/ {glib_l+=$2;glib_b+=$3;glib_f++;next}
> +    /\/usr/ {sys_l+=$2;sys_b+=$3;sys_f++;next}
> +    {qemu_l+=$2;qemu_b+=$3;qemu_f++;next}
> +    END {
> +      printf "%s\t %s\t %s\t %s\n", "lines", "bytes", "files", "source"
> +      printf "%s\t %s\t %s\t %s\n", qemu_l, qemu_b, qemu_f, "QEMU"
> +      printf "%s\t %s\t %s\t %s\n", sys_l, sys_b, sys_f, "system"
> +      printf "%s\t %s\t %s\t %s\n", glib_l, glib_b, glib_f, "glib"
> +      printf "%s\t %s\t %s\t %s\n", tot_l, tot_b, tot_f, "total"
> +    }'

For comparision, here's how I hacked this up:

stats()
{
    n=$1
    shift
    awk '/^#/ { c["#"]++; s["#"]+=length($0)+1; f=$3; next }
{ c[f]++; s[f]+=length($0)+1 }
END { for (i in c) {
        printf "%8d %7d %s\n", c[i], s[i], i; n++
        ct+=c[i]; st+=s[i]
    }
    printf "%8d %7d %d\n", ct, st, n }' $n.i | sort -k 3 >$n.out
    echo
    echo "$@"
    echo "  #lines  KiBytes  #files  source"
    awk 'function pr(c, s, n, t) { printf "%8d %7d %7d   %s\n", c, s/1024, n, t }
{ tc+=$1; ts+=$2; tn++ }
$3 ~ /\/glib-2.0\// { gc+=$1; gs+=$2; gn++; next }
$3 ~ /^"\/usr\// { uc+=$1; us+=$2; un++; next }
$3 == "#" { hc+=$1; hs+=$2; hn++; next }
$3 !~ /^[0-9]/ { qc+=$1; qs+=$2; qn++ }
END { pr(qc, qs, qn, "QEMU")
    pr(uc, us, un, "system")
    pr(gc, gs, gn, "GLib")
    pr(hc, hs, hn, "# lines")
    pr(qc+uc+gc+hc, qs+us+gs+hs, qn+un+gn+hn, "total") }' $n.out
}

> +
> +analyze() {
> +  cc $QEMU_CFLAGS $QEMU_INCLUDES $CFLAGS  -E -o - "$@" | \
> +    awk "$awk1" | awk "$awk2"
> +  echo
> +}
> +
> +echo osdep.h:
> +analyze ../include/qemu/osdep.h
> +
> +echo qemu-common.h:
> +analyze  -include ../include/qemu/osdep.h ../include/qemu-common.h
> +
> +echo hw/hw.h:
> +analyze -include ../include/qemu/osdep.h ../include/hw/hw.h
> +
> +echo trace/generated-tracers.h:
> +analyze -include ../include/qemu/osdep.h trace/generated-tracers.h
> +
> +echo target-i386/cpu.h:
> +analyze -DNEED_CPU_H -I../target-i386 -Ii386-softmmu -include ../include/qemu/osdep.h ../target-i386/cpu.h
> +
> +echo hw/hw.h + NEED_CPU_H:
> +analyze -DNEED_CPU_H -I../target-i386 -Ii386-softmmu -include ../include/qemu/osdep.h ../include/hw/hw.h

We want to watch commonly included big headers, especially the ones that
are prone to indirect inclusion.  These will change as we go.

Output of my header counting bash script (first 64 lines appended)
provides possible additional initial candidates.


479379846  124806   3841 qapi-types.h
199662236   55756   3581 /work/armbru/qemu/include/qom/object.h
187691645   53857   3485 /work/armbru/qemu/include/exec/memory.h
118894840   30643   3880 /work/armbru/qemu/include/fpu/softfloat.h
109943680  124936    880 trace/generated-events.h
 88524072   27022   3276 /work/armbru/qemu/include/qom/cpu.h
 82757301   46519   1779 /work/armbru/qemu/include/migration/vmstate.h
 82340280   21510   3828 /work/armbru/qemu/include/qemu/queue.h
 63362110   19259   3290 /work/armbru/qemu/include/disas/bfd.h
 62800785   26667   2355 /work/armbru/qemu/include/qemu/timer.h
 52975068   13828   3831 /work/armbru/qemu/include/qemu/atomic.h
 51315482   16442   3121 /work/armbru/qemu/include/exec/exec-all.h
 48329904   13944   3466 /work/armbru/qemu/include/hw/qdev-core.h
 47768052   12508   3819 /work/armbru/qemu/include/qemu/host-utils.h
 45446418   12603   3606 /work/armbru/qemu/include/qemu/bitops.h
 44024926  102146    431 /work/armbru/qemu/target-ppc/cpu.h
 38564586   79351    486 /work/armbru/qemu/target-arm/cpu.h
 37448181    9459   3959 /work/armbru/qemu/include/qemu/osdep.h
 35412449    9263   3823 /work/armbru/qemu/include/qemu/bswap.h
 34768410   84801    410 /work/armbru/qemu/linux-user/syscall_defs.h
 32384620    8180   3959 /work/armbru/qemu/include/glib-compat.h
 30675274    8722   3517 /work/armbru/qemu/include/qemu/bitmap.h
 29553480   14487   2040 /work/armbru/qemu/include/block/aio.h
 28660968   49077    584 /work/armbru/qemu/include/standard-headers/linux/pci_regs.h
 26771938    8578   3121 /work/armbru/qemu/include/exec/cpu-all.h
 26076375   23179   1125 /work/armbru/qemu/include/block/block.h
 23502126    6154   3819 /work/armbru/qemu/include/qemu/option.h
 21961012    5758   3814 /work/armbru/qemu/include/qemu-common.h
 20414844   17814   1146 /work/armbru/qemu/include/sysemu/kvm.h
 20357714   34043    598 /work/armbru/qemu/tcg/tcg.h
 17830273    5713   3121 /work/armbru/qemu/include/exec/cpu-defs.h
 17747303   34867    509 /work/armbru/qemu/target-mips/cpu.h
 17693696   59776    296 /work/armbru/qemu/include/elf.h
 17242542   10107   1706 /work/armbru/qemu/include/migration/qemu-file.h
 16867400   11275   1496 /work/armbru/qemu/include/hw/qdev-properties.h
 16589807    4709   3523 /work/armbru/qemu/include/exec/cpu-common.h
 15574706    3934   3959 /work/armbru/qemu/include/qemu/typedefs.h
 15539459    4979   3121 /work/armbru/qemu/tcg/i386/tcg-target.h
 14808486   10241   1446 /work/armbru/qemu/include/qemu/main-loop.h
 14653088    4201   3488 /work/armbru/qemu/include/qemu/rcu.h
 14620587    3693   3959 config-host.h
 14311504   24506    584 /work/armbru/qemu/include/hw/pci/pci.h
 13875582   45794    303 /work/armbru/qemu/target-i386/cpu.h
 13025073   10027   1299 /work/armbru/qemu/include/qapi/error.h
 12931152    3657   3536 /work/armbru/qemu/include/qemu/log.h
 11520690    2910   3959 /work/armbru/qemu/include/qemu/compiler.h
 10893750    8750   1245 /work/armbru/qemu/include/sysemu/sysemu.h
 10214680    2674   3820 /work/armbru/qemu/include/qapi/qmp/qdict.h
 10129776    2649   3824 /work/armbru/qemu/include/qapi/qmp/qobject.h
  9114743    2629   3467 /work/armbru/qemu/include/hw/hotplug.h
  8747820   38034    230 /work/armbru/qemu/tcg/tcg-op.h
  8147622    2058   3959 /work/armbru/qemu/include/sysemu/os-posix.h
  8082800    6680   1210 /work/armbru/qemu/include/qemu/iov.h
  7691673    2013   3821 /work/armbru/qemu/include/qemu/module.h
  7522880   23509    320 qmp-commands.h
  7284094    6469   1126 /work/armbru/qemu/include/qemu/hbitmap.h
  7214376    1976   3651 /work/armbru/qemu/include/qemu/thread.h
  6756243    2721   2483 /work/armbru/qemu/include/qemu/int128.h
  6706616    5842   1148 /work/armbru/qemu/include/qemu/coroutine.h
  6601240   10445    632 /work/armbru/qemu/include/exec/cpu_ldst.h
  6306784    1804   3496 /work/armbru/qemu/include/hw/irq.h
  6285708   15444    407 /work/armbru/qemu/linux-user/qemu.h
  6109779    1599   3821 /work/armbru/qemu/include/qapi/qmp/qlist.h
  5626144    1613   3488 /work/armbru/qemu/include/exec/memattrs.h

^ permalink raw reply	[flat|nested] 72+ messages in thread

* Re: [Qemu-devel] [PATCH 13/50] target-ppc: do not use target_ulong in cpu-qom.h
  2016-04-08 20:28 ` [Qemu-devel] [PATCH 13/50] target-ppc: do not use target_ulong in cpu-qom.h Paolo Bonzini
@ 2016-04-18 13:46   ` Markus Armbruster
  0 siblings, 0 replies; 72+ messages in thread
From: Markus Armbruster @ 2016-04-18 13:46 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: qemu-devel

Paolo Bonzini <pbonzini@redhat.com> writes:

> Bring the PowerPCCPUClass handle_mmu_fault method type into line with
> the one in CPUState.

You mean CPUClass, don't you?

> Using vaddr also makes the cpu-qom.h file target independent.
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

^ permalink raw reply	[flat|nested] 72+ messages in thread

* Re: [Qemu-devel] [PATCH 39/50] gdbstub: remove includes from gdbstub-xml.c
  2016-04-08 20:28 ` [Qemu-devel] [PATCH 39/50] gdbstub: remove includes from gdbstub-xml.c Paolo Bonzini
@ 2016-04-18 13:54   ` Markus Armbruster
  2016-04-18 14:12     ` Peter Maydell
  0 siblings, 1 reply; 72+ messages in thread
From: Markus Armbruster @ 2016-04-18 13:54 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: qemu-devel

Paolo Bonzini <pbonzini@redhat.com> writes:

> gdbstub-xml.c defines a bunch of arrays of strings; there is no
> need to include anything.
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  scripts/feature_to_c.sh | 3 ---
>  1 file changed, 3 deletions(-)
>
> diff --git a/scripts/feature_to_c.sh b/scripts/feature_to_c.sh
> index fb1f336..0994d95 100644
> --- a/scripts/feature_to_c.sh
> +++ b/scripts/feature_to_c.sh
> @@ -36,9 +36,6 @@ for input; do
>    arrayname=xml_feature_`echo $input | sed 's,.*/,,; s/[-.]/_/g'`
>  
>    ${AWK:-awk} 'BEGIN { n = 0
> -      printf "#include \"qemu/osdep.h\"\n"
> -      printf "#include \"qemu-common.h\"\n"
> -      printf "#include \"exec/gdbstub.h\"\n"
>        print "static const char '$arrayname'[] = {"
>        for (i = 0; i < 255; i++)
>          _ord_[sprintf("%c", i)] = i

We might want to include osdep.h anyway, just to avoid adding an
exception to the rule "any C file must include qemu/osdep.h first."

^ permalink raw reply	[flat|nested] 72+ messages in thread

* Re: [Qemu-devel] [PATCH 49/50] hw: remove pio_addr_t
  2016-04-08 20:29 ` [Qemu-devel] [PATCH 49/50] hw: remove pio_addr_t Paolo Bonzini
@ 2016-04-18 14:01   ` Markus Armbruster
  0 siblings, 0 replies; 72+ messages in thread
From: Markus Armbruster @ 2016-04-18 14:01 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: qemu-devel

Paolo Bonzini <pbonzini@redhat.com> writes:

> pio_addr_t is almost unused, because these days I/O ports are simply
> accessed through the address space.  cpu_{in,out}[bwl] themselves are
> almost unused; monitor.c and xen-hvm.c could use address_space_read/write
> directly, since they have an integer size at hand.  This leaves qtest as
> the only user of those functions.
>
> Not the other hand even portio_* functions use this type; the only

On the other hand?

> interesting use of pio_addr_t thus is include/hw/sysbus.h.  I guess I
> could move it there, but I don't see much benefit in that either.  Using
> uint32_t is enough and avoids the need to include ioport.h everywhere.
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

^ permalink raw reply	[flat|nested] 72+ messages in thread

* Re: [Qemu-devel] [PATCH for-2.7 00/49] NEED_CPU_H / cpu.h / hw/hw.h cleanups
  2016-04-08 20:28 [Qemu-devel] [PATCH for-2.7 00/49] NEED_CPU_H / cpu.h / hw/hw.h cleanups Paolo Bonzini
                   ` (50 preceding siblings ...)
  2016-04-18  8:42 ` [Qemu-devel] [PATCH for-2.7 00/49] NEED_CPU_H / cpu.h / hw/hw.h cleanups Markus Armbruster
@ 2016-04-18 14:07 ` Markus Armbruster
  51 siblings, 0 replies; 72+ messages in thread
From: Markus Armbruster @ 2016-04-18 14:07 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: qemu-devel, peter.maydell

Paolo Bonzini <pbonzini@redhat.com> writes:

> (CCs only on cover letter due to huge series).
>
> I am sending this now because of vacation coming soon (yay!).
> This series removes usage of NEED_CPU_H from several central
> include files in QEMU, most notably hw/hw.h and qemu-common.h.
> Definitions conditional on NEED_CPU_H remain only in disas/disas.h,
> exec/gdbstub.h, exec/helper-head.h and exec/log.h.
>
> The interesting patches are interspersed with other miscellaenous
> cleanups that I won't really dwell on in the cover letter.  Most
> of them are just making indirect inclusions explicit.
>
> Patches 5 to 27 make sure that target-independent code can access
> QOM objects for the CPU through an opaque type.  This is useful
> because often target-independent code uses a target-specific header
> file that happens to use pointers to ARMCPU* or similar.  The
> target-independent code itself does not use the pointed-to object,
> but the very presenece of the ARMCPU* name means that all users of
> that header have to bring in cpu.h.  By providing the opaque type,
> a much smaller API can be exposed to all these users in hw/.
>
> Patches 34 to 37 remove NEED_CPU_H from hw/hw.h, exec/memory.h
> and exec/cpu-common.h.
>
> Patches 38 and 39 remove two nested inclusions from qemu-common.h.
> This should make Markus's patch to remove unnecessary qemu-common.h
> inclusions even more effective.
>
> Patches 42 and 43 disentangle qemu-common.h and cpu.h, so that all
> users of the latter have to be explicit.  This has the biggest
> effect on reducing include pollution (the next offender is now
> exec/cpu-common.h).
>
> Patches 46 to 50 remove more nested inclusions, and especially:
> 1) the inclusion of the (TCG-specific) exec-all.h header from
> cpu.h, so that non-TCG functions cannot anymore creep into
> exec-all.h; 2) indirect qemu-common.h inclusion in hw/hw.h.
>
> At the end, hw/hw.h includes 13 fewer headers indirectly compared
> to before when NEED_CPU_H is not defined, and 27 fewer headers
> when NEED_CPU_H is defined.  This was found with the script of
> patch 1, which produces the following statistics:
>
> Compiled 3979 files                         | After: 4006 (nmi.o now built per target)
> 3773 files include qemu-common.h            | After: 3702 (-71)
> 1658 files include hw/hw.h                  | After: 1589 (-69)
> 3101 files include cpu.h                    | After: 2337 (-764, -25%!)
> 3800 files include qapi-types.h             | After: 3811 (+11, mostly from nmi.c)
>  844 files include generated-tracers.h      | After: 844
> 1270 files include qapi/error.h             | After: 1297 (+27, from nmi.c)
> 1996 files include block/aio.h              | After: 1647 (-349, -18%)
> 3544 files include qom/object.h             | After: 3514 (-30)
> 3451 files include exec/memory.h            | After: 3540 (+89, from indirect inclusions)
> 3840 files include fpu/softfloat.h          | After: 3701 (-139)
> 3783 files include qemu/bswap.h             | After: 3644 (-139)
>                                             |
> osdep.h:                                    | After: (adds exec/poison.h)
> lines    bytes   files   source             | lines    bytes   files   source
> 174      4944    3       QEMU               | 226      5217    4       QEMU
> 17460    440677  157     total              | 17512    440950  158     total
>                                             |
> qemu-common.h:                              | After:
> lines    bytes   files   source             | lines    bytes   files   source
> 7037     160007  14      QEMU               | 5919     132798  12      QEMU
> 24323    595740  168     total              | 23205    568531  166     total
>                                             |
> hw/hw.h:                                    | After:
> lines    bytes   files   source             | lines    bytes   files   source
> 9714     228659  36      QEMU               | 8458     201740  24      QEMU
> 27052    665298  192     total              | 25796    638379  180     total
>                                             |
> target-i386/cpu.h:                          | After:
> lines    bytes   files   source             | lines    bytes   files   source
> 11259    270041  41      QEMU               | 10981    263615  39      QEMU
> 28597    706680  197     total              | 28319    700254  195     total
>                                             |
> hw/hw.h + NEED_CPU_H:                       | After:
> lines    bytes   files   source             | lines    bytes   files   source
> 12340    294661  50      QEMU               | 8407     201467  23      QEMU
> 29678    731300  206     total              | 25745    638106  179     total
>
> The next objectives should be removing unnecessary inclusions from/of
> qemu-common.h (or delete it altogether) and exec/cpu-common.h.

I skimmed the whole series, and it all looks sane to me.

As your stats show, there's more work to do.  However, I believe your
series takes care of some of the hairier parts.  Very much appreaciated.

^ permalink raw reply	[flat|nested] 72+ messages in thread

* Re: [Qemu-devel] [PATCH 39/50] gdbstub: remove includes from gdbstub-xml.c
  2016-04-18 13:54   ` Markus Armbruster
@ 2016-04-18 14:12     ` Peter Maydell
  0 siblings, 0 replies; 72+ messages in thread
From: Peter Maydell @ 2016-04-18 14:12 UTC (permalink / raw)
  To: Markus Armbruster; +Cc: Paolo Bonzini, QEMU Developers

On 18 April 2016 at 14:54, Markus Armbruster <armbru@redhat.com> wrote:
> Paolo Bonzini <pbonzini@redhat.com> writes:
>
>> gdbstub-xml.c defines a bunch of arrays of strings; there is no
>> need to include anything.

> We might want to include osdep.h anyway, just to avoid adding an
> exception to the rule "any C file must include qemu/osdep.h first."

Yes, I think we should be consistent there.

thanks
-- PMM

^ permalink raw reply	[flat|nested] 72+ messages in thread

* Re: [Qemu-devel] [PATCH 46/50] hw: explicitly include qemu/log.h
  2016-04-08 20:29 ` [Qemu-devel] [PATCH 46/50] hw: explicitly include qemu/log.h Paolo Bonzini
@ 2016-04-20 18:30   ` Alex Bennée
  0 siblings, 0 replies; 72+ messages in thread
From: Alex Bennée @ 2016-04-20 18:30 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: qemu-devel


Paolo Bonzini <pbonzini@redhat.com> writes:

> Move the inclusion out of hw/hw.h, most files do not need it.

This failed when I applied the series to 4113b05

>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  hw/arm/ast2400.c               | 1 +
>  hw/arm/nseries.c               | 1 +
>  hw/arm/palmetto-bmc.c          | 1 +
>  hw/arm/pxa2xx_gpio.c           | 1 +
>  hw/arm/stellaris.c             | 1 +
>  hw/arm/strongarm.c             | 1 +
>  hw/arm/xlnx-ep108.c            | 1 +
>  hw/audio/pl041.c               | 1 +
>  hw/block/m25p80.c              | 1 +
>  hw/block/pflash_cfi01.c        | 1 +
>  hw/char/bcm2835_aux.c          | 1 +
>  hw/char/cadence_uart.c         | 4 ++++
>  hw/char/digic-uart.c           | 1 +
>  hw/char/imx_serial.c           | 1 +
>  hw/char/pl011.c                | 1 +
>  hw/char/stm32f2xx_usart.c      | 1 +
>  hw/display/bcm2835_fb.c        | 1 +
>  hw/display/cg3.c               | 1 +
>  hw/display/pl110.c             | 1 +
>  hw/display/virtio-gpu.c        | 1 +
>  hw/dma/bcm2835_dma.c           | 1 +
>  hw/dma/pl080.c                 | 1 +
>  hw/dma/pl330.c                 | 1 +
>  hw/dma/rc4030.c                | 1 +
>  hw/gpio/imx_gpio.c             | 1 +
>  hw/gpio/pl061.c                | 1 +
>  hw/i2c/imx_i2c.c               | 1 +
>  hw/i2c/versatile_i2c.c         | 1 +
>  hw/input/pl050.c               | 1 +
>  hw/intc/allwinner-a10-pic.c    | 1 +
>  hw/intc/arm_gic.c              | 1 +
>  hw/intc/arm_gicv2m.c           | 1 +
>  hw/intc/armv7m_nvic.c          | 1 +
>  hw/intc/bcm2835_ic.c           | 1 +
>  hw/intc/bcm2836_control.c      | 1 +
>  hw/intc/i8259.c                | 1 +
>  hw/intc/imx_avic.c             | 1 +
>  hw/intc/openpic.c              | 1 +
>  hw/intc/pl190.c                | 1 +
>  hw/misc/arm11scu.c             | 1 +
>  hw/misc/arm_integrator_debug.c | 1 +
>  hw/misc/arm_l2x0.c             | 1 +
>  hw/misc/arm_sysctl.c           | 1 +
>  hw/misc/bcm2835_mbox.c         | 1 +
>  hw/misc/bcm2835_property.c     | 1 +
>  hw/misc/imx25_ccm.c            | 1 +
>  hw/misc/imx31_ccm.c            | 1 +
>  hw/misc/imx6_ccm.c             | 1 +
>  hw/misc/imx_ccm.c              | 1 +
>  hw/misc/macio/cuda.c           | 1 +
>  hw/misc/macio/mac_dbdma.c      | 1 +
>  hw/misc/mips_cmgcr.c           | 1 +
>  hw/misc/mips_cpc.c             | 1 +
>  hw/misc/mips_itu.c             | 1 +
>  hw/misc/stm32f2xx_syscfg.c     | 1 +
>  hw/misc/zynq-xadc.c            | 1 +
>  hw/misc/zynq_slcr.c            | 1 +
>  hw/net/allwinner_emac.c        | 1 +
>  hw/net/fsl_etsec/etsec.c       | 1 +
>  hw/net/fsl_etsec/rings.c       | 2 +-
>  hw/net/imx_fec.c               | 1 +
>  hw/net/lan9118.c               | 1 +
>  hw/net/spapr_llan.c            | 1 +
>  hw/pci-host/apb.c              | 1 +
>  hw/pci-host/versatile.c        | 1 +
>  hw/ppc/spapr.c                 | 1 +
>  hw/ppc/spapr_hcall.c           | 1 +
>  hw/ppc/spapr_iommu.c           | 1 +
>  hw/ppc/spapr_rtas.c            | 1 +
>  hw/ppc/spapr_vio.c             | 1 +
>  hw/sd/pl181.c                  | 1 +
>  hw/sd/sd.c                     | 1 +
>  hw/sd/sdhci.c                  | 1 +
>  hw/ssi/pl022.c                 | 1 +
>  hw/timer/allwinner-a10-pit.c   | 1 +
>  hw/timer/arm_timer.c           | 1 +
>  hw/timer/digic-timer.c         | 1 +
>  hw/timer/imx_epit.c            | 1 +
>  hw/timer/imx_gpt.c             | 1 +
>  hw/timer/pl031.c               | 1 +
>  hw/timer/stm32f2xx_timer.c     | 1 +
>  hw/watchdog/wdt_diag288.c      | 1 +
>  include/hw/hw.h                | 1 -
>  monitor.c                      | 1 +
>  vl.c                           | 1 +
>  85 files changed, 87 insertions(+), 2 deletions(-)
>
> diff --git a/hw/arm/ast2400.c b/hw/arm/ast2400.c
> index 03f9938..5510a8a 100644
> --- a/hw/arm/ast2400.c
> +++ b/hw/arm/ast2400.c
> @@ -17,6 +17,7 @@
>  #include "exec/address-spaces.h"
>  #include "hw/arm/ast2400.h"
>  #include "hw/char/serial.h"
> +#include "qemu/log.h"
>
>  #define AST2400_UART_5_BASE      0x00184000
>  #define AST2400_IOMEM_SIZE       0x00200000
> diff --git a/hw/arm/nseries.c b/hw/arm/nseries.c
> index 43a78c2..6ed3dd3 100644
> --- a/hw/arm/nseries.c
> +++ b/hw/arm/nseries.c
> @@ -37,6 +37,7 @@
>  #include "hw/loader.h"
>  #include "sysemu/block-backend.h"
>  #include "hw/sysbus.h"
> +#include "qemu/log.h"
>  #include "exec/address-spaces.h"
>
>  /* Nokia N8x0 support */
> diff --git a/hw/arm/palmetto-bmc.c b/hw/arm/palmetto-bmc.c
> index 89ebd92..a51d960 100644
> --- a/hw/arm/palmetto-bmc.c
> +++ b/hw/arm/palmetto-bmc.c
> @@ -17,6 +17,7 @@
>  #include "hw/arm/arm.h"
>  #include "hw/arm/ast2400.h"
>  #include "hw/boards.h"
> +#include "qemu/log.h"
>
>  static struct arm_boot_info palmetto_bmc_binfo = {
>      .loader_start = AST2400_SDRAM_BASE,
> diff --git a/hw/arm/pxa2xx_gpio.c b/hw/arm/pxa2xx_gpio.c
> index 8c9626e..576a8eb 100644
> --- a/hw/arm/pxa2xx_gpio.c
> +++ b/hw/arm/pxa2xx_gpio.c
> @@ -12,6 +12,7 @@
>  #include "hw/hw.h"
>  #include "hw/sysbus.h"
>  #include "hw/arm/pxa.h"
> +#include "qemu/log.h"
>
>  #define PXA2XX_GPIO_BANKS	4
>
> diff --git a/hw/arm/stellaris.c b/hw/arm/stellaris.c
> index c1766f8..54f7010 100644
> --- a/hw/arm/stellaris.c
> +++ b/hw/arm/stellaris.c
> @@ -17,6 +17,7 @@
>  #include "hw/i2c/i2c.h"
>  #include "net/net.h"
>  #include "hw/boards.h"
> +#include "qemu/log.h"
>  #include "exec/address-spaces.h"
>  #include "sysemu/sysemu.h"
>
> diff --git a/hw/arm/strongarm.c b/hw/arm/strongarm.c
> index 1eeb1ab..aa5ddbf 100644
> --- a/hw/arm/strongarm.c
> +++ b/hw/arm/strongarm.c
> @@ -38,6 +38,7 @@
>  #include "sysemu/sysemu.h"
>  #include "hw/ssi/ssi.h"
>  #include "qemu/cutils.h"
> +#include "qemu/log.h"
>
>  //#define DEBUG
>
> diff --git a/hw/arm/xlnx-ep108.c b/hw/arm/xlnx-ep108.c
> index 5f48018..40f7cc1 100644
> --- a/hw/arm/xlnx-ep108.c
> +++ b/hw/arm/xlnx-ep108.c
> @@ -23,6 +23,7 @@
>  #include "hw/boards.h"
>  #include "qemu/error-report.h"
>  #include "exec/address-spaces.h"
> +#include "qemu/log.h"
>
>  typedef struct XlnxEP108 {
>      XlnxZynqMPState soc;
> diff --git a/hw/audio/pl041.c b/hw/audio/pl041.c
> index 4717bc9..6e9c104 100644
> --- a/hw/audio/pl041.c
> +++ b/hw/audio/pl041.c
> @@ -22,6 +22,7 @@
>
>  #include "qemu/osdep.h"
>  #include "hw/sysbus.h"
> +#include "qemu/log.h"
>
>  #include "pl041.h"
>  #include "lm4549.h"
> diff --git a/hw/block/m25p80.c b/hw/block/m25p80.c
> index 906b712..05f864f 100644
> --- a/hw/block/m25p80.c
> +++ b/hw/block/m25p80.c
> @@ -27,6 +27,7 @@
>  #include "sysemu/blockdev.h"
>  #include "hw/ssi/ssi.h"
>  #include "qemu/bitops.h"
> +#include "qemu/log.h"
>
>  #ifndef M25P80_ERR_DEBUG
>  #define M25P80_ERR_DEBUG 0
> diff --git a/hw/block/pflash_cfi01.c b/hw/block/pflash_cfi01.c
> index c475c2a..43cb0b6 100644
> --- a/hw/block/pflash_cfi01.c
> +++ b/hw/block/pflash_cfi01.c
> @@ -45,6 +45,7 @@
>  #include "qemu/bitops.h"
>  #include "exec/address-spaces.h"
>  #include "qemu/host-utils.h"
> +#include "qemu/log.h"
>  #include "hw/sysbus.h"
>
>  #define PFLASH_BUG(fmt, ...) \
> diff --git a/hw/char/bcm2835_aux.c b/hw/char/bcm2835_aux.c
> index 0394d11..319f165 100644
> --- a/hw/char/bcm2835_aux.c
> +++ b/hw/char/bcm2835_aux.c
> @@ -22,6 +22,7 @@
>
>  #include "qemu/osdep.h"
>  #include "hw/char/bcm2835_aux.h"
> +#include "qemu/log.h"
>
>  #define AUX_IRQ         0x0
>  #define AUX_ENABLES     0x4
> diff --git a/hw/char/cadence_uart.c b/hw/char/cadence_uart.c
> index 486591b..0e53210 100644
> --- a/hw/char/cadence_uart.c
> +++ b/hw/char/cadence_uart.c
> @@ -17,6 +17,10 @@
>   */
>
>  #include "qemu/osdep.h"
> +#include "hw/sysbus.h"
> +#include "sysemu/char.h"
> +#include "qemu/timer.h"
> +#include "qemu/log.h"
>  #include "hw/char/cadence_uart.h"
>
>  #ifdef CADENCE_UART_ERR_DEBUG
> diff --git a/hw/char/digic-uart.c b/hw/char/digic-uart.c
> index d3bc533..0e44878 100644
> --- a/hw/char/digic-uart.c
> +++ b/hw/char/digic-uart.c
> @@ -30,6 +30,7 @@
>  #include "hw/hw.h"
>  #include "hw/sysbus.h"
>  #include "sysemu/char.h"
> +#include "qemu/log.h"
>
>  #include "hw/char/digic-uart.h"
>
> diff --git a/hw/char/imx_serial.c b/hw/char/imx_serial.c
> index 6df74ac..44856d6 100644
> --- a/hw/char/imx_serial.c
> +++ b/hw/char/imx_serial.c
> @@ -22,6 +22,7 @@
>  #include "hw/char/imx_serial.h"
>  #include "sysemu/sysemu.h"
>  #include "sysemu/char.h"
> +#include "qemu/log.h"
>
>  #ifndef DEBUG_IMX_UART
>  #define DEBUG_IMX_UART 0
> diff --git a/hw/char/pl011.c b/hw/char/pl011.c
> index 210c87b..6876ea6 100644
> --- a/hw/char/pl011.c
> +++ b/hw/char/pl011.c
> @@ -10,6 +10,7 @@
>  #include "qemu/osdep.h"
>  #include "hw/sysbus.h"
>  #include "sysemu/char.h"
> +#include "qemu/log.h"
>
>  #define TYPE_PL011 "pl011"
>  #define PL011(obj) OBJECT_CHECK(PL011State, (obj), TYPE_PL011)
> diff --git a/hw/char/stm32f2xx_usart.c b/hw/char/stm32f2xx_usart.c
> index a94d61c..72305ec 100644
> --- a/hw/char/stm32f2xx_usart.c
> +++ b/hw/char/stm32f2xx_usart.c
> @@ -24,6 +24,7 @@
>
>  #include "qemu/osdep.h"
>  #include "hw/char/stm32f2xx_usart.h"
> +#include "qemu/log.h"
>
>  #ifndef STM_USART_ERR_DEBUG
>  #define STM_USART_ERR_DEBUG 0
> diff --git a/hw/display/bcm2835_fb.c b/hw/display/bcm2835_fb.c
> index 506f1d3..7eab927 100644
> --- a/hw/display/bcm2835_fb.c
> +++ b/hw/display/bcm2835_fb.c
> @@ -29,6 +29,7 @@
>  #include "hw/display/framebuffer.h"
>  #include "ui/pixel_ops.h"
>  #include "hw/misc/bcm2835_mbox_defs.h"
> +#include "qemu/log.h"
>
>  #define DEFAULT_VCRAM_SIZE 0x4000000
>  #define BCM2835_FB_OFFSET  0x00100000
> diff --git a/hw/display/cg3.c b/hw/display/cg3.c
> index eb0e71a..1174220 100644
> --- a/hw/display/cg3.c
> +++ b/hw/display/cg3.c
> @@ -31,6 +31,7 @@
>  #include "ui/console.h"
>  #include "hw/sysbus.h"
>  #include "hw/loader.h"
> +#include "qemu/log.h"
>
>  /* Change to 1 to enable debugging */
>  #define DEBUG_CG3 0
> diff --git a/hw/display/pl110.c b/hw/display/pl110.c
> index d589959..c069c0b 100644
> --- a/hw/display/pl110.c
> +++ b/hw/display/pl110.c
> @@ -12,6 +12,7 @@
>  #include "ui/console.h"
>  #include "framebuffer.h"
>  #include "ui/pixel_ops.h"
> +#include "qemu/log.h"
>
>  #define PL110_CR_EN   0x001
>  #define PL110_CR_BGR  0x100
> diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c
> index ddf3bfb..50978a6 100644
> --- a/hw/display/virtio-gpu.c
> +++ b/hw/display/virtio-gpu.c
> @@ -19,6 +19,7 @@
>  #include "hw/virtio/virtio.h"
>  #include "hw/virtio/virtio-gpu.h"
>  #include "hw/virtio/virtio-bus.h"
> +#include "qemu/log.h"
>
>  static struct virtio_gpu_simple_resource*
>  virtio_gpu_find_resource(VirtIOGPU *g, uint32_t resource_id);
> diff --git a/hw/dma/bcm2835_dma.c b/hw/dma/bcm2835_dma.c
> index 5421175..5d144a2 100644
> --- a/hw/dma/bcm2835_dma.c
> +++ b/hw/dma/bcm2835_dma.c
> @@ -6,6 +6,7 @@
>  #include "qemu/osdep.h"
>  #include "qapi/error.h"
>  #include "hw/dma/bcm2835_dma.h"
> +#include "qemu/log.h"
>
>  /* DMA CS Control and Status bits */
>  #define BCM2708_DMA_ACTIVE      (1 << 0)
> diff --git a/hw/dma/pl080.c b/hw/dma/pl080.c
> index 9318108..3bed5c3 100644
> --- a/hw/dma/pl080.c
> +++ b/hw/dma/pl080.c
> @@ -10,6 +10,7 @@
>  #include "qemu/osdep.h"
>  #include "hw/sysbus.h"
>  #include "exec/address-spaces.h"
> +#include "qemu/log.h"
>
>  #define PL080_MAX_CHANNELS 8
>  #define PL080_CONF_E    0x1
> diff --git a/hw/dma/pl330.c b/hw/dma/pl330.c
> index ea89ecb..c0bd9fe 100644
> --- a/hw/dma/pl330.c
> +++ b/hw/dma/pl330.c
> @@ -19,6 +19,7 @@
>  #include "qapi/error.h"
>  #include "qemu/timer.h"
>  #include "sysemu/dma.h"
> +#include "qemu/log.h"
>
>  #ifndef PL330_ERR_DEBUG
>  #define PL330_ERR_DEBUG 0
> diff --git a/hw/dma/rc4030.c b/hw/dma/rc4030.c
> index a06c235..2f2576f 100644
> --- a/hw/dma/rc4030.c
> +++ b/hw/dma/rc4030.c
> @@ -27,6 +27,7 @@
>  #include "hw/mips/mips.h"
>  #include "hw/sysbus.h"
>  #include "qemu/timer.h"
> +#include "qemu/log.h"
>  #include "exec/address-spaces.h"
>  #include "trace.h"
>
> diff --git a/hw/gpio/imx_gpio.c b/hw/gpio/imx_gpio.c
> index ed7e247..f3574aa 100644
> --- a/hw/gpio/imx_gpio.c
> +++ b/hw/gpio/imx_gpio.c
> @@ -19,6 +19,7 @@
>
>  #include "qemu/osdep.h"
>  #include "hw/gpio/imx_gpio.h"
> +#include "qemu/log.h"
>
>  #ifndef DEBUG_IMX_GPIO
>  #define DEBUG_IMX_GPIO 0
> diff --git a/hw/gpio/pl061.c b/hw/gpio/pl061.c
> index 29dc7fc..44faeb2 100644
> --- a/hw/gpio/pl061.c
> +++ b/hw/gpio/pl061.c
> @@ -10,6 +10,7 @@
>
>  #include "qemu/osdep.h"
>  #include "hw/sysbus.h"
> +#include "qemu/log.h"
>
>  //#define DEBUG_PL061 1
>
> diff --git a/hw/i2c/imx_i2c.c b/hw/i2c/imx_i2c.c
> index a01e43e..7830056 100644
> --- a/hw/i2c/imx_i2c.c
> +++ b/hw/i2c/imx_i2c.c
> @@ -21,6 +21,7 @@
>  #include "qemu/osdep.h"
>  #include "hw/i2c/imx_i2c.h"
>  #include "hw/i2c/i2c.h"
> +#include "qemu/log.h"
>
>  #ifndef DEBUG_IMX_I2C
>  #define DEBUG_IMX_I2C 0
> diff --git a/hw/i2c/versatile_i2c.c b/hw/i2c/versatile_i2c.c
> index fee3bc7..0bce524 100644
> --- a/hw/i2c/versatile_i2c.c
> +++ b/hw/i2c/versatile_i2c.c
> @@ -24,6 +24,7 @@
>  #include "qemu/osdep.h"
>  #include "hw/sysbus.h"
>  #include "bitbang_i2c.h"
> +#include "qemu/log.h"
>
>  #define TYPE_VERSATILE_I2C "versatile_i2c"
>  #define VERSATILE_I2C(obj) \
> diff --git a/hw/input/pl050.c b/hw/input/pl050.c
> index 3092b0f..be9cd57 100644
> --- a/hw/input/pl050.c
> +++ b/hw/input/pl050.c
> @@ -10,6 +10,7 @@
>  #include "qemu/osdep.h"
>  #include "hw/sysbus.h"
>  #include "hw/input/ps2.h"
> +#include "qemu/log.h"
>
>  #define TYPE_PL050 "pl050"
>  #define PL050(obj) OBJECT_CHECK(PL050State, (obj), TYPE_PL050)
> diff --git a/hw/intc/allwinner-a10-pic.c b/hw/intc/allwinner-a10-pic.c
> index dc971a1..11f1366 100644
> --- a/hw/intc/allwinner-a10-pic.c
> +++ b/hw/intc/allwinner-a10-pic.c
> @@ -20,6 +20,7 @@
>  #include "hw/devices.h"
>  #include "sysemu/sysemu.h"
>  #include "hw/intc/allwinner-a10-pic.h"
> +#include "qemu/log.h"
>
>  static void aw_a10_pic_update(AwA10PICState *s)
>  {
> diff --git a/hw/intc/arm_gic.c b/hw/intc/arm_gic.c
> index f551241..62429b1 100644
> --- a/hw/intc/arm_gic.c
> +++ b/hw/intc/arm_gic.c
> @@ -23,6 +23,7 @@
>  #include "gic_internal.h"
>  #include "qapi/error.h"
>  #include "qom/cpu.h"
> +#include "qemu/log.h"
>
>  //#define DEBUG_GIC
>
> diff --git a/hw/intc/arm_gicv2m.c b/hw/intc/arm_gicv2m.c
> index 589d315..3922fbc 100644
> --- a/hw/intc/arm_gicv2m.c
> +++ b/hw/intc/arm_gicv2m.c
> @@ -30,6 +30,7 @@
>  #include "hw/sysbus.h"
>  #include "hw/pci/msi.h"
>  #include "sysemu/kvm.h"
> +#include "qemu/log.h"
>
>  #define TYPE_ARM_GICV2M "arm-gicv2m"
>  #define ARM_GICV2M(obj) OBJECT_CHECK(ARMGICv2mState, (obj), TYPE_ARM_GICV2M)
> diff --git a/hw/intc/armv7m_nvic.c b/hw/intc/armv7m_nvic.c
> index 4d584ef..890d5d7 100644
> --- a/hw/intc/armv7m_nvic.c
> +++ b/hw/intc/armv7m_nvic.c
> @@ -19,6 +19,7 @@
>  #include "hw/arm/arm.h"
>  #include "exec/address-spaces.h"
>  #include "gic_internal.h"
> +#include "qemu/log.h"
>
>  typedef struct {
>      GICState gic;
> diff --git a/hw/intc/bcm2835_ic.c b/hw/intc/bcm2835_ic.c
> index 80513b2..00d2530 100644
> --- a/hw/intc/bcm2835_ic.c
> +++ b/hw/intc/bcm2835_ic.c
> @@ -14,6 +14,7 @@
>
>  #include "qemu/osdep.h"
>  #include "hw/intc/bcm2835_ic.h"
> +#include "qemu/log.h"
>
>  #define GPU_IRQS 64
>  #define ARM_IRQS 8
> diff --git a/hw/intc/bcm2836_control.c b/hw/intc/bcm2836_control.c
> index d027181..cfa5bc7 100644
> --- a/hw/intc/bcm2836_control.c
> +++ b/hw/intc/bcm2836_control.c
> @@ -15,6 +15,7 @@
>
>  #include "qemu/osdep.h"
>  #include "hw/intc/bcm2836_control.h"
> +#include "qemu/log.h"
>
>  #define REG_GPU_ROUTE           0x0c
>  #define REG_TIMERCONTROL        0x40
> diff --git a/hw/intc/i8259.c b/hw/intc/i8259.c
> index bb43669..c2607a5 100644
> --- a/hw/intc/i8259.c
> +++ b/hw/intc/i8259.c
> @@ -27,6 +27,7 @@
>  #include "hw/isa/isa.h"
>  #include "monitor/monitor.h"
>  #include "qemu/timer.h"
> +#include "qemu/log.h"
>  #include "hw/isa/i8259_internal.h"
>
>  /* debug PIC */
> diff --git a/hw/intc/imx_avic.c b/hw/intc/imx_avic.c
> index 7027655..63e5340 100644
> --- a/hw/intc/imx_avic.c
> +++ b/hw/intc/imx_avic.c
> @@ -17,6 +17,7 @@
>
>  #include "qemu/osdep.h"
>  #include "hw/intc/imx_avic.h"
> +#include "qemu/log.h"
>
>  #ifndef DEBUG_IMX_AVIC
>  #define DEBUG_IMX_AVIC 0
> diff --git a/hw/intc/openpic.c b/hw/intc/openpic.c
> index 2d37693..4349e45 100644
> --- a/hw/intc/openpic.c
> +++ b/hw/intc/openpic.c
> @@ -44,6 +44,7 @@
>  #include "qapi/error.h"
>  #include "qemu/bitops.h"
>  #include "qapi/qmp/qerror.h"
> +#include "qemu/log.h"
>
>  //#define DEBUG_OPENPIC
>
> diff --git a/hw/intc/pl190.c b/hw/intc/pl190.c
> index 5ecbc4a..ed0a98c 100644
> --- a/hw/intc/pl190.c
> +++ b/hw/intc/pl190.c
> @@ -9,6 +9,7 @@
>
>  #include "qemu/osdep.h"
>  #include "hw/sysbus.h"
> +#include "qemu/log.h"
>
>  /* The number of virtual priority levels.  16 user vectors plus the
>     unvectored IRQ.  Chained interrupts would require an additional level
> diff --git a/hw/misc/arm11scu.c b/hw/misc/arm11scu.c
> index 5e54b49..7042ce1 100644
> --- a/hw/misc/arm11scu.c
> +++ b/hw/misc/arm11scu.c
> @@ -10,6 +10,7 @@
>
>  #include "qemu/osdep.h"
>  #include "hw/misc/arm11scu.h"
> +#include "qemu/log.h"
>
>  static uint64_t mpcore_scu_read(void *opaque, hwaddr offset,
>                                  unsigned size)
> diff --git a/hw/misc/arm_integrator_debug.c b/hw/misc/arm_integrator_debug.c
> index 902605f..8a5f295 100644
> --- a/hw/misc/arm_integrator_debug.c
> +++ b/hw/misc/arm_integrator_debug.c
> @@ -19,6 +19,7 @@
>  #include "hw/sysbus.h"
>  #include "exec/address-spaces.h"
>  #include "hw/misc/arm_integrator_debug.h"
> +#include "qemu/log.h"
>
>  #define INTEGRATOR_DEBUG(obj) \
>      OBJECT_CHECK(IntegratorDebugState, (obj), TYPE_INTEGRATOR_DEBUG)
> diff --git a/hw/misc/arm_l2x0.c b/hw/misc/arm_l2x0.c
> index 7e179f1..4442227 100644
> --- a/hw/misc/arm_l2x0.c
> +++ b/hw/misc/arm_l2x0.c
> @@ -20,6 +20,7 @@
>
>  #include "qemu/osdep.h"
>  #include "hw/sysbus.h"
> +#include "qemu/log.h"
>
>  /* L2C-310 r3p2 */
>  #define CACHE_ID 0x410000c8
> diff --git a/hw/misc/arm_sysctl.c b/hw/misc/arm_sysctl.c
> index 34d90d5..8524008 100644
> --- a/hw/misc/arm_sysctl.c
> +++ b/hw/misc/arm_sysctl.c
> @@ -14,6 +14,7 @@
>  #include "hw/sysbus.h"
>  #include "hw/arm/primecell.h"
>  #include "sysemu/sysemu.h"
> +#include "qemu/log.h"
>
>  #define LOCK_VALUE 0xa05f
>
> diff --git a/hw/misc/bcm2835_mbox.c b/hw/misc/bcm2835_mbox.c
> index 263280f..e97cc81 100644
> --- a/hw/misc/bcm2835_mbox.c
> +++ b/hw/misc/bcm2835_mbox.c
> @@ -11,6 +11,7 @@
>  #include "qemu/osdep.h"
>  #include "qapi/error.h"
>  #include "hw/misc/bcm2835_mbox.h"
> +#include "qemu/log.h"
>
>  #define MAIL0_PEEK   0x90
>  #define MAIL0_SENDER 0x94
> diff --git a/hw/misc/bcm2835_property.c b/hw/misc/bcm2835_property.c
> index 530411f..21a18c8 100644
> --- a/hw/misc/bcm2835_property.c
> +++ b/hw/misc/bcm2835_property.c
> @@ -8,6 +8,7 @@
>  #include "hw/misc/bcm2835_property.h"
>  #include "hw/misc/bcm2835_mbox_defs.h"
>  #include "sysemu/dma.h"
> +#include "qemu/log.h"
>
>  /* https://github.com/raspberrypi/firmware/wiki/Mailbox-property-interface */
>
> diff --git a/hw/misc/imx25_ccm.c b/hw/misc/imx25_ccm.c
> index 225604d..5cd8c0a 100644
> --- a/hw/misc/imx25_ccm.c
> +++ b/hw/misc/imx25_ccm.c
> @@ -13,6 +13,7 @@
>
>  #include "qemu/osdep.h"
>  #include "hw/misc/imx25_ccm.h"
> +#include "qemu/log.h"
>
>  #ifndef DEBUG_IMX25_CCM
>  #define DEBUG_IMX25_CCM 0
> diff --git a/hw/misc/imx31_ccm.c b/hw/misc/imx31_ccm.c
> index 80c1647..1c03e52 100644
> --- a/hw/misc/imx31_ccm.c
> +++ b/hw/misc/imx31_ccm.c
> @@ -13,6 +13,7 @@
>
>  #include "qemu/osdep.h"
>  #include "hw/misc/imx31_ccm.h"
> +#include "qemu/log.h"
>
>  #define CKIH_FREQ 26000000 /* 26MHz crystal input */
>
> diff --git a/hw/misc/imx6_ccm.c b/hw/misc/imx6_ccm.c
> index 4e1d49d..ec58eef 100644
> --- a/hw/misc/imx6_ccm.c
> +++ b/hw/misc/imx6_ccm.c
> @@ -12,6 +12,7 @@
>
>  #include "qemu/osdep.h"
>  #include "hw/misc/imx6_ccm.h"
> +#include "qemu/log.h"
>
>  #ifndef DEBUG_IMX6_CCM
>  #define DEBUG_IMX6_CCM 0
> diff --git a/hw/misc/imx_ccm.c b/hw/misc/imx_ccm.c
> index 986d890..7f239a4 100644
> --- a/hw/misc/imx_ccm.c
> +++ b/hw/misc/imx_ccm.c
> @@ -13,6 +13,7 @@
>
>  #include "qemu/osdep.h"
>  #include "hw/misc/imx_ccm.h"
> +#include "qemu/log.h"
>
>  #ifndef DEBUG_IMX_CCM
>  #define DEBUG_IMX_CCM 0
> diff --git a/hw/misc/macio/cuda.c b/hw/misc/macio/cuda.c
> index c7472aa..0648979 100644
> --- a/hw/misc/macio/cuda.c
> +++ b/hw/misc/macio/cuda.c
> @@ -29,6 +29,7 @@
>  #include "qemu/timer.h"
>  #include "sysemu/sysemu.h"
>  #include "qemu/cutils.h"
> +#include "qemu/log.h"
>
>  /* XXX: implement all timer modes */
>
> diff --git a/hw/misc/macio/mac_dbdma.c b/hw/misc/macio/mac_dbdma.c
> index 6051f17..5632743 100644
> --- a/hw/misc/macio/mac_dbdma.c
> +++ b/hw/misc/macio/mac_dbdma.c
> @@ -41,6 +41,7 @@
>  #include "hw/isa/isa.h"
>  #include "hw/ppc/mac_dbdma.h"
>  #include "qemu/main-loop.h"
> +#include "qemu/log.h"
>
>  /* debug DBDMA */
>  //#define DEBUG_DBDMA
> diff --git a/hw/misc/mips_cmgcr.c b/hw/misc/mips_cmgcr.c
> index 37be239..40f3464 100644
> --- a/hw/misc/mips_cmgcr.c
> +++ b/hw/misc/mips_cmgcr.c
> @@ -11,6 +11,7 @@
>
>  #include "qemu/osdep.h"
>  #include "qapi/error.h"
> +#include "qemu/log.h"
>  #include "hw/hw.h"
>  #include "hw/sysbus.h"
>  #include "sysemu/sysemu.h"
> diff --git a/hw/misc/mips_cpc.c b/hw/misc/mips_cpc.c
> index 05688b7..e6a35dd 100644
> --- a/hw/misc/mips_cpc.c
> +++ b/hw/misc/mips_cpc.c
> @@ -20,6 +20,7 @@
>  #include "qemu/osdep.h"
>  #include "qapi/error.h"
>  #include "cpu.h"
> +#include "qemu/log.h"
>  #include "hw/sysbus.h"
>
>  #include "hw/misc/mips_cpc.h"
> diff --git a/hw/misc/mips_itu.c b/hw/misc/mips_itu.c
> index c75ce7b..8aa5dee 100644
> --- a/hw/misc/mips_itu.c
> +++ b/hw/misc/mips_itu.c
> @@ -20,6 +20,7 @@
>  #include "qemu/osdep.h"
>  #include "qapi/error.h"
>  #include "cpu.h"
> +#include "qemu/log.h"
>  #include "hw/hw.h"
>  #include "hw/sysbus.h"
>  #include "sysemu/sysemu.h"
> diff --git a/hw/misc/stm32f2xx_syscfg.c b/hw/misc/stm32f2xx_syscfg.c
> index d0d7076..7c45833 100644
> --- a/hw/misc/stm32f2xx_syscfg.c
> +++ b/hw/misc/stm32f2xx_syscfg.c
> @@ -24,6 +24,7 @@
>
>  #include "qemu/osdep.h"
>  #include "hw/misc/stm32f2xx_syscfg.h"
> +#include "qemu/log.h"
>
>  #ifndef STM_SYSCFG_ERR_DEBUG
>  #define STM_SYSCFG_ERR_DEBUG 0
> diff --git a/hw/misc/zynq-xadc.c b/hw/misc/zynq-xadc.c
> index 71fbccd..1490610 100644
> --- a/hw/misc/zynq-xadc.c
> +++ b/hw/misc/zynq-xadc.c
> @@ -18,6 +18,7 @@
>  #include "hw/misc/zynq-xadc.h"
>  #include "qemu/timer.h"
>  #include "sysemu/sysemu.h"
> +#include "qemu/log.h"
>
>  enum {
>      CFG                = 0x000 / 4,
> diff --git a/hw/misc/zynq_slcr.c b/hw/misc/zynq_slcr.c
> index b1b7591..7891219 100644
> --- a/hw/misc/zynq_slcr.c
> +++ b/hw/misc/zynq_slcr.c
> @@ -19,6 +19,7 @@
>  #include "qemu/timer.h"
>  #include "hw/sysbus.h"
>  #include "sysemu/sysemu.h"
> +#include "qemu/log.h"
>
>  #ifndef ZYNQ_SLCR_ERR_DEBUG
>  #define ZYNQ_SLCR_ERR_DEBUG 0
> diff --git a/hw/net/allwinner_emac.c b/hw/net/allwinner_emac.c
> index 16d4b63..d575023 100644
> --- a/hw/net/allwinner_emac.c
> +++ b/hw/net/allwinner_emac.c
> @@ -21,6 +21,7 @@
>  #include "net/net.h"
>  #include "qemu/fifo8.h"
>  #include "hw/net/allwinner_emac.h"
> +#include "qemu/log.h"
>  #include <zlib.h>
>
>  static uint8_t padding[60];
> diff --git a/hw/net/fsl_etsec/etsec.c b/hw/net/fsl_etsec/etsec.c
> index 1e35f7f..98250e0 100644
> --- a/hw/net/fsl_etsec/etsec.c
> +++ b/hw/net/fsl_etsec/etsec.c
> @@ -33,6 +33,7 @@
>  #include "hw/ptimer.h"
>  #include "etsec.h"
>  #include "registers.h"
> +#include "qemu/log.h"
>
>  /* #define HEX_DUMP */
>  /* #define DEBUG_REGISTER */
> diff --git a/hw/net/fsl_etsec/rings.c b/hw/net/fsl_etsec/rings.c
> index ed1de7d..79d2f14 100644
> --- a/hw/net/fsl_etsec/rings.c
> +++ b/hw/net/fsl_etsec/rings.c
> @@ -23,7 +23,7 @@
>   */
>  #include "qemu/osdep.h"
>  #include "net/checksum.h"
> -
> +#include "qemu/log.h"
>  #include "etsec.h"
>  #include "registers.h"
>
> diff --git a/hw/net/imx_fec.c b/hw/net/imx_fec.c
> index e60e338..9055ea8 100644
> --- a/hw/net/imx_fec.c
> +++ b/hw/net/imx_fec.c
> @@ -24,6 +24,7 @@
>  #include "qemu/osdep.h"
>  #include "hw/net/imx_fec.h"
>  #include "sysemu/dma.h"
> +#include "qemu/log.h"
>
>  /* For crc32 */
>  #include <zlib.h>
> diff --git a/hw/net/lan9118.c b/hw/net/lan9118.c
> index 08dc474..2052073 100644
> --- a/hw/net/lan9118.c
> +++ b/hw/net/lan9118.c
> @@ -16,6 +16,7 @@
>  #include "hw/devices.h"
>  #include "sysemu/sysemu.h"
>  #include "hw/ptimer.h"
> +#include "qemu/log.h"
>  /* For crc32 */
>  #include <zlib.h>
>
> diff --git a/hw/net/spapr_llan.c b/hw/net/spapr_llan.c
> index db97da3..a8266f8 100644
> --- a/hw/net/spapr_llan.c
> +++ b/hw/net/spapr_llan.c
> @@ -28,6 +28,7 @@
>  #include "qemu-common.h"
>  #include "cpu.h"
>  #include "hw/hw.h"
> +#include "qemu/log.h"
>  #include "net/net.h"
>  #include "hw/qdev.h"
>  #include "hw/ppc/spapr.h"
> diff --git a/hw/pci-host/apb.c b/hw/pci-host/apb.c
> index aaef7bb..babbbef 100644
> --- a/hw/pci-host/apb.c
> +++ b/hw/pci-host/apb.c
> @@ -36,6 +36,7 @@
>  #include "hw/pci-host/apb.h"
>  #include "sysemu/sysemu.h"
>  #include "exec/address-spaces.h"
> +#include "qemu/log.h"
>
>  /* debug APB */
>  //#define DEBUG_APB
> diff --git a/hw/pci-host/versatile.c b/hw/pci-host/versatile.c
> index 339ec2c..0792c45 100644
> --- a/hw/pci-host/versatile.c
> +++ b/hw/pci-host/versatile.c
> @@ -13,6 +13,7 @@
>  #include "hw/pci/pci_bus.h"
>  #include "hw/pci/pci_host.h"
>  #include "exec/address-spaces.h"
> +#include "qemu/log.h"
>
>  /* Old and buggy versions of QEMU used the wrong mapping from
>   * PCI IRQs to system interrupt lines. Unfortunately the Linux
> diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
> index e7be21e..32404cf 100644
> --- a/hw/ppc/spapr.c
> +++ b/hw/ppc/spapr.c
> @@ -29,6 +29,7 @@
>  #include "sysemu/sysemu.h"
>  #include "sysemu/numa.h"
>  #include "hw/hw.h"
> +#include "qemu/log.h"
>  #include "hw/fw-path-provider.h"
>  #include "elf.h"
>  #include "net/net.h"
> diff --git a/hw/ppc/spapr_hcall.c b/hw/ppc/spapr_hcall.c
> index 4426a50..c5fecb5 100644
> --- a/hw/ppc/spapr_hcall.c
> +++ b/hw/ppc/spapr_hcall.c
> @@ -1,6 +1,7 @@
>  #include "qemu/osdep.h"
>  #include "qapi/error.h"
>  #include "sysemu/sysemu.h"
> +#include "qemu/log.h"
>  #include "cpu.h"
>  #include "helper_regs.h"
>  #include "hw/ppc/spapr.h"
> diff --git a/hw/ppc/spapr_iommu.c b/hw/ppc/spapr_iommu.c
> index 7dd4588..722db91 100644
> --- a/hw/ppc/spapr_iommu.c
> +++ b/hw/ppc/spapr_iommu.c
> @@ -18,6 +18,7 @@
>   */
>  #include "qemu/osdep.h"
>  #include "hw/hw.h"
> +#include "qemu/log.h"
>  #include "sysemu/kvm.h"
>  #include "hw/qdev.h"
>  #include "kvm_ppc.h"
> diff --git a/hw/ppc/spapr_rtas.c b/hw/ppc/spapr_rtas.c
> index 5352767..9c9fe55 100644
> --- a/hw/ppc/spapr_rtas.c
> +++ b/hw/ppc/spapr_rtas.c
> @@ -26,6 +26,7 @@
>   */
>  #include "qemu/osdep.h"
>  #include "cpu.h"
> +#include "qemu/log.h"
>  #include "sysemu/sysemu.h"
>  #include "sysemu/char.h"
>  #include "hw/qdev.h"
> diff --git a/hw/ppc/spapr_vio.c b/hw/ppc/spapr_vio.c
> index 6b20b40..d084aed 100644
> --- a/hw/ppc/spapr_vio.c
> +++ b/hw/ppc/spapr_vio.c
> @@ -22,6 +22,7 @@
>  #include "qemu/osdep.h"
>  #include "qapi/error.h"
>  #include "hw/hw.h"
> +#include "qemu/log.h"
>  #include "sysemu/sysemu.h"
>  #include "hw/boards.h"
>  #include "hw/loader.h"
> diff --git a/hw/sd/pl181.c b/hw/sd/pl181.c
> index e87abb2..eb783c6 100644
> --- a/hw/sd/pl181.c
> +++ b/hw/sd/pl181.c
> @@ -12,6 +12,7 @@
>  #include "sysemu/blockdev.h"
>  #include "hw/sysbus.h"
>  #include "hw/sd/sd.h"
> +#include "qemu/log.h"
>
>  //#define DEBUG_PL181 1
>
> diff --git a/hw/sd/sd.c b/hw/sd/sd.c
> index b66e5d2..3372870 100644
> --- a/hw/sd/sd.c
> +++ b/hw/sd/sd.c
> @@ -39,6 +39,7 @@
>  #include "hw/qdev-properties.h"
>  #include "qemu/error-report.h"
>  #include "qemu/timer.h"
> +#include "qemu/log.h"
>
>  //#define DEBUG_SD 1
>
> diff --git a/hw/sd/sdhci.c b/hw/sd/sdhci.c
> index d28b587..01fbf22 100644
> --- a/hw/sd/sdhci.c
> +++ b/hw/sd/sdhci.c
> @@ -30,6 +30,7 @@
>  #include "qemu/timer.h"
>  #include "qemu/bitops.h"
>  #include "sdhci-internal.h"
> +#include "qemu/log.h"
>
>  /* host controller debug messages */
>  #ifndef SDHC_DEBUG
> diff --git a/hw/ssi/pl022.c b/hw/ssi/pl022.c
> index 564a0d3..c136801 100644
> --- a/hw/ssi/pl022.c
> +++ b/hw/ssi/pl022.c
> @@ -10,6 +10,7 @@
>  #include "qemu/osdep.h"
>  #include "hw/sysbus.h"
>  #include "hw/ssi/ssi.h"
> +#include "qemu/log.h"
>
>  //#define DEBUG_PL022 1
>
> diff --git a/hw/timer/allwinner-a10-pit.c b/hw/timer/allwinner-a10-pit.c
> index 51cdc98..3385e5d 100644
> --- a/hw/timer/allwinner-a10-pit.c
> +++ b/hw/timer/allwinner-a10-pit.c
> @@ -19,6 +19,7 @@
>  #include "hw/sysbus.h"
>  #include "sysemu/sysemu.h"
>  #include "hw/timer/allwinner-a10-pit.h"
> +#include "qemu/log.h"
>
>  static void a10_pit_update_irq(AwA10PITState *s)
>  {
> diff --git a/hw/timer/arm_timer.c b/hw/timer/arm_timer.c
> index f1ede5f..111a16d 100644
> --- a/hw/timer/arm_timer.c
> +++ b/hw/timer/arm_timer.c
> @@ -14,6 +14,7 @@
>  #include "hw/qdev.h"
>  #include "hw/ptimer.h"
>  #include "qemu/main-loop.h"
> +#include "qemu/log.h"
>
>  /* Common timer implementation.  */
>
> diff --git a/hw/timer/digic-timer.c b/hw/timer/digic-timer.c
> index 5b97e1e..0f21faf 100644
> --- a/hw/timer/digic-timer.c
> +++ b/hw/timer/digic-timer.c
> @@ -30,6 +30,7 @@
>  #include "hw/sysbus.h"
>  #include "hw/ptimer.h"
>  #include "qemu/main-loop.h"
> +#include "qemu/log.h"
>
>  #include "hw/timer/digic-timer.h"
>
> diff --git a/hw/timer/imx_epit.c b/hw/timer/imx_epit.c
> index f5836e2..eddf348 100644
> --- a/hw/timer/imx_epit.c
> +++ b/hw/timer/imx_epit.c
> @@ -16,6 +16,7 @@
>  #include "hw/timer/imx_epit.h"
>  #include "hw/misc/imx_ccm.h"
>  #include "qemu/main-loop.h"
> +#include "qemu/log.h"
>
>  #ifndef DEBUG_IMX_EPIT
>  #define DEBUG_IMX_EPIT 0
> diff --git a/hw/timer/imx_gpt.c b/hw/timer/imx_gpt.c
> index ab2e213..3c2f01a 100644
> --- a/hw/timer/imx_gpt.c
> +++ b/hw/timer/imx_gpt.c
> @@ -16,6 +16,7 @@
>  #include "hw/timer/imx_gpt.h"
>  #include "hw/misc/imx_ccm.h"
>  #include "qemu/main-loop.h"
> +#include "qemu/log.h"
>
>  #ifndef DEBUG_IMX_GPT
>  #define DEBUG_IMX_GPT 0
> diff --git a/hw/timer/pl031.c b/hw/timer/pl031.c
> index 38e0cb5..dbbeb9b 100644
> --- a/hw/timer/pl031.c
> +++ b/hw/timer/pl031.c
> @@ -16,6 +16,7 @@
>  #include "qemu/timer.h"
>  #include "sysemu/sysemu.h"
>  #include "qemu/cutils.h"
> +#include "qemu/log.h"
>
>  //#define DEBUG_PL031
>
> diff --git a/hw/timer/stm32f2xx_timer.c b/hw/timer/stm32f2xx_timer.c
> index 55dacbb..bf0fb28 100644
> --- a/hw/timer/stm32f2xx_timer.c
> +++ b/hw/timer/stm32f2xx_timer.c
> @@ -24,6 +24,7 @@
>
>  #include "qemu/osdep.h"
>  #include "hw/timer/stm32f2xx_timer.h"
> +#include "qemu/log.h"
>
>  #ifndef STM_TIMER_ERR_DEBUG
>  #define STM_TIMER_ERR_DEBUG 0
> diff --git a/hw/watchdog/wdt_diag288.c b/hw/watchdog/wdt_diag288.c
> index f54a35a..a7b64e2 100644
> --- a/hw/watchdog/wdt_diag288.c
> +++ b/hw/watchdog/wdt_diag288.c
> @@ -16,6 +16,7 @@
>  #include "hw/sysbus.h"
>  #include "qemu/timer.h"
>  #include "hw/watchdog/wdt_diag288.h"
> +#include "qemu/log.h"
>
>  static WatchdogTimerModel model = {
>      .wdt_name = TYPE_WDT_DIAG288,
> diff --git a/include/hw/hw.h b/include/hw/hw.h
> index a20321b..029b1e8 100644
> --- a/include/hw/hw.h
> +++ b/include/hw/hw.h
> @@ -11,7 +11,6 @@
>  #include "hw/irq.h"
>  #include "block/aio.h"
>  #include "migration/vmstate.h"
> -#include "qemu/log.h"
>  #include "qemu/module.h"
>
>  typedef void QEMUResetHandler(void *opaque);
> diff --git a/monitor.c b/monitor.c
> index 812383f..a2c1ad2 100644
> --- a/monitor.c
> +++ b/monitor.c
> @@ -71,6 +71,7 @@
>  #include "trace/simple.h"
>  #endif
>  #include "exec/memory.h"
> +#include "qemu/log.h"
>  #include "qmp-commands.h"
>  #include "hmp.h"
>  #include "qemu/thread.h"
> diff --git a/vl.c b/vl.c
> index b83d275..f366115 100644
> --- a/vl.c
> +++ b/vl.c
> @@ -80,6 +80,7 @@ int main(int argc, char **argv)
>  #include "qemu/timer.h"
>  #include "sysemu/char.h"
>  #include "qemu/bitmap.h"
> +#include "qemu/log.h"
>  #include "sysemu/blockdev.h"
>  #include "hw/block/block.h"
>  #include "migration/block.h"


--
Alex Bennée

^ permalink raw reply	[flat|nested] 72+ messages in thread

* Re: [Qemu-devel] [PATCH 01/50] scripts: add script to build QEMU and analyze inclusions
  2016-04-08 20:28 ` [Qemu-devel] [PATCH 01/50] scripts: add script to build QEMU and analyze inclusions Paolo Bonzini
  2016-04-18 13:10   ` Markus Armbruster
@ 2016-04-20 19:47   ` Alex Bennée
  2016-05-09  9:39     ` Paolo Bonzini
  1 sibling, 1 reply; 72+ messages in thread
From: Alex Bennée @ 2016-04-20 19:47 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: qemu-devel


Paolo Bonzini <pbonzini@redhat.com> writes:

> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  scripts/analyze-inclusions | 89 ++++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 89 insertions(+)
>  create mode 100644 scripts/analyze-inclusions
>
> diff --git a/scripts/analyze-inclusions b/scripts/analyze-inclusions

.sh extension to make it clear what it is?

> new file mode 100644

OK the script directory is inconsistent but if we want to use it for
automated testing it should be executable in the checkout.

> index 0000000..e241bd4
> --- /dev/null
> +++ b/scripts/analyze-inclusions
> @@ -0,0 +1,89 @@
> +#! /bin/sh
> +#
> +# Copyright (C) 2016 Red Hat, Inc.
> +#
> +# Author: Paolo Bonzini <pbonzini@redhat.com>
> +#
> +# Print statistics about header file inclusions.
> +# The script configures and builds QEMU itself in a "+build"
> +# subdirectory which is left around when the script exits.
> +# To run the statistics on a pre-existing "+build" directory,
> +# pass "--no-build" as the first argument on the command line.
> +# Any other command line is passed directly to "make" (so
> +# you can for example pass a "-j" argument suitable for your
> +# system).
> +#
> +# Inspired by a post by Markus Armbruster.
> +
> +mkdir -p +build
> +cd +build
> +if test "x$1" != "x--no-build"; then
> +  test -f Makefile && make distclean
> +  ../configure
> +  make "$@"
> +fi
> +
> +QEMU_CFLAGS=$(sed -n s/^QEMU_CFLAGS=//p config-host.mak)
> +QEMU_INCLUDES=$(sed -n s/^QEMU_INCLUDES=//p config-host.mak | \
> +    sed 's/$(SRC_PATH)/../g' )
> +CFLAGS=$(sed -n s/^CFLAGS=//p config-host.mak)
> +
> +grep_include() {
> +  find . -name "*.d" | xargs grep -l "$@" | wc -l
> +}
> +
> +echo Found $(find . -name "*.d" | wc -l) object files
> +echo $(grep_include -F 'include/qemu-common.h') files include qemu-common.h
> +echo $(grep_include -F 'hw/hw.h') files include hw/hw.h
> +echo $(grep_include 'target-[a-z0-9]*/cpu\.h') files include cpu.h
> +echo $(grep_include -F 'qapi-types.h') files include qapi-types.h
> +echo $(grep_include -F 'trace/generated-tracers.h') files include generated-tracers.h
> +echo $(grep_include -F 'qapi/error.h') files include qapi/error.h
> +echo $(grep_include -F 'qom/object.h') files include qom/object.h
> +echo $(grep_include -F 'block/aio.h') files include block/aio.h
> +echo $(grep_include -F 'exec/memory.h') files include exec/memory.h
> +echo $(grep_include -F 'fpu/softfloat.h') files include fpu/softfloat.h
> +echo $(grep_include -F 'qemu/bswap.h') files include qemu/bswap.h
> +echo
> +
> +awk1='
> +    /^# / { file = $3;next }
> +    NR>1 { bytes[file]+=length; lines[file]++ }
> +    END { for(i in lines) print i,lines[i],bytes[i] }'
> +
> +awk2='
> +    {tot_l+=$2;tot_b+=$3;tot_f++}
> +    /\/usr.*\/glib/ {glib_l+=$2;glib_b+=$3;glib_f++;next}
> +    /\/usr/ {sys_l+=$2;sys_b+=$3;sys_f++;next}
> +    {qemu_l+=$2;qemu_b+=$3;qemu_f++;next}
> +    END {
> +      printf "%s\t %s\t %s\t %s\n", "lines", "bytes", "files", "source"
> +      printf "%s\t %s\t %s\t %s\n", qemu_l, qemu_b, qemu_f, "QEMU"
> +      printf "%s\t %s\t %s\t %s\n", sys_l, sys_b, sys_f, "system"
> +      printf "%s\t %s\t %s\t %s\n", glib_l, glib_b, glib_f, "glib"
> +      printf "%s\t %s\t %s\t %s\n", tot_l, tot_b, tot_f, "total"
> +    }'
> +
> +analyze() {
> +  cc $QEMU_CFLAGS $QEMU_INCLUDES $CFLAGS  -E -o - "$@" | \
> +    awk "$awk1" | awk "$awk2"
> +  echo
> +}
> +
> +echo osdep.h:
> +analyze ../include/qemu/osdep.h
> +
> +echo qemu-common.h:
> +analyze  -include ../include/qemu/osdep.h ../include/qemu-common.h
> +
> +echo hw/hw.h:
> +analyze -include ../include/qemu/osdep.h ../include/hw/hw.h
> +
> +echo trace/generated-tracers.h:
> +analyze -include ../include/qemu/osdep.h trace/generated-tracers.h
> +
> +echo target-i386/cpu.h:
> +analyze -DNEED_CPU_H -I../target-i386 -Ii386-softmmu -include ../include/qemu/osdep.h ../target-i386/cpu.h
> +
> +echo hw/hw.h + NEED_CPU_H:
> +analyze -DNEED_CPU_H -I../target-i386 -Ii386-softmmu -include ../include/qemu/osdep.h ../include/hw/hw.h

If we get to be include clean we want this script to have a non-zero
exit for automated testing.

--
Alex Bennée

^ permalink raw reply	[flat|nested] 72+ messages in thread

* Re: [Qemu-devel] [PATCH 02/50] include: move CPU-related definitions out of qemu-common.h
  2016-04-08 20:28 ` [Qemu-devel] [PATCH 02/50] include: move CPU-related definitions out of qemu-common.h Paolo Bonzini
@ 2016-04-21  7:53   ` Alex Bennée
  0 siblings, 0 replies; 72+ messages in thread
From: Alex Bennée @ 2016-04-21  7:53 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: qemu-devel


Paolo Bonzini <pbonzini@redhat.com> writes:

> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>

> ---
>  include/qemu-common.h  | 24 ------------------------
>  include/qemu/timer.h   |  1 +
>  include/qom/cpu.h      |  9 +++++++++
>  include/sysemu/cpus.h  | 13 +++++++++++++
>  stubs/cpu-get-icount.c |  1 +
>  translate-common.c     |  1 +
>  vl.c                   |  1 +
>  7 files changed, 26 insertions(+), 24 deletions(-)
>
> diff --git a/include/qemu-common.h b/include/qemu-common.h
> index 163bcbb..f0d74076 100644
> --- a/include/qemu-common.h
> +++ b/include/qemu-common.h
> @@ -23,17 +23,6 @@
>  #include "qemu/option.h"
>  #include "qemu/host-utils.h"
>
> -void cpu_ticks_init(void);
> -
> -/* icount */
> -void configure_icount(QemuOpts *opts, Error **errp);
> -extern int use_icount;
> -extern int icount_align_option;
> -/* drift information for info jit command */
> -extern int64_t max_delay;
> -extern int64_t max_advance;
> -void dump_drift_info(FILE *f, fprintf_function cpu_fprintf);
> -
>  #include "qemu/bswap.h"
>
>  /* FIXME: Remove NEED_CPU_H.  */
> @@ -100,19 +89,6 @@ bool tcg_enabled(void);
>
>  void cpu_exec_init_all(void);
>
> -/* Unblock cpu */
> -void qemu_cpu_kick_self(void);
> -
> -/* work queue */
> -struct qemu_work_item {
> -    struct qemu_work_item *next;
> -    void (*func)(void *data);
> -    void *data;
> -    int done;
> -    bool free;
> -};
> -
> -
>  /**
>   * Sends a (part of) iovec down a socket, yielding when the socket is full, or
>   * Receives data into a (part of) iovec from a socket,
> diff --git a/include/qemu/timer.h b/include/qemu/timer.h
> index 471969a..309f3d0 100644
> --- a/include/qemu/timer.h
> +++ b/include/qemu/timer.h
> @@ -4,6 +4,7 @@
>  #include "qemu-common.h"
>  #include "qemu/notify.h"
>  #include "qemu/host-utils.h"
> +#include "sysemu/cpus.h"
>
>  #define NANOSECONDS_PER_SECOND 1000000000LL
>
> diff --git a/include/qom/cpu.h b/include/qom/cpu.h
> index b7a10f7..ab38ce1 100644
> --- a/include/qom/cpu.h
> +++ b/include/qom/cpu.h
> @@ -222,6 +222,15 @@ struct kvm_run;
>  #define TB_JMP_CACHE_BITS 12
>  #define TB_JMP_CACHE_SIZE (1 << TB_JMP_CACHE_BITS)
>
> +/* work queue */
> +struct qemu_work_item {
> +    struct qemu_work_item *next;
> +    void (*func)(void *data);
> +    void *data;
> +    int done;
> +    bool free;
> +};
> +
>  /**
>   * CPUState:
>   * @cpu_index: CPU index (informative).
> diff --git a/include/sysemu/cpus.h b/include/sysemu/cpus.h
> index 3d1e5ba..fe992a8 100644
> --- a/include/sysemu/cpus.h
> +++ b/include/sysemu/cpus.h
> @@ -7,6 +7,19 @@ void qemu_init_cpu_loop(void);
>  void resume_all_vcpus(void);
>  void pause_all_vcpus(void);
>  void cpu_stop_current(void);
> +void cpu_ticks_init(void);
> +
> +void configure_icount(QemuOpts *opts, Error **errp);
> +extern int use_icount;
> +extern int icount_align_option;
> +
> +/* drift information for info jit command */
> +extern int64_t max_delay;
> +extern int64_t max_advance;
> +void dump_drift_info(FILE *f, fprintf_function cpu_fprintf);
> +
> +/* Unblock cpu */
> +void qemu_cpu_kick_self(void);
>
>  void cpu_synchronize_all_states(void);
>  void cpu_synchronize_all_post_reset(void);
> diff --git a/stubs/cpu-get-icount.c b/stubs/cpu-get-icount.c
> index 3a6f2ab..2e8b63b 100644
> --- a/stubs/cpu-get-icount.c
> +++ b/stubs/cpu-get-icount.c
> @@ -1,6 +1,7 @@
>  #include "qemu/osdep.h"
>  #include "qemu-common.h"
>  #include "qemu/timer.h"
> +#include "sysemu/cpus.h"
>
>  int use_icount;
>
> diff --git a/translate-common.c b/translate-common.c
> index ffbfe85..5e989cd 100644
> --- a/translate-common.c
> +++ b/translate-common.c
> @@ -20,6 +20,7 @@
>  #include "qemu/osdep.h"
>  #include "qemu-common.h"
>  #include "qom/cpu.h"
> +#include "sysemu/cpus.h"
>
>  uintptr_t qemu_real_host_page_size;
>  intptr_t qemu_real_host_page_mask;
> diff --git a/vl.c b/vl.c
> index 3629336..b83d275 100644
> --- a/vl.c
> +++ b/vl.c
> @@ -87,6 +87,7 @@ int main(int argc, char **argv)
>  #include "sysemu/dma.h"
>  #include "audio/audio.h"
>  #include "migration/migration.h"
> +#include "sysemu/cpus.h"
>  #include "sysemu/kvm.h"
>  #include "qapi/qmp/qjson.h"
>  #include "qemu/option.h"


--
Alex Bennée

^ permalink raw reply	[flat|nested] 72+ messages in thread

* Re: [Qemu-devel] [PATCH 03/50] log: do not use CONFIG_USER_ONLY
  2016-04-08 20:28 ` [Qemu-devel] [PATCH 03/50] log: do not use CONFIG_USER_ONLY Paolo Bonzini
@ 2016-04-21 10:20   ` Alex Bennée
  0 siblings, 0 replies; 72+ messages in thread
From: Alex Bennée @ 2016-04-21 10:20 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: qemu-devel


Paolo Bonzini <pbonzini@redhat.com> writes:

> This decouples logging further from config-target.h
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

Reviewed-by: Alex Bennée <alex.bennee@linaro.org>

> ---
>  bsd-user/main.c    |  1 +
>  include/qemu/log.h | 17 ++---------------
>  linux-user/main.c  |  1 +
>  util/log.c         | 12 ++++++++++--
>  4 files changed, 14 insertions(+), 17 deletions(-)
>
> diff --git a/bsd-user/main.c b/bsd-user/main.c
> index 27854c1..058eaca 100644
> --- a/bsd-user/main.c
> +++ b/bsd-user/main.c
> @@ -849,6 +849,7 @@ int main(int argc, char **argv)
>      }
>
>      /* init debug */
> +    qemu_log_needs_buffers();
>      qemu_set_log_filename(log_file);
>      if (log_mask) {
>          int mask;
> diff --git a/include/qemu/log.h b/include/qemu/log.h
> index c52f136..234fa81 100644
> --- a/include/qemu/log.h
> +++ b/include/qemu/log.h
> @@ -104,21 +104,8 @@ typedef struct QEMULogItem {
>
>  extern const QEMULogItem qemu_log_items[];
>
> -/* This is the function that actually does the work of
> - * changing the log level; it should only be accessed via
> - * the qemu_set_log() wrapper.
> - */
> -void do_qemu_set_log(int log_flags, bool use_own_buffers);
> -
> -static inline void qemu_set_log(int log_flags)
> -{
> -#ifdef CONFIG_USER_ONLY
> -    do_qemu_set_log(log_flags, true);
> -#else
> -    do_qemu_set_log(log_flags, false);
> -#endif
> -}
> -
> +void qemu_set_log(int log_flags);
> +void qemu_log_needs_buffers(void);
>  void qemu_set_log_filename(const char *filename);
>  void qemu_set_dfilter_ranges(const char *ranges);
>  bool qemu_log_in_addr_range(uint64_t addr);
> diff --git a/linux-user/main.c b/linux-user/main.c
> index 5f3ec97..2b7fa9c 100644
> --- a/linux-user/main.c
> +++ b/linux-user/main.c
> @@ -3760,6 +3760,7 @@ static void handle_arg_log(const char *arg)
>          qemu_print_log_usage(stdout);
>          exit(EXIT_FAILURE);
>      }
> +    qemu_log_needs_buffers();
>      qemu_set_log(mask);
>  }
>
> diff --git a/util/log.c b/util/log.c
> index 1857730..5ad72c1 100644
> --- a/util/log.c
> +++ b/util/log.c
> @@ -42,8 +42,10 @@ void qemu_log(const char *fmt, ...)
>      va_end(ap);
>  }
>
> +static bool log_uses_own_buffers;
> +
>  /* enable or disable low levels log */
> -void do_qemu_set_log(int log_flags, bool use_own_buffers)
> +void qemu_set_log(int log_flags)
>  {
>      qemu_loglevel = log_flags;
>  #ifdef CONFIG_TRACE_LOG
> @@ -70,7 +72,7 @@ void do_qemu_set_log(int log_flags, bool use_own_buffers)
>              qemu_logfile = stderr;
>          }
>          /* must avoid mmap() usage of glibc by setting a buffer "by hand" */
> -        if (use_own_buffers) {
> +        if (log_uses_own_buffers) {
>              static char logfile_buf[4096];
>
>              setvbuf(qemu_logfile, logfile_buf, _IOLBF, sizeof(logfile_buf));
> @@ -89,6 +91,12 @@ void do_qemu_set_log(int log_flags, bool use_own_buffers)
>          qemu_log_close();
>      }
>  }
> +
> +void qemu_log_needs_buffers(void)
> +{
> +    log_uses_own_buffers = true;
> +}
> +
>  /*
>   * Allow the user to include %d in their logfile which will be
>   * substituted with the current PID. This is useful for debugging many


--
Alex Bennée

^ permalink raw reply	[flat|nested] 72+ messages in thread

* Re: [Qemu-devel] [PATCH 04/50] cpu: make cpu-qom.h only include-able from cpu.h
  2016-04-08 20:28 ` [Qemu-devel] [PATCH 04/50] cpu: make cpu-qom.h only include-able from cpu.h Paolo Bonzini
@ 2016-04-21 10:26   ` Alex Bennée
  0 siblings, 0 replies; 72+ messages in thread
From: Alex Bennée @ 2016-04-21 10:26 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: qemu-devel


Paolo Bonzini <pbonzini@redhat.com> writes:

> Make cpu-qom.h so that it is only included from cpu.h.  Then there
> is no need for it to include cpu.h again.
>
> Later we will make cpu-qom.h target independent and we will _want_
> to include it from elsewhere, but for now reduce the number of cases
> to handle.
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

Reviewed-by: Alex Bennée <alex.bennee@linaro.org>

> ---
>  target-alpha/cpu-qom.h     | 1 -
>  target-arm/psci.c          | 1 -
>  target-i386/cpu-qom.h      | 1 -
>  target-lm32/cpu-qom.h      | 1 -
>  target-ppc/cpu-qom.h       | 1 -
>  target-s390x/cpu-qom.h     | 1 -
>  target-sparc/cpu-qom.h     | 1 -
>  target-unicore32/cpu-qom.h | 1 -
>  target-xtensa/cpu-qom.h    | 1 -
>  9 files changed, 9 deletions(-)
>
> diff --git a/target-alpha/cpu-qom.h b/target-alpha/cpu-qom.h
> index b01c6c8..cf5264a 100644
> --- a/target-alpha/cpu-qom.h
> +++ b/target-alpha/cpu-qom.h
> @@ -21,7 +21,6 @@
>  #define QEMU_ALPHA_CPU_QOM_H
>
>  #include "qom/cpu.h"
> -#include "cpu.h"
>
>  #define TYPE_ALPHA_CPU "alpha-cpu"
>
> diff --git a/target-arm/psci.c b/target-arm/psci.c
> index c55487f..2b624b9 100644
> --- a/target-arm/psci.c
> +++ b/target-arm/psci.c
> @@ -17,7 +17,6 @@
>   */
>  #include "qemu/osdep.h"
>  #include <cpu.h>
> -#include <cpu-qom.h>
>  #include <exec/helper-proto.h>
>  #include <kvm-consts.h>
>  #include <sysemu/sysemu.h>
> diff --git a/target-i386/cpu-qom.h b/target-i386/cpu-qom.h
> index cb75017..2ca7b9e 100644
> --- a/target-i386/cpu-qom.h
> +++ b/target-i386/cpu-qom.h
> @@ -21,7 +21,6 @@
>  #define QEMU_I386_CPU_QOM_H
>
>  #include "qom/cpu.h"
> -#include "cpu.h"
>  #include "qemu/notify.h"
>
>  #ifdef TARGET_X86_64
> diff --git a/target-lm32/cpu-qom.h b/target-lm32/cpu-qom.h
> index 77bc7b2..54989e4 100644
> --- a/target-lm32/cpu-qom.h
> +++ b/target-lm32/cpu-qom.h
> @@ -21,7 +21,6 @@
>  #define QEMU_LM32_CPU_QOM_H
>
>  #include "qom/cpu.h"
> -#include "cpu.h"
>
>  #define TYPE_LM32_CPU "lm32-cpu"
>
> diff --git a/target-ppc/cpu-qom.h b/target-ppc/cpu-qom.h
> index 7d5e2b3..eb822a3 100644
> --- a/target-ppc/cpu-qom.h
> +++ b/target-ppc/cpu-qom.h
> @@ -21,7 +21,6 @@
>  #define QEMU_PPC_CPU_QOM_H
>
>  #include "qom/cpu.h"
> -#include "cpu.h"
>
>  #ifdef TARGET_PPC64
>  #define TYPE_POWERPC_CPU "powerpc64-cpu"
> diff --git a/target-s390x/cpu-qom.h b/target-s390x/cpu-qom.h
> index 1c90933..681e370 100644
> --- a/target-s390x/cpu-qom.h
> +++ b/target-s390x/cpu-qom.h
> @@ -21,7 +21,6 @@
>  #define QEMU_S390_CPU_QOM_H
>
>  #include "qom/cpu.h"
> -#include "cpu.h"
>
>  #define TYPE_S390_CPU "s390-cpu"
>
> diff --git a/target-sparc/cpu-qom.h b/target-sparc/cpu-qom.h
> index 5096b10..174dfd3 100644
> --- a/target-sparc/cpu-qom.h
> +++ b/target-sparc/cpu-qom.h
> @@ -21,7 +21,6 @@
>  #define QEMU_SPARC_CPU_QOM_H
>
>  #include "qom/cpu.h"
> -#include "cpu.h"
>
>  #ifdef TARGET_SPARC64
>  #define TYPE_SPARC_CPU "sparc64-cpu"
> diff --git a/target-unicore32/cpu-qom.h b/target-unicore32/cpu-qom.h
> index ea65b83..e554f1f 100644
> --- a/target-unicore32/cpu-qom.h
> +++ b/target-unicore32/cpu-qom.h
> @@ -12,7 +12,6 @@
>  #define QEMU_UC32_CPU_QOM_H
>
>  #include "qom/cpu.h"
> -#include "cpu.h"
>
>  #define TYPE_UNICORE32_CPU "unicore32-cpu"
>
> diff --git a/target-xtensa/cpu-qom.h b/target-xtensa/cpu-qom.h
> index 2258224..f5d9b9f 100644
> --- a/target-xtensa/cpu-qom.h
> +++ b/target-xtensa/cpu-qom.h
> @@ -30,7 +30,6 @@
>  #define QEMU_XTENSA_CPU_QOM_H
>
>  #include "qom/cpu.h"
> -#include "cpu.h"
>
>  #define TYPE_XTENSA_CPU "xtensa-cpu"


--
Alex Bennée

^ permalink raw reply	[flat|nested] 72+ messages in thread

* Re: [Qemu-devel] [PATCH 06/50] target-arm: make cpu-qom.h not target specific
  2016-04-08 20:28 ` [Qemu-devel] [PATCH 06/50] target-arm: " Paolo Bonzini
@ 2016-04-21 10:29   ` Alex Bennée
  0 siblings, 0 replies; 72+ messages in thread
From: Alex Bennée @ 2016-04-21 10:29 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: qemu-devel


Paolo Bonzini <pbonzini@redhat.com> writes:

> Make ARMCPU an opaque type within cpu-qom.h, and move all definitions of
> private methods, as well as all type definitions that require knowledge
> of the layout to cpu.h.  This helps making files independent of NEED_CPU_H
> if they only need to pass around CPU pointers.
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

Reviewed-by: Alex Bennée <alex.bennee@linaro.org>

> ---
>  target-arm/cpu-qom.h | 178 +-------------------------------------------------
>  target-arm/cpu.h     | 179 ++++++++++++++++++++++++++++++++++++++++++++++++++-
>  2 files changed, 179 insertions(+), 178 deletions(-)
>
> diff --git a/target-arm/cpu-qom.h b/target-arm/cpu-qom.h
> index 1061c08..3991173 100644
> --- a/target-arm/cpu-qom.h
> +++ b/target-arm/cpu-qom.h
> @@ -22,6 +22,8 @@
>
>  #include "qom/cpu.h"
>
> +struct arm_boot_info;
> +
>  #define TYPE_ARM_CPU "arm-cpu"
>
>  #define ARM_CPU_CLASS(klass) \
> @@ -47,145 +49,7 @@ typedef struct ARMCPUClass {
>      void (*parent_reset)(CPUState *cpu);
>  } ARMCPUClass;
>
> -/**
> - * ARMCPU:
> - * @env: #CPUARMState
> - *
> - * An ARM CPU core.
> - */
> -typedef struct ARMCPU {
> -    /*< private >*/
> -    CPUState parent_obj;
> -    /*< public >*/
> -
> -    CPUARMState env;
> -
> -    /* Coprocessor information */
> -    GHashTable *cp_regs;
> -    /* For marshalling (mostly coprocessor) register state between the
> -     * kernel and QEMU (for KVM) and between two QEMUs (for migration),
> -     * we use these arrays.
> -     */
> -    /* List of register indexes managed via these arrays; (full KVM style
> -     * 64 bit indexes, not CPRegInfo 32 bit indexes)
> -     */
> -    uint64_t *cpreg_indexes;
> -    /* Values of the registers (cpreg_indexes[i]'s value is cpreg_values[i]) */
> -    uint64_t *cpreg_values;
> -    /* Length of the indexes, values, reset_values arrays */
> -    int32_t cpreg_array_len;
> -    /* These are used only for migration: incoming data arrives in
> -     * these fields and is sanity checked in post_load before copying
> -     * to the working data structures above.
> -     */
> -    uint64_t *cpreg_vmstate_indexes;
> -    uint64_t *cpreg_vmstate_values;
> -    int32_t cpreg_vmstate_array_len;
> -
> -    /* Timers used by the generic (architected) timer */
> -    QEMUTimer *gt_timer[NUM_GTIMERS];
> -    /* GPIO outputs for generic timer */
> -    qemu_irq gt_timer_outputs[NUM_GTIMERS];
> -
> -    /* MemoryRegion to use for secure physical accesses */
> -    MemoryRegion *secure_memory;
> -
> -    /* 'compatible' string for this CPU for Linux device trees */
> -    const char *dtb_compatible;
> -
> -    /* PSCI version for this CPU
> -     * Bits[31:16] = Major Version
> -     * Bits[15:0] = Minor Version
> -     */
> -    uint32_t psci_version;
> -
> -    /* Should CPU start in PSCI powered-off state? */
> -    bool start_powered_off;
> -    /* CPU currently in PSCI powered-off state */
> -    bool powered_off;
> -    /* CPU has security extension */
> -    bool has_el3;
> -
> -    /* CPU has memory protection unit */
> -    bool has_mpu;
> -    /* PMSAv7 MPU number of supported regions */
> -    uint32_t pmsav7_dregion;
> -
> -    /* PSCI conduit used to invoke PSCI methods
> -     * 0 - disabled, 1 - smc, 2 - hvc
> -     */
> -    uint32_t psci_conduit;
> -
> -    /* [QEMU_]KVM_ARM_TARGET_* constant for this CPU, or
> -     * QEMU_KVM_ARM_TARGET_NONE if the kernel doesn't support this CPU type.
> -     */
> -    uint32_t kvm_target;
> -
> -    /* KVM init features for this CPU */
> -    uint32_t kvm_init_features[7];
> -
> -    /* Uniprocessor system with MP extensions */
> -    bool mp_is_up;
> -
> -    /* The instance init functions for implementation-specific subclasses
> -     * set these fields to specify the implementation-dependent values of
> -     * various constant registers and reset values of non-constant
> -     * registers.
> -     * Some of these might become QOM properties eventually.
> -     * Field names match the official register names as defined in the
> -     * ARMv7AR ARM Architecture Reference Manual. A reset_ prefix
> -     * is used for reset values of non-constant registers; no reset_
> -     * prefix means a constant register.
> -     */
> -    uint32_t midr;
> -    uint32_t revidr;
> -    uint32_t reset_fpsid;
> -    uint32_t mvfr0;
> -    uint32_t mvfr1;
> -    uint32_t mvfr2;
> -    uint32_t ctr;
> -    uint32_t reset_sctlr;
> -    uint32_t id_pfr0;
> -    uint32_t id_pfr1;
> -    uint32_t id_dfr0;
> -    uint32_t pmceid0;
> -    uint32_t pmceid1;
> -    uint32_t id_afr0;
> -    uint32_t id_mmfr0;
> -    uint32_t id_mmfr1;
> -    uint32_t id_mmfr2;
> -    uint32_t id_mmfr3;
> -    uint32_t id_mmfr4;
> -    uint32_t id_isar0;
> -    uint32_t id_isar1;
> -    uint32_t id_isar2;
> -    uint32_t id_isar3;
> -    uint32_t id_isar4;
> -    uint32_t id_isar5;
> -    uint64_t id_aa64pfr0;
> -    uint64_t id_aa64pfr1;
> -    uint64_t id_aa64dfr0;
> -    uint64_t id_aa64dfr1;
> -    uint64_t id_aa64afr0;
> -    uint64_t id_aa64afr1;
> -    uint64_t id_aa64isar0;
> -    uint64_t id_aa64isar1;
> -    uint64_t id_aa64mmfr0;
> -    uint64_t id_aa64mmfr1;
> -    uint32_t dbgdidr;
> -    uint32_t clidr;
> -    uint64_t mp_affinity; /* MP ID without feature bits */
> -    /* The elements of this array are the CCSIDR values for each cache,
> -     * in the order L1DCache, L1ICache, L2DCache, L2ICache, etc.
> -     */
> -    uint32_t ccsidr[16];
> -    uint64_t reset_cbar;
> -    uint32_t reset_auxcr;
> -    bool reset_hivecs;
> -    /* DCZ blocksize, in log_2(words), ie low 4 bits of DCZID_EL0 */
> -    uint32_t dcz_blocksize;
> -    uint64_t rvbar;
> -} ARMCPU;
> +typedef struct ARMCPU ARMCPU;
>
>  #define TYPE_AARCH64_CPU "aarch64-cpu"
>  #define AARCH64_CPU_CLASS(klass) \
> @@ -199,40 +63,9 @@ typedef struct AArch64CPUClass {
>      /*< public >*/
>  } AArch64CPUClass;
>
> -static inline ARMCPU *arm_env_get_cpu(CPUARMState *env)
> -{
> -    return container_of(env, ARMCPU, env);
> -}
> -
> -#define ENV_GET_CPU(e) CPU(arm_env_get_cpu(e))
> -
> -#define ENV_OFFSET offsetof(ARMCPU, env)
> -
> -#ifndef CONFIG_USER_ONLY
> -extern const struct VMStateDescription vmstate_arm_cpu;
> -#endif
> -
>  void register_cp_regs_for_features(ARMCPU *cpu);
>  void init_cpreg_list(ARMCPU *cpu);
>
> -void arm_cpu_do_interrupt(CPUState *cpu);
> -void arm_v7m_cpu_do_interrupt(CPUState *cpu);
> -bool arm_cpu_exec_interrupt(CPUState *cpu, int int_req);
> -
> -void arm_cpu_dump_state(CPUState *cs, FILE *f, fprintf_function cpu_fprintf,
> -                        int flags);
> -
> -hwaddr arm_cpu_get_phys_page_attrs_debug(CPUState *cpu, vaddr addr,
> -                                         MemTxAttrs *attrs);
> -
> -int arm_cpu_gdb_read_register(CPUState *cpu, uint8_t *buf, int reg);
> -int arm_cpu_gdb_write_register(CPUState *cpu, uint8_t *buf, int reg);
> -
> -int arm_cpu_write_elf64_note(WriteCoreDumpFunction f, CPUState *cs,
> -                             int cpuid, void *opaque);
> -int arm_cpu_write_elf32_note(WriteCoreDumpFunction f, CPUState *cs,
> -                             int cpuid, void *opaque);
> -
>  /* Callback functions for the generic timer's timers. */
>  void arm_gt_ptimer_cb(void *opaque);
>  void arm_gt_vtimer_cb(void *opaque);
> @@ -252,9 +85,4 @@ void arm_gt_stimer_cb(void *opaque);
>  #define ARM64_AFFINITY_MASK \
>      (ARM_AFF0_MASK|ARM_AFF1_MASK|ARM_AFF2_MASK|ARM_AFF3_MASK)
>
> -#ifdef TARGET_AARCH64
> -int aarch64_cpu_gdb_read_register(CPUState *cpu, uint8_t *buf, int reg);
> -int aarch64_cpu_gdb_write_register(CPUState *cpu, uint8_t *buf, int reg);
> -#endif
> -
>  #endif
> diff --git a/target-arm/cpu.h b/target-arm/cpu.h
> index 066ff67..bf6904c 100644
> --- a/target-arm/cpu.h
> +++ b/target-arm/cpu.h
> @@ -34,6 +34,7 @@
>  #define CPUArchState struct CPUARMState
>
>  #include "qemu-common.h"
> +#include "cpu-qom.h"
>  #include "exec/cpu-defs.h"
>
>  #include "fpu/softfloat.h"
> @@ -91,8 +92,6 @@
>  #define ARM_CPU_VIRQ 2
>  #define ARM_CPU_VFIQ 3
>
> -struct arm_boot_info;
> -
>  #define NB_MMU_MODES 7
>  #define TARGET_INSN_START_EXTRA_WORDS 1
>
> @@ -504,7 +503,181 @@ typedef struct CPUARMState {
>      const struct arm_boot_info *boot_info;
>  } CPUARMState;
>
> -#include "cpu-qom.h"
> +/**
> + * ARMCPU:
> + * @env: #CPUARMState
> + *
> + * An ARM CPU core.
> + */
> +struct ARMCPU {
> +    /*< private >*/
> +    CPUState parent_obj;
> +    /*< public >*/
> +
> +    CPUARMState env;
> +
> +    /* Coprocessor information */
> +    GHashTable *cp_regs;
> +    /* For marshalling (mostly coprocessor) register state between the
> +     * kernel and QEMU (for KVM) and between two QEMUs (for migration),
> +     * we use these arrays.
> +     */
> +    /* List of register indexes managed via these arrays; (full KVM style
> +     * 64 bit indexes, not CPRegInfo 32 bit indexes)
> +     */
> +    uint64_t *cpreg_indexes;
> +    /* Values of the registers (cpreg_indexes[i]'s value is cpreg_values[i]) */
> +    uint64_t *cpreg_values;
> +    /* Length of the indexes, values, reset_values arrays */
> +    int32_t cpreg_array_len;
> +    /* These are used only for migration: incoming data arrives in
> +     * these fields and is sanity checked in post_load before copying
> +     * to the working data structures above.
> +     */
> +    uint64_t *cpreg_vmstate_indexes;
> +    uint64_t *cpreg_vmstate_values;
> +    int32_t cpreg_vmstate_array_len;
> +
> +    /* Timers used by the generic (architected) timer */
> +    QEMUTimer *gt_timer[NUM_GTIMERS];
> +    /* GPIO outputs for generic timer */
> +    qemu_irq gt_timer_outputs[NUM_GTIMERS];
> +
> +    /* MemoryRegion to use for secure physical accesses */
> +    MemoryRegion *secure_memory;
> +
> +    /* 'compatible' string for this CPU for Linux device trees */
> +    const char *dtb_compatible;
> +
> +    /* PSCI version for this CPU
> +     * Bits[31:16] = Major Version
> +     * Bits[15:0] = Minor Version
> +     */
> +    uint32_t psci_version;
> +
> +    /* Should CPU start in PSCI powered-off state? */
> +    bool start_powered_off;
> +    /* CPU currently in PSCI powered-off state */
> +    bool powered_off;
> +    /* CPU has security extension */
> +    bool has_el3;
> +
> +    /* CPU has memory protection unit */
> +    bool has_mpu;
> +    /* PMSAv7 MPU number of supported regions */
> +    uint32_t pmsav7_dregion;
> +
> +    /* PSCI conduit used to invoke PSCI methods
> +     * 0 - disabled, 1 - smc, 2 - hvc
> +     */
> +    uint32_t psci_conduit;
> +
> +    /* [QEMU_]KVM_ARM_TARGET_* constant for this CPU, or
> +     * QEMU_KVM_ARM_TARGET_NONE if the kernel doesn't support this CPU type.
> +     */
> +    uint32_t kvm_target;
> +
> +    /* KVM init features for this CPU */
> +    uint32_t kvm_init_features[7];
> +
> +    /* Uniprocessor system with MP extensions */
> +    bool mp_is_up;
> +
> +    /* The instance init functions for implementation-specific subclasses
> +     * set these fields to specify the implementation-dependent values of
> +     * various constant registers and reset values of non-constant
> +     * registers.
> +     * Some of these might become QOM properties eventually.
> +     * Field names match the official register names as defined in the
> +     * ARMv7AR ARM Architecture Reference Manual. A reset_ prefix
> +     * is used for reset values of non-constant registers; no reset_
> +     * prefix means a constant register.
> +     */
> +    uint32_t midr;
> +    uint32_t revidr;
> +    uint32_t reset_fpsid;
> +    uint32_t mvfr0;
> +    uint32_t mvfr1;
> +    uint32_t mvfr2;
> +    uint32_t ctr;
> +    uint32_t reset_sctlr;
> +    uint32_t id_pfr0;
> +    uint32_t id_pfr1;
> +    uint32_t id_dfr0;
> +    uint32_t pmceid0;
> +    uint32_t pmceid1;
> +    uint32_t id_afr0;
> +    uint32_t id_mmfr0;
> +    uint32_t id_mmfr1;
> +    uint32_t id_mmfr2;
> +    uint32_t id_mmfr3;
> +    uint32_t id_mmfr4;
> +    uint32_t id_isar0;
> +    uint32_t id_isar1;
> +    uint32_t id_isar2;
> +    uint32_t id_isar3;
> +    uint32_t id_isar4;
> +    uint32_t id_isar5;
> +    uint64_t id_aa64pfr0;
> +    uint64_t id_aa64pfr1;
> +    uint64_t id_aa64dfr0;
> +    uint64_t id_aa64dfr1;
> +    uint64_t id_aa64afr0;
> +    uint64_t id_aa64afr1;
> +    uint64_t id_aa64isar0;
> +    uint64_t id_aa64isar1;
> +    uint64_t id_aa64mmfr0;
> +    uint64_t id_aa64mmfr1;
> +    uint32_t dbgdidr;
> +    uint32_t clidr;
> +    uint64_t mp_affinity; /* MP ID without feature bits */
> +    /* The elements of this array are the CCSIDR values for each cache,
> +     * in the order L1DCache, L1ICache, L2DCache, L2ICache, etc.
> +     */
> +    uint32_t ccsidr[16];
> +    uint64_t reset_cbar;
> +    uint32_t reset_auxcr;
> +    bool reset_hivecs;
> +    /* DCZ blocksize, in log_2(words), ie low 4 bits of DCZID_EL0 */
> +    uint32_t dcz_blocksize;
> +    uint64_t rvbar;
> +};
> +
> +static inline ARMCPU *arm_env_get_cpu(CPUARMState *env)
> +{
> +    return container_of(env, ARMCPU, env);
> +}
> +
> +#define ENV_GET_CPU(e) CPU(arm_env_get_cpu(e))
> +
> +#define ENV_OFFSET offsetof(ARMCPU, env)
> +
> +#ifndef CONFIG_USER_ONLY
> +extern const struct VMStateDescription vmstate_arm_cpu;
> +#endif
> +
> +void arm_cpu_do_interrupt(CPUState *cpu);
> +void arm_v7m_cpu_do_interrupt(CPUState *cpu);
> +bool arm_cpu_exec_interrupt(CPUState *cpu, int int_req);
> +
> +void arm_cpu_dump_state(CPUState *cs, FILE *f, fprintf_function cpu_fprintf,
> +                        int flags);
> +
> +hwaddr arm_cpu_get_phys_page_attrs_debug(CPUState *cpu, vaddr addr,
> +                                         MemTxAttrs *attrs);
> +
> +int arm_cpu_gdb_read_register(CPUState *cpu, uint8_t *buf, int reg);
> +int arm_cpu_gdb_write_register(CPUState *cpu, uint8_t *buf, int reg);
> +
> +int arm_cpu_write_elf64_note(WriteCoreDumpFunction f, CPUState *cs,
> +                             int cpuid, void *opaque);
> +int arm_cpu_write_elf32_note(WriteCoreDumpFunction f, CPUState *cs,
> +                             int cpuid, void *opaque);
> +
> +#ifdef TARGET_AARCH64
> +int aarch64_cpu_gdb_read_register(CPUState *cpu, uint8_t *buf, int reg);
> +int aarch64_cpu_gdb_write_register(CPUState *cpu, uint8_t *buf, int reg);
> +#endif
>
>  ARMCPU *cpu_arm_init(const char *cpu_model);
>  int cpu_arm_exec(CPUState *cpu);


--
Alex Bennée

^ permalink raw reply	[flat|nested] 72+ messages in thread

* Re: [Qemu-devel] [PATCH 38/50] qemu-common: stop including qemu/host-utils.h from qemu-common.h
  2016-04-08 20:28 ` [Qemu-devel] [PATCH 38/50] qemu-common: stop including qemu/host-utils.h " Paolo Bonzini
@ 2016-04-21 10:46   ` Alex Bennée
  2016-05-09  9:39     ` Paolo Bonzini
  0 siblings, 1 reply; 72+ messages in thread
From: Alex Bennée @ 2016-04-21 10:46 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: qemu-devel


Paolo Bonzini <pbonzini@redhat.com> writes:

> Move it to the actual users.  There are some inclusions of
> qemu/host-utils.h in headers, but they are all necessary.
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>


This patch breaks the bisect:

make -k -j9
  CC    audio/spiceaudio.o
audio/spiceaudio.c: In function ‘rate_get_samples’:
audio/spiceaudio.c:107:13: error: implicit declaration of function ‘muldiv64’ [-Werror=implicit-function-declaration]
     bytes = muldiv64(ticks, info->bytes_per_second, NANOSECONDS_PER_SECOND);
             ^
audio/spiceaudio.c:107:5: error: nested extern declaration of ‘muldiv64’ [-Werror=nested-externs]
     bytes = muldiv64(ticks, info->bytes_per_second, NANOSECONDS_PER_SECOND);
     ^
cc1: all warnings being treated as errors
/home/alex/lsrc/qemu/qemu.git/rules.mak:57: recipe for target 'audio/spiceaudio.o' failed
make: *** [audio/spiceaudio.o] Error 1
make: Target 'all' not remade because of errors.

Compilation exited abnormally with code 2 at Thu Apr 21 11:45:33


> ---
>  audio/noaudio.c                         | 1 +
>  audio/wavaudio.c                        | 2 +-
>  contrib/ivshmem-server/ivshmem-server.c | 1 +
>  hw/acpi/core.c                          | 6 ++++++
>  hw/bt/sdp.c                             | 1 +
>  hw/display/tc6393xb.c                   | 1 +
>  include/exec/cpu-defs.h                 | 1 +
>  include/hw/acpi/acpi.h                  | 7 -------
>  include/qemu-common.h                   | 1 -
>  include/qemu/timer.h                    | 1 -
>  page_cache.c                            | 1 +
>  slirp/slirp.h                           | 1 +
>  stubs/slirp.c                           | 1 +
>  tests/libqos/malloc.c                   | 1 +
>  util/buffer.c                           | 1 +
>  15 files changed, 17 insertions(+), 10 deletions(-)
>
> diff --git a/audio/noaudio.c b/audio/noaudio.c
> index b360c19..9ca9eaf 100644
> --- a/audio/noaudio.c
> +++ b/audio/noaudio.c
> @@ -23,6 +23,7 @@
>   */
>  #include "qemu/osdep.h"
>  #include "qemu-common.h"
> +#include "qemu/host-utils.h"
>  #include "audio.h"
>  #include "qemu/timer.h"
>
> diff --git a/audio/wavaudio.c b/audio/wavaudio.c
> index 345952e..341eec3 100644
> --- a/audio/wavaudio.c
> +++ b/audio/wavaudio.c
> @@ -22,7 +22,7 @@
>   * THE SOFTWARE.
>   */
>  #include "qemu/osdep.h"
> -#include "hw/hw.h"
> +#include "qemu/host-utils.h"
>  #include "qemu/timer.h"
>  #include "audio.h"
>
> diff --git a/contrib/ivshmem-server/ivshmem-server.c b/contrib/ivshmem-server/ivshmem-server.c
> index 172db78..bf4ee0b 100644
> --- a/contrib/ivshmem-server/ivshmem-server.c
> +++ b/contrib/ivshmem-server/ivshmem-server.c
> @@ -7,6 +7,7 @@
>   */
>  #include "qemu/osdep.h"
>  #include "qemu-common.h"
> +#include "qemu/host-utils.h"
>  #include "qemu/sockets.h"
>
>  #include <sys/mman.h>
> diff --git a/hw/acpi/core.c b/hw/acpi/core.c
> index 7925a1a..f0808c1 100644
> --- a/hw/acpi/core.c
> +++ b/hw/acpi/core.c
> @@ -491,6 +491,12 @@ void acpi_pm_tmr_update(ACPIREGS *ar, bool enable)
>      }
>  }
>
> +static inline int64_t acpi_pm_tmr_get_clock(void)
> +{
> +    return muldiv64(qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL), PM_TIMER_FREQUENCY,
> +                    NANOSECONDS_PER_SECOND);
> +}
> +
>  void acpi_pm_tmr_calc_overflow_time(ACPIREGS *ar)
>  {
>      int64_t d = acpi_pm_tmr_get_clock();
> diff --git a/hw/bt/sdp.c b/hw/bt/sdp.c
> index be26009..f67b3b8 100644
> --- a/hw/bt/sdp.c
> +++ b/hw/bt/sdp.c
> @@ -19,6 +19,7 @@
>
>  #include "qemu/osdep.h"
>  #include "qemu-common.h"
> +#include "qemu/host-utils.h"
>  #include "hw/bt.h"
>
>  struct bt_l2cap_sdp_state_s {
> diff --git a/hw/display/tc6393xb.c b/hw/display/tc6393xb.c
> index da3cece..92f7120 100644
> --- a/hw/display/tc6393xb.c
> +++ b/hw/display/tc6393xb.c
> @@ -12,6 +12,7 @@
>   */
>  #include "qemu/osdep.h"
>  #include "qapi/error.h"
> +#include "qemu/host-utils.h"
>  #include "hw/hw.h"
>  #include "hw/devices.h"
>  #include "hw/block/flash.h"
> diff --git a/include/exec/cpu-defs.h b/include/exec/cpu-defs.h
> index 854e7e3..5f4e303 100644
> --- a/include/exec/cpu-defs.h
> +++ b/include/exec/cpu-defs.h
> @@ -23,6 +23,7 @@
>  #error cpu.h included from common code
>  #endif
>
> +#include "qemu/host-utils.h"
>  #include "qemu/queue.h"
>  #include "tcg-target.h"
>  #ifndef CONFIG_USER_ONLY
> diff --git a/include/hw/acpi/acpi.h b/include/hw/acpi/acpi.h
> index e0978c8..dc6ee00 100644
> --- a/include/hw/acpi/acpi.h
> +++ b/include/hw/acpi/acpi.h
> @@ -150,13 +150,6 @@ void acpi_pm_tmr_init(ACPIREGS *ar, acpi_update_sci_fn update_sci,
>                        MemoryRegion *parent);
>  void acpi_pm_tmr_reset(ACPIREGS *ar);
>
> -#include "qemu/timer.h"
> -static inline int64_t acpi_pm_tmr_get_clock(void)
> -{
> -    return muldiv64(qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL), PM_TIMER_FREQUENCY,
> -                    NANOSECONDS_PER_SECOND);
> -}
> -
>  /* PM1a_EVT: piix and ich9 don't implement PM1b. */
>  uint16_t acpi_pm1_evt_get_sts(ACPIREGS *ar);
>  void acpi_pm1_evt_power_down(ACPIREGS *ar);
> diff --git a/include/qemu-common.h b/include/qemu-common.h
> index dc041fc..cd3139b 100644
> --- a/include/qemu-common.h
> +++ b/include/qemu-common.h
> @@ -21,7 +21,6 @@
>  #define TFR(expr) do { if ((expr) != -1) break; } while (errno == EINTR)
>
>  #include "qemu/option.h"
> -#include "qemu/host-utils.h"
>
>  /* FIXME: Remove NEED_CPU_H.  */
>  #ifdef NEED_CPU_H
> diff --git a/include/qemu/timer.h b/include/qemu/timer.h
> index 309f3d0..d97ddfb 100644
> --- a/include/qemu/timer.h
> +++ b/include/qemu/timer.h
> @@ -3,7 +3,6 @@
>
>  #include "qemu-common.h"
>  #include "qemu/notify.h"
> -#include "qemu/host-utils.h"
>  #include "sysemu/cpus.h"
>
>  #define NANOSECONDS_PER_SECOND 1000000000LL
> diff --git a/page_cache.c b/page_cache.c
> index cb8a69e..37a66e4 100644
> --- a/page_cache.c
> +++ b/page_cache.c
> @@ -16,6 +16,7 @@
>  #include <glib.h>
>
>  #include "qemu-common.h"
> +#include "qemu/host-utils.h"
>  #include "migration/page_cache.h"
>
>  #ifdef DEBUG_CACHE
> diff --git a/slirp/slirp.h b/slirp/slirp.h
> index c99ebb9..223da91 100644
> --- a/slirp/slirp.h
> +++ b/slirp/slirp.h
> @@ -1,6 +1,7 @@
>  #ifndef __COMMON_H__
>  #define __COMMON_H__
>
> +#include "qemu/host-utils.h"
>  #include "slirp_config.h"
>
>  #ifdef _WIN32
> diff --git a/stubs/slirp.c b/stubs/slirp.c
> index dcae51f..42f7e1a 100644
> --- a/stubs/slirp.c
> +++ b/stubs/slirp.c
> @@ -1,5 +1,6 @@
>  #include "qemu/osdep.h"
>  #include "qemu-common.h"
> +#include "qemu/host-utils.h"
>  #include "slirp/slirp.h"
>
>  void slirp_pollfds_fill(GArray *pollfds, uint32_t *timeout)
> diff --git a/tests/libqos/malloc.c b/tests/libqos/malloc.c
> index c0df52f..793fe69 100644
> --- a/tests/libqos/malloc.c
> +++ b/tests/libqos/malloc.c
> @@ -13,6 +13,7 @@
>  #include "qemu/osdep.h"
>  #include "libqos/malloc.h"
>  #include "qemu-common.h"
> +#include "qemu/host-utils.h"
>  #include <glib.h>
>
>  typedef QTAILQ_HEAD(MemList, MemBlock) MemList;
> diff --git a/util/buffer.c b/util/buffer.c
> index a6118bf..f59bacc 100644
> --- a/util/buffer.c
> +++ b/util/buffer.c
> @@ -19,6 +19,7 @@
>   */
>
>  #include "qemu/osdep.h"
> +#include "qemu/host-utils.h"
>  #include "qemu/buffer.h"
>  #include "trace.h"


--
Alex Bennée

^ permalink raw reply	[flat|nested] 72+ messages in thread

* Re: [Qemu-devel] [PATCH 44/50] arm: move arm_log_exception into .c file
  2016-04-08 20:29 ` [Qemu-devel] [PATCH 44/50] arm: move arm_log_exception into .c file Paolo Bonzini
@ 2016-04-21 10:48   ` Alex Bennée
  0 siblings, 0 replies; 72+ messages in thread
From: Alex Bennée @ 2016-04-21 10:48 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: qemu-devel


Paolo Bonzini <pbonzini@redhat.com> writes:

> Avoid need for qemu/log.h inclusion, and make the function static too.
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

Reviewed-by: Alex Bennée <alex.bennee@linaro.org>

> ---
>  target-arm/helper.c    | 15 +++++++++++++++
>  target-arm/internals.h | 15 ---------------
>  2 files changed, 15 insertions(+), 15 deletions(-)
>
> diff --git a/target-arm/helper.c b/target-arm/helper.c
> index 09638b2..41abdff 100644
> --- a/target-arm/helper.c
> +++ b/target-arm/helper.c
> @@ -5815,6 +5815,21 @@ static void do_v7m_exception_exit(CPUARMState *env)
>         pointer.  */
>  }
>
> +static void arm_log_exception(int idx)
> +{
> +    if (qemu_loglevel_mask(CPU_LOG_INT)) {
> +        const char *exc = NULL;
> +
> +        if (idx >= 0 && idx < ARRAY_SIZE(excnames)) {
> +            exc = excnames[idx];
> +        }
> +        if (!exc) {
> +            exc = "unknown";
> +        }
> +        qemu_log_mask(CPU_LOG_INT, "Taking exception %d [%s]\n", idx, exc);
> +    }
> +}
> +
>  void arm_v7m_cpu_do_interrupt(CPUState *cs)
>  {
>      ARMCPU *cpu = ARM_CPU(cs);
> diff --git a/target-arm/internals.h b/target-arm/internals.h
> index 2e70272..c484700 100644
> --- a/target-arm/internals.h
> +++ b/target-arm/internals.h
> @@ -72,21 +72,6 @@ static const char * const excnames[] = {
>      [EXCP_SEMIHOST] = "Semihosting call",
>  };
>
> -static inline void arm_log_exception(int idx)
> -{
> -    if (qemu_loglevel_mask(CPU_LOG_INT)) {
> -        const char *exc = NULL;
> -
> -        if (idx >= 0 && idx < ARRAY_SIZE(excnames)) {
> -            exc = excnames[idx];
> -        }
> -        if (!exc) {
> -            exc = "unknown";
> -        }
> -        qemu_log_mask(CPU_LOG_INT, "Taking exception %d [%s]\n", idx, exc);
> -    }
> -}
> -
>  /* Scale factor for generic timers, ie number of ns per tick.
>   * This gives a 62.5MHz timer.
>   */


--
Alex Bennée

^ permalink raw reply	[flat|nested] 72+ messages in thread

* Re: [Qemu-devel] [PATCH 38/50] qemu-common: stop including qemu/host-utils.h from qemu-common.h
  2016-04-21 10:46   ` Alex Bennée
@ 2016-05-09  9:39     ` Paolo Bonzini
  0 siblings, 0 replies; 72+ messages in thread
From: Paolo Bonzini @ 2016-05-09  9:39 UTC (permalink / raw)
  To: Alex Bennée; +Cc: qemu-devel



On 21/04/2016 12:46, Alex Bennée wrote:
> 
>> > Move it to the actual users.  There are some inclusions of
>> > qemu/host-utils.h in headers, but they are all necessary.
>> >
>> > Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> 
> This patch breaks the bisect:

Thanks, fixed.

Paolo

^ permalink raw reply	[flat|nested] 72+ messages in thread

* Re: [Qemu-devel] [PATCH 01/50] scripts: add script to build QEMU and analyze inclusions
  2016-04-20 19:47   ` Alex Bennée
@ 2016-05-09  9:39     ` Paolo Bonzini
  0 siblings, 0 replies; 72+ messages in thread
From: Paolo Bonzini @ 2016-05-09  9:39 UTC (permalink / raw)
  To: Alex Bennée; +Cc: qemu-devel



On 20/04/2016 21:47, Alex Bennée wrote:
> OK the script directory is inconsistent but if we want to use it for
> automated testing it should be executable in the checkout.

This is not a testing script, it's just for analysis.

Paolo

^ permalink raw reply	[flat|nested] 72+ messages in thread

* Re: [Qemu-devel] [PATCH 41/50] s390x: move stuff out of cpu.h
  2016-04-11  8:24   ` Cornelia Huck
@ 2016-05-09  9:43     ` Paolo Bonzini
  0 siblings, 0 replies; 72+ messages in thread
From: Paolo Bonzini @ 2016-05-09  9:43 UTC (permalink / raw)
  To: Cornelia Huck; +Cc: qemu-devel



On 11/04/2016 10:24, Cornelia Huck wrote:
>> > +void cpu_inject_ext(S390CPU *cpu, uint32_t code, uint32_t param,
>> > +                    uint64_t param64)
> ...but this one can be both floating and per-vcpu. Need to adust the
> comment above?
> 

I've moved the comment to just above s390_sclp_extint, which is where
the dummy CPUState is used.

Paolo

^ permalink raw reply	[flat|nested] 72+ messages in thread

* Re: [Qemu-devel] [PATCH 01/50] scripts: add script to build QEMU and analyze inclusions
  2016-04-18 13:10   ` Markus Armbruster
@ 2016-05-09 10:07     ` Paolo Bonzini
  0 siblings, 0 replies; 72+ messages in thread
From: Paolo Bonzini @ 2016-05-09 10:07 UTC (permalink / raw)
  To: Markus Armbruster; +Cc: qemu-devel



On 18/04/2016 15:10, Markus Armbruster wrote:
> Paolo Bonzini <pbonzini@redhat.com> writes:
> 
>> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
>> ---
>>  scripts/analyze-inclusions | 89 ++++++++++++++++++++++++++++++++++++++++++++++
>>  1 file changed, 89 insertions(+)
>>  create mode 100644 scripts/analyze-inclusions
>>
>> diff --git a/scripts/analyze-inclusions b/scripts/analyze-inclusions
>> new file mode 100644
>> index 0000000..e241bd4
>> --- /dev/null
>> +++ b/scripts/analyze-inclusions
>> @@ -0,0 +1,89 @@
>> +#! /bin/sh
>> +#
>> +# Copyright (C) 2016 Red Hat, Inc.
>> +#
>> +# Author: Paolo Bonzini <pbonzini@redhat.com>
>> +#
>> +# Print statistics about header file inclusions.
>> +# The script configures and builds QEMU itself in a "+build"
>> +# subdirectory which is left around when the script exits.
>> +# To run the statistics on a pre-existing "+build" directory,
>> +# pass "--no-build" as the first argument on the command line.
>> +# Any other command line is passed directly to "make" (so
>> +# you can for example pass a "-j" argument suitable for your
>> +# system).
>> +#
>> +# Inspired by a post by Markus Armbruster.
>> +
>> +mkdir -p +build
>> +cd +build
>> +if test "x$1" != "x--no-build"; then
>> +  test -f Makefile && make distclean
>> +  ../configure
>> +  make "$@"
>> +fi
> 
> Unfortunate: "mkdir -p +build" clobbers an existing symbolic link from
> +build to the build tree of my choice.

Changed to this:

# The script has two modes of execution:
#
# 1) if invoked with a path on the command line (possibly
# preceded by a "--" argument), it will run the analysis on
# an existing build directory
#
# 2) otherwise, it will configure and builds QEMU itself in a
# "+build" subdirectory which is left around when the script
# exits.  In this case the command line is passed directly to
# "make" (typically used for a "-j" argument suitable for your
# system).
#
# Inspired by a post by Markus Armbruster.

case "x$1" in
--)
  shift
  cd "$1" || exit $?
  ;;
x-* | x)
  mkdir -p +build
  cd +build
  test -f Makefile && make distclean
  ../configure
  make "$@"
  ;;
*)
  cd "$1" || exit $?
esac

>> +
>> +QEMU_CFLAGS=$(sed -n s/^QEMU_CFLAGS=//p config-host.mak)
>> +QEMU_INCLUDES=$(sed -n s/^QEMU_INCLUDES=//p config-host.mak | \
>> +    sed 's/$(SRC_PATH)/../g' )
>> +CFLAGS=$(sed -n s/^CFLAGS=//p config-host.mak)
>> +
>> +grep_include() {
>> +  find . -name "*.d" | xargs grep -l "$@" | wc -l
> 
> More robust against funny names would be:
> 
>      find . -name "*.d" -exec grep -l {} + | wc -l

Missing a "$@", otherwise adopted your version.

>> +echo Found $(find . -name "*.d" | wc -l) object files
>> +echo $(grep_include -F 'include/qemu-common.h') files include qemu-common.h
>> +echo $(grep_include -F 'hw/hw.h') files include hw/hw.h
>> +echo $(grep_include 'target-[a-z0-9]*/cpu\.h') files include cpu.h
>> +echo $(grep_include -F 'qapi-types.h') files include qapi-types.h
>> +echo $(grep_include -F 'trace/generated-tracers.h') files include generated-tracers.h
>> +echo $(grep_include -F 'qapi/error.h') files include qapi/error.h
>> +echo $(grep_include -F 'qom/object.h') files include qom/object.h
>> +echo $(grep_include -F 'block/aio.h') files include block/aio.h
>> +echo $(grep_include -F 'exec/memory.h') files include exec/memory.h
>> +echo $(grep_include -F 'fpu/softfloat.h') files include fpu/softfloat.h
>> +echo $(grep_include -F 'qemu/bswap.h') files include qemu/bswap.h
>> +echo
> 
> How did you select these headers?

>From your post, mostly.  A lot of these are files that we are planning
to tackle one way or another, or that have a lot of indirect inclusions.

>> +
>> +awk1='
>> +    /^# / { file = $3;next }
>> +    NR>1 { bytes[file]+=length; lines[file]++ }
> 
> Your #bytes is off by one, because AWK chops off the newlines.  I think
> you want length() + 1.

Fixed.

> We want to watch commonly included big headers, especially the ones that
> are prone to indirect inclusion.  These will change as we go.

That's valuable, but actually I wanted to check for something else.  I'm
looking at:

- files that include the world: these are hw/hw.h, cpu.h, etc.

- files included from anywhere, that probably shouldn't be included
anywhere: these are the ones I cherry-picked in the first part of the
script, such as block/aio.h, qemu/bswap.h, fpu/softfloat.h.

> Output of my header counting bash script (first 64 lines appended)
> provides possible additional initial candidates.
> 
> 479379846  124806   3841 qapi-types.h
> 199662236   55756   3581 /work/armbru/qemu/include/qom/object.h
> 187691645   53857   3485 /work/armbru/qemu/include/exec/memory.h
> 118894840   30643   3880 /work/armbru/qemu/include/fpu/softfloat.h
> 109943680  124936    880 trace/generated-events.h

These are examples of the second case.

>  88524072   27022   3276 /work/armbru/qemu/include/qom/cpu.h

This needs to be included by all target-*/cpu.h (which are in my list),
so I'm tracking one of those instead.

>  82757301   46519   1779 /work/armbru/qemu/include/migration/vmstate.h

Almost always included through hw/hw.h, tracking that instead.  The
problem (if it is a problem) here is too many inclusions of hw/hw.h, and
hw/hw.h including the kitchen sink.

>  82340280   21510   3828 /work/armbru/qemu/include/qemu/queue.h

Probably unavoidable, might as well move it to qemu/osdep.h?!?

>  63362110   19259   3290 /work/armbru/qemu/include/disas/bfd.h

For disas/bfd.h and (before this series) exec/exec-all.h, the problem is
not too many inclusions of the header, but possibly unnecessary
inclusions from heavily used headers.  In particular I'm not sure why
qom/cpu.h needs disas/bfd.h.

Anyhow, my point is that the generic counting script tends to count
things twice, which is why I went for a limited hand-written list based
on your message and thus on your script.  The obvious disadvantage is
that the hand-written list may become obsolete.

>  62800785   26667   2355 /work/armbru/qemu/include/qemu/timer.h
>  52975068   13828   3831 /work/armbru/qemu/include/qemu/atomic.h
>  51315482   16442   3121 /work/armbru/qemu/include/exec/exec-all.h

Happy to say my patches fix this one. :)

Paolo

^ permalink raw reply	[flat|nested] 72+ messages in thread

* [Qemu-devel] [PATCH 37/50] qemu-common: stop including qemu/bswap.h from qemu-common.h
  2016-05-16 15:35 [Qemu-devel] [PATCH CFT v3 00/50] " Paolo Bonzini
@ 2016-05-16 15:36 ` Paolo Bonzini
  0 siblings, 0 replies; 72+ messages in thread
From: Paolo Bonzini @ 2016-05-16 15:36 UTC (permalink / raw)
  To: qemu-devel

Move it to the actual users.  There are still a few includes of
qemu/bswap.h in headers; removing them is left for future work.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 audio/mixeng.c         | 1 +
 block/bochs.c          | 1 +
 block/cloop.c          | 1 +
 block/parallels.c      | 1 +
 block/qcow.c           | 1 +
 block/qcow2-cluster.c  | 1 +
 block/qcow2-refcount.c | 1 +
 block/qcow2-snapshot.c | 1 +
 block/qcow2.c          | 1 +
 block/qed-table.c      | 1 +
 block/qed.c            | 1 +
 block/vdi.c            | 1 +
 block/vhdx-endian.c    | 1 +
 block/vhdx-log.c       | 1 +
 block/vhdx.c           | 1 +
 block/vmdk.c           | 1 +
 block/vpc.c            | 1 +
 block/vvfat.c          | 1 +
 crypto/afsplit.c       | 1 +
 crypto/block-luks.c    | 1 +
 device_tree.c          | 1 +
 hw/arm/nseries.c       | 1 +
 hw/block/hd-geometry.c | 1 +
 hw/bt/hci-csr.c        | 1 +
 hw/bt/l2cap.c          | 1 +
 include/qemu-common.h  | 2 --
 io/channel-websock.c   | 1 +
 nbd/nbd-internal.h     | 1 +
 qemu-nbd.c             | 1 +
 tests/ide-test.c       | 1 +
 ui/vnc-ws.c            | 1 +
 31 files changed, 30 insertions(+), 2 deletions(-)

diff --git a/audio/mixeng.c b/audio/mixeng.c
index 981b97a..b4b3a4a 100644
--- a/audio/mixeng.c
+++ b/audio/mixeng.c
@@ -24,6 +24,7 @@
  */
 #include "qemu/osdep.h"
 #include "qemu-common.h"
+#include "qemu/bswap.h"
 #include "audio.h"
 
 #define AUDIO_CAP "mixeng"
diff --git a/block/bochs.c b/block/bochs.c
index f0e18c0..6c8d0f3 100644
--- a/block/bochs.c
+++ b/block/bochs.c
@@ -27,6 +27,7 @@
 #include "qemu-common.h"
 #include "block/block_int.h"
 #include "qemu/module.h"
+#include "qemu/bswap.h"
 
 /**************************************************************/
 
diff --git a/block/cloop.c b/block/cloop.c
index fc1ca3a..ea5a92b 100644
--- a/block/cloop.c
+++ b/block/cloop.c
@@ -26,6 +26,7 @@
 #include "qemu-common.h"
 #include "block/block_int.h"
 #include "qemu/module.h"
+#include "qemu/bswap.h"
 #include <zlib.h>
 
 /* Maximum compressed block size */
diff --git a/block/parallels.c b/block/parallels.c
index cddbfc4..88cface 100644
--- a/block/parallels.c
+++ b/block/parallels.c
@@ -33,6 +33,7 @@
 #include "block/block_int.h"
 #include "sysemu/block-backend.h"
 #include "qemu/module.h"
+#include "qemu/bswap.h"
 #include "qemu/bitmap.h"
 #include "qapi/util.h"
 
diff --git a/block/qcow.c b/block/qcow.c
index d6dc1b0..cb4bf02 100644
--- a/block/qcow.c
+++ b/block/qcow.c
@@ -28,6 +28,7 @@
 #include "block/block_int.h"
 #include "sysemu/block-backend.h"
 #include "qemu/module.h"
+#include "qemu/bswap.h"
 #include <zlib.h>
 #include "qapi/qmp/qerror.h"
 #include "crypto/cipher.h"
diff --git a/block/qcow2-cluster.c b/block/qcow2-cluster.c
index 31ecc10..892e0fb 100644
--- a/block/qcow2-cluster.c
+++ b/block/qcow2-cluster.c
@@ -29,6 +29,7 @@
 #include "qemu-common.h"
 #include "block/block_int.h"
 #include "block/qcow2.h"
+#include "qemu/bswap.h"
 #include "trace.h"
 
 int qcow2_grow_l1_table(BlockDriverState *bs, uint64_t min_size,
diff --git a/block/qcow2-refcount.c b/block/qcow2-refcount.c
index ca6094f..7fa972a 100644
--- a/block/qcow2-refcount.c
+++ b/block/qcow2-refcount.c
@@ -28,6 +28,7 @@
 #include "block/block_int.h"
 #include "block/qcow2.h"
 #include "qemu/range.h"
+#include "qemu/bswap.h"
 
 static int64_t alloc_clusters_noref(BlockDriverState *bs, uint64_t size);
 static int QEMU_WARN_UNUSED_RESULT update_refcount(BlockDriverState *bs,
diff --git a/block/qcow2-snapshot.c b/block/qcow2-snapshot.c
index 5f4a17e..242fb21 100644
--- a/block/qcow2-snapshot.c
+++ b/block/qcow2-snapshot.c
@@ -26,6 +26,7 @@
 #include "qapi/error.h"
 #include "block/block_int.h"
 #include "block/qcow2.h"
+#include "qemu/bswap.h"
 #include "qemu/error-report.h"
 #include "qemu/cutils.h"
 
diff --git a/block/qcow2.c b/block/qcow2.c
index 62febfc..49d7cff 100644
--- a/block/qcow2.c
+++ b/block/qcow2.c
@@ -36,6 +36,7 @@
 #include "trace.h"
 #include "qemu/option_int.h"
 #include "qemu/cutils.h"
+#include "qemu/bswap.h"
 
 /*
   Differences with QCOW:
diff --git a/block/qed-table.c b/block/qed-table.c
index 802945f..c841ad1 100644
--- a/block/qed-table.c
+++ b/block/qed-table.c
@@ -16,6 +16,7 @@
 #include "trace.h"
 #include "qemu/sockets.h" /* for EINPROGRESS on Windows */
 #include "qed.h"
+#include "qemu/bswap.h"
 
 typedef struct {
     GenericCB gencb;
diff --git a/block/qed.c b/block/qed.c
index 10ce18e..b591d4a 100644
--- a/block/qed.c
+++ b/block/qed.c
@@ -15,6 +15,7 @@
 #include "qemu/osdep.h"
 #include "qapi/error.h"
 #include "qemu/timer.h"
+#include "qemu/bswap.h"
 #include "trace.h"
 #include "qed.h"
 #include "qapi/qmp/qerror.h"
diff --git a/block/vdi.c b/block/vdi.c
index 54e1144..7d9ab9c 100644
--- a/block/vdi.c
+++ b/block/vdi.c
@@ -54,6 +54,7 @@
 #include "block/block_int.h"
 #include "sysemu/block-backend.h"
 #include "qemu/module.h"
+#include "qemu/bswap.h"
 #include "migration/migration.h"
 #include "qemu/coroutine.h"
 #include "qemu/cutils.h"
diff --git a/block/vhdx-endian.c b/block/vhdx-endian.c
index da33cd3..c306b90 100644
--- a/block/vhdx-endian.c
+++ b/block/vhdx-endian.c
@@ -18,6 +18,7 @@
 #include "qemu/osdep.h"
 #include "qemu-common.h"
 #include "block/block_int.h"
+#include "qemu/bswap.h"
 #include "block/vhdx.h"
 
 #include <uuid/uuid.h>
diff --git a/block/vhdx-log.c b/block/vhdx-log.c
index 7ea7187..8ab7d22 100644
--- a/block/vhdx-log.c
+++ b/block/vhdx-log.c
@@ -23,6 +23,7 @@
 #include "block/block_int.h"
 #include "qemu/error-report.h"
 #include "qemu/module.h"
+#include "qemu/bswap.h"
 #include "block/vhdx.h"
 
 
diff --git a/block/vhdx.c b/block/vhdx.c
index ec778fe..c0d24a2 100644
--- a/block/vhdx.c
+++ b/block/vhdx.c
@@ -22,6 +22,7 @@
 #include "sysemu/block-backend.h"
 #include "qemu/module.h"
 #include "qemu/crc32c.h"
+#include "qemu/bswap.h"
 #include "block/vhdx.h"
 #include "migration/migration.h"
 
diff --git a/block/vmdk.c b/block/vmdk.c
index e6c97c2..1cb4b85 100644
--- a/block/vmdk.c
+++ b/block/vmdk.c
@@ -30,6 +30,7 @@
 #include "qapi/qmp/qerror.h"
 #include "qemu/error-report.h"
 #include "qemu/module.h"
+#include "qemu/bswap.h"
 #include "migration/migration.h"
 #include "qemu/cutils.h"
 #include <zlib.h>
diff --git a/block/vpc.c b/block/vpc.c
index 0379813..076a7ce 100644
--- a/block/vpc.c
+++ b/block/vpc.c
@@ -29,6 +29,7 @@
 #include "sysemu/block-backend.h"
 #include "qemu/module.h"
 #include "migration/migration.h"
+#include "qemu/bswap.h"
 #if defined(CONFIG_UUID)
 #include <uuid/uuid.h>
 #endif
diff --git a/block/vvfat.c b/block/vvfat.c
index 5b0c8dd..3e484a1 100644
--- a/block/vvfat.c
+++ b/block/vvfat.c
@@ -27,6 +27,7 @@
 #include "qapi/error.h"
 #include "block/block_int.h"
 #include "qemu/module.h"
+#include "qemu/bswap.h"
 #include "migration/migration.h"
 #include "qapi/qmp/qint.h"
 #include "qapi/qmp/qbool.h"
diff --git a/crypto/afsplit.c b/crypto/afsplit.c
index 8074913..825e2cf 100644
--- a/crypto/afsplit.c
+++ b/crypto/afsplit.c
@@ -24,6 +24,7 @@
  */
 
 #include "qemu/osdep.h"
+#include "qemu/bswap.h"
 #include "crypto/afsplit.h"
 #include "crypto/random.h"
 
diff --git a/crypto/block-luks.c b/crypto/block-luks.c
index 439f892..17c4300 100644
--- a/crypto/block-luks.c
+++ b/crypto/block-luks.c
@@ -20,6 +20,7 @@
 
 #include "qemu/osdep.h"
 #include "qapi/error.h"
+#include "qemu/bswap.h"
 
 #include "crypto/block-luks.h"
 
diff --git a/device_tree.c b/device_tree.c
index ccba1fd..6e06320 100644
--- a/device_tree.c
+++ b/device_tree.c
@@ -20,6 +20,7 @@
 #include "qapi/error.h"
 #include "qemu-common.h"
 #include "qemu/error-report.h"
+#include "qemu/bswap.h"
 #include "sysemu/device_tree.h"
 #include "sysemu/sysemu.h"
 #include "hw/loader.h"
diff --git a/hw/arm/nseries.c b/hw/arm/nseries.c
index c7068c0..f3a9b1a 100644
--- a/hw/arm/nseries.c
+++ b/hw/arm/nseries.c
@@ -21,6 +21,7 @@
 #include "qemu/osdep.h"
 #include "qapi/error.h"
 #include "qemu/cutils.h"
+#include "qemu/bswap.h"
 #include "sysemu/sysemu.h"
 #include "hw/arm/omap.h"
 #include "hw/arm/arm.h"
diff --git a/hw/block/hd-geometry.c b/hw/block/hd-geometry.c
index d388f13..57ad501 100644
--- a/hw/block/hd-geometry.c
+++ b/hw/block/hd-geometry.c
@@ -32,6 +32,7 @@
 
 #include "qemu/osdep.h"
 #include "sysemu/block-backend.h"
+#include "qemu/bswap.h"
 #include "hw/block/block.h"
 #include "trace.h"
 
diff --git a/hw/bt/hci-csr.c b/hw/bt/hci-csr.c
index 2e970b6..e6b8998 100644
--- a/hw/bt/hci-csr.c
+++ b/hw/bt/hci-csr.c
@@ -22,6 +22,7 @@
 #include "qemu-common.h"
 #include "sysemu/char.h"
 #include "qemu/timer.h"
+#include "qemu/bswap.h"
 #include "hw/irq.h"
 #include "sysemu/bt.h"
 #include "hw/bt.h"
diff --git a/hw/bt/l2cap.c b/hw/bt/l2cap.c
index 8065251..dfc95ed 100644
--- a/hw/bt/l2cap.c
+++ b/hw/bt/l2cap.c
@@ -20,6 +20,7 @@
 #include "qemu/osdep.h"
 #include "qemu-common.h"
 #include "qemu/timer.h"
+#include "qemu/bswap.h"
 #include "hw/bt.h"
 
 #define L2CAP_CID_MAX	0x100	/* Between 0x40 and 0x10000 */
diff --git a/include/qemu-common.h b/include/qemu-common.h
index f0d74076..dc041fc 100644
--- a/include/qemu-common.h
+++ b/include/qemu-common.h
@@ -23,8 +23,6 @@
 #include "qemu/option.h"
 #include "qemu/host-utils.h"
 
-#include "qemu/bswap.h"
-
 /* FIXME: Remove NEED_CPU_H.  */
 #ifdef NEED_CPU_H
 #include "cpu.h"
diff --git a/io/channel-websock.c b/io/channel-websock.c
index 7081787..239c75a 100644
--- a/io/channel-websock.c
+++ b/io/channel-websock.c
@@ -20,6 +20,7 @@
 
 #include "qemu/osdep.h"
 #include "qapi/error.h"
+#include "qemu/bswap.h"
 #include "io/channel-websock.h"
 #include "crypto/hash.h"
 #include "trace.h"
diff --git a/nbd/nbd-internal.h b/nbd/nbd-internal.h
index 3791535..26a9f4d 100644
--- a/nbd/nbd-internal.h
+++ b/nbd/nbd-internal.h
@@ -27,6 +27,7 @@
 #include <linux/fs.h>
 #endif
 
+#include "qemu/bswap.h"
 #include "qemu/queue.h"
 #include "qemu/main-loop.h"
 
diff --git a/qemu-nbd.c b/qemu-nbd.c
index 3e54113..d59b187 100644
--- a/qemu-nbd.c
+++ b/qemu-nbd.c
@@ -26,6 +26,7 @@
 #include "qemu/main-loop.h"
 #include "qemu/error-report.h"
 #include "qemu/config-file.h"
+#include "qemu/bswap.h"
 #include "block/snapshot.h"
 #include "qapi/util.h"
 #include "qapi/qmp/qstring.h"
diff --git a/tests/ide-test.c b/tests/ide-test.c
index 0d9ab4d..67e5c1f 100644
--- a/tests/ide-test.c
+++ b/tests/ide-test.c
@@ -32,6 +32,7 @@
 #include "libqos/malloc-pc.h"
 
 #include "qemu-common.h"
+#include "qemu/bswap.h"
 #include "hw/pci/pci_ids.h"
 #include "hw/pci/pci_regs.h"
 
diff --git a/ui/vnc-ws.c b/ui/vnc-ws.c
index 7c79a4c..3bac46e 100644
--- a/ui/vnc-ws.c
+++ b/ui/vnc-ws.c
@@ -22,6 +22,7 @@
 #include "qapi/error.h"
 #include "vnc.h"
 #include "io/channel-websock.h"
+#include "qemu/bswap.h"
 
 static void vncws_tls_handshake_done(Object *source,
                                      Error *err,
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 72+ messages in thread

end of thread, other threads:[~2016-05-16 15:37 UTC | newest]

Thread overview: 72+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-08 20:28 [Qemu-devel] [PATCH for-2.7 00/49] NEED_CPU_H / cpu.h / hw/hw.h cleanups Paolo Bonzini
2016-04-08 20:28 ` [Qemu-devel] [PATCH 01/50] scripts: add script to build QEMU and analyze inclusions Paolo Bonzini
2016-04-18 13:10   ` Markus Armbruster
2016-05-09 10:07     ` Paolo Bonzini
2016-04-20 19:47   ` Alex Bennée
2016-05-09  9:39     ` Paolo Bonzini
2016-04-08 20:28 ` [Qemu-devel] [PATCH 02/50] include: move CPU-related definitions out of qemu-common.h Paolo Bonzini
2016-04-21  7:53   ` Alex Bennée
2016-04-08 20:28 ` [Qemu-devel] [PATCH 03/50] log: do not use CONFIG_USER_ONLY Paolo Bonzini
2016-04-21 10:20   ` Alex Bennée
2016-04-08 20:28 ` [Qemu-devel] [PATCH 04/50] cpu: make cpu-qom.h only include-able from cpu.h Paolo Bonzini
2016-04-21 10:26   ` Alex Bennée
2016-04-08 20:28 ` [Qemu-devel] [PATCH 05/50] target-alpha: make cpu-qom.h not target specific Paolo Bonzini
2016-04-08 20:28 ` [Qemu-devel] [PATCH 06/50] target-arm: " Paolo Bonzini
2016-04-21 10:29   ` Alex Bennée
2016-04-08 20:28 ` [Qemu-devel] [PATCH 07/50] target-cris: " Paolo Bonzini
2016-04-08 20:28 ` [Qemu-devel] [PATCH 08/50] target-i386: " Paolo Bonzini
2016-04-08 20:28 ` [Qemu-devel] [PATCH 09/50] target-lm32: " Paolo Bonzini
2016-04-08 20:28 ` [Qemu-devel] [PATCH 10/50] target-m68k: " Paolo Bonzini
2016-04-08 20:28 ` [Qemu-devel] [PATCH 11/50] target-microblaze: " Paolo Bonzini
2016-04-08 20:28 ` [Qemu-devel] [PATCH 12/50] target-mips: " Paolo Bonzini
2016-04-08 20:28 ` [Qemu-devel] [PATCH 13/50] target-ppc: do not use target_ulong in cpu-qom.h Paolo Bonzini
2016-04-18 13:46   ` Markus Armbruster
2016-04-08 20:28 ` [Qemu-devel] [PATCH 14/50] target-ppc: make cpu-qom.h not target specific Paolo Bonzini
2016-04-08 20:28 ` [Qemu-devel] [PATCH 15/50] target-s390x: " Paolo Bonzini
2016-04-08 20:28 ` [Qemu-devel] [PATCH 16/50] target-sh4: " Paolo Bonzini
2016-04-08 20:28 ` [Qemu-devel] [PATCH 17/50] target-sparc: " Paolo Bonzini
2016-04-08 20:28 ` [Qemu-devel] [PATCH 18/50] target-tricore: " Paolo Bonzini
2016-04-08 20:28 ` [Qemu-devel] [PATCH 19/50] target-unicore32: " Paolo Bonzini
2016-04-08 20:28 ` [Qemu-devel] [PATCH 20/50] target-xtensa: " Paolo Bonzini
2016-04-08 20:28 ` [Qemu-devel] [PATCH 21/50] arm: include cpu-qom.h in files that require ARMCPU Paolo Bonzini
2016-04-08 20:28 ` [Qemu-devel] [PATCH 22/50] m68k: include cpu-qom.h in files that require M68KCPU Paolo Bonzini
2016-04-08 20:28 ` [Qemu-devel] [PATCH 23/50] sh4: include cpu-qom.h in files that require SuperHCPU Paolo Bonzini
2016-04-08 20:28 ` [Qemu-devel] [PATCH 24/50] alpha: include cpu-qom.h in files that require AlphaCPU Paolo Bonzini
2016-04-08 20:28 ` [Qemu-devel] [PATCH 25/50] mips: use MIPSCPU instead of CPUMIPSState Paolo Bonzini
2016-04-08 20:28 ` [Qemu-devel] [PATCH 26/50] ppc: use PowerPCCPU instead of CPUPPCState Paolo Bonzini
2016-04-08 20:28 ` [Qemu-devel] [PATCH 27/50] arm: remove useless cpu.h inclusion Paolo Bonzini
2016-04-08 20:28 ` [Qemu-devel] [PATCH 28/50] explicitly include qom/cpu.h Paolo Bonzini
2016-04-08 20:28 ` [Qemu-devel] [PATCH 29/50] explicitly include hw/qdev-core.h Paolo Bonzini
2016-04-08 20:28 ` [Qemu-devel] [PATCH 30/50] explicitly include linux/kvm.h Paolo Bonzini
2016-04-08 20:28 ` [Qemu-devel] [PATCH 31/50] apic: move target-dependent definitions to cpu.h Paolo Bonzini
2016-04-08 20:28 ` [Qemu-devel] [PATCH 32/50] include: poison symbols in osdep.h Paolo Bonzini
2016-04-08 20:28 ` [Qemu-devel] [PATCH 33/50] hw: do not use VMSTATE_*TL Paolo Bonzini
2016-04-08 20:28 ` [Qemu-devel] [PATCH 34/50] hw: move CPU state serialization to migration/cpu.h Paolo Bonzini
2016-04-08 20:28 ` [Qemu-devel] [PATCH 35/50] hw: cannot include hw/hw.h from user emulation Paolo Bonzini
2016-04-08 20:28 ` [Qemu-devel] [PATCH 36/50] cpu: move endian-dependent load/store functions to cpu-all.h Paolo Bonzini
2016-04-08 20:28 ` [Qemu-devel] [PATCH 37/50] qemu-common: stop including qemu/bswap.h from qemu-common.h Paolo Bonzini
2016-04-08 20:28 ` [Qemu-devel] [PATCH 38/50] qemu-common: stop including qemu/host-utils.h " Paolo Bonzini
2016-04-21 10:46   ` Alex Bennée
2016-05-09  9:39     ` Paolo Bonzini
2016-04-08 20:28 ` [Qemu-devel] [PATCH 39/50] gdbstub: remove includes from gdbstub-xml.c Paolo Bonzini
2016-04-18 13:54   ` Markus Armbruster
2016-04-18 14:12     ` Peter Maydell
2016-04-08 20:29 ` [Qemu-devel] [PATCH 40/50] dma: do not depend on kvm_enabled() Paolo Bonzini
2016-04-08 20:29 ` [Qemu-devel] [PATCH 41/50] s390x: move stuff out of cpu.h Paolo Bonzini
2016-04-11  8:24   ` Cornelia Huck
2016-05-09  9:43     ` Paolo Bonzini
2016-04-08 20:29 ` [Qemu-devel] [PATCH 42/50] acpi: do not use TARGET_PAGE_SIZE Paolo Bonzini
2016-04-08 20:29 ` [Qemu-devel] [PATCH 43/50] qemu-common: push cpu.h inclusion out of qemu-common.h Paolo Bonzini
2016-04-08 20:29 ` [Qemu-devel] [PATCH 44/50] arm: move arm_log_exception into .c file Paolo Bonzini
2016-04-21 10:48   ` Alex Bennée
2016-04-08 20:29 ` [Qemu-devel] [PATCH 45/50] mips: move CP0 functions out of cpu.h Paolo Bonzini
2016-04-08 20:29 ` [Qemu-devel] [PATCH 46/50] hw: explicitly include qemu/log.h Paolo Bonzini
2016-04-20 18:30   ` Alex Bennée
2016-04-08 20:29 ` [Qemu-devel] [PATCH 47/50] exec: extract exec/tb-context.h Paolo Bonzini
2016-04-08 20:29 ` [Qemu-devel] [PATCH 48/50] cpu: move exec-all.h inclusion out of cpu.h Paolo Bonzini
2016-04-08 20:29 ` [Qemu-devel] [PATCH 49/50] hw: remove pio_addr_t Paolo Bonzini
2016-04-18 14:01   ` Markus Armbruster
2016-04-08 20:29 ` [Qemu-devel] [PATCH 50/50] hw: clean up hw/hw.h includes Paolo Bonzini
2016-04-18  8:42 ` [Qemu-devel] [PATCH for-2.7 00/49] NEED_CPU_H / cpu.h / hw/hw.h cleanups Markus Armbruster
2016-04-18 14:07 ` Markus Armbruster
2016-05-16 15:35 [Qemu-devel] [PATCH CFT v3 00/50] " Paolo Bonzini
2016-05-16 15:36 ` [Qemu-devel] [PATCH 37/50] qemu-common: stop including qemu/bswap.h from qemu-common.h Paolo Bonzini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.