qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel]  [Discussion 00/10] about API hierarchy
@ 2014-03-04  2:47 Xuebing Wang
  2014-03-04  2:47 ` [Qemu-devel] [Discussion 01/10] docs: add docs/api-hierarchy.txt Xuebing Wang
                   ` (10 more replies)
  0 siblings, 11 replies; 37+ messages in thread
From: Xuebing Wang @ 2014-03-04  2:47 UTC (permalink / raw)
  To: qemu-devel; +Cc: pbonzini, xbing6, afaerber, stefanha

Hi Community,

Q1) Is it helpful for the document docs/api_hierarchy.txt I wrote? Would you
    please help review/correct it?

Q2) Does it make sense to remove NEED_CPU_H from qemu-common.h?

Q3) In include/sysemu/kvm.h, CONFIG_KVM is used thus considering dependency
    we should include "config-target.h", what is the best conditional to use?
    Or we don't use any conditional and assume architecture-independent code
    should NOT include include/sysemu/kvm.h?

Q4) Is it better for include/qemu-common.h to only include C99 API and QEMU
    basic API declared in include/qemu/*?

Q5) Should we move exec/def-helper.h => tcg/def-helper.h and 
    exec/spinlock.h => include/qemu/spinlock.h, to reflect the definition of
    exec is: memory API, translation API and cpu API?

After this patchset, cpu-all.h and exec-all.h should ONLY be included from
target-xxx/*.

Thanks.


Xuebing Wang (10):
  docs: add docs/api-hierarchy.txt
  NEED_CPU_H: remove '#include "cpu.h"' from include/qemu-common.h
  NEED_CPU_H: remove unnecessary use of NEED_CPU_H
  memory_mapping: make this architecture-independent
  NEED_CPU_H: remove unnecessary inclusion of "cpu.h" in root
  memory: move contents in include/exec/address-spaces.h => memory.h
  memory: remove file include/exec/address-spaces.h
  exec: move TranslationBlock API from exec-all.h => translate.h
  exec: remove the unnecessary include of "exec-all.h"
  translate: remove file translate-all.h

 arch_init.c                              |    2 -
 cpu-exec.c                               |    7 +-
 cputlb.c                                 |    8 +-
 disas.c                                  |    7 +-
 docs/api-hierarchy.txt                   |   93 +++++++++
 dump.c                                   |    2 -
 exec.c                                   |    5 -
 gdbstub.c                                |    8 +-
 hw/acpi/ich9.c                           |    1 -
 hw/acpi/pcihp.c                          |    1 -
 hw/acpi/piix4.c                          |    1 -
 hw/alpha/typhoon.c                       |    1 -
 hw/arm/boot.c                            |    1 -
 hw/arm/collie.c                          |    1 -
 hw/arm/digic_boards.c                    |    1 -
 hw/arm/exynos4_boards.c                  |    1 -
 hw/arm/gumstix.c                         |    1 -
 hw/arm/highbank.c                        |    1 -
 hw/arm/integratorcp.c                    |    1 -
 hw/arm/kzm.c                             |    1 -
 hw/arm/mainstone.c                       |    1 -
 hw/arm/musicpal.c                        |    1 -
 hw/arm/nseries.c                         |    1 -
 hw/arm/omap_sx1.c                        |    1 -
 hw/arm/palm.c                            |    1 -
 hw/arm/realview.c                        |    1 -
 hw/arm/spitz.c                           |    1 -
 hw/arm/stellaris.c                       |    1 -
 hw/arm/tosa.c                            |    1 -
 hw/arm/versatilepb.c                     |    1 -
 hw/arm/vexpress.c                        |    1 -
 hw/arm/virt.c                            |    1 -
 hw/arm/xilinx_zynq.c                     |    1 -
 hw/arm/z2.c                              |    1 -
 hw/block/onenand.c                       |    1 -
 hw/block/pflash_cfi01.c                  |    1 -
 hw/block/pflash_cfi02.c                  |    1 -
 hw/char/mcf_uart.c                       |    1 -
 hw/char/omap_uart.c                      |    1 -
 hw/char/serial.c                         |    1 -
 hw/char/sh_serial.c                      |    1 -
 hw/core/loader.c                         |    1 -
 hw/core/sysbus.c                         |    1 -
 hw/cris/axis_dev88.c                     |    1 -
 hw/display/sm501.c                       |    1 -
 hw/dma/etraxfs_dma.c                     |    1 -
 hw/dma/pl080.c                           |    1 -
 hw/dma/soc_dma.c                         |    5 +
 hw/dma/sun4m_iommu.c                     |    1 -
 hw/i386/pc.c                             |    1 -
 hw/i386/pc_piix.c                        |    1 -
 hw/i386/pc_q35.c                         |    1 -
 hw/intc/armv7m_nvic.c                    |    1 -
 hw/intc/openpic_kvm.c                    |    1 -
 hw/isa/isa-bus.c                         |    1 -
 hw/isa/lpc_ich9.c                        |    1 -
 hw/isa/vt82c686.c                        |    1 -
 hw/lm32/lm32_boards.c                    |    1 -
 hw/lm32/milkymist.c                      |    1 -
 hw/m68k/an5206.c                         |    1 -
 hw/m68k/dummy_m68k.c                     |    1 -
 hw/m68k/mcf5206.c                        |    1 -
 hw/m68k/mcf5208.c                        |    1 -
 hw/m68k/mcf_intc.c                       |    1 -
 hw/microblaze/petalogix_ml605_mmu.c      |    1 -
 hw/microblaze/petalogix_s3adsp1800_mmu.c |    1 -
 hw/mips/gt64xxx_pci.c                    |    1 -
 hw/mips/mips_fulong2e.c                  |    1 -
 hw/mips/mips_jazz.c                      |    1 -
 hw/mips/mips_malta.c                     |    1 -
 hw/mips/mips_mipssim.c                   |    1 -
 hw/mips/mips_r4k.c                       |    1 -
 hw/misc/arm_integrator_debug.c           |    1 -
 hw/misc/omap_gpmc.c                      |    1 -
 hw/misc/vfio.c                           |    1 -
 hw/moxie/moxiesim.c                      |    1 -
 hw/net/mcf_fec.c                         |    1 -
 hw/net/ne2000-isa.c                      |    1 -
 hw/openrisc/openrisc_sim.c               |    1 -
 hw/pci-host/apb.c                        |    1 -
 hw/pci-host/bonito.c                     |    1 -
 hw/pci-host/ppce500.c                    |    1 -
 hw/pci-host/prep.c                       |    1 -
 hw/pci-host/versatile.c                  |    1 -
 hw/pci/pci.c                             |    1 -
 hw/pci/pcie_host.c                       |    1 -
 hw/ppc/e500.c                            |    1 -
 hw/ppc/mac_newworld.c                    |    1 -
 hw/ppc/mac_oldworld.c                    |    1 -
 hw/ppc/ppc405_boards.c                   |    1 -
 hw/ppc/ppc405_uc.c                       |    1 -
 hw/ppc/ppc440_bamboo.c                   |    1 -
 hw/ppc/ppc4xx_devs.c                     |    1 -
 hw/ppc/ppc4xx_pci.c                      |    1 -
 hw/ppc/prep.c                            |    1 -
 hw/ppc/spapr.c                           |    1 -
 hw/ppc/spapr_iommu.c                     |    1 -
 hw/ppc/spapr_pci.c                       |    1 -
 hw/ppc/virtex_ml507.c                    |    1 -
 hw/s390x/css.c                           |    1 -
 hw/s390x/s390-virtio-ccw.c               |    1 -
 hw/s390x/s390-virtio.c                   |    1 -
 hw/sh4/r2d.c                             |    1 -
 hw/sh4/sh7750.c                          |    1 -
 hw/sh4/sh_pci.c                          |    1 -
 hw/sh4/shix.c                            |    1 -
 hw/sparc/leon3.c                         |    1 -
 hw/sparc64/sun4u.c                       |    1 -
 hw/timer/m48t59.c                        |    1 -
 hw/timer/sh_timer.c                      |    1 -
 hw/tpm/tpm_tis.c                         |    1 -
 hw/unicore32/puv3.c                      |    1 -
 hw/virtio/dataplane/vring.c              |    1 -
 hw/virtio/vhost.c                        |    1 -
 hw/virtio/virtio-balloon.c               |    1 -
 hw/virtio/virtio.c                       |    1 -
 hw/xen/xen_platform.c                    |    1 -
 hw/xen/xen_pt.c                          |    1 -
 hw/xtensa/xtensa_lx60.c                  |    1 -
 hw/xtensa/xtensa_sim.c                   |    1 -
 include/disas/disas.h                    |    6 +-
 include/exec/address-spaces.h            |   41 ----
 include/exec/cpu-all.h                   |    6 +
 include/exec/cpu-common.h                |    5 +
 include/exec/exec-all.h                  |  302 +----------------------------
 include/exec/gdbstub.h                   |    4 +-
 include/exec/memory.h                    |   19 +-
 include/exec/ram_addr.h                  |    5 +
 include/exec/softmmu_template.h          |    1 -
 include/exec/translate.h                 |  310 ++++++++++++++++++++++++++++++
 include/hw/arm/allwinner-a10.h           |    1 -
 include/hw/arm/omap.h                    |    6 +
 include/hw/hw.h                          |   13 +-
 include/hw/i386/apic.h                   |    6 +
 include/hw/i386/apic_internal.h          |    6 +
 include/hw/sh4/sh_intc.h                 |    2 +-
 include/hw/xen/xen.h                     |    4 +-
 include/migration/vmstate.h              |   11 ++
 include/qemu-common.h                    |   11 --
 include/qemu/log.h                       |    7 +-
 include/qom/cpu.h                        |   14 --
 include/sysemu/dma.h                     |    1 -
 include/sysemu/kvm.h                     |   12 +-
 include/sysemu/memory_mapping.h          |    3 +-
 ioport.c                                 |    1 -
 kvm-all.c                                |    1 -
 kvm-stub.c                               |    1 -
 memory.c                                 |    1 -
 memory_mapping.c                         |    7 +-
 monitor.c                                |    1 -
 target-sparc/mmu_helper.c                |    1 -
 target-xtensa/op_helper.c                |    1 -
 tcg/README                               |    2 +-
 tcg/tcg.h                                |    6 +
 tci.c                                    |    2 +-
 translate-all.c                          |   10 +-
 translate-all.h                          |   27 ---
 ui/input.c                               |    2 -
 user-exec.c                              |    7 +-
 xen-all.c                                |    1 -
 160 files changed, 552 insertions(+), 563 deletions(-)
 create mode 100644 docs/api-hierarchy.txt
 delete mode 100644 include/exec/address-spaces.h
 create mode 100644 include/exec/translate.h
 delete mode 100644 translate-all.h

-- 
1.7.9.5

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

* [Qemu-devel]  [Discussion 01/10] docs: add docs/api-hierarchy.txt
  2014-03-04  2:47 [Qemu-devel] [Discussion 00/10] about API hierarchy Xuebing Wang
@ 2014-03-04  2:47 ` Xuebing Wang
  2014-03-04  9:42   ` Stefan Hajnoczi
  2014-03-04  2:47 ` [Qemu-devel] [Discussion 02/10] NEED_CPU_H: remove '#include "cpu.h"' from include/qemu-common.h Xuebing Wang
                   ` (9 subsequent siblings)
  10 siblings, 1 reply; 37+ messages in thread
From: Xuebing Wang @ 2014-03-04  2:47 UTC (permalink / raw)
  To: qemu-devel; +Cc: pbonzini, xbing6, afaerber, stefanha

Signed-off-by: Xuebing Wang <xbing6@gmail.com>
---
 docs/api-hierarchy.txt |   93 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 93 insertions(+)
 create mode 100644 docs/api-hierarchy.txt

diff --git a/docs/api-hierarchy.txt b/docs/api-hierarchy.txt
new file mode 100644
index 0000000..9982f51
--- /dev/null
+++ b/docs/api-hierarchy.txt
@@ -0,0 +1,93 @@
+API hierarchy
+=============
+
+1) QEMU common API
+
+   |-------------------------------|
+   |  C99 API                      |
+   |  - <stdio.h> <stdlib.h> ...   |
+   |-------------------------------|
+   |  QEMU basic API               |
+   |  - include/qemu/*             |
+   |-------------------------------|
+   |  QEMU utility/helper API      |
+   |  - block                      |
+   |  - disas                      |
+   |  - migration                  |
+   |  - monitor                    |
+   |  - net                        |
+   |  - qapi                       |
+   |  - ...                        |
+   |-------------------------------|
+
+2) CPUArchState API
+
+   |-----------------------------------------------------------------------|
+   |  qom/Object  |  QEMU common API                                       |
+   |--------------|  - Linux API                                           |
+                  |  - QEMU basic API                                      |
+                  |  - QEMU utility/helper API                             |
+   |-----------------------------------------------------------------------|
+   |  qdev/DeviceState    |
+   |-----------------------------------------------------------------------|
+                          | Create new file? | sysemu/kvm.h | hw/xen/xen.h |
+                          | exec/cpu-exec.h? |              |              |
+                          |------------------------------------------------|
+                          |  TODO: consider to abstract vcpu here?         |
+                          |  include/qom/vcpu.h?                           |
+   |-----------------------------------------------------------------------|
+   |  qom/CPUState                                 |
+   |-----------------------------------------------------------------------|
+   |  target-xxx/CPUArchState                      |  sysemu/sysemu.h      |
+   |-----------------------------------------------------------------------|
+
+   cpu-exec.h is for one (tcg) of the 3 accelerators: tcg, kvm and xen.
+
+3) Memory API
+
+   |--------------------------------------------------------------|
+   |  linux-user               |  softmmu                         |
+   |  gueust virtual address   |  guest physical address          |
+   |                           |  guest virtual address           |
+   |                           |                                  |
+   |                           |  --------------------------------|
+   |                           |  |  Memory modelling             |
+   |                           |  |                               |
+   |                           |  |  MemoryRegion  |  RAMBlock    |
+   |                           |  |  memory.h      |              |
+   |                           |  --------------------------------|
+   |                           |  |  softmmu API                  |
+   |                           |  |  - include/exec/softmmu*.h    |
+   |                           |  |  - include/exec/cputlb.h      |
+   |--------------------------------------------------------------|
+   |  memory load/store API                                       |
+   |  include/exec/cpu-common.h                                   |
+   |--------------------------------------------------------------|
+
+4) exec API
+
+                                architecture-independent | architecture
+                                                         | specific
+   |------------------|                                  |
+   | memory           |                                  |
+   | load/store API   |                                  |
+   | cpu-common.h     |                                  |
+   |-----------------------------------------------------|---------------|
+                                         | tcg framework | tcg frontend  |
+                                         | tcg/tcg*.h    |               |
+                      |------------------|---------------|---------------|
+                      | TranslationBlock |               |
+                      | translate.h      |               |
+   |-------------------------------------|---------------|---------------|
+   |                                     | misc cpu API  | misc cpu API  |
+   | include/exec/exec-all.h             | cpu-common.h  | cpu-all.h     |
+   |-------------------------------------|---------------|---------------|
+
+   include/exec includes:
+   - Memory  API
+   - TranslationBlock API
+   - misc cpu API (both architecture-independent and architecture-specific)
+
+   include/exec/cpu-all.h is for architecture-specific, it's only included
+   in target-xxx/* files.
+
-- 
1.7.9.5

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

* [Qemu-devel] [Discussion 02/10] NEED_CPU_H: remove '#include "cpu.h"' from include/qemu-common.h
  2014-03-04  2:47 [Qemu-devel] [Discussion 00/10] about API hierarchy Xuebing Wang
  2014-03-04  2:47 ` [Qemu-devel] [Discussion 01/10] docs: add docs/api-hierarchy.txt Xuebing Wang
@ 2014-03-04  2:47 ` Xuebing Wang
  2014-03-04 10:19   ` Paolo Bonzini
  2014-03-04  2:47 ` [Qemu-devel] [Discussion 03/10] NEED_CPU_H: remove unnecessary use of NEED_CPU_H Xuebing Wang
                   ` (8 subsequent siblings)
  10 siblings, 1 reply; 37+ messages in thread
From: Xuebing Wang @ 2014-03-04  2:47 UTC (permalink / raw)
  To: qemu-devel; +Cc: pbonzini, xbing6, afaerber, stefanha

Note: there is a FIXME to be addressed in this patch.

This patch handles NEED_CPU_H (thus "target-xxx/cpu.h") only. The changes are:
-   Remove inclusion of "cpu.h" from qemu-common.h
-   CPU_SAVE_VERSION is defined in target-xxx/cpu.h as well, thus move it
    out of qemu-common.h, and move it into include/exec/cpu-all.h

-   To make --enable-kvm build, add '#include "config-target.h"' into
    sysemu/kvm.h
-   To make target-i386 build, change apic_internal.h and apic.h in folder
    include/hw/i386/
-   To make target-arm build, change include/hw/arm/omap.h
-   To make target-alpha build (which uses VMSTATE_CPU), move VMSTATE_CPU()
    from include/qom/cpu.h => include/migration/vmstate.h
-   The rest changes are generic to all targets, to make all targets build

Why use "#ifndef NEED_CPU_H, then #error ...", is because "target-xxx/cpu.h"
is better included for the whole file.

If "target-xxx/cpu.h" is only needed for part of the file, use
"#ifdef NEED_CPU_H, then #include "cpu.h"".

Notes on NEED_CPU_H
-------------------
NEED_CPU_H means that code needs architecture-specific information. Here are
a few examples:
-   CPUArchState
-   TARGET_LONG_BITS
-   TARGET_PAGE_BITS
-   TARGET_PHYS_ADDR_SPACE_BITS, TARGET_VIRT_ADDR_SPACE_BITS
And constructs that are derived from above, examples are:
-   target_long, target_ulong

Examples of non-architecture-dependent are:
-   hwaddr
-   vaddr
-   ram_addr_t

Signed-off-by: Xuebing Wang <xbing6@gmail.com>
---
 hw/dma/soc_dma.c                |    5 +++++
 include/disas/disas.h           |    6 +++---
 include/exec/cpu-all.h          |    6 ++++++
 include/exec/gdbstub.h          |    4 +++-
 include/exec/ram_addr.h         |    5 +++++
 include/hw/arm/omap.h           |    6 ++++++
 include/hw/i386/apic.h          |    6 ++++++
 include/hw/i386/apic_internal.h |    6 ++++++
 include/hw/xen/xen.h            |    2 +-
 include/migration/vmstate.h     |   11 +++++++++++
 include/qemu-common.h           |   11 -----------
 include/qom/cpu.h               |   14 --------------
 include/sysemu/kvm.h            |   10 ++++++++++
 tcg/tcg.h                       |    6 ++++++
 14 files changed, 68 insertions(+), 30 deletions(-)

diff --git a/hw/dma/soc_dma.c b/hw/dma/soc_dma.c
index c06aabb..950f3ec 100644
--- a/hw/dma/soc_dma.c
+++ b/hw/dma/soc_dma.c
@@ -21,6 +21,11 @@
 #include "qemu/timer.h"
 #include "hw/arm/soc_dma.h"
 
+#ifndef NEED_CPU_H
+#error target-xxx/cpu.h must be included because target-specific are required
+#endif
+#include "cpu.h" /* target-xxx/cpu.h, required for TARGET_FMT_lx etc */
+
 static void transfer_mem2mem(struct soc_dma_ch_s *ch)
 {
     memcpy(ch->paddr[0], ch->paddr[1], ch->bytes);
diff --git a/include/disas/disas.h b/include/disas/disas.h
index c13ca9a..e5cdfd7 100644
--- a/include/disas/disas.h
+++ b/include/disas/disas.h
@@ -1,9 +1,9 @@
 #ifndef _QEMU_DISAS_H
 #define _QEMU_DISAS_H
 
-#include "qemu-common.h"
-
 #ifdef NEED_CPU_H
+#include "cpu.h" /* target-xxx/cpu.h, required for target_ulong,
+                    CPUArchState */
 /* Disassemble this for me please... (debugging). */
 void disas(FILE *out, void *code, unsigned long size);
 void target_disas(FILE *out, CPUArchState *env, target_ulong code,
@@ -14,7 +14,7 @@ void monitor_disas(Monitor *mon, CPUArchState *env,
 
 /* Look up symbol for debugging purpose.  Returns "" if unknown. */
 const char *lookup_symbol(target_ulong orig_addr);
-#endif
+#endif /* NEED_CPU_H */
 
 struct syminfo;
 struct elf32_sym;
diff --git a/include/exec/cpu-all.h b/include/exec/cpu-all.h
index 4cb4b4a..7045732 100644
--- a/include/exec/cpu-all.h
+++ b/include/exec/cpu-all.h
@@ -490,4 +490,10 @@ void qemu_mutex_unlock_ramlist(void);
 int cpu_memory_rw_debug(CPUState *cpu, target_ulong addr,
                         uint8_t *buf, int len, int is_write);
 
+/* CPU save/load.  */
+#ifdef CPU_SAVE_VERSION
+void cpu_save(QEMUFile *f, void *opaque);
+int cpu_load(QEMUFile *f, void *opaque, int version_id);
+#endif
+
 #endif /* CPU_ALL_H */
diff --git a/include/exec/gdbstub.h b/include/exec/gdbstub.h
index a608a26..14addcb 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" /* target-xxx/cpu.h, required for target_ulong,
+                    CPUArchState */
 typedef void (*gdb_syscall_complete_cb)(CPUState *cpu,
                                         target_ulong ret, target_ulong err);
 
@@ -76,7 +78,7 @@ static inline int gdb_get_reg64(uint8_t *mem_buf, uint64_t val)
 #define ldtul_p(addr) ldl_p(addr)
 #endif
 
-#endif
+#endif /* NEED_CPU_H */
 
 #ifdef CONFIG_USER_ONLY
 int gdbserver_start(int);
diff --git a/include/exec/ram_addr.h b/include/exec/ram_addr.h
index 2edfa96..09e2aa6 100644
--- a/include/exec/ram_addr.h
+++ b/include/exec/ram_addr.h
@@ -19,6 +19,11 @@
 #ifndef RAM_ADDR_H
 #define RAM_ADDR_H
 
+#ifndef NEED_CPU_H
+#error target-xxx/cpu.h must be included because target-specific are required
+#endif
+#include "cpu.h" /* target-xxx/cpu.h, required for TARGET_PAGE_BITS etc */
+
 #ifndef CONFIG_USER_ONLY
 #include "hw/xen/xen.h"
 
diff --git a/include/hw/arm/omap.h b/include/hw/arm/omap.h
index b9655ee..580510f 100644
--- a/include/hw/arm/omap.h
+++ b/include/hw/arm/omap.h
@@ -17,10 +17,16 @@
  * with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 #ifndef hw_omap_h
+
 #include "exec/memory.h"
 # define hw_omap_h		"omap.h"
 #include "hw/irq.h"
 
+#ifndef NEED_CPU_H
+#error target-xxx/cpu.h must be included because target-specific are required
+#endif
+#include "cpu.h" /* target-xxx/cpu.h, required for ARMCPU etc */
+
 # define OMAP_EMIFS_BASE	0x00000000
 # define OMAP2_Q0_BASE		0x00000000
 # define OMAP_CS0_BASE		0x00000000
diff --git a/include/hw/i386/apic.h b/include/hw/i386/apic.h
index 1d48e02..a0e6922 100644
--- a/include/hw/i386/apic.h
+++ b/include/hw/i386/apic.h
@@ -1,6 +1,12 @@
 #ifndef APIC_H
 #define APIC_H
 
+#ifndef NEED_CPU_H
+#error target-xxx/cpu.h must be included because target-specific are required
+#endif
+#include "cpu.h" /* target-xxx/cpu.h, required for X86CPU, target_ulong,
+                    TPRAccess */
+
 #include "qemu-common.h"
 
 /* apic.c */
diff --git a/include/hw/i386/apic_internal.h b/include/hw/i386/apic_internal.h
index 70542a6..a1569a1 100644
--- a/include/hw/i386/apic_internal.h
+++ b/include/hw/i386/apic_internal.h
@@ -20,6 +20,12 @@
 #ifndef QEMU_APIC_INTERNAL_H
 #define QEMU_APIC_INTERNAL_H
 
+#ifndef NEED_CPU_H
+#error target-xxx/cpu.h must be included because target-specific are required
+#endif
+#include "cpu.h" /* target-xxx/cpu.h, required for X86CPU, target_ulong,
+                    TPRAccess */
+
 #include "exec/memory.h"
 #include "hw/cpu/icc_bus.h"
 #include "qemu/timer.h"
diff --git a/include/hw/xen/xen.h b/include/hw/xen/xen.h
index e1f88bf..34773b9 100644
--- a/include/hw/xen/xen.h
+++ b/include/hw/xen/xen.h
@@ -9,7 +9,7 @@
 #include <inttypes.h>
 
 #include "hw/irq.h"
-#include "qemu-common.h"
+#include "exec/cpu-common.h" /* for ram_addr_t */
 
 /* xen-machine.c */
 enum xen_mode {
diff --git a/include/migration/vmstate.h b/include/migration/vmstate.h
index ded8e23..040cc75 100644
--- a/include/migration/vmstate.h
+++ b/include/migration/vmstate.h
@@ -138,8 +138,19 @@ struct VMStateDescription {
 
 #ifdef CONFIG_USER_ONLY
 extern const VMStateDescription vmstate_dummy;
+#define vmstate_cpu_common vmstate_dummy
+#else
+extern const struct VMStateDescription vmstate_cpu_common;
 #endif
 
+#define VMSTATE_CPU() {                                                     \
+    .name = "parent_obj",                                                   \
+    .size = sizeof(CPUState),                                               \
+    .vmsd = &vmstate_cpu_common,                                            \
+    .flags = VMS_STRUCT,                                                    \
+    .offset = 0,                                                            \
+}
+
 extern const VMStateInfo vmstate_info_bool;
 
 extern const VMStateInfo vmstate_info_int8;
diff --git a/include/qemu-common.h b/include/qemu-common.h
index c8a58a8..cd33b2c 100644
--- a/include/qemu-common.h
+++ b/include/qemu-common.h
@@ -111,11 +111,6 @@ extern int use_icount;
 #include "qemu/osdep.h"
 #include "qemu/bswap.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);
@@ -273,12 +268,6 @@ bool tcg_enabled(void);
 
 void cpu_exec_init_all(void);
 
-/* CPU save/load.  */
-#ifdef CPU_SAVE_VERSION
-void cpu_save(QEMUFile *f, void *opaque);
-int cpu_load(QEMUFile *f, void *opaque, int version_id);
-#endif
-
 /* Unblock cpu */
 void qemu_cpu_kick_self(void);
 
diff --git a/include/qom/cpu.h b/include/qom/cpu.h
index 367eda1..f0157e3 100644
--- a/include/qom/cpu.h
+++ b/include/qom/cpu.h
@@ -510,18 +510,4 @@ void qemu_init_vcpu(CPUState *cpu);
  */
 void cpu_single_step(CPUState *cpu, int enabled);
 
-#ifdef CONFIG_SOFTMMU
-extern const struct VMStateDescription vmstate_cpu_common;
-#else
-#define vmstate_cpu_common vmstate_dummy
-#endif
-
-#define VMSTATE_CPU() {                                                     \
-    .name = "parent_obj",                                                   \
-    .size = sizeof(CPUState),                                               \
-    .vmsd = &vmstate_cpu_common,                                            \
-    .flags = VMS_STRUCT,                                                    \
-    .offset = 0,                                                            \
-}
-
 #endif
diff --git a/include/sysemu/kvm.h b/include/sysemu/kvm.h
index a02d67c..112721d 100644
--- a/include/sysemu/kvm.h
+++ b/include/sysemu/kvm.h
@@ -19,6 +19,15 @@
 #include "qemu/queue.h"
 #include "qom/cpu.h"
 
+/* Ideally, for every appearance of NEED_CPU_H, there must be followed by
+ * the inclusion of "target-xxx/cpu.h".
+ *
+ * FIXME: find another logic other than using NEED_CPU_H.
+ */
+#ifdef NEED_CPU_H
+#include "config-target.h" /* for CONFIG_KVM */
+#endif
+
 #ifdef CONFIG_KVM
 #include <linux/kvm.h>
 #include <linux/kvm_para.h>
@@ -169,6 +178,7 @@ int kvm_init_vcpu(CPUState *cpu);
 int kvm_cpu_exec(CPUState *cpu);
 
 #ifdef NEED_CPU_H
+#include "cpu.h" /* target-xxx/cpu.h, required for target_ulong */
 
 void kvm_setup_guest_memory(void *start, size_t size);
 void kvm_flush_coalesced_mmio_buffer(void);
diff --git a/tcg/tcg.h b/tcg/tcg.h
index f7efcb4..4dea41a 100644
--- a/tcg/tcg.h
+++ b/tcg/tcg.h
@@ -29,6 +29,12 @@
 #include "qemu/bitops.h"
 #include "tcg-target.h"
 
+#ifndef NEED_CPU_H
+#error target-xxx/cpu.h must be included because target-specific are required
+#endif
+#include "cpu.h" /* target-xxx/cpu.h, required for CPUArchState,
+                    TARGET_LONG_BITS in tcg-opc.h */
+
 /* Default target word size to pointer size.  */
 #ifndef TCG_TARGET_REG_BITS
 # if UINTPTR_MAX == UINT32_MAX
-- 
1.7.9.5

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

* [Qemu-devel] [Discussion 03/10] NEED_CPU_H: remove unnecessary use of NEED_CPU_H
  2014-03-04  2:47 [Qemu-devel] [Discussion 00/10] about API hierarchy Xuebing Wang
  2014-03-04  2:47 ` [Qemu-devel] [Discussion 01/10] docs: add docs/api-hierarchy.txt Xuebing Wang
  2014-03-04  2:47 ` [Qemu-devel] [Discussion 02/10] NEED_CPU_H: remove '#include "cpu.h"' from include/qemu-common.h Xuebing Wang
@ 2014-03-04  2:47 ` Xuebing Wang
  2014-03-04 10:20   ` Paolo Bonzini
  2014-03-04  2:47 ` [Qemu-devel] [Discussion 04/10] memory_mapping: make this architecture-independent Xuebing Wang
                   ` (7 subsequent siblings)
  10 siblings, 1 reply; 37+ messages in thread
From: Xuebing Wang @ 2014-03-04  2:47 UTC (permalink / raw)
  To: qemu-devel; +Cc: pbonzini, xbing6, afaerber, stefanha

Note: there is a FIXME to be addressed in this patch.

For every appearance of NEED_CPU_H, there must be '#include "cpu.h"' to
include "target-xxx/cpu.h", because the code below NEED_CPU_H depends on
architecture-specific information.

Signed-off-by: Xuebing Wang <xbing6@gmail.com>
---
 include/exec/cpu-common.h |    5 +++++
 include/hw/hw.h           |   13 +++++++++----
 include/hw/xen/xen.h      |    2 +-
 include/qemu/log.h        |    7 ++++---
 include/sysemu/kvm.h      |    2 +-
 ui/input.c                |    2 --
 6 files changed, 20 insertions(+), 11 deletions(-)

diff --git a/include/exec/cpu-common.h b/include/exec/cpu-common.h
index a21b65a..a696667 100644
--- a/include/exec/cpu-common.h
+++ b/include/exec/cpu-common.h
@@ -98,6 +98,11 @@ 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);
 
+/*
+ * FIXME: although it's nice to keep ld/st APIs together with above,
+ *        below violates the idea that every NEED_CPU_H should be followed
+ *        by inclusion of "target-xxx/cpu.h"
+ */
 #ifdef NEED_CPU_H
 uint32_t lduw_phys(AddressSpace *as, hwaddr addr);
 uint32_t ldl_phys(AddressSpace *as, hwaddr addr);
diff --git a/include/hw/hw.h b/include/hw/hw.h
index 33bdb92..3accd44 100644
--- a/include/hw/hw.h
+++ b/include/hw/hw.h
@@ -4,7 +4,7 @@
 
 #include "qemu-common.h"
 
-#if !defined(CONFIG_USER_ONLY) && !defined(NEED_CPU_H)
+#if !defined(CONFIG_USER_ONLY)
 #include "exec/cpu-common.h"
 #endif
 
@@ -15,6 +15,8 @@
 #include "qemu/log.h"
 
 #ifdef NEED_CPU_H
+#include "cpu.h" /* target-xxx/cpu.h, required for TARGET_LONG_BITS */
+
 #if TARGET_LONG_BITS == 64
 #define qemu_put_betl qemu_put_be64
 #define qemu_get_betl qemu_get_be64
@@ -34,7 +36,7 @@
 #define qemu_put_sbetls qemu_put_sbe32s
 #define qemu_get_sbetls qemu_get_sbe32s
 #endif
-#endif
+#endif /* NEED_CPU_H */
 
 typedef void QEMUResetHandler(void *opaque);
 
@@ -48,6 +50,8 @@ void qemu_register_boot_set(QEMUBootSetHandler *func, void *opaque);
 int qemu_boot_set(const char *boot_order);
 
 #ifdef NEED_CPU_H
+#include "cpu.h" /* target-xxx/cpu.h, required for TARGET_LONG_BITS */
+
 #if TARGET_LONG_BITS == 64
 #define VMSTATE_UINTTL_V(_f, _s, _v)                                  \
     VMSTATE_UINT64_V(_f, _s, _v)
@@ -63,6 +67,7 @@ int qemu_boot_set(const char *boot_order);
 #define VMSTATE_UINTTL_ARRAY_V(_f, _s, _n, _v)                        \
     VMSTATE_UINT32_ARRAY_V(_f, _s, _n, _v)
 #endif
+
 #define VMSTATE_UINTTL(_f, _s)                                        \
     VMSTATE_UINTTL_V(_f, _s, 0)
 #define VMSTATE_UINTTL_EQUAL(_f, _s)                                  \
@@ -70,6 +75,6 @@ int qemu_boot_set(const char *boot_order);
 #define VMSTATE_UINTTL_ARRAY(_f, _s, _n)                              \
     VMSTATE_UINTTL_ARRAY_V(_f, _s, _n, 0)
 
-#endif
+#endif /* NEED_CPU_H */
 
-#endif
+#endif /* QEMU_HW_H */
diff --git a/include/hw/xen/xen.h b/include/hw/xen/xen.h
index 34773b9..638817b 100644
--- a/include/hw/xen/xen.h
+++ b/include/hw/xen/xen.h
@@ -40,7 +40,7 @@ int xen_init(void);
 int xen_hvm_init(MemoryRegion **ram_memory);
 void xenstore_store_pv_console_info(int i, struct CharDriverState *chr);
 
-#if defined(NEED_CPU_H) && !defined(CONFIG_USER_ONLY)
+#if !defined(CONFIG_USER_ONLY)
 void xen_ram_alloc(ram_addr_t ram_addr, ram_addr_t size,
                    struct MemoryRegion *mr);
 void xen_modified_memory(ram_addr_t start, ram_addr_t length);
diff --git a/include/qemu/log.h b/include/qemu/log.h
index d515424..715accb 100644
--- a/include/qemu/log.h
+++ b/include/qemu/log.h
@@ -6,9 +6,7 @@
 #include <stdio.h>
 #include "qemu/compiler.h"
 #include "qom/cpu.h"
-#ifdef NEED_CPU_H
 #include "disas/disas.h"
-#endif
 
 /* Private global variables, don't use */
 extern FILE *qemu_logfile;
@@ -102,6 +100,9 @@ static inline void log_cpu_state_mask(int mask, CPUState *cpu, int flags)
 }
 
 #ifdef NEED_CPU_H
+#include "cpu.h" /* target-xxx/cpu.h, required for target_ulong,
+                    CPUArchState */
+
 /* disas() and target_disas() to qemu_logfile: */
 static inline void log_target_disas(CPUArchState *env, target_ulong start,
                                     target_ulong len, int flags)
@@ -121,7 +122,7 @@ static inline void log_page_dump(void)
     page_dump(qemu_logfile);
 }
 #endif
-#endif
+#endif /* NEED_CPU_H */
 
 
 /* Maintenance: */
diff --git a/include/sysemu/kvm.h b/include/sysemu/kvm.h
index 112721d..d1e5389 100644
--- a/include/sysemu/kvm.h
+++ b/include/sysemu/kvm.h
@@ -58,7 +58,7 @@ extern bool kvm_gsi_routing_allowed;
 extern bool kvm_gsi_direct_mapping;
 extern bool kvm_readonly_mem_allowed;
 
-#if defined CONFIG_KVM || !defined NEED_CPU_H
+#if defined CONFIG_KVM
 #define kvm_enabled()           (kvm_allowed)
 /**
  * kvm_irqchip_in_kernel:
diff --git a/ui/input.c b/ui/input.c
index 1c70f60..b6d216d 100644
--- a/ui/input.c
+++ b/ui/input.c
@@ -187,7 +187,6 @@ static const int key_defs[] = {
 
     [Q_KEY_CODE_INSERT] = 0xd2,
     [Q_KEY_CODE_DELETE] = 0xd3,
-#ifdef NEED_CPU_H
 #if defined(TARGET_SPARC) && !defined(TARGET_SPARC64)
     [Q_KEY_CODE_STOP] = 0xf0,
     [Q_KEY_CODE_AGAIN] = 0xf1,
@@ -205,7 +204,6 @@ static const int key_defs[] = {
     [Q_KEY_CODE_META_R] = 0xfd,
     [Q_KEY_CODE_COMPOSE] = 0xfe,
 #endif
-#endif
     [Q_KEY_CODE_MAX] = 0,
 };
 
-- 
1.7.9.5

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

* [Qemu-devel] [Discussion 04/10] memory_mapping: make this architecture-independent
  2014-03-04  2:47 [Qemu-devel] [Discussion 00/10] about API hierarchy Xuebing Wang
                   ` (2 preceding siblings ...)
  2014-03-04  2:47 ` [Qemu-devel] [Discussion 03/10] NEED_CPU_H: remove unnecessary use of NEED_CPU_H Xuebing Wang
@ 2014-03-04  2:47 ` Xuebing Wang
  2014-03-04 10:22   ` Paolo Bonzini
  2014-03-04 11:05   ` Peter Maydell
  2014-03-04  2:47 ` [Qemu-devel] [Discussion 05/10] NEED_CPU_H: remove unnecessary inclusion of "cpu.h" in root Xuebing Wang
                   ` (6 subsequent siblings)
  10 siblings, 2 replies; 37+ messages in thread
From: Xuebing Wang @ 2014-03-04  2:47 UTC (permalink / raw)
  To: qemu-devel; +Cc: pbonzini, xbing6, afaerber, stefanha

Use vaddr (instead of target_ulong) for virtual address. See document HACKING
for more information about vaddr and target_ulong.

Signed-off-by: Xuebing Wang <xbing6@gmail.com>
---
 include/sysemu/memory_mapping.h |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/include/sysemu/memory_mapping.h b/include/sysemu/memory_mapping.h
index a75d59a..4a5f7be 100644
--- a/include/sysemu/memory_mapping.h
+++ b/include/sysemu/memory_mapping.h
@@ -16,6 +16,7 @@
 
 #include "qemu/queue.h"
 #include "qemu/typedefs.h"
+#include "qom/cpu.h" /* for vaddr */
 
 typedef struct GuestPhysBlock {
     /* visible to guest, reflects PCI hole, etc */
@@ -39,7 +40,7 @@ typedef struct GuestPhysBlockList {
 /* The physical and virtual address in the memory mapping are contiguous. */
 typedef struct MemoryMapping {
     hwaddr phys_addr;
-    target_ulong virt_addr;
+    vaddr virt_addr;
     ram_addr_t length;
     QTAILQ_ENTRY(MemoryMapping) next;
 } MemoryMapping;
-- 
1.7.9.5

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

* [Qemu-devel] [Discussion 05/10] NEED_CPU_H: remove unnecessary inclusion of "cpu.h" in root
  2014-03-04  2:47 [Qemu-devel] [Discussion 00/10] about API hierarchy Xuebing Wang
                   ` (3 preceding siblings ...)
  2014-03-04  2:47 ` [Qemu-devel] [Discussion 04/10] memory_mapping: make this architecture-independent Xuebing Wang
@ 2014-03-04  2:47 ` Xuebing Wang
  2014-03-04 10:24   ` Paolo Bonzini
  2014-03-04  2:47 ` [Qemu-devel] [Discussion 06/10] memory: move contents in include/exec/address-spaces.h => memory.h Xuebing Wang
                   ` (5 subsequent siblings)
  10 siblings, 1 reply; 37+ messages in thread
From: Xuebing Wang @ 2014-03-04  2:47 UTC (permalink / raw)
  To: qemu-devel; +Cc: pbonzini, xbing6, afaerber, stefanha

Enforce the strict associativity between NEED_CPU_H and "inclusion of cpu.h",
for every appearance of '#include "cpu.h"', there must have the check of
NEED_CPU_H, and conversely.

This patch only checks file in qemu root directory by:
grep -nw "cpu.h" *.[ch] .

Note: remove unnecessary inclusion of "cpu-all.h" too. "cpu-all.h" is
architecture-specific, should ONLY be included from target-xxx/*
- 'git grep -nw "cpu-all.h"' confirms this

Signed-off-by: Xuebing Wang <xbing6@gmail.com>
---
 arch_init.c      |    1 -
 cpu-exec.c       |    7 ++++++-
 cputlb.c         |    6 +++++-
 disas.c          |    7 ++++++-
 dump.c           |    2 --
 exec.c           |    2 --
 gdbstub.c        |    8 +++++++-
 kvm-stub.c       |    1 -
 memory_mapping.c |    6 +++---
 monitor.c        |    1 -
 translate-all.c  |    7 ++++++-
 user-exec.c      |    7 ++++++-
 12 files changed, 39 insertions(+), 16 deletions(-)

diff --git a/arch_init.c b/arch_init.c
index fe17279..76e8630 100644
--- a/arch_init.c
+++ b/arch_init.c
@@ -47,7 +47,6 @@
 #include "qemu/config-file.h"
 #include "qmp-commands.h"
 #include "trace.h"
-#include "exec/cpu-all.h"
 #include "exec/ram_addr.h"
 #include "hw/acpi/acpi.h"
 #include "qemu/host-utils.h"
diff --git a/cpu-exec.c b/cpu-exec.c
index 1b0f617..858825f 100644
--- a/cpu-exec.c
+++ b/cpu-exec.c
@@ -16,8 +16,13 @@
  * 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 NEED_CPU_H
+#error target-xxx/cpu.h must be included because target-specific are required
+#endif
+#include "cpu.h" /* target-xxx/cpu.h, required for CPUArchState etc */
+
 #include "config.h"
-#include "cpu.h"
 #include "disas/disas.h"
 #include "tcg.h"
 #include "qemu/atomic.h"
diff --git a/cputlb.c b/cputlb.c
index 0fbaa39..3c6cb16 100644
--- a/cputlb.c
+++ b/cputlb.c
@@ -17,8 +17,12 @@
  * License along with this library; if not, see <http://www.gnu.org/licenses/>.
  */
 
+#ifndef NEED_CPU_H
+#error target-xxx/cpu.h must be included because target-specific are required
+#endif
+#include "cpu.h" /* target-xxx/cpu.h, required for CPUArchState etc */
+
 #include "config.h"
-#include "cpu.h"
 #include "exec/exec-all.h"
 #include "exec/memory.h"
 #include "exec/address-spaces.h"
diff --git a/disas.c b/disas.c
index 79e6944..8dc51c8 100644
--- a/disas.c
+++ b/disas.c
@@ -1,10 +1,15 @@
 /* General "disassemble this chunk" code.  Used for debugging. */
+
+#ifndef NEED_CPU_H
+#error target-xxx/cpu.h must be included because target-specific are required
+#endif
+#include "cpu.h" /* target-xxx/cpu.h, required for CPUArchState etc */
+
 #include "config.h"
 #include "disas/bfd.h"
 #include "elf.h"
 #include <errno.h>
 
-#include "cpu.h"
 #include "disas/disas.h"
 
 typedef struct CPUDebug {
diff --git a/dump.c b/dump.c
index 80a9116..d75c2ea 100644
--- a/dump.c
+++ b/dump.c
@@ -13,8 +13,6 @@
 
 #include "qemu-common.h"
 #include "elf.h"
-#include "cpu.h"
-#include "exec/cpu-all.h"
 #include "exec/hwaddr.h"
 #include "monitor/monitor.h"
 #include "sysemu/kvm.h"
diff --git a/exec.c b/exec.c
index b69fd29..3df2ffc 100644
--- a/exec.c
+++ b/exec.c
@@ -25,7 +25,6 @@
 #endif
 
 #include "qemu-common.h"
-#include "cpu.h"
 #include "tcg.h"
 #include "hw/hw.h"
 #include "hw/qdev.h"
@@ -44,7 +43,6 @@
 #include "sysemu/xen-mapcache.h"
 #include "trace.h"
 #endif
-#include "exec/cpu-all.h"
 
 #include "exec/cputlb.h"
 #include "translate-all.h"
diff --git a/gdbstub.c b/gdbstub.c
index e8ab0b2..a96add1 100644
--- a/gdbstub.c
+++ b/gdbstub.c
@@ -16,6 +16,13 @@
  * 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 NEED_CPU_H
+#error target-xxx/cpu.h must be included because target-specific are required
+#endif
+#include "cpu.h" /* target-xxx/cpu.h, required for CPUArchState etc */
+/* TODO: to remove using CPUArchState to make thie file arch-independent. */
+
 #include "config.h"
 #include "qemu-common.h"
 #ifdef CONFIG_USER_ONLY
@@ -37,7 +44,6 @@
 
 #define MAX_PACKET_LENGTH 4096
 
-#include "cpu.h"
 #include "qemu/sockets.h"
 #include "sysemu/kvm.h"
 
diff --git a/kvm-stub.c b/kvm-stub.c
index e979f76..581350a 100644
--- a/kvm-stub.c
+++ b/kvm-stub.c
@@ -12,7 +12,6 @@
 
 #include "qemu-common.h"
 #include "hw/hw.h"
-#include "cpu.h"
 #include "sysemu/kvm.h"
 
 #ifndef CONFIG_USER_ONLY
diff --git a/memory_mapping.c b/memory_mapping.c
index 87a6ed5..b17eea1 100644
--- a/memory_mapping.c
+++ b/memory_mapping.c
@@ -13,11 +13,11 @@
 
 #include <glib.h>
 
-#include "cpu.h"
-#include "exec/cpu-all.h"
-#include "sysemu/memory_mapping.h"
+#include "qemu-common.h"
+#include "exec/cpu-common.h" /* for ram_addr_t */
 #include "exec/memory.h"
 #include "exec/address-spaces.h"
+#include "sysemu/memory_mapping.h"
 
 //#define DEBUG_GUEST_PHYS_REGION_ADD
 
diff --git a/monitor.c b/monitor.c
index aebcbd8..1a8dd24 100644
--- a/monitor.c
+++ b/monitor.c
@@ -58,7 +58,6 @@
 #include "qapi/qmp/json-parser.h"
 #include <qom/object_interfaces.h>
 #include "qemu/osdep.h"
-#include "cpu.h"
 #include "trace.h"
 #include "trace/control.h"
 #ifdef CONFIG_TRACE_SIMPLE
diff --git a/translate-all.c b/translate-all.c
index 1ac0246..be220fb 100644
--- a/translate-all.c
+++ b/translate-all.c
@@ -16,6 +16,12 @@
  * 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 NEED_CPU_H
+#error target-xxx/cpu.h must be included because target-specific are required
+#endif
+#include "cpu.h" /* target-xxx/cpu.h, required for CPUArchState etc */
+
 #ifdef _WIN32
 #include <windows.h>
 #else
@@ -32,7 +38,6 @@
 
 #include "qemu-common.h"
 #define NO_CPU_IO_DEFS
-#include "cpu.h"
 #include "disas/disas.h"
 #include "tcg.h"
 #if defined(CONFIG_USER_ONLY)
diff --git a/user-exec.c b/user-exec.c
index 82bfa66..c4c1e3f 100644
--- a/user-exec.c
+++ b/user-exec.c
@@ -16,8 +16,13 @@
  * 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 NEED_CPU_H
+#error target-xxx/cpu.h must be included because target-specific are required
+#endif
+#include "cpu.h" /* target-xxx/cpu.h, required for CPUArchState etc */
+
 #include "config.h"
-#include "cpu.h"
 #include "disas/disas.h"
 #include "tcg.h"
 #include "qemu/bitops.h"
-- 
1.7.9.5

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

* [Qemu-devel] [Discussion 06/10] memory: move contents in include/exec/address-spaces.h => memory.h
  2014-03-04  2:47 [Qemu-devel] [Discussion 00/10] about API hierarchy Xuebing Wang
                   ` (4 preceding siblings ...)
  2014-03-04  2:47 ` [Qemu-devel] [Discussion 05/10] NEED_CPU_H: remove unnecessary inclusion of "cpu.h" in root Xuebing Wang
@ 2014-03-04  2:47 ` Xuebing Wang
  2014-03-04 10:26   ` Paolo Bonzini
  2014-03-04  2:47 ` [Qemu-devel] [Discussion 07/10] memory: remove file include/exec/address-spaces.h Xuebing Wang
                   ` (4 subsequent siblings)
  10 siblings, 1 reply; 37+ messages in thread
From: Xuebing Wang @ 2014-03-04  2:47 UTC (permalink / raw)
  To: qemu-devel; +Cc: pbonzini, xbing6, afaerber, stefanha

In preparation for removing include/exec/address-spaces.h

Signed-off-by: Xuebing Wang <xbing6@gmail.com>
---
 include/exec/address-spaces.h |   29 -----------------------------
 include/exec/memory.h         |   19 +++++++++++++++----
 include/hw/sh4/sh_intc.h      |    1 +
 3 files changed, 16 insertions(+), 33 deletions(-)

diff --git a/include/exec/address-spaces.h b/include/exec/address-spaces.h
index 3d12cdd..c6e5d51 100644
--- a/include/exec/address-spaces.h
+++ b/include/exec/address-spaces.h
@@ -10,32 +10,3 @@
  * the COPYING file in the top-level directory.
  *
  */
-
-#ifndef EXEC_MEMORY_H
-#define EXEC_MEMORY_H
-
-/*
- * Internal interfaces between memory.c/exec.c/vl.c.  Do not #include unless
- * you're one of them.
- */
-
-#include "exec/memory.h"
-
-#ifndef CONFIG_USER_ONLY
-
-/* Get the root memory region.  This interface should only be used temporarily
- * until a proper bus interface is available.
- */
-MemoryRegion *get_system_memory(void);
-
-/* Get the root I/O port region.  This interface should only be used
- * temporarily until a proper bus interface is available.
- */
-MemoryRegion *get_system_io(void);
-
-extern AddressSpace address_space_memory;
-extern AddressSpace address_space_io;
-
-#endif
-
-#endif
diff --git a/include/exec/memory.h b/include/exec/memory.h
index 9101fc3..bd75af9 100644
--- a/include/exec/memory.h
+++ b/include/exec/memory.h
@@ -25,9 +25,7 @@
 #include <stdbool.h>
 #include "qemu-common.h"
 #include "exec/cpu-common.h"
-#ifndef CONFIG_USER_ONLY
 #include "exec/hwaddr.h"
-#endif
 #include "qemu/queue.h"
 #include "qemu/int128.h"
 #include "qemu/notify.h"
@@ -1052,6 +1050,19 @@ void address_space_unmap(AddressSpace *as, void *buffer, hwaddr len,
                          int is_write, hwaddr access_len);
 
 
-#endif
+/* Get the root memory region.  This interface should only be used temporarily
+ * until a proper bus interface is available.
+ */
+MemoryRegion *get_system_memory(void);
+
+/* Get the root I/O port region.  This interface should only be used
+ * temporarily until a proper bus interface is available.
+ */
+MemoryRegion *get_system_io(void);
+
+extern AddressSpace address_space_memory;
+extern AddressSpace address_space_io;
+
+#endif /* !CONFIG_USER_ONLY */
 
-#endif
+#endif /* MEMORY_H */
diff --git a/include/hw/sh4/sh_intc.h b/include/hw/sh4/sh_intc.h
index b7ddcb0..644acb7 100644
--- a/include/hw/sh4/sh_intc.h
+++ b/include/hw/sh4/sh_intc.h
@@ -4,6 +4,7 @@
 #include "qemu-common.h"
 #include "hw/irq.h"
 #include "exec/address-spaces.h"
+#include "exec/memory.h"
 
 typedef unsigned char intc_enum;
 
-- 
1.7.9.5

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

* [Qemu-devel] [Discussion 07/10] memory: remove file include/exec/address-spaces.h
  2014-03-04  2:47 [Qemu-devel] [Discussion 00/10] about API hierarchy Xuebing Wang
                   ` (5 preceding siblings ...)
  2014-03-04  2:47 ` [Qemu-devel] [Discussion 06/10] memory: move contents in include/exec/address-spaces.h => memory.h Xuebing Wang
@ 2014-03-04  2:47 ` Xuebing Wang
  2014-03-04  2:47 ` [Qemu-devel] [Discussion 08/10] exec: move TranslationBlock API from exec-all.h => translate.h Xuebing Wang
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 37+ messages in thread
From: Xuebing Wang @ 2014-03-04  2:47 UTC (permalink / raw)
  To: qemu-devel; +Cc: pbonzini, xbing6, afaerber, stefanha

Remove '#include "exec/address-spaces.h"' is done by:
git grep -w "exec\/address-spaces.h" | cut -d: -f1 |
    xargs sed -i '/exec\/address-spaces.h/d'

Signed-off-by: Xuebing Wang <xbing6@gmail.com>
---
 arch_init.c                              |    1 -
 cputlb.c                                 |    1 -
 exec.c                                   |    1 -
 hw/acpi/ich9.c                           |    1 -
 hw/acpi/pcihp.c                          |    1 -
 hw/acpi/piix4.c                          |    1 -
 hw/alpha/typhoon.c                       |    1 -
 hw/arm/boot.c                            |    1 -
 hw/arm/collie.c                          |    1 -
 hw/arm/digic_boards.c                    |    1 -
 hw/arm/exynos4_boards.c                  |    1 -
 hw/arm/gumstix.c                         |    1 -
 hw/arm/highbank.c                        |    1 -
 hw/arm/integratorcp.c                    |    1 -
 hw/arm/kzm.c                             |    1 -
 hw/arm/mainstone.c                       |    1 -
 hw/arm/musicpal.c                        |    1 -
 hw/arm/nseries.c                         |    1 -
 hw/arm/omap_sx1.c                        |    1 -
 hw/arm/palm.c                            |    1 -
 hw/arm/realview.c                        |    1 -
 hw/arm/spitz.c                           |    1 -
 hw/arm/stellaris.c                       |    1 -
 hw/arm/tosa.c                            |    1 -
 hw/arm/versatilepb.c                     |    1 -
 hw/arm/vexpress.c                        |    1 -
 hw/arm/virt.c                            |    1 -
 hw/arm/xilinx_zynq.c                     |    1 -
 hw/arm/z2.c                              |    1 -
 hw/block/onenand.c                       |    1 -
 hw/block/pflash_cfi01.c                  |    1 -
 hw/block/pflash_cfi02.c                  |    1 -
 hw/char/mcf_uart.c                       |    1 -
 hw/char/omap_uart.c                      |    1 -
 hw/char/serial.c                         |    1 -
 hw/char/sh_serial.c                      |    1 -
 hw/core/loader.c                         |    1 -
 hw/core/sysbus.c                         |    1 -
 hw/cris/axis_dev88.c                     |    1 -
 hw/display/sm501.c                       |    1 -
 hw/dma/etraxfs_dma.c                     |    1 -
 hw/dma/pl080.c                           |    1 -
 hw/dma/sun4m_iommu.c                     |    1 -
 hw/i386/pc.c                             |    1 -
 hw/i386/pc_piix.c                        |    1 -
 hw/i386/pc_q35.c                         |    1 -
 hw/intc/armv7m_nvic.c                    |    1 -
 hw/intc/openpic_kvm.c                    |    1 -
 hw/isa/isa-bus.c                         |    1 -
 hw/isa/lpc_ich9.c                        |    1 -
 hw/isa/vt82c686.c                        |    1 -
 hw/lm32/lm32_boards.c                    |    1 -
 hw/lm32/milkymist.c                      |    1 -
 hw/m68k/an5206.c                         |    1 -
 hw/m68k/dummy_m68k.c                     |    1 -
 hw/m68k/mcf5206.c                        |    1 -
 hw/m68k/mcf5208.c                        |    1 -
 hw/m68k/mcf_intc.c                       |    1 -
 hw/microblaze/petalogix_ml605_mmu.c      |    1 -
 hw/microblaze/petalogix_s3adsp1800_mmu.c |    1 -
 hw/mips/gt64xxx_pci.c                    |    1 -
 hw/mips/mips_fulong2e.c                  |    1 -
 hw/mips/mips_jazz.c                      |    1 -
 hw/mips/mips_malta.c                     |    1 -
 hw/mips/mips_mipssim.c                   |    1 -
 hw/mips/mips_r4k.c                       |    1 -
 hw/misc/arm_integrator_debug.c           |    1 -
 hw/misc/omap_gpmc.c                      |    1 -
 hw/misc/vfio.c                           |    1 -
 hw/moxie/moxiesim.c                      |    1 -
 hw/net/mcf_fec.c                         |    1 -
 hw/net/ne2000-isa.c                      |    1 -
 hw/openrisc/openrisc_sim.c               |    1 -
 hw/pci-host/apb.c                        |    1 -
 hw/pci-host/bonito.c                     |    1 -
 hw/pci-host/ppce500.c                    |    1 -
 hw/pci-host/prep.c                       |    1 -
 hw/pci-host/versatile.c                  |    1 -
 hw/pci/pci.c                             |    1 -
 hw/pci/pcie_host.c                       |    1 -
 hw/ppc/e500.c                            |    1 -
 hw/ppc/mac_newworld.c                    |    1 -
 hw/ppc/mac_oldworld.c                    |    1 -
 hw/ppc/ppc405_boards.c                   |    1 -
 hw/ppc/ppc405_uc.c                       |    1 -
 hw/ppc/ppc440_bamboo.c                   |    1 -
 hw/ppc/ppc4xx_devs.c                     |    1 -
 hw/ppc/ppc4xx_pci.c                      |    1 -
 hw/ppc/prep.c                            |    1 -
 hw/ppc/spapr.c                           |    1 -
 hw/ppc/spapr_iommu.c                     |    1 -
 hw/ppc/spapr_pci.c                       |    1 -
 hw/ppc/virtex_ml507.c                    |    1 -
 hw/s390x/css.c                           |    1 -
 hw/s390x/s390-virtio-ccw.c               |    1 -
 hw/s390x/s390-virtio.c                   |    1 -
 hw/sh4/r2d.c                             |    1 -
 hw/sh4/sh7750.c                          |    1 -
 hw/sh4/sh_pci.c                          |    1 -
 hw/sh4/shix.c                            |    1 -
 hw/sparc/leon3.c                         |    1 -
 hw/sparc64/sun4u.c                       |    1 -
 hw/timer/m48t59.c                        |    1 -
 hw/timer/sh_timer.c                      |    1 -
 hw/tpm/tpm_tis.c                         |    1 -
 hw/unicore32/puv3.c                      |    1 -
 hw/virtio/dataplane/vring.c              |    1 -
 hw/virtio/vhost.c                        |    1 -
 hw/virtio/virtio-balloon.c               |    1 -
 hw/virtio/virtio.c                       |    1 -
 hw/xen/xen_platform.c                    |    1 -
 hw/xen/xen_pt.c                          |    1 -
 hw/xtensa/xtensa_lx60.c                  |    1 -
 hw/xtensa/xtensa_sim.c                   |    1 -
 include/exec/address-spaces.h            |   12 ------------
 include/exec/softmmu_template.h          |    1 -
 include/hw/arm/allwinner-a10.h           |    1 -
 include/hw/sh4/sh_intc.h                 |    1 -
 include/sysemu/dma.h                     |    1 -
 ioport.c                                 |    1 -
 kvm-all.c                                |    1 -
 memory.c                                 |    1 -
 memory_mapping.c                         |    1 -
 target-sparc/mmu_helper.c                |    1 -
 target-xtensa/op_helper.c                |    1 -
 translate-all.c                          |    1 -
 xen-all.c                                |    1 -
 127 files changed, 138 deletions(-)
 delete mode 100644 include/exec/address-spaces.h

diff --git a/arch_init.c b/arch_init.c
index 76e8630..a6d44b5 100644
--- a/arch_init.c
+++ b/arch_init.c
@@ -41,7 +41,6 @@
 #include "sysemu/kvm.h"
 #include "migration/migration.h"
 #include "hw/i386/smbios.h"
-#include "exec/address-spaces.h"
 #include "hw/audio/pcspk.h"
 #include "migration/page_cache.h"
 #include "qemu/config-file.h"
diff --git a/cputlb.c b/cputlb.c
index 3c6cb16..724bdda 100644
--- a/cputlb.c
+++ b/cputlb.c
@@ -25,7 +25,6 @@
 #include "config.h"
 #include "exec/exec-all.h"
 #include "exec/memory.h"
-#include "exec/address-spaces.h"
 
 #include "exec/cputlb.h"
 
diff --git a/exec.c b/exec.c
index 3df2ffc..ffbd26c 100644
--- a/exec.c
+++ b/exec.c
@@ -36,7 +36,6 @@
 #include "qemu/config-file.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 */
diff --git a/hw/acpi/ich9.c b/hw/acpi/ich9.c
index 0afac42..644c6fe 100644
--- a/hw/acpi/ich9.c
+++ b/hw/acpi/ich9.c
@@ -31,7 +31,6 @@
 #include "sysemu/sysemu.h"
 #include "hw/acpi/acpi.h"
 #include "sysemu/kvm.h"
-#include "exec/address-spaces.h"
 
 #include "hw/i386/ich9.h"
 
diff --git a/hw/acpi/pcihp.c b/hw/acpi/pcihp.c
index f80c480..e62d5d0 100644
--- a/hw/acpi/pcihp.c
+++ b/hw/acpi/pcihp.c
@@ -33,7 +33,6 @@
 #include "sysemu/sysemu.h"
 #include "qemu/range.h"
 #include "exec/ioport.h"
-#include "exec/address-spaces.h"
 #include "hw/pci/pci_bus.h"
 #include "qom/qom-qobject.h"
 #include "qapi/qmp/qint.h"
diff --git a/hw/acpi/piix4.c b/hw/acpi/piix4.c
index 67dc075..82ddbfd 100644
--- a/hw/acpi/piix4.c
+++ b/hw/acpi/piix4.c
@@ -28,7 +28,6 @@
 #include "qemu/range.h"
 #include "exec/ioport.h"
 #include "hw/nvram/fw_cfg.h"
-#include "exec/address-spaces.h"
 #include "hw/acpi/piix4.h"
 #include "hw/acpi/pcihp.h"
 #include "hw/acpi/cpu_hotplug.h"
diff --git a/hw/alpha/typhoon.c b/hw/alpha/typhoon.c
index 67a1070..89c42a8 100644
--- a/hw/alpha/typhoon.c
+++ b/hw/alpha/typhoon.c
@@ -11,7 +11,6 @@
 #include "hw/devices.h"
 #include "sysemu/sysemu.h"
 #include "alpha_sys.h"
-#include "exec/address-spaces.h"
 
 
 #define TYPE_TYPHOON_PCI_HOST_BRIDGE "typhoon-pcihost"
diff --git a/hw/arm/boot.c b/hw/arm/boot.c
index dc62918..96609a0 100644
--- a/hw/arm/boot.c
+++ b/hw/arm/boot.c
@@ -16,7 +16,6 @@
 #include "elf.h"
 #include "sysemu/device_tree.h"
 #include "qemu/config-file.h"
-#include "exec/address-spaces.h"
 
 /* Kernel boot protocol is specified in the kernel docs
  * Documentation/arm/Booting and Documentation/arm64/booting.txt
diff --git a/hw/arm/collie.c b/hw/arm/collie.c
index 8878b0e..867b47b 100644
--- a/hw/arm/collie.c
+++ b/hw/arm/collie.c
@@ -16,7 +16,6 @@
 #include "hw/arm/arm.h"
 #include "hw/block/flash.h"
 #include "sysemu/blockdev.h"
-#include "exec/address-spaces.h"
 
 static struct arm_boot_info collie_binfo = {
     .loader_start = SA_SDCS0,
diff --git a/hw/arm/digic_boards.c b/hw/arm/digic_boards.c
index 32fc30a..9c28137 100644
--- a/hw/arm/digic_boards.c
+++ b/hw/arm/digic_boards.c
@@ -24,7 +24,6 @@
  */
 
 #include "hw/boards.h"
-#include "exec/address-spaces.h"
 #include "qemu/error-report.h"
 #include "hw/arm/digic.h"
 #include "hw/block/flash.h"
diff --git a/hw/arm/exynos4_boards.c b/hw/arm/exynos4_boards.c
index 26cedec..73df49e 100644
--- a/hw/arm/exynos4_boards.c
+++ b/hw/arm/exynos4_boards.c
@@ -26,7 +26,6 @@
 #include "hw/sysbus.h"
 #include "net/net.h"
 #include "hw/arm/arm.h"
-#include "exec/address-spaces.h"
 #include "hw/arm/exynos4210.h"
 #include "hw/boards.h"
 
diff --git a/hw/arm/gumstix.c b/hw/arm/gumstix.c
index aeea172..1b5e9af 100644
--- a/hw/arm/gumstix.c
+++ b/hw/arm/gumstix.c
@@ -41,7 +41,6 @@
 #include "hw/devices.h"
 #include "hw/boards.h"
 #include "sysemu/blockdev.h"
-#include "exec/address-spaces.h"
 #include "sysemu/qtest.h"
 
 static const int sector_len = 128 * 1024;
diff --git a/hw/arm/highbank.c b/hw/arm/highbank.c
index f66d57b..6210c31 100644
--- a/hw/arm/highbank.c
+++ b/hw/arm/highbank.c
@@ -25,7 +25,6 @@
 #include "sysemu/sysemu.h"
 #include "hw/boards.h"
 #include "sysemu/blockdev.h"
-#include "exec/address-spaces.h"
 #include "qemu/error-report.h"
 
 #define SMP_BOOT_ADDR           0x100
diff --git a/hw/arm/integratorcp.c b/hw/arm/integratorcp.c
index a759689..b4c1f40 100644
--- a/hw/arm/integratorcp.c
+++ b/hw/arm/integratorcp.c
@@ -13,7 +13,6 @@
 #include "hw/arm/arm.h"
 #include "hw/misc/arm_integrator_debug.h"
 #include "net/net.h"
-#include "exec/address-spaces.h"
 #include "sysemu/sysemu.h"
 
 #define TYPE_INTEGRATOR_CM "integrator_core"
diff --git a/hw/arm/kzm.c b/hw/arm/kzm.c
index 99d33cb..1c78be9 100644
--- a/hw/arm/kzm.c
+++ b/hw/arm/kzm.c
@@ -14,7 +14,6 @@
  */
 
 #include "hw/sysbus.h"
-#include "exec/address-spaces.h"
 #include "hw/hw.h"
 #include "hw/arm/arm.h"
 #include "hw/devices.h"
diff --git a/hw/arm/mainstone.c b/hw/arm/mainstone.c
index d8e075e..a97114b 100644
--- a/hw/arm/mainstone.c
+++ b/hw/arm/mainstone.c
@@ -20,7 +20,6 @@
 #include "hw/block/flash.h"
 #include "sysemu/blockdev.h"
 #include "hw/sysbus.h"
-#include "exec/address-spaces.h"
 #include "sysemu/qtest.h"
 
 /* Device addresses */
diff --git a/hw/arm/musicpal.c b/hw/arm/musicpal.c
index cce7127..ca69e4c 100644
--- a/hw/arm/musicpal.c
+++ b/hw/arm/musicpal.c
@@ -23,7 +23,6 @@
 #include "ui/console.h"
 #include "hw/i2c/i2c.h"
 #include "sysemu/blockdev.h"
-#include "exec/address-spaces.h"
 #include "ui/pixel_ops.h"
 
 #define MP_MISC_BASE            0x80002000
diff --git a/hw/arm/nseries.c b/hw/arm/nseries.c
index c28f895..25d535f 100644
--- a/hw/arm/nseries.c
+++ b/hw/arm/nseries.c
@@ -33,7 +33,6 @@
 #include "hw/loader.h"
 #include "sysemu/blockdev.h"
 #include "hw/sysbus.h"
-#include "exec/address-spaces.h"
 
 /* Nokia N8x0 support */
 struct n800_s {
diff --git a/hw/arm/omap_sx1.c b/hw/arm/omap_sx1.c
index 3ba263a..81e93b1 100644
--- a/hw/arm/omap_sx1.c
+++ b/hw/arm/omap_sx1.c
@@ -33,7 +33,6 @@
 #include "hw/block/flash.h"
 #include "sysemu/blockdev.h"
 #include "sysemu/qtest.h"
-#include "exec/address-spaces.h"
 
 /*****************************************************************************/
 /* Siemens SX1 Cellphone V1 */
diff --git a/hw/arm/palm.c b/hw/arm/palm.c
index fac4f69..dad4255 100644
--- a/hw/arm/palm.c
+++ b/hw/arm/palm.c
@@ -26,7 +26,6 @@
 #include "hw/arm/arm.h"
 #include "hw/devices.h"
 #include "hw/loader.h"
-#include "exec/address-spaces.h"
 
 static uint32_t static_readb(void *opaque, hwaddr offset)
 {
diff --git a/hw/arm/realview.c b/hw/arm/realview.c
index 6ef7646..a1d8344 100644
--- a/hw/arm/realview.c
+++ b/hw/arm/realview.c
@@ -17,7 +17,6 @@
 #include "hw/boards.h"
 #include "hw/i2c/i2c.h"
 #include "sysemu/blockdev.h"
-#include "exec/address-spaces.h"
 
 #define SMP_BOOT_ADDR 0xe0000000
 #define SMP_BOOTREG_ADDR 0x10000030
diff --git a/hw/arm/spitz.c b/hw/arm/spitz.c
index 2decff1..66ee98b 100644
--- a/hw/arm/spitz.c
+++ b/hw/arm/spitz.c
@@ -27,7 +27,6 @@
 #include "hw/boards.h"
 #include "sysemu/blockdev.h"
 #include "hw/sysbus.h"
-#include "exec/address-spaces.h"
 
 #undef REG_FMT
 #define REG_FMT			"0x%02lx"
diff --git a/hw/arm/stellaris.c b/hw/arm/stellaris.c
index d6cc77b..77d3865 100644
--- a/hw/arm/stellaris.c
+++ b/hw/arm/stellaris.c
@@ -15,7 +15,6 @@
 #include "hw/i2c/i2c.h"
 #include "net/net.h"
 #include "hw/boards.h"
-#include "exec/address-spaces.h"
 
 #define GPIO_A 0
 #define GPIO_B 1
diff --git a/hw/arm/tosa.c b/hw/arm/tosa.c
index 2069f55..7389b53 100644
--- a/hw/arm/tosa.c
+++ b/hw/arm/tosa.c
@@ -23,7 +23,6 @@
 #include "hw/ssi.h"
 #include "sysemu/blockdev.h"
 #include "hw/sysbus.h"
-#include "exec/address-spaces.h"
 
 #define TOSA_RAM    0x04000000
 #define TOSA_ROM	0x00800000
diff --git a/hw/arm/versatilepb.c b/hw/arm/versatilepb.c
index e5493b4..dd44d2b 100644
--- a/hw/arm/versatilepb.c
+++ b/hw/arm/versatilepb.c
@@ -16,7 +16,6 @@
 #include "hw/i2c/i2c.h"
 #include "hw/boards.h"
 #include "sysemu/blockdev.h"
-#include "exec/address-spaces.h"
 #include "hw/block/flash.h"
 
 #define VERSATILE_FLASH_ADDR 0x34000000
diff --git a/hw/arm/vexpress.c b/hw/arm/vexpress.c
index ef1707a..ae5a120 100644
--- a/hw/arm/vexpress.c
+++ b/hw/arm/vexpress.c
@@ -28,7 +28,6 @@
 #include "net/net.h"
 #include "sysemu/sysemu.h"
 #include "hw/boards.h"
-#include "exec/address-spaces.h"
 #include "sysemu/blockdev.h"
 #include "hw/block/flash.h"
 #include "sysemu/device_tree.h"
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
index 517f2fe..ab0165a 100644
--- a/hw/arm/virt.c
+++ b/hw/arm/virt.c
@@ -37,7 +37,6 @@
 #include "sysemu/sysemu.h"
 #include "sysemu/kvm.h"
 #include "hw/boards.h"
-#include "exec/address-spaces.h"
 #include "qemu/bitops.h"
 #include "qemu/error-report.h"
 
diff --git a/hw/arm/xilinx_zynq.c b/hw/arm/xilinx_zynq.c
index 9ee21e7..32a4e1f 100644
--- a/hw/arm/xilinx_zynq.c
+++ b/hw/arm/xilinx_zynq.c
@@ -18,7 +18,6 @@
 #include "hw/sysbus.h"
 #include "hw/arm/arm.h"
 #include "net/net.h"
-#include "exec/address-spaces.h"
 #include "sysemu/sysemu.h"
 #include "hw/boards.h"
 #include "hw/block/flash.h"
diff --git a/hw/arm/z2.c b/hw/arm/z2.c
index 67c1be8..1cf4152 100644
--- a/hw/arm/z2.c
+++ b/hw/arm/z2.c
@@ -23,7 +23,6 @@
 #include "sysemu/blockdev.h"
 #include "ui/console.h"
 #include "audio/audio.h"
-#include "exec/address-spaces.h"
 #include "sysemu/qtest.h"
 
 #ifdef DEBUG_Z2
diff --git a/hw/block/onenand.c b/hw/block/onenand.c
index aae9ee7..86068b0 100644
--- a/hw/block/onenand.c
+++ b/hw/block/onenand.c
@@ -24,7 +24,6 @@
 #include "hw/irq.h"
 #include "sysemu/blockdev.h"
 #include "exec/memory.h"
-#include "exec/address-spaces.h"
 #include "hw/sysbus.h"
 #include "qemu/error-report.h"
 
diff --git a/hw/block/pflash_cfi01.c b/hw/block/pflash_cfi01.c
index 0c95d53..ae87e54 100644
--- a/hw/block/pflash_cfi01.c
+++ b/hw/block/pflash_cfi01.c
@@ -41,7 +41,6 @@
 #include "block/block.h"
 #include "qemu/timer.h"
 #include "qemu/bitops.h"
-#include "exec/address-spaces.h"
 #include "qemu/host-utils.h"
 #include "hw/sysbus.h"
 
diff --git a/hw/block/pflash_cfi02.c b/hw/block/pflash_cfi02.c
index 8d4b828..986ba91 100644
--- a/hw/block/pflash_cfi02.c
+++ b/hw/block/pflash_cfi02.c
@@ -39,7 +39,6 @@
 #include "hw/block/flash.h"
 #include "qemu/timer.h"
 #include "block/block.h"
-#include "exec/address-spaces.h"
 #include "qemu/host-utils.h"
 #include "hw/sysbus.h"
 
diff --git a/hw/char/mcf_uart.c b/hw/char/mcf_uart.c
index 98fd44e..5457f12 100644
--- a/hw/char/mcf_uart.c
+++ b/hw/char/mcf_uart.c
@@ -8,7 +8,6 @@
 #include "hw/hw.h"
 #include "hw/m68k/mcf.h"
 #include "sysemu/char.h"
-#include "exec/address-spaces.h"
 
 typedef struct {
     MemoryRegion iomem;
diff --git a/hw/char/omap_uart.c b/hw/char/omap_uart.c
index 0b91693..8dee1be 100644
--- a/hw/char/omap_uart.c
+++ b/hw/char/omap_uart.c
@@ -21,7 +21,6 @@
 #include "hw/hw.h"
 #include "hw/arm/omap.h"
 #include "hw/char/serial.h"
-#include "exec/address-spaces.h"
 
 /* UARTs */
 struct omap_uart_s {
diff --git a/hw/char/serial.c b/hw/char/serial.c
index 6d3b5af..3be462b 100644
--- a/hw/char/serial.c
+++ b/hw/char/serial.c
@@ -26,7 +26,6 @@
 #include "hw/char/serial.h"
 #include "sysemu/char.h"
 #include "qemu/timer.h"
-#include "exec/address-spaces.h"
 #include "qemu/error-report.h"
 
 //#define DEBUG_SERIAL
diff --git a/hw/char/sh_serial.c b/hw/char/sh_serial.c
index 9328dd1..92dac4b 100644
--- a/hw/char/sh_serial.c
+++ b/hw/char/sh_serial.c
@@ -27,7 +27,6 @@
 #include "hw/hw.h"
 #include "hw/sh4/sh.h"
 #include "sysemu/char.h"
-#include "exec/address-spaces.h"
 
 //#define DEBUG_SERIAL
 
diff --git a/hw/core/loader.c b/hw/core/loader.c
index e1c3f3a..932f2d5 100644
--- a/hw/core/loader.c
+++ b/hw/core/loader.c
@@ -50,7 +50,6 @@
 #include "hw/loader.h"
 #include "hw/nvram/fw_cfg.h"
 #include "exec/memory.h"
-#include "exec/address-spaces.h"
 
 #include <zlib.h>
 
diff --git a/hw/core/sysbus.c b/hw/core/sysbus.c
index f4e760d..55994e4 100644
--- a/hw/core/sysbus.c
+++ b/hw/core/sysbus.c
@@ -19,7 +19,6 @@
 
 #include "hw/sysbus.h"
 #include "monitor/monitor.h"
-#include "exec/address-spaces.h"
 
 static void sysbus_dev_print(Monitor *mon, DeviceState *dev, int indent);
 static char *sysbus_get_fw_dev_path(DeviceState *dev);
diff --git a/hw/cris/axis_dev88.c b/hw/cris/axis_dev88.c
index 645e45c..a3a51e8 100644
--- a/hw/cris/axis_dev88.c
+++ b/hw/cris/axis_dev88.c
@@ -31,7 +31,6 @@
 #include "elf.h"
 #include "boot.h"
 #include "sysemu/blockdev.h"
-#include "exec/address-spaces.h"
 #include "sysemu/qtest.h"
 
 #define D(x)
diff --git a/hw/display/sm501.c b/hw/display/sm501.c
index 0b5f993..c75d6ac 100644
--- a/hw/display/sm501.c
+++ b/hw/display/sm501.c
@@ -30,7 +30,6 @@
 #include "hw/sysbus.h"
 #include "qemu/range.h"
 #include "ui/pixel_ops.h"
-#include "exec/address-spaces.h"
 
 /*
  * Status: 2010/05/07
diff --git a/hw/dma/etraxfs_dma.c b/hw/dma/etraxfs_dma.c
index 3599513..fed9994 100644
--- a/hw/dma/etraxfs_dma.c
+++ b/hw/dma/etraxfs_dma.c
@@ -24,7 +24,6 @@
 #include <stdio.h>
 #include <sys/time.h>
 #include "hw/hw.h"
-#include "exec/address-spaces.h"
 #include "qemu-common.h"
 #include "sysemu/sysemu.h"
 
diff --git a/hw/dma/pl080.c b/hw/dma/pl080.c
index 741dd20..53695f3 100644
--- a/hw/dma/pl080.c
+++ b/hw/dma/pl080.c
@@ -8,7 +8,6 @@
  */
 
 #include "hw/sysbus.h"
-#include "exec/address-spaces.h"
 
 #define PL080_MAX_CHANNELS 8
 #define PL080_CONF_E    0x1
diff --git a/hw/dma/sun4m_iommu.c b/hw/dma/sun4m_iommu.c
index 899d454..33fb033 100644
--- a/hw/dma/sun4m_iommu.c
+++ b/hw/dma/sun4m_iommu.c
@@ -24,7 +24,6 @@
 
 #include "hw/sparc/sun4m.h"
 #include "hw/sysbus.h"
-#include "exec/address-spaces.h"
 #include "trace.h"
 
 /*
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index e715a33..1482e2f 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -48,7 +48,6 @@
 #include "hw/block/block.h"
 #include "ui/qemu-spice.h"
 #include "exec/memory.h"
-#include "exec/address-spaces.h"
 #include "sysemu/arch_init.h"
 #include "qemu/bitmap.h"
 #include "qemu/config-file.h"
diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
index d5dc1ef..89f4456 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
@@ -45,7 +45,6 @@
 #include "hw/i2c/smbus.h"
 #include "hw/xen/xen.h"
 #include "exec/memory.h"
-#include "exec/address-spaces.h"
 #include "hw/acpi/acpi.h"
 #include "cpu.h"
 #ifdef CONFIG_XEN
diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
index a7f6260..203d5f2 100644
--- a/hw/i386/pc_q35.c
+++ b/hw/i386/pc_q35.c
@@ -37,7 +37,6 @@
 #include "sysemu/kvm.h"
 #include "hw/kvm/clock.h"
 #include "hw/pci-host/q35.h"
-#include "exec/address-spaces.h"
 #include "hw/i386/ich9.h"
 #include "hw/i386/smbios.h"
 #include "hw/ide/pci.h"
diff --git a/hw/intc/armv7m_nvic.c b/hw/intc/armv7m_nvic.c
index 6066fa6..6558020 100644
--- a/hw/intc/armv7m_nvic.c
+++ b/hw/intc/armv7m_nvic.c
@@ -13,7 +13,6 @@
 #include "hw/sysbus.h"
 #include "qemu/timer.h"
 #include "hw/arm/arm.h"
-#include "exec/address-spaces.h"
 #include "gic_internal.h"
 
 typedef struct {
diff --git a/hw/intc/openpic_kvm.c b/hw/intc/openpic_kvm.c
index c7f7b84..98e69a2 100644
--- a/hw/intc/openpic_kvm.c
+++ b/hw/intc/openpic_kvm.c
@@ -23,7 +23,6 @@
  */
 
 #include <sys/ioctl.h>
-#include "exec/address-spaces.h"
 #include "hw/hw.h"
 #include "hw/ppc/openpic.h"
 #include "hw/pci/msi.h"
diff --git a/hw/isa/isa-bus.c b/hw/isa/isa-bus.c
index 55d0100..052fd84 100644
--- a/hw/isa/isa-bus.c
+++ b/hw/isa/isa-bus.c
@@ -21,7 +21,6 @@
 #include "hw/sysbus.h"
 #include "sysemu/sysemu.h"
 #include "hw/isa/isa.h"
-#include "exec/address-spaces.h"
 
 static ISABus *isabus;
 hwaddr isa_mem_base = 0;
diff --git a/hw/isa/lpc_ich9.c b/hw/isa/lpc_ich9.c
index 51ce12d..e08b843 100644
--- a/hw/isa/lpc_ich9.c
+++ b/hw/isa/lpc_ich9.c
@@ -43,7 +43,6 @@
 #include "hw/acpi/acpi.h"
 #include "hw/acpi/ich9.h"
 #include "hw/pci/pci_bus.h"
-#include "exec/address-spaces.h"
 #include "sysemu/sysemu.h"
 
 static int ich9_lpc_sci_irq(ICH9LPCState *lpc);
diff --git a/hw/isa/vt82c686.c b/hw/isa/vt82c686.c
index 1a93afd..4373e18 100644
--- a/hw/isa/vt82c686.c
+++ b/hw/isa/vt82c686.c
@@ -24,7 +24,6 @@
 #include "hw/i2c/pm_smbus.h"
 #include "sysemu/sysemu.h"
 #include "qemu/timer.h"
-#include "exec/address-spaces.h"
 
 //#define DEBUG_VT82C686B
 
diff --git a/hw/lm32/lm32_boards.c b/hw/lm32/lm32_boards.c
index 5e22e9b..aad7527 100644
--- a/hw/lm32/lm32_boards.c
+++ b/hw/lm32/lm32_boards.c
@@ -27,7 +27,6 @@
 #include "elf.h"
 #include "lm32_hwsetup.h"
 #include "lm32.h"
-#include "exec/address-spaces.h"
 
 typedef struct {
     LM32CPU *cpu;
diff --git a/hw/lm32/milkymist.c b/hw/lm32/milkymist.c
index baf234c..27de8e8 100644
--- a/hw/lm32/milkymist.c
+++ b/hw/lm32/milkymist.c
@@ -29,7 +29,6 @@
 #include "sysemu/blockdev.h"
 #include "milkymist-hw.h"
 #include "lm32.h"
-#include "exec/address-spaces.h"
 
 #define BIOS_FILENAME    "mmone-bios.bin"
 #define BIOS_OFFSET      0x00860000
diff --git a/hw/m68k/an5206.c b/hw/m68k/an5206.c
index 24f2068..4800d3f 100644
--- a/hw/m68k/an5206.c
+++ b/hw/m68k/an5206.c
@@ -11,7 +11,6 @@
 #include "hw/boards.h"
 #include "hw/loader.h"
 #include "elf.h"
-#include "exec/address-spaces.h"
 #include "sysemu/qtest.h"
 
 #define KERNEL_LOAD_ADDR 0x10000
diff --git a/hw/m68k/dummy_m68k.c b/hw/m68k/dummy_m68k.c
index 86e2e6e..b8e04e3 100644
--- a/hw/m68k/dummy_m68k.c
+++ b/hw/m68k/dummy_m68k.c
@@ -10,7 +10,6 @@
 #include "hw/boards.h"
 #include "hw/loader.h"
 #include "elf.h"
-#include "exec/address-spaces.h"
 
 #define KERNEL_LOAD_ADDR 0x10000
 
diff --git a/hw/m68k/mcf5206.c b/hw/m68k/mcf5206.c
index 1727a46..8b185b0 100644
--- a/hw/m68k/mcf5206.c
+++ b/hw/m68k/mcf5206.c
@@ -10,7 +10,6 @@
 #include "qemu/timer.h"
 #include "hw/ptimer.h"
 #include "sysemu/sysemu.h"
-#include "exec/address-spaces.h"
 
 /* General purpose timer module.  */
 typedef struct {
diff --git a/hw/m68k/mcf5208.c b/hw/m68k/mcf5208.c
index 6e30c0b..12b2115 100644
--- a/hw/m68k/mcf5208.c
+++ b/hw/m68k/mcf5208.c
@@ -15,7 +15,6 @@
 #include "hw/boards.h"
 #include "hw/loader.h"
 #include "elf.h"
-#include "exec/address-spaces.h"
 
 #define SYS_FREQ 66000000
 
diff --git a/hw/m68k/mcf_intc.c b/hw/m68k/mcf_intc.c
index 621423c..a931f02 100644
--- a/hw/m68k/mcf_intc.c
+++ b/hw/m68k/mcf_intc.c
@@ -7,7 +7,6 @@
  */
 #include "hw/hw.h"
 #include "hw/m68k/mcf.h"
-#include "exec/address-spaces.h"
 
 typedef struct {
     MemoryRegion iomem;
diff --git a/hw/microblaze/petalogix_ml605_mmu.c b/hw/microblaze/petalogix_ml605_mmu.c
index 40a9f5c..c3d9cad 100644
--- a/hw/microblaze/petalogix_ml605_mmu.c
+++ b/hw/microblaze/petalogix_ml605_mmu.c
@@ -34,7 +34,6 @@
 #include "hw/boards.h"
 #include "sysemu/blockdev.h"
 #include "hw/char/serial.h"
-#include "exec/address-spaces.h"
 #include "hw/ssi.h"
 
 #include "boot.h"
diff --git a/hw/microblaze/petalogix_s3adsp1800_mmu.c b/hw/microblaze/petalogix_s3adsp1800_mmu.c
index 6c45e20..4d9115d 100644
--- a/hw/microblaze/petalogix_s3adsp1800_mmu.c
+++ b/hw/microblaze/petalogix_s3adsp1800_mmu.c
@@ -31,7 +31,6 @@
 #include "hw/devices.h"
 #include "hw/boards.h"
 #include "sysemu/blockdev.h"
-#include "exec/address-spaces.h"
 
 #include "boot.h"
 
diff --git a/hw/mips/gt64xxx_pci.c b/hw/mips/gt64xxx_pci.c
index 6398514..3fc7bf2 100644
--- a/hw/mips/gt64xxx_pci.c
+++ b/hw/mips/gt64xxx_pci.c
@@ -27,7 +27,6 @@
 #include "hw/pci/pci.h"
 #include "hw/pci/pci_host.h"
 #include "hw/i386/pc.h"
-#include "exec/address-spaces.h"
 
 //#define DEBUG
 
diff --git a/hw/mips/mips_fulong2e.c b/hw/mips/mips_fulong2e.c
index e1551aa..23a673c 100644
--- a/hw/mips/mips_fulong2e.c
+++ b/hw/mips/mips_fulong2e.c
@@ -42,7 +42,6 @@
 #include "hw/timer/mc146818rtc.h"
 #include "hw/timer/i8254.h"
 #include "sysemu/blockdev.h"
-#include "exec/address-spaces.h"
 #include "sysemu/qtest.h"
 #include "qemu/error-report.h"
 
diff --git a/hw/mips/mips_jazz.c b/hw/mips/mips_jazz.c
index 5f6dd9f..66fad2e 100644
--- a/hw/mips/mips_jazz.c
+++ b/hw/mips/mips_jazz.c
@@ -41,7 +41,6 @@
 #include "hw/audio/pcspk.h"
 #include "sysemu/blockdev.h"
 #include "hw/sysbus.h"
-#include "exec/address-spaces.h"
 #include "sysemu/qtest.h"
 #include "qemu/error-report.h"
 
diff --git a/hw/mips/mips_malta.c b/hw/mips/mips_malta.c
index ac5ec44..dea12b0 100644
--- a/hw/mips/mips_malta.c
+++ b/hw/mips/mips_malta.c
@@ -45,7 +45,6 @@
 #include "hw/timer/mc146818rtc.h"
 #include "hw/timer/i8254.h"
 #include "sysemu/blockdev.h"
-#include "exec/address-spaces.h"
 #include "hw/sysbus.h"             /* SysBusDevice */
 #include "qemu/host-utils.h"
 #include "sysemu/qtest.h"
diff --git a/hw/mips/mips_mipssim.c b/hw/mips/mips_mipssim.c
index 239aa6a..8524c99 100644
--- a/hw/mips/mips_mipssim.c
+++ b/hw/mips/mips_mipssim.c
@@ -36,7 +36,6 @@
 #include "hw/loader.h"
 #include "elf.h"
 #include "hw/sysbus.h"
-#include "exec/address-spaces.h"
 #include "qemu/error-report.h"
 #include "sysemu/qtest.h"
 
diff --git a/hw/mips/mips_r4k.c b/hw/mips/mips_r4k.c
index e94b543..f9967c4 100644
--- a/hw/mips/mips_r4k.c
+++ b/hw/mips/mips_r4k.c
@@ -25,7 +25,6 @@
 #include "hw/timer/mc146818rtc.h"
 #include "hw/timer/i8254.h"
 #include "sysemu/blockdev.h"
-#include "exec/address-spaces.h"
 #include "sysemu/qtest.h"
 
 #define MAX_IDE_BUS 2
diff --git a/hw/misc/arm_integrator_debug.c b/hw/misc/arm_integrator_debug.c
index 99b720f..36ca7c7 100644
--- a/hw/misc/arm_integrator_debug.c
+++ b/hw/misc/arm_integrator_debug.c
@@ -16,7 +16,6 @@
 
 #include "hw/hw.h"
 #include "hw/sysbus.h"
-#include "exec/address-spaces.h"
 #include "hw/misc/arm_integrator_debug.h"
 
 #define INTEGRATOR_DEBUG(obj) \
diff --git a/hw/misc/omap_gpmc.c b/hw/misc/omap_gpmc.c
index 2047274..da490b1 100644
--- a/hw/misc/omap_gpmc.c
+++ b/hw/misc/omap_gpmc.c
@@ -22,7 +22,6 @@
 #include "hw/block/flash.h"
 #include "hw/arm/omap.h"
 #include "exec/memory.h"
-#include "exec/address-spaces.h"
 
 /* General-Purpose Memory Controller */
 struct omap_gpmc_s {
diff --git a/hw/misc/vfio.c b/hw/misc/vfio.c
index c2c688c..ae1ca64 100644
--- a/hw/misc/vfio.c
+++ b/hw/misc/vfio.c
@@ -27,7 +27,6 @@
 #include <unistd.h>
 
 #include "config.h"
-#include "exec/address-spaces.h"
 #include "exec/memory.h"
 #include "hw/pci/msi.h"
 #include "hw/pci/msix.h"
diff --git a/hw/moxie/moxiesim.c b/hw/moxie/moxiesim.c
index ef4f3a8..2667d79 100644
--- a/hw/moxie/moxiesim.c
+++ b/hw/moxie/moxiesim.c
@@ -33,7 +33,6 @@
 #include "hw/boards.h"
 #include "hw/loader.h"
 #include "hw/char/serial.h"
-#include "exec/address-spaces.h"
 
 #define PHYS_MEM_BASE 0x80000000
 
diff --git a/hw/net/mcf_fec.c b/hw/net/mcf_fec.c
index 4bff3de..f2b9ebb 100644
--- a/hw/net/mcf_fec.c
+++ b/hw/net/mcf_fec.c
@@ -10,7 +10,6 @@
 #include "hw/m68k/mcf.h"
 /* For crc32 */
 #include <zlib.h>
-#include "exec/address-spaces.h"
 
 //#define DEBUG_FEC 1
 
diff --git a/hw/net/ne2000-isa.c b/hw/net/ne2000-isa.c
index c660e58..795f13d 100644
--- a/hw/net/ne2000-isa.c
+++ b/hw/net/ne2000-isa.c
@@ -27,7 +27,6 @@
 #include "hw/qdev.h"
 #include "net/net.h"
 #include "ne2000.h"
-#include "exec/address-spaces.h"
 
 #define TYPE_ISA_NE2000 "ne2k_isa"
 #define ISA_NE2000(obj) OBJECT_CHECK(ISANE2000State, (obj), TYPE_ISA_NE2000)
diff --git a/hw/openrisc/openrisc_sim.c b/hw/openrisc/openrisc_sim.c
index 8e1af8b..12ba3e5 100644
--- a/hw/openrisc/openrisc_sim.c
+++ b/hw/openrisc/openrisc_sim.c
@@ -24,7 +24,6 @@
 #include "hw/char/serial.h"
 #include "net/net.h"
 #include "hw/loader.h"
-#include "exec/address-spaces.h"
 #include "sysemu/sysemu.h"
 #include "hw/sysbus.h"
 #include "sysemu/qtest.h"
diff --git a/hw/pci-host/apb.c b/hw/pci-host/apb.c
index 1b399dd..7c756cd 100644
--- a/hw/pci-host/apb.c
+++ b/hw/pci-host/apb.c
@@ -34,7 +34,6 @@
 #include "hw/pci/pci_bus.h"
 #include "hw/pci-host/apb.h"
 #include "sysemu/sysemu.h"
-#include "exec/address-spaces.h"
 
 /* debug APB */
 //#define DEBUG_APB
diff --git a/hw/pci-host/bonito.c b/hw/pci-host/bonito.c
index 902441f..dc4445f 100644
--- a/hw/pci-host/bonito.c
+++ b/hw/pci-host/bonito.c
@@ -45,7 +45,6 @@
 #include "hw/mips/mips.h"
 #include "hw/pci/pci_host.h"
 #include "sysemu/sysemu.h"
-#include "exec/address-spaces.h"
 
 //#define DEBUG_BONITO
 
diff --git a/hw/pci-host/ppce500.c b/hw/pci-host/ppce500.c
index c80b7cb..fb3227a 100644
--- a/hw/pci-host/ppce500.c
+++ b/hw/pci-host/ppce500.c
@@ -317,7 +317,6 @@ static const VMStateDescription vmstate_ppce500_pci = {
     }
 };
 
-#include "exec/address-spaces.h"
 
 static int e500_pcihost_bridge_initfn(PCIDevice *d)
 {
diff --git a/hw/pci-host/prep.c b/hw/pci-host/prep.c
index 0c948e2..05ed065 100644
--- a/hw/pci-host/prep.c
+++ b/hw/pci-host/prep.c
@@ -28,7 +28,6 @@
 #include "hw/pci/pci_bus.h"
 #include "hw/pci/pci_host.h"
 #include "hw/i386/pc.h"
-#include "exec/address-spaces.h"
 
 #define TYPE_RAVEN_PCI_DEVICE "raven"
 #define TYPE_RAVEN_PCI_HOST_BRIDGE "raven-pcihost"
diff --git a/hw/pci-host/versatile.c b/hw/pci-host/versatile.c
index 71ff0de..f55a607 100644
--- a/hw/pci-host/versatile.c
+++ b/hw/pci-host/versatile.c
@@ -11,7 +11,6 @@
 #include "hw/pci/pci.h"
 #include "hw/pci/pci_bus.h"
 #include "hw/pci/pci_host.h"
-#include "exec/address-spaces.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/pci/pci.c b/hw/pci/pci.c
index 4e0701d..d9d8f56 100644
--- a/hw/pci/pci.c
+++ b/hw/pci/pci.c
@@ -34,7 +34,6 @@
 #include "qmp-commands.h"
 #include "hw/pci/msi.h"
 #include "hw/pci/msix.h"
-#include "exec/address-spaces.h"
 #include "hw/hotplug.h"
 
 //#define DEBUG_PCI
diff --git a/hw/pci/pcie_host.c b/hw/pci/pcie_host.c
index c6e1b57..2b8538a 100644
--- a/hw/pci/pcie_host.c
+++ b/hw/pci/pcie_host.c
@@ -22,7 +22,6 @@
 #include "hw/hw.h"
 #include "hw/pci/pci.h"
 #include "hw/pci/pcie_host.h"
-#include "exec/address-spaces.h"
 
 /* a helper function to get a PCIDevice for a given mmconfig address */
 static inline PCIDevice *pcie_dev_find_by_mmcfg_addr(PCIBus *s,
diff --git a/hw/ppc/e500.c b/hw/ppc/e500.c
index b37ce9d..de51b1a 100644
--- a/hw/ppc/e500.c
+++ b/hw/ppc/e500.c
@@ -33,7 +33,6 @@
 #include "hw/loader.h"
 #include "elf.h"
 #include "hw/sysbus.h"
-#include "exec/address-spaces.h"
 #include "qemu/host-utils.h"
 #include "hw/pci-host/ppce500.h"
 
diff --git a/hw/ppc/mac_newworld.c b/hw/ppc/mac_newworld.c
index 5e79575..34d0321 100644
--- a/hw/ppc/mac_newworld.c
+++ b/hw/ppc/mac_newworld.c
@@ -66,7 +66,6 @@
 #include "kvm_ppc.h"
 #include "hw/usb.h"
 #include "sysemu/blockdev.h"
-#include "exec/address-spaces.h"
 #include "hw/sysbus.h"
 
 #define MAX_IDE_BUS 2
diff --git a/hw/ppc/mac_oldworld.c b/hw/ppc/mac_oldworld.c
index 2f27754..87e3295 100644
--- a/hw/ppc/mac_oldworld.c
+++ b/hw/ppc/mac_oldworld.c
@@ -41,7 +41,6 @@
 #include "sysemu/kvm.h"
 #include "kvm_ppc.h"
 #include "sysemu/blockdev.h"
-#include "exec/address-spaces.h"
 
 #define MAX_IDE_BUS 2
 #define CFG_ADDR 0xf0000510
diff --git a/hw/ppc/ppc405_boards.c b/hw/ppc/ppc405_boards.c
index f1a8f67..4b9bb5a 100644
--- a/hw/ppc/ppc405_boards.c
+++ b/hw/ppc/ppc405_boards.c
@@ -34,7 +34,6 @@
 #include "qemu/error-report.h"
 #include "hw/loader.h"
 #include "sysemu/blockdev.h"
-#include "exec/address-spaces.h"
 
 #define BIOS_FILENAME "ppc405_rom.bin"
 #define BIOS_SIZE (2048 * 1024)
diff --git a/hw/ppc/ppc405_uc.c b/hw/ppc/ppc405_uc.c
index ca520e8..e5f804e 100644
--- a/hw/ppc/ppc405_uc.c
+++ b/hw/ppc/ppc405_uc.c
@@ -28,7 +28,6 @@
 #include "qemu/timer.h"
 #include "sysemu/sysemu.h"
 #include "qemu/log.h"
-#include "exec/address-spaces.h"
 
 //#define DEBUG_OPBA
 //#define DEBUG_SDRAM
diff --git a/hw/ppc/ppc440_bamboo.c b/hw/ppc/ppc440_bamboo.c
index ec15bab..39bb7f7 100644
--- a/hw/ppc/ppc440_bamboo.c
+++ b/hw/ppc/ppc440_bamboo.c
@@ -22,7 +22,6 @@
 #include "sysemu/device_tree.h"
 #include "hw/loader.h"
 #include "elf.h"
-#include "exec/address-spaces.h"
 #include "hw/char/serial.h"
 #include "hw/ppc/ppc.h"
 #include "ppc405.h"
diff --git a/hw/ppc/ppc4xx_devs.c b/hw/ppc/ppc4xx_devs.c
index 9160ee7..11468cd 100644
--- a/hw/ppc/ppc4xx_devs.c
+++ b/hw/ppc/ppc4xx_devs.c
@@ -25,7 +25,6 @@
 #include "hw/ppc/ppc.h"
 #include "hw/ppc/ppc4xx.h"
 #include "qemu/log.h"
-#include "exec/address-spaces.h"
 
 #define DEBUG_UIC
 
diff --git a/hw/ppc/ppc4xx_pci.c b/hw/ppc/ppc4xx_pci.c
index 4cb7851..4d20732 100644
--- a/hw/ppc/ppc4xx_pci.c
+++ b/hw/ppc/ppc4xx_pci.c
@@ -24,7 +24,6 @@
 #include "hw/ppc/ppc4xx.h"
 #include "hw/pci/pci.h"
 #include "hw/pci/pci_host.h"
-#include "exec/address-spaces.h"
 
 #undef DEBUG
 #ifdef DEBUG
diff --git a/hw/ppc/prep.c b/hw/ppc/prep.c
index 9f8538c..79f6878 100644
--- a/hw/ppc/prep.c
+++ b/hw/ppc/prep.c
@@ -41,7 +41,6 @@
 #include "sysemu/blockdev.h"
 #include "sysemu/arch_init.h"
 #include "sysemu/qtest.h"
-#include "exec/address-spaces.h"
 #include "elf.h"
 
 //#define HARD_DEBUG_PPC_IO
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index 93d02c1..870ccbf 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -46,7 +46,6 @@
 
 #include "hw/pci/pci.h"
 
-#include "exec/address-spaces.h"
 #include "hw/usb.h"
 #include "qemu/config-file.h"
 
diff --git a/hw/ppc/spapr_iommu.c b/hw/ppc/spapr_iommu.c
index ef45f4f..fca5fae 100644
--- a/hw/ppc/spapr_iommu.c
+++ b/hw/ppc/spapr_iommu.c
@@ -21,7 +21,6 @@
 #include "hw/qdev.h"
 #include "kvm_ppc.h"
 #include "sysemu/dma.h"
-#include "exec/address-spaces.h"
 #include "trace.h"
 
 #include "hw/ppc/spapr.h"
diff --git a/hw/ppc/spapr_pci.c b/hw/ppc/spapr_pci.c
index 4c7c3ae..8efb738 100644
--- a/hw/ppc/spapr_pci.c
+++ b/hw/ppc/spapr_pci.c
@@ -29,7 +29,6 @@
 #include "hw/pci/pci_host.h"
 #include "hw/ppc/spapr.h"
 #include "hw/pci-host/spapr.h"
-#include "exec/address-spaces.h"
 #include <libfdt.h>
 #include "trace.h"
 
diff --git a/hw/ppc/virtex_ml507.c b/hw/ppc/virtex_ml507.c
index 85a0e53..387ee28 100644
--- a/hw/ppc/virtex_ml507.c
+++ b/hw/ppc/virtex_ml507.c
@@ -33,7 +33,6 @@
 #include "hw/loader.h"
 #include "elf.h"
 #include "qemu/log.h"
-#include "exec/address-spaces.h"
 
 #include "hw/ppc/ppc.h"
 #include "hw/ppc/ppc4xx.h"
diff --git a/hw/s390x/css.c b/hw/s390x/css.c
index 75b04b4..bdb3ccb 100644
--- a/hw/s390x/css.c
+++ b/hw/s390x/css.c
@@ -11,7 +11,6 @@
 
 #include <hw/qdev.h>
 #include "qemu/bitops.h"
-#include "exec/address-spaces.h"
 #include "cpu.h"
 #include "ioinst.h"
 #include "css.h"
diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c
index 733d988..6bcfa35 100644
--- a/hw/s390x/s390-virtio-ccw.c
+++ b/hw/s390x/s390-virtio-ccw.c
@@ -10,7 +10,6 @@
  */
 
 #include "hw/boards.h"
-#include "exec/address-spaces.h"
 #include "s390-virtio.h"
 #include "hw/s390x/sclp.h"
 #include "ioinst.h"
diff --git a/hw/s390x/s390-virtio.c b/hw/s390x/s390-virtio.c
index 9eeda97..32ed091 100644
--- a/hw/s390x/s390-virtio.c
+++ b/hw/s390x/s390-virtio.c
@@ -32,7 +32,6 @@
 #include "hw/virtio/virtio.h"
 #include "hw/sysbus.h"
 #include "sysemu/kvm.h"
-#include "exec/address-spaces.h"
 
 #include "hw/s390x/s390-virtio-bus.h"
 #include "hw/s390x/sclp.h"
diff --git a/hw/sh4/r2d.c b/hw/sh4/r2d.c
index eaeb7ed..b86e000 100644
--- a/hw/sh4/r2d.c
+++ b/hw/sh4/r2d.c
@@ -37,7 +37,6 @@
 #include "hw/usb.h"
 #include "hw/block/flash.h"
 #include "sysemu/blockdev.h"
-#include "exec/address-spaces.h"
 
 #define FLASH_BASE 0x00000000
 #define FLASH_SIZE 0x02000000
diff --git a/hw/sh4/sh7750.c b/hw/sh4/sh7750.c
index 1439ba4..c019489 100644
--- a/hw/sh4/sh7750.c
+++ b/hw/sh4/sh7750.c
@@ -30,7 +30,6 @@
 #include "sh7750_regnames.h"
 #include "hw/sh4/sh_intc.h"
 #include "cpu.h"
-#include "exec/address-spaces.h"
 
 #define NB_DEVICES 4
 
diff --git a/hw/sh4/sh_pci.c b/hw/sh4/sh_pci.c
index a2f6d9e..9e6e29e 100644
--- a/hw/sh4/sh_pci.c
+++ b/hw/sh4/sh_pci.c
@@ -26,7 +26,6 @@
 #include "hw/pci/pci.h"
 #include "hw/pci/pci_host.h"
 #include "qemu/bswap.h"
-#include "exec/address-spaces.h"
 
 #define TYPE_SH_PCI_HOST_BRIDGE "sh_pci"
 
diff --git a/hw/sh4/shix.c b/hw/sh4/shix.c
index 904a966..3b2a611 100644
--- a/hw/sh4/shix.c
+++ b/hw/sh4/shix.c
@@ -33,7 +33,6 @@
 #include "sysemu/qtest.h"
 #include "hw/boards.h"
 #include "hw/loader.h"
-#include "exec/address-spaces.h"
 #include "qemu/error-report.h"
 
 #define BIOS_FILENAME "shix_bios.bin"
diff --git a/hw/sparc/leon3.c b/hw/sparc/leon3.c
index c16e9e4..b150e47 100644
--- a/hw/sparc/leon3.c
+++ b/hw/sparc/leon3.c
@@ -31,7 +31,6 @@
 #include "hw/loader.h"
 #include "elf.h"
 #include "trace.h"
-#include "exec/address-spaces.h"
 
 #include "hw/sparc/grlib.h"
 
diff --git a/hw/sparc64/sun4u.c b/hw/sparc64/sun4u.c
index 6f271d9..b1b87b5 100644
--- a/hw/sparc64/sun4u.c
+++ b/hw/sparc64/sun4u.c
@@ -39,7 +39,6 @@
 #include "hw/loader.h"
 #include "elf.h"
 #include "sysemu/blockdev.h"
-#include "exec/address-spaces.h"
 
 //#define DEBUG_IRQ
 //#define DEBUG_EBUS
diff --git a/hw/timer/m48t59.c b/hw/timer/m48t59.c
index 7cf8684..655fe36 100644
--- a/hw/timer/m48t59.c
+++ b/hw/timer/m48t59.c
@@ -27,7 +27,6 @@
 #include "sysemu/sysemu.h"
 #include "hw/sysbus.h"
 #include "hw/isa/isa.h"
-#include "exec/address-spaces.h"
 
 //#define DEBUG_NVRAM
 
diff --git a/hw/timer/sh_timer.c b/hw/timer/sh_timer.c
index 07f0670..492d9e3 100644
--- a/hw/timer/sh_timer.c
+++ b/hw/timer/sh_timer.c
@@ -12,7 +12,6 @@
 #include "hw/sh4/sh.h"
 #include "qemu/timer.h"
 #include "qemu/main-loop.h"
-#include "exec/address-spaces.h"
 #include "hw/ptimer.h"
 
 //#define DEBUG_TIMER
diff --git a/hw/tpm/tpm_tis.c b/hw/tpm/tpm_tis.c
index 6f0a4d2..a0b1001 100644
--- a/hw/tpm/tpm_tis.c
+++ b/hw/tpm/tpm_tis.c
@@ -22,7 +22,6 @@
 #include "sysemu/tpm_backend.h"
 #include "tpm_int.h"
 #include "block/block.h"
-#include "exec/address-spaces.h"
 #include "hw/hw.h"
 #include "hw/i386/pc.h"
 #include "hw/pci/pci_ids.h"
diff --git a/hw/unicore32/puv3.c b/hw/unicore32/puv3.c
index e05cbc1..48cb984 100644
--- a/hw/unicore32/puv3.c
+++ b/hw/unicore32/puv3.c
@@ -12,7 +12,6 @@
 #include "qemu-common.h"
 #include "ui/console.h"
 #include "elf.h"
-#include "exec/address-spaces.h"
 #include "hw/sysbus.h"
 #include "hw/boards.h"
 #include "hw/loader.h"
diff --git a/hw/virtio/dataplane/vring.c b/hw/virtio/dataplane/vring.c
index 665a1ff..0780d1f 100644
--- a/hw/virtio/dataplane/vring.c
+++ b/hw/virtio/dataplane/vring.c
@@ -17,7 +17,6 @@
 #include "trace.h"
 #include "hw/hw.h"
 #include "exec/memory.h"
-#include "exec/address-spaces.h"
 #include "hw/virtio/dataplane/vring.h"
 #include "qemu/error-report.h"
 
diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c
index 9e336ad..12e1e75 100644
--- a/hw/virtio/vhost.c
+++ b/hw/virtio/vhost.c
@@ -19,7 +19,6 @@
 #include "qemu/atomic.h"
 #include "qemu/range.h"
 #include <linux/vhost.h>
-#include "exec/address-spaces.h"
 #include "hw/virtio/virtio-bus.h"
 
 static void vhost_dev_sync_region(struct vhost_dev *dev,
diff --git a/hw/virtio/virtio-balloon.c b/hw/virtio/virtio-balloon.c
index a470a0b..be5c96e 100644
--- a/hw/virtio/virtio-balloon.c
+++ b/hw/virtio/virtio-balloon.c
@@ -22,7 +22,6 @@
 #include "sysemu/balloon.h"
 #include "hw/virtio/virtio-balloon.h"
 #include "sysemu/kvm.h"
-#include "exec/address-spaces.h"
 #include "qapi/visitor.h"
 
 #if defined(__linux__)
diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
index aeabf3a..9133e80 100644
--- a/hw/virtio/virtio.c
+++ b/hw/virtio/virtio.c
@@ -14,7 +14,6 @@
 #include <inttypes.h>
 
 #include "trace.h"
-#include "exec/address-spaces.h"
 #include "qemu/error-report.h"
 #include "hw/virtio/virtio.h"
 #include "qemu/atomic.h"
diff --git a/hw/xen/xen_platform.c b/hw/xen/xen_platform.c
index 1d9d0e9..99d6052 100644
--- a/hw/xen/xen_platform.c
+++ b/hw/xen/xen_platform.c
@@ -33,7 +33,6 @@
 #include "hw/xen/xen_common.h"
 #include "hw/xen/xen_backend.h"
 #include "trace.h"
-#include "exec/address-spaces.h"
 
 #include <xenguest.h>
 
diff --git a/hw/xen/xen_pt.c b/hw/xen/xen_pt.c
index be4220b..c4410ea 100644
--- a/hw/xen/xen_pt.c
+++ b/hw/xen/xen_pt.c
@@ -59,7 +59,6 @@
 #include "hw/xen/xen_backend.h"
 #include "xen_pt.h"
 #include "qemu/range.h"
-#include "exec/address-spaces.h"
 
 #define XEN_PT_NR_IRQS (256)
 static uint8_t xen_pt_mapped_machine_irq[XEN_PT_NR_IRQS] = {0};
diff --git a/hw/xtensa/xtensa_lx60.c b/hw/xtensa/xtensa_lx60.c
index 49c58d1..e5ac2f5 100644
--- a/hw/xtensa/xtensa_lx60.c
+++ b/hw/xtensa/xtensa_lx60.c
@@ -30,7 +30,6 @@
 #include "hw/loader.h"
 #include "elf.h"
 #include "exec/memory.h"
-#include "exec/address-spaces.h"
 #include "hw/char/serial.h"
 #include "net/net.h"
 #include "hw/sysbus.h"
diff --git a/hw/xtensa/xtensa_sim.c b/hw/xtensa/xtensa_sim.c
index 1192ce7..42ece0e 100644
--- a/hw/xtensa/xtensa_sim.c
+++ b/hw/xtensa/xtensa_sim.c
@@ -30,7 +30,6 @@
 #include "hw/loader.h"
 #include "elf.h"
 #include "exec/memory.h"
-#include "exec/address-spaces.h"
 
 static uint64_t translate_phys_addr(void *opaque, uint64_t addr)
 {
diff --git a/include/exec/address-spaces.h b/include/exec/address-spaces.h
deleted file mode 100644
index c6e5d51..0000000
--- a/include/exec/address-spaces.h
+++ /dev/null
@@ -1,12 +0,0 @@
-/*
- * Internal memory management interfaces
- *
- * Copyright 2011 Red Hat, Inc. and/or its affiliates
- *
- * Authors:
- *  Avi Kivity <avi@redhat.com>
- *
- * This work is licensed under the terms of the GNU GPL, version 2.  See
- * the COPYING file in the top-level directory.
- *
- */
diff --git a/include/exec/softmmu_template.h b/include/exec/softmmu_template.h
index c14a04d..b7689ec 100644
--- a/include/exec/softmmu_template.h
+++ b/include/exec/softmmu_template.h
@@ -22,7 +22,6 @@
  * License along with this library; if not, see <http://www.gnu.org/licenses/>.
  */
 #include "qemu/timer.h"
-#include "exec/address-spaces.h"
 #include "exec/memory.h"
 
 #define DATA_SIZE (1 << SHIFT)
diff --git a/include/hw/arm/allwinner-a10.h b/include/hw/arm/allwinner-a10.h
index 01a189b..5f3d378 100644
--- a/include/hw/arm/allwinner-a10.h
+++ b/include/hw/arm/allwinner-a10.h
@@ -9,7 +9,6 @@
 #include "hw/net/allwinner_emac.h"
 
 #include "sysemu/sysemu.h"
-#include "exec/address-spaces.h"
 
 
 #define AW_A10_PIC_REG_BASE     0x01c20400
diff --git a/include/hw/sh4/sh_intc.h b/include/hw/sh4/sh_intc.h
index 644acb7..79c26d0 100644
--- a/include/hw/sh4/sh_intc.h
+++ b/include/hw/sh4/sh_intc.h
@@ -3,7 +3,6 @@
 
 #include "qemu-common.h"
 #include "hw/irq.h"
-#include "exec/address-spaces.h"
 #include "exec/memory.h"
 
 typedef unsigned char intc_enum;
diff --git a/include/sysemu/dma.h b/include/sysemu/dma.h
index 00f21f3..b894b3a 100644
--- a/include/sysemu/dma.h
+++ b/include/sysemu/dma.h
@@ -12,7 +12,6 @@
 
 #include <stdio.h>
 #include "exec/memory.h"
-#include "exec/address-spaces.h"
 #include "hw/hw.h"
 #include "block/block.h"
 #include "sysemu/kvm.h"
diff --git a/ioport.c b/ioport.c
index 3d91e79..014713b 100644
--- a/ioport.c
+++ b/ioport.c
@@ -28,7 +28,6 @@
 #include "exec/ioport.h"
 #include "trace.h"
 #include "exec/memory.h"
-#include "exec/address-spaces.h"
 
 //#define DEBUG_IOPORT
 
diff --git a/kvm-all.c b/kvm-all.c
index fd8157a..425fc5f 100644
--- a/kvm-all.c
+++ b/kvm-all.c
@@ -32,7 +32,6 @@
 #include "qemu/bswap.h"
 #include "exec/memory.h"
 #include "exec/ram_addr.h"
-#include "exec/address-spaces.h"
 #include "qemu/event_notifier.h"
 #include "trace.h"
 
diff --git a/memory.c b/memory.c
index 59ecc28..6d39b48 100644
--- a/memory.c
+++ b/memory.c
@@ -14,7 +14,6 @@
  */
 
 #include "exec/memory.h"
-#include "exec/address-spaces.h"
 #include "exec/ioport.h"
 #include "qemu/bitops.h"
 #include "qom/object.h"
diff --git a/memory_mapping.c b/memory_mapping.c
index b17eea1..88f2da7 100644
--- a/memory_mapping.c
+++ b/memory_mapping.c
@@ -16,7 +16,6 @@
 #include "qemu-common.h"
 #include "exec/cpu-common.h" /* for ram_addr_t */
 #include "exec/memory.h"
-#include "exec/address-spaces.h"
 #include "sysemu/memory_mapping.h"
 
 //#define DEBUG_GUEST_PHYS_REGION_ADD
diff --git a/target-sparc/mmu_helper.c b/target-sparc/mmu_helper.c
index 5fc2fd6..11d2d74 100644
--- a/target-sparc/mmu_helper.c
+++ b/target-sparc/mmu_helper.c
@@ -19,7 +19,6 @@
 
 #include "cpu.h"
 #include "trace.h"
-#include "exec/address-spaces.h"
 
 /* Sparc MMU emulation */
 
diff --git a/target-xtensa/op_helper.c b/target-xtensa/op_helper.c
index 509ba49..34bc6a1 100644
--- a/target-xtensa/op_helper.c
+++ b/target-xtensa/op_helper.c
@@ -29,7 +29,6 @@
 #include "helper.h"
 #include "qemu/host-utils.h"
 #include "exec/softmmu_exec.h"
-#include "exec/address-spaces.h"
 
 static void do_unaligned_access(CPUXtensaState *env,
         target_ulong addr, int is_write, int is_user, uintptr_t retaddr);
diff --git a/translate-all.c b/translate-all.c
index be220fb..98e215f 100644
--- a/translate-all.c
+++ b/translate-all.c
@@ -58,7 +58,6 @@
 #endif
 #endif
 #else
-#include "exec/address-spaces.h"
 #endif
 
 #include "exec/cputlb.h"
diff --git a/xen-all.c b/xen-all.c
index 4a594bd..07652f5 100644
--- a/xen-all.c
+++ b/xen-all.c
@@ -20,7 +20,6 @@
 #include "qemu/range.h"
 #include "sysemu/xen-mapcache.h"
 #include "trace.h"
-#include "exec/address-spaces.h"
 
 #include <xen/hvm/ioreq.h>
 #include <xen/hvm/params.h>
-- 
1.7.9.5

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

* [Qemu-devel] [Discussion 08/10] exec: move TranslationBlock API from exec-all.h => translate.h
  2014-03-04  2:47 [Qemu-devel] [Discussion 00/10] about API hierarchy Xuebing Wang
                   ` (6 preceding siblings ...)
  2014-03-04  2:47 ` [Qemu-devel] [Discussion 07/10] memory: remove file include/exec/address-spaces.h Xuebing Wang
@ 2014-03-04  2:47 ` Xuebing Wang
  2014-03-04 10:27   ` Paolo Bonzini
  2014-03-04  2:47 ` [Qemu-devel] [Discussion 09/10] exec: remove the unnecessary include of "exec-all.h" Xuebing Wang
                   ` (2 subsequent siblings)
  10 siblings, 1 reply; 37+ messages in thread
From: Xuebing Wang @ 2014-03-04  2:47 UTC (permalink / raw)
  To: qemu-devel; +Cc: pbonzini, xbing6, afaerber, stefanha

Signed-off-by: Xuebing Wang <xbing6@gmail.com>
---
 include/exec/exec-all.h  |  302 +--------------------------------------------
 include/exec/translate.h |  306 ++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 307 insertions(+), 301 deletions(-)
 create mode 100644 include/exec/translate.h

diff --git a/include/exec/exec-all.h b/include/exec/exec-all.h
index a387922..68a888f 100644
--- a/include/exec/exec-all.h
+++ b/include/exec/exec-all.h
@@ -20,307 +20,7 @@
 #ifndef _EXEC_ALL_H_
 #define _EXEC_ALL_H_
 
-#include "qemu-common.h"
-
-/* allow to see translation results - the slowdown should be negligible, so we leave it */
-#define DEBUG_DISAS
-
-/* Page tracking code uses ram addresses in system mode, and virtual
-   addresses in userspace mode.  Define tb_page_addr_t to be an appropriate
-   type.  */
-#if defined(CONFIG_USER_ONLY)
-typedef abi_ulong tb_page_addr_t;
-#else
-typedef ram_addr_t tb_page_addr_t;
-#endif
-
-/* is_jmp field values */
-#define DISAS_NEXT    0 /* next instruction can be analyzed */
-#define DISAS_JUMP    1 /* only pc was modified dynamically */
-#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 208
-
-#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)
-
-/* Maximum size a TCG op can expand to.  This is complicated because a
-   single op may require several host instructions and register reloads.
-   For now take a wild guess at 192 bytes, which should allow at least
-   a couple of fixup instructions per argument.  */
-#define TCG_MAX_OP_SIZE 192
-
-#define OPPARAM_BUF_SIZE (OPC_BUF_SIZE * MAX_OPC_PARAM)
-
-#include "qemu/log.h"
-
-void gen_intermediate_code(CPUArchState *env, struct TranslationBlock *tb);
-void gen_intermediate_code_pc(CPUArchState *env, struct TranslationBlock *tb);
-void restore_state_to_opc(CPUArchState *env, struct TranslationBlock *tb,
-                          int pc_pos);
-
-void cpu_gen_init(void);
-int cpu_gen_code(CPUArchState *env, struct TranslationBlock *tb,
-                 int *gen_code_size_ptr);
-bool cpu_restore_state(CPUArchState *env, uintptr_t searched_pc);
-void page_size_init(void);
-
-void QEMU_NORETURN cpu_resume_from_signal(CPUArchState *env1, void *puc);
-void QEMU_NORETURN cpu_io_recompile(CPUArchState *env, uintptr_t retaddr);
-TranslationBlock *tb_gen_code(CPUArchState *env, 
-                              target_ulong pc, target_ulong cs_base, int flags,
-                              int cflags);
-void cpu_exec_init(CPUArchState *env);
-void QEMU_NORETURN cpu_loop_exit(CPUArchState *env1);
-int page_unprotect(target_ulong address, uintptr_t pc, void *puc);
-void tb_invalidate_phys_page_range(tb_page_addr_t start, tb_page_addr_t end,
-                                   int is_cpu_write_access);
-void tb_invalidate_phys_range(tb_page_addr_t start, tb_page_addr_t end,
-                              int is_cpu_write_access);
-#if !defined(CONFIG_USER_ONLY)
-void tcg_cpu_address_space_init(CPUState *cpu, AddressSpace *as);
-/* cputlb.c */
-void tlb_flush_page(CPUArchState *env, target_ulong addr);
-void tlb_flush(CPUArchState *env, int flush_global);
-void tlb_set_page(CPUArchState *env, target_ulong vaddr,
-                  hwaddr paddr, int prot,
-                  int mmu_idx, target_ulong size);
-void tb_invalidate_phys_addr(AddressSpace *as, hwaddr addr);
-#else
-static inline void tlb_flush_page(CPUArchState *env, target_ulong addr)
-{
-}
-
-static inline void tlb_flush(CPUArchState *env, int flush_global)
-{
-}
-#endif
-
-#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 */
-/* XXX: use a per code average code fragment size and modulate it
-   according to the host CPU */
-#if defined(CONFIG_SOFTMMU)
-#define CODE_GEN_AVG_BLOCK_SIZE 128
-#else
-#define CODE_GEN_AVG_BLOCK_SIZE 64
-#endif
-
-#if defined(__arm__) || defined(_ARCH_PPC) \
-    || defined(__x86_64__) || defined(__i386__) \
-    || defined(__sparc__) || defined(__aarch64__) \
-    || defined(CONFIG_TCG_INTERPRETER)
-#define USE_DIRECT_JUMP
-#endif
-
-struct TranslationBlock {
-    target_ulong pc;   /* simulated PC corresponding to this block (EIP + CS base) */
-    target_ulong cs_base; /* CS base for this block */
-    uint64_t flags; /* flags defining in which context the code was generated */
-    uint16_t size;      /* size of target code for this block (1 <=
-                           size <= TARGET_PAGE_SIZE) */
-    uint16_t cflags;    /* compile flags */
-#define CF_COUNT_MASK  0x7fff
-#define CF_LAST_IO     0x8000 /* Last insn may be an IO access.  */
-
-    uint8_t *tc_ptr;    /* pointer to the translated code */
-    /* next matching tb for physical address. */
-    struct TranslationBlock *phys_hash_next;
-    /* first and second physical page containing code. The lower bit
-       of the pointer tells the index in page_next[] */
-    struct TranslationBlock *page_next[2];
-    tb_page_addr_t page_addr[2];
-
-    /* the following data are used to directly call another TB from
-       the code of this one. */
-    uint16_t tb_next_offset[2]; /* offset of original jump target */
-#ifdef USE_DIRECT_JUMP
-    uint16_t tb_jmp_offset[2]; /* offset of jump instruction */
-#else
-    uintptr_t tb_next[2]; /* address of jump generated code */
-#endif
-    /* list of TBs jumping to this one. This is a circular list using
-       the two least significant bits of the pointers to tell what is
-       the next pointer: 0 = jmp_next[0], 1 = jmp_next[1], 2 =
-       jmp_first */
-    struct TranslationBlock *jmp_next[2];
-    struct TranslationBlock *jmp_first;
-    uint32_t icount;
-};
-
-#include "exec/spinlock.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 */
-    spinlock_t tb_lock;
-
-    /* statistics */
-    int tb_flush_count;
-    int tb_phys_invalidate_count;
-
-    int tb_invalidated_flag;
-};
-
-static inline unsigned int tb_jmp_cache_hash_page(target_ulong pc)
-{
-    target_ulong tmp;
-    tmp = pc ^ (pc >> (TARGET_PAGE_BITS - TB_JMP_PAGE_BITS));
-    return (tmp >> (TARGET_PAGE_BITS - TB_JMP_PAGE_BITS)) & TB_JMP_PAGE_MASK;
-}
-
-static inline unsigned int tb_jmp_cache_hash_func(target_ulong pc)
-{
-    target_ulong tmp;
-    tmp = pc ^ (pc >> (TARGET_PAGE_BITS - TB_JMP_PAGE_BITS));
-    return (((tmp >> (TARGET_PAGE_BITS - TB_JMP_PAGE_BITS)) & TB_JMP_PAGE_MASK)
-	    | (tmp & TB_JMP_ADDR_MASK));
-}
-
-static inline unsigned int tb_phys_hash_func(tb_page_addr_t pc)
-{
-    return (pc >> 2) & (CODE_GEN_PHYS_HASH_SIZE - 1);
-}
-
-void tb_free(TranslationBlock *tb);
-void tb_flush(CPUArchState *env);
-void tb_phys_invalidate(TranslationBlock *tb, tb_page_addr_t page_addr);
-
-#if defined(USE_DIRECT_JUMP)
-
-#if defined(CONFIG_TCG_INTERPRETER)
-static inline void tb_set_jmp_target1(uintptr_t jmp_addr, uintptr_t addr)
-{
-    /* patch the branch destination */
-    *(uint32_t *)jmp_addr = addr - (jmp_addr + 4);
-    /* no need to flush icache explicitly */
-}
-#elif defined(_ARCH_PPC)
-void ppc_tb_set_jmp_target(unsigned long jmp_addr, unsigned long addr);
-#define tb_set_jmp_target1 ppc_tb_set_jmp_target
-#elif defined(__i386__) || defined(__x86_64__)
-static inline void tb_set_jmp_target1(uintptr_t jmp_addr, uintptr_t addr)
-{
-    /* patch the branch destination */
-    *(uint32_t *)jmp_addr = addr - (jmp_addr + 4);
-    /* no need to flush icache explicitly */
-}
-#elif defined(__aarch64__)
-void aarch64_tb_set_jmp_target(uintptr_t jmp_addr, uintptr_t addr);
-#define tb_set_jmp_target1 aarch64_tb_set_jmp_target
-#elif defined(__arm__)
-static inline void tb_set_jmp_target1(uintptr_t jmp_addr, uintptr_t addr)
-{
-#if !QEMU_GNUC_PREREQ(4, 1)
-    register unsigned long _beg __asm ("a1");
-    register unsigned long _end __asm ("a2");
-    register unsigned long _flg __asm ("a3");
-#endif
-
-    /* we could use a ldr pc, [pc, #-4] kind of branch and avoid the flush */
-    *(uint32_t *)jmp_addr =
-        (*(uint32_t *)jmp_addr & ~0xffffff)
-        | (((addr - (jmp_addr + 8)) >> 2) & 0xffffff);
-
-#if QEMU_GNUC_PREREQ(4, 1)
-    __builtin___clear_cache((char *) jmp_addr, (char *) jmp_addr + 4);
-#else
-    /* flush icache */
-    _beg = jmp_addr;
-    _end = jmp_addr + 4;
-    _flg = 0;
-    __asm __volatile__ ("swi 0x9f0002" : : "r" (_beg), "r" (_end), "r" (_flg));
-#endif
-}
-#elif defined(__sparc__)
-void tb_set_jmp_target1(uintptr_t jmp_addr, uintptr_t addr);
-#else
-#error tb_set_jmp_target1 is missing
-#endif
-
-static inline void tb_set_jmp_target(TranslationBlock *tb,
-                                     int n, uintptr_t addr)
-{
-    uint16_t offset = tb->tb_jmp_offset[n];
-    tb_set_jmp_target1((uintptr_t)(tb->tc_ptr + offset), addr);
-}
-
-#else
-
-/* set the jump target */
-static inline void tb_set_jmp_target(TranslationBlock *tb,
-                                     int n, uintptr_t addr)
-{
-    tb->tb_next[n] = addr;
-}
-
-#endif
-
-static inline void tb_add_jump(TranslationBlock *tb, int n,
-                               TranslationBlock *tb_next)
-{
-    /* NOTE: this test is only needed for thread safety */
-    if (!tb->jmp_next[n]) {
-        /* patch the native jump address */
-        tb_set_jmp_target(tb, n, (uintptr_t)tb_next->tc_ptr);
-
-        /* add in TB jmp circular list */
-        tb->jmp_next[n] = tb_next->jmp_first;
-        tb_next->jmp_first = (TranslationBlock *)((uintptr_t)(tb) | (n));
-    }
-}
-
-/* GETRA is the true target of the return instruction that we'll execute,
-   defined here for simplicity of defining the follow-up macros.  */
-#if defined(CONFIG_TCG_INTERPRETER)
-extern uintptr_t tci_tb_ptr;
-# define GETRA() tci_tb_ptr
-#else
-# define GETRA() \
-    ((uintptr_t)__builtin_extract_return_addr(__builtin_return_address(0)))
-#endif
-
-/* The true return address will often point to a host insn that is part of
-   the next translated guest insn.  Adjust the address backward to point to
-   the middle of the call insn.  Subtracting one would do the job except for
-   several compressed mode architectures (arm, mips) which set the low bit
-   to indicate the compressed mode; subtracting two works around that.  It
-   is also the case that there are no host isas that contain a call insn
-   smaller than 4 bytes, so we don't worry about special-casing this.  */
-#if defined(CONFIG_TCG_INTERPRETER)
-# define GETPC_ADJ   0
-#else
-# define GETPC_ADJ   2
-#endif
-
-#define GETPC()  (GETRA() - GETPC_ADJ)
+#include "exec/translate.h"
 
 #if !defined(CONFIG_USER_ONLY)
 
diff --git a/include/exec/translate.h b/include/exec/translate.h
new file mode 100644
index 0000000..9e877f2
--- /dev/null
+++ b/include/exec/translate.h
@@ -0,0 +1,306 @@
+#ifndef EXEC_TRANSLATE_H
+#define EXEC_TRANSLATE_H
+
+#include "qemu-common.h"
+
+/* allow to see translation results - the slowdown should be negligible, so we leave it */
+#define DEBUG_DISAS
+
+/* Page tracking code uses ram addresses in system mode, and virtual
+   addresses in userspace mode.  Define tb_page_addr_t to be an appropriate
+   type.  */
+#if defined(CONFIG_USER_ONLY)
+typedef abi_ulong tb_page_addr_t;
+#else
+typedef ram_addr_t tb_page_addr_t;
+#endif
+
+/* is_jmp field values */
+#define DISAS_NEXT    0 /* next instruction can be analyzed */
+#define DISAS_JUMP    1 /* only pc was modified dynamically */
+#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 208
+
+#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)
+
+/* Maximum size a TCG op can expand to.  This is complicated because a
+   single op may require several host instructions and register reloads.
+   For now take a wild guess at 192 bytes, which should allow at least
+   a couple of fixup instructions per argument.  */
+#define TCG_MAX_OP_SIZE 192
+
+#define OPPARAM_BUF_SIZE (OPC_BUF_SIZE * MAX_OPC_PARAM)
+
+#include "qemu/log.h"
+
+void gen_intermediate_code(CPUArchState *env, struct TranslationBlock *tb);
+void gen_intermediate_code_pc(CPUArchState *env, struct TranslationBlock *tb);
+void restore_state_to_opc(CPUArchState *env, struct TranslationBlock *tb,
+                          int pc_pos);
+
+void cpu_gen_init(void);
+int cpu_gen_code(CPUArchState *env, struct TranslationBlock *tb,
+                 int *gen_code_size_ptr);
+bool cpu_restore_state(CPUArchState *env, uintptr_t searched_pc);
+void page_size_init(void);
+
+void QEMU_NORETURN cpu_resume_from_signal(CPUArchState *env1, void *puc);
+void QEMU_NORETURN cpu_io_recompile(CPUArchState *env, uintptr_t retaddr);
+TranslationBlock *tb_gen_code(CPUArchState *env, 
+                              target_ulong pc, target_ulong cs_base, int flags,
+                              int cflags);
+void cpu_exec_init(CPUArchState *env);
+void QEMU_NORETURN cpu_loop_exit(CPUArchState *env1);
+int page_unprotect(target_ulong address, uintptr_t pc, void *puc);
+void tb_invalidate_phys_page_range(tb_page_addr_t start, tb_page_addr_t end,
+                                   int is_cpu_write_access);
+void tb_invalidate_phys_range(tb_page_addr_t start, tb_page_addr_t end,
+                              int is_cpu_write_access);
+#if !defined(CONFIG_USER_ONLY)
+void tcg_cpu_address_space_init(CPUState *cpu, AddressSpace *as);
+/* cputlb.c */
+void tlb_flush_page(CPUArchState *env, target_ulong addr);
+void tlb_flush(CPUArchState *env, int flush_global);
+void tlb_set_page(CPUArchState *env, target_ulong vaddr,
+                  hwaddr paddr, int prot,
+                  int mmu_idx, target_ulong size);
+void tb_invalidate_phys_addr(AddressSpace *as, hwaddr addr);
+#else
+static inline void tlb_flush_page(CPUArchState *env, target_ulong addr)
+{
+}
+
+static inline void tlb_flush(CPUArchState *env, int flush_global)
+{
+}
+#endif
+
+#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 */
+/* XXX: use a per code average code fragment size and modulate it
+   according to the host CPU */
+#if defined(CONFIG_SOFTMMU)
+#define CODE_GEN_AVG_BLOCK_SIZE 128
+#else
+#define CODE_GEN_AVG_BLOCK_SIZE 64
+#endif
+
+#if defined(__arm__) || defined(_ARCH_PPC) \
+    || defined(__x86_64__) || defined(__i386__) \
+    || defined(__sparc__) || defined(__aarch64__) \
+    || defined(CONFIG_TCG_INTERPRETER)
+#define USE_DIRECT_JUMP
+#endif
+
+struct TranslationBlock {
+    target_ulong pc;   /* simulated PC corresponding to this block (EIP + CS base) */
+    target_ulong cs_base; /* CS base for this block */
+    uint64_t flags; /* flags defining in which context the code was generated */
+    uint16_t size;      /* size of target code for this block (1 <=
+                           size <= TARGET_PAGE_SIZE) */
+    uint16_t cflags;    /* compile flags */
+#define CF_COUNT_MASK  0x7fff
+#define CF_LAST_IO     0x8000 /* Last insn may be an IO access.  */
+
+    uint8_t *tc_ptr;    /* pointer to the translated code */
+    /* next matching tb for physical address. */
+    struct TranslationBlock *phys_hash_next;
+    /* first and second physical page containing code. The lower bit
+       of the pointer tells the index in page_next[] */
+    struct TranslationBlock *page_next[2];
+    tb_page_addr_t page_addr[2];
+
+    /* the following data are used to directly call another TB from
+       the code of this one. */
+    uint16_t tb_next_offset[2]; /* offset of original jump target */
+#ifdef USE_DIRECT_JUMP
+    uint16_t tb_jmp_offset[2]; /* offset of jump instruction */
+#else
+    uintptr_t tb_next[2]; /* address of jump generated code */
+#endif
+    /* list of TBs jumping to this one. This is a circular list using
+       the two least significant bits of the pointers to tell what is
+       the next pointer: 0 = jmp_next[0], 1 = jmp_next[1], 2 =
+       jmp_first */
+    struct TranslationBlock *jmp_next[2];
+    struct TranslationBlock *jmp_first;
+    uint32_t icount;
+};
+
+#include "exec/spinlock.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 */
+    spinlock_t tb_lock;
+
+    /* statistics */
+    int tb_flush_count;
+    int tb_phys_invalidate_count;
+
+    int tb_invalidated_flag;
+};
+
+static inline unsigned int tb_jmp_cache_hash_page(target_ulong pc)
+{
+    target_ulong tmp;
+    tmp = pc ^ (pc >> (TARGET_PAGE_BITS - TB_JMP_PAGE_BITS));
+    return (tmp >> (TARGET_PAGE_BITS - TB_JMP_PAGE_BITS)) & TB_JMP_PAGE_MASK;
+}
+
+static inline unsigned int tb_jmp_cache_hash_func(target_ulong pc)
+{
+    target_ulong tmp;
+    tmp = pc ^ (pc >> (TARGET_PAGE_BITS - TB_JMP_PAGE_BITS));
+    return (((tmp >> (TARGET_PAGE_BITS - TB_JMP_PAGE_BITS)) & TB_JMP_PAGE_MASK)
+	    | (tmp & TB_JMP_ADDR_MASK));
+}
+
+static inline unsigned int tb_phys_hash_func(tb_page_addr_t pc)
+{
+    return (pc >> 2) & (CODE_GEN_PHYS_HASH_SIZE - 1);
+}
+
+void tb_free(TranslationBlock *tb);
+void tb_flush(CPUArchState *env);
+void tb_phys_invalidate(TranslationBlock *tb, tb_page_addr_t page_addr);
+
+#if defined(USE_DIRECT_JUMP)
+
+#if defined(CONFIG_TCG_INTERPRETER)
+static inline void tb_set_jmp_target1(uintptr_t jmp_addr, uintptr_t addr)
+{
+    /* patch the branch destination */
+    *(uint32_t *)jmp_addr = addr - (jmp_addr + 4);
+    /* no need to flush icache explicitly */
+}
+#elif defined(_ARCH_PPC)
+void ppc_tb_set_jmp_target(unsigned long jmp_addr, unsigned long addr);
+#define tb_set_jmp_target1 ppc_tb_set_jmp_target
+#elif defined(__i386__) || defined(__x86_64__)
+static inline void tb_set_jmp_target1(uintptr_t jmp_addr, uintptr_t addr)
+{
+    /* patch the branch destination */
+    *(uint32_t *)jmp_addr = addr - (jmp_addr + 4);
+    /* no need to flush icache explicitly */
+}
+#elif defined(__aarch64__)
+void aarch64_tb_set_jmp_target(uintptr_t jmp_addr, uintptr_t addr);
+#define tb_set_jmp_target1 aarch64_tb_set_jmp_target
+#elif defined(__arm__)
+static inline void tb_set_jmp_target1(uintptr_t jmp_addr, uintptr_t addr)
+{
+#if !QEMU_GNUC_PREREQ(4, 1)
+    register unsigned long _beg __asm ("a1");
+    register unsigned long _end __asm ("a2");
+    register unsigned long _flg __asm ("a3");
+#endif
+
+    /* we could use a ldr pc, [pc, #-4] kind of branch and avoid the flush */
+    *(uint32_t *)jmp_addr =
+        (*(uint32_t *)jmp_addr & ~0xffffff)
+        | (((addr - (jmp_addr + 8)) >> 2) & 0xffffff);
+
+#if QEMU_GNUC_PREREQ(4, 1)
+    __builtin___clear_cache((char *) jmp_addr, (char *) jmp_addr + 4);
+#else
+    /* flush icache */
+    _beg = jmp_addr;
+    _end = jmp_addr + 4;
+    _flg = 0;
+    __asm __volatile__ ("swi 0x9f0002" : : "r" (_beg), "r" (_end), "r" (_flg));
+#endif
+}
+#elif defined(__sparc__)
+void tb_set_jmp_target1(uintptr_t jmp_addr, uintptr_t addr);
+#else
+#error tb_set_jmp_target1 is missing
+#endif
+
+static inline void tb_set_jmp_target(TranslationBlock *tb,
+                                     int n, uintptr_t addr)
+{
+    uint16_t offset = tb->tb_jmp_offset[n];
+    tb_set_jmp_target1((uintptr_t)(tb->tc_ptr + offset), addr);
+}
+
+#else
+
+/* set the jump target */
+static inline void tb_set_jmp_target(TranslationBlock *tb,
+                                     int n, uintptr_t addr)
+{
+    tb->tb_next[n] = addr;
+}
+
+#endif
+
+static inline void tb_add_jump(TranslationBlock *tb, int n,
+                               TranslationBlock *tb_next)
+{
+    /* NOTE: this test is only needed for thread safety */
+    if (!tb->jmp_next[n]) {
+        /* patch the native jump address */
+        tb_set_jmp_target(tb, n, (uintptr_t)tb_next->tc_ptr);
+
+        /* add in TB jmp circular list */
+        tb->jmp_next[n] = tb_next->jmp_first;
+        tb_next->jmp_first = (TranslationBlock *)((uintptr_t)(tb) | (n));
+    }
+}
+
+/* GETRA is the true target of the return instruction that we'll execute,
+   defined here for simplicity of defining the follow-up macros.  */
+#if defined(CONFIG_TCG_INTERPRETER)
+extern uintptr_t tci_tb_ptr;
+# define GETRA() tci_tb_ptr
+#else
+# define GETRA() \
+    ((uintptr_t)__builtin_extract_return_addr(__builtin_return_address(0)))
+#endif
+
+/* The true return address will often point to a host insn that is part of
+   the next translated guest insn.  Adjust the address backward to point to
+   the middle of the call insn.  Subtracting one would do the job except for
+   several compressed mode architectures (arm, mips) which set the low bit
+   to indicate the compressed mode; subtracting two works around that.  It
+   is also the case that there are no host isas that contain a call insn
+   smaller than 4 bytes, so we don't worry about special-casing this.  */
+#if defined(CONFIG_TCG_INTERPRETER)
+# define GETPC_ADJ   0
+#else
+# define GETPC_ADJ   2
+#endif
+
+#define GETPC()  (GETRA() - GETPC_ADJ)
+
+#endif /* EXEC_TRANSLATE_H */
-- 
1.7.9.5

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

* [Qemu-devel] [Discussion 09/10] exec: remove the unnecessary include of "exec-all.h"
  2014-03-04  2:47 [Qemu-devel] [Discussion 00/10] about API hierarchy Xuebing Wang
                   ` (7 preceding siblings ...)
  2014-03-04  2:47 ` [Qemu-devel] [Discussion 08/10] exec: move TranslationBlock API from exec-all.h => translate.h Xuebing Wang
@ 2014-03-04  2:47 ` Xuebing Wang
  2014-03-04 10:27   ` Paolo Bonzini
  2014-03-04 11:11   ` Peter Maydell
  2014-03-04  2:47 ` [Qemu-devel] [Discussion 10/10] translate: remove file translate-all.h Xuebing Wang
  2014-03-04  3:45 ` [Qemu-devel] [Discussion 00/10] about API hierarchy Andreas Färber
  10 siblings, 2 replies; 37+ messages in thread
From: Xuebing Wang @ 2014-03-04  2:47 UTC (permalink / raw)
  To: qemu-devel; +Cc: pbonzini, xbing6, afaerber, stefanha

include/exec/exec-all.h should ONLY be included in target-xxx/*
-   'git grep -nw exec-all.h' confirms this

Signed-off-by: Xuebing Wang <xbing6@gmail.com>
---
 cputlb.c   |    1 -
 tcg/README |    2 +-
 tci.c      |    2 +-
 3 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/cputlb.c b/cputlb.c
index 724bdda..f1458a6 100644
--- a/cputlb.c
+++ b/cputlb.c
@@ -23,7 +23,6 @@
 #include "cpu.h" /* target-xxx/cpu.h, required for CPUArchState etc */
 
 #include "config.h"
-#include "exec/exec-all.h"
 #include "exec/memory.h"
 
 #include "exec/cputlb.h"
diff --git a/tcg/README b/tcg/README
index f178212..0788bdc 100644
--- a/tcg/README
+++ b/tcg/README
@@ -530,7 +530,7 @@ register.
   inline TCG may still be faster for longer sequences.
 
 - The hard limit on the number of TCG instructions you can generate
-  per guest instruction is set by MAX_OP_PER_INSTR in exec-all.h --
+  per guest instruction is set by MAX_OP_PER_INSTR in translate.h --
   you cannot exceed this without risking a buffer overrun.
 
 - Use the 'discard' instruction if you know that TCG won't be able to
diff --git a/tci.c b/tci.c
index 0202ed9..7b9d0af 100644
--- a/tci.c
+++ b/tci.c
@@ -25,7 +25,7 @@
 #endif
 
 #include "qemu-common.h"
-#include "exec/exec-all.h"           /* MAX_OPC_PARAM_IARGS */
+#include "exec/translate.h"           /* MAX_OPC_PARAM_IARGS */
 #include "tcg-op.h"
 
 /* Marker for missing code. */
-- 
1.7.9.5

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

* [Qemu-devel] [Discussion 10/10] translate: remove file translate-all.h
  2014-03-04  2:47 [Qemu-devel] [Discussion 00/10] about API hierarchy Xuebing Wang
                   ` (8 preceding siblings ...)
  2014-03-04  2:47 ` [Qemu-devel] [Discussion 09/10] exec: remove the unnecessary include of "exec-all.h" Xuebing Wang
@ 2014-03-04  2:47 ` Xuebing Wang
  2014-03-04 10:29   ` Paolo Bonzini
  2014-03-04  3:45 ` [Qemu-devel] [Discussion 00/10] about API hierarchy Andreas Färber
  10 siblings, 1 reply; 37+ messages in thread
From: Xuebing Wang @ 2014-03-04  2:47 UTC (permalink / raw)
  To: qemu-devel; +Cc: pbonzini, xbing6, afaerber, stefanha

This patch does below:
-   Move the declaration of 2 translate functions from translate-all.h into
    include/exec/translate.h
-   remove file translate-all.h

Signed-off-by: Xuebing Wang <xbing6@gmail.com>
---
 exec.c                   |    2 --
 include/exec/translate.h |    4 ++++
 translate-all.c          |    2 +-
 translate-all.h          |   27 ---------------------------
 4 files changed, 5 insertions(+), 30 deletions(-)
 delete mode 100644 translate-all.h

diff --git a/exec.c b/exec.c
index ffbd26c..ee52b3b 100644
--- a/exec.c
+++ b/exec.c
@@ -44,8 +44,6 @@
 #endif
 
 #include "exec/cputlb.h"
-#include "translate-all.h"
-
 #include "exec/memory-internal.h"
 #include "exec/ram_addr.h"
 #include "qemu/cache-utils.h"
diff --git a/include/exec/translate.h b/include/exec/translate.h
index 9e877f2..42895b4 100644
--- a/include/exec/translate.h
+++ b/include/exec/translate.h
@@ -303,4 +303,8 @@ extern uintptr_t tci_tb_ptr;
 
 #define GETPC()  (GETRA() - GETPC_ADJ)
 
+/* translate-all.c */
+void tb_invalidate_phys_page_fast(tb_page_addr_t start, int len);
+void tb_check_watchpoint(CPUArchState *env);
+
 #endif /* EXEC_TRANSLATE_H */
diff --git a/translate-all.c b/translate-all.c
index 98e215f..975f823 100644
--- a/translate-all.c
+++ b/translate-all.c
@@ -61,7 +61,7 @@
 #endif
 
 #include "exec/cputlb.h"
-#include "translate-all.h"
+#include "exec/translate.h"
 #include "qemu/timer.h"
 
 //#define DEBUG_TB_INVALIDATE
diff --git a/translate-all.h b/translate-all.h
deleted file mode 100644
index f7e5932..0000000
--- a/translate-all.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- *  Translated block handling
- *
- *  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 TRANSLATE_ALL_H
-#define TRANSLATE_ALL_H
-
-/* translate-all.c */
-void tb_invalidate_phys_page_fast(tb_page_addr_t start, int len);
-void cpu_unlink_tb(CPUState *cpu);
-void tb_check_watchpoint(CPUArchState *env);
-
-#endif /* TRANSLATE_ALL_H */
-- 
1.7.9.5

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

* Re: [Qemu-devel] [Discussion 00/10] about API hierarchy
  2014-03-04  2:47 [Qemu-devel] [Discussion 00/10] about API hierarchy Xuebing Wang
                   ` (9 preceding siblings ...)
  2014-03-04  2:47 ` [Qemu-devel] [Discussion 10/10] translate: remove file translate-all.h Xuebing Wang
@ 2014-03-04  3:45 ` Andreas Färber
  2014-03-04  5:37   ` Xuebing wang
  10 siblings, 1 reply; 37+ messages in thread
From: Andreas Färber @ 2014-03-04  3:45 UTC (permalink / raw)
  To: Xuebing Wang, qemu-devel; +Cc: Paolo Bonzini, Eduardo Habkost, Stefan Hajnoczi

Hi Xuebing,

Am 04.03.2014 03:47, schrieb Xuebing Wang:
> Q2) Does it make sense to remove NEED_CPU_H from qemu-common.h?

IMO not in this way. Work has been ongoing to obsolete NEED_CPU_H by
introducing CPUState in addition to CPUArchState and moving fields into
CPUState, so that less files need to include target-xxx/cpu.h. Your
approach seems to be rather spreading it to more and different files.

Please explain in more detail: Why is code being moved from qom/cpu.h to
vmstate.h for target-alpha?

Concerning gdbstub.h, have you investigated replacing remaining
CPUArchState usages with CPUState, like I started in a previous series?

Concerning memory_mapping.h, have you checked the mailing list archives
for reasons why I didn't use my vaddr there myself? Pointing me to my
HACKING entry does not answer that. ;) (Either vaddr didn't exist yet at
the time or there was some reason not to use it, I would hope!)

An important thing to watch out for when moving includes around is
avoiding (more) circular dependencies. CC'ing Eduardo.

Also note that I still haven't fully rebased my qom-cpu-13 branch yet,
which includes a number of field movements and is likely to clash with
some of your refactorings in CPU/exec/translate files.

Your observation is correct that not all things are in the best shape.
The question is in which way and in which order to address them.
To better judge, what are the immediate gains of your proposals? For
example, I don't spot any Makefile changes in your diffstat that benefit
from a dropped cpu.h include somewhere in terms of build dependencies.
Nor does your series include a proof of concept that something becomes
possible that wasn't before. Understanding the exact advantages would
help me in determining what priority to assign such changes. Thanks.

Regards,
Andreas

-- 
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg

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

* Re: [Qemu-devel] [Discussion 00/10] about API hierarchy
  2014-03-04  3:45 ` [Qemu-devel] [Discussion 00/10] about API hierarchy Andreas Färber
@ 2014-03-04  5:37   ` Xuebing wang
  0 siblings, 0 replies; 37+ messages in thread
From: Xuebing wang @ 2014-03-04  5:37 UTC (permalink / raw)
  To: Andreas Färber, qemu-devel
  Cc: Paolo Bonzini, Eduardo Habkost, Stefan Hajnoczi

Hi Andreas, thank you very much for your reply.

Would you please help review/correct doc/api-hierarchy too?


On 03/04/2014 11:45 AM, Andreas Färber wrote:
> Hi Xuebing,
>
> Am 04.03.2014 03:47, schrieb Xuebing Wang:
>> Q2) Does it make sense to remove NEED_CPU_H from qemu-common.h?
> IMO not in this way. Work has been ongoing to obsolete NEED_CPU_H by
> introducing CPUState in addition to CPUArchState and moving fields into
> CPUState, so that less files need to include target-xxx/cpu.h. Your
> approach seems to be rather spreading it to more and different files.
IMHO, CPUArchState is NOT the only data structure that is 
target-specific, thus needs "cpu.h".

target_ulong is a define, thus can NOT be moved into CPUState. And there 
are TARGET_LONG_BITS, TARGET_PAGE_BITS, etc

More importantly, their derivatives (for lack of a better word) need 
"cpu.h" too. 'git grep -nw target_ulong include/' lists the derivatives 
of target_ulong. And there could be derivatives of the derivatives.

After this patchset, excluding folders (bsd/user, disas/, hw/, 
include/hw, target-xxx/), only a few files need "cpu.h"
> Please explain in more detail: Why is code being moved from qom/cpu.h to
> vmstate.h for target-alpha?
target alpha and openrisc use VMSTATE_CPU(), for alpha-linuxuser 
VMSTATE_CPU() uses vmstate_cpu_common and vmstate_dummy, and 
vmstate_dummy is declared in include/migration/vmstate.h. Currently, 
vmstate.h is NOT included in qom/cpu.h

Considering API hierarchy (and their dependencies), I'd consider vmstate 
to depend on qom/cpu, rather than conversely. Do you agree?

> Concerning gdbstub.h, have you investigated replacing remaining
> CPUArchState usages with CPUState, like I started in a previous series?
Yes, I did. I even tried to replace CPUArchState with CPUState for other 
subsystems, to make them architecture-independent. But, it involves 
changing too many places. :-)

>
> Concerning memory_mapping.h, have you checked the mailing list archives
> for reasons why I didn't use my vaddr there myself? Pointing me to my
> HACKING entry does not answer that. ;) (Either vaddr didn't exist yet at
> the time or there was some reason not to use it, I would hope!)
"target_ulong virt_addr" was there before the born of vaddr. vaddr was 
introduced in your commit 577f42c0e11a5bfb462ff3a217701cd5c4356fb4 dated 
Jul 6 2013. :-)

At this moment, do you think we better use vaddr to make memory_mapping 
target-independent?
>
> An important thing to watch out for when moving includes around is
> avoiding (more) circular dependencies. CC'ing Eduardo.
Thanks for reminding. Yes, I keep avoiding circular dependencies in 
mind, that's the reason I wrote document docs/api-hierarchy.

Do you agree that in general, strictly following api hierarchy is a good 
approach to avoid circular dependencies?
>
> Also note that I still haven't fully rebased my qom-cpu-13 branch yet,
> which includes a number of field movements and is likely to clash with
> some of your refactorings in CPU/exec/translate files.
Thanks for reminding.
>
> Your observation is correct that not all things are in the best shape.
> The question is in which way and in which order to address them.
> To better judge, what are the immediate gains of your proposals? For
> example, I don't spot any Makefile changes in your diffstat that benefit
> from a dropped cpu.h include somewhere in terms of build dependencies.
> Nor does your series include a proof of concept that something becomes
> possible that wasn't before. Understanding the exact advantages would
> help me in determining what priority to assign such changes. Thanks.
My idea of the immediate gains is to circulate the api-hierarchy, and 
watch out dependencies while we adding new features. That's why I name 
this discussion "about API hierarchy"

Here is a quote from Anthony's "kvm forum 2011" keynote (slide 3):
We're growing so fast, and are so popular, that we simply don't have 
time to exercise and eat healthy.

http://www.linux-kvm.org/wiki/images/5/57/2011-forum-qemu-keynote-liguori.pdf

I hope api-hierarchy and removing NEED_CPU_H from qemu-common.h is the 
low-hanging fruit, in the sense of "exercise". :-)

>
> Regards,
> Andreas
>

-- 
Thanks,
Xuebing Wang

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

* Re: [Qemu-devel] [Discussion 01/10] docs: add docs/api-hierarchy.txt
  2014-03-04  2:47 ` [Qemu-devel] [Discussion 01/10] docs: add docs/api-hierarchy.txt Xuebing Wang
@ 2014-03-04  9:42   ` Stefan Hajnoczi
  2014-03-04  9:58     ` Xuebing wang
  0 siblings, 1 reply; 37+ messages in thread
From: Stefan Hajnoczi @ 2014-03-04  9:42 UTC (permalink / raw)
  To: Xuebing Wang; +Cc: pbonzini, qemu-devel, stefanha, afaerber

On Tue, Mar 04, 2014 at 10:47:21AM +0800, Xuebing Wang wrote:
> Signed-off-by: Xuebing Wang <xbing6@gmail.com>
> ---
>  docs/api-hierarchy.txt |   93 ++++++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 93 insertions(+)
>  create mode 100644 docs/api-hierarchy.txt

This type of documentation gets outdated really quickly.  I'm not sure
it should be merged.

Documenting the various APIs as doc comments in the code would have a
better chance of staying up-to-date.

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

* Re: [Qemu-devel] [Discussion 01/10] docs: add docs/api-hierarchy.txt
  2014-03-04  9:42   ` Stefan Hajnoczi
@ 2014-03-04  9:58     ` Xuebing wang
  2014-03-04 11:57       ` Stefan Hajnoczi
  0 siblings, 1 reply; 37+ messages in thread
From: Xuebing wang @ 2014-03-04  9:58 UTC (permalink / raw)
  To: Stefan Hajnoczi; +Cc: pbonzini, qemu-devel, stefanha, afaerber


On 03/04/2014 05:42 PM, Stefan Hajnoczi wrote:
> On Tue, Mar 04, 2014 at 10:47:21AM +0800, Xuebing Wang wrote:
>> Signed-off-by: Xuebing Wang <xbing6@gmail.com>
>> ---
>>   docs/api-hierarchy.txt |   93 ++++++++++++++++++++++++++++++++++++++++++++++++
>>   1 file changed, 93 insertions(+)
>>   create mode 100644 docs/api-hierarchy.txt
> This type of documentation gets outdated really quickly.  I'm not sure
> it should be merged.
>
> Documenting the various APIs as doc comments in the code would have a
> better chance of staying up-to-date.
>

Thanks. But, doc comments in the code don't show the hierarchy and their 
dependencies (or inheriting relationship).

Any idea how to draw the hierarchy to show the big picture of the APIs 
(as a high-level API design doc)? :-)

-- 
Thanks,
Xuebing Wang

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

* Re: [Qemu-devel] [Discussion 02/10] NEED_CPU_H: remove '#include "cpu.h"' from include/qemu-common.h
  2014-03-04  2:47 ` [Qemu-devel] [Discussion 02/10] NEED_CPU_H: remove '#include "cpu.h"' from include/qemu-common.h Xuebing Wang
@ 2014-03-04 10:19   ` Paolo Bonzini
  2014-03-04 11:54     ` Xuebing wang
                       ` (4 more replies)
  0 siblings, 5 replies; 37+ messages in thread
From: Paolo Bonzini @ 2014-03-04 10:19 UTC (permalink / raw)
  To: Xuebing Wang, qemu-devel; +Cc: afaerber, stefanha

Hi,

in general I agree with this patch.  I have a few comments, and I 
suggest that you split it in multiple patches so that it's easier to get 
it in when each part is ready.

> diff --git a/hw/dma/soc_dma.c b/hw/dma/soc_dma.c
> index c06aabb..950f3ec 100644
> --- a/hw/dma/soc_dma.c
> +++ b/hw/dma/soc_dma.c
> @@ -21,6 +21,11 @@
>  #include "qemu/timer.h"
>  #include "hw/arm/soc_dma.h"
>
> +#ifndef NEED_CPU_H
> +#error target-xxx/cpu.h must be included because target-specific are required
> +#endif

Not needed; include/exec/cpu-defs.h already has a similar #error.

> +#include "cpu.h" /* target-xxx/cpu.h, required for TARGET_FMT_lx etc */

Space line below the #include, not above.

>  static void transfer_mem2mem(struct soc_dma_ch_s *ch)
>  {
>      memcpy(ch->paddr[0], ch->paddr[1], ch->bytes);
> diff --git a/include/disas/disas.h b/include/disas/disas.h
> index c13ca9a..e5cdfd7 100644
> --- a/include/disas/disas.h
> +++ b/include/disas/disas.h
> @@ -1,9 +1,9 @@
>  #ifndef _QEMU_DISAS_H
>  #define _QEMU_DISAS_H
>
> -#include "qemu-common.h"
> -
>  #ifdef NEED_CPU_H
> +#include "cpu.h" /* target-xxx/cpu.h, required for target_ulong,
> +                    CPUArchState */
>  /* Disassemble this for me please... (debugging). */
>  void disas(FILE *out, void *code, unsigned long size);
>  void target_disas(FILE *out, CPUArchState *env, target_ulong code,
> @@ -14,7 +14,7 @@ void monitor_disas(Monitor *mon, CPUArchState *env,
>
>  /* Look up symbol for debugging purpose.  Returns "" if unknown. */
>  const char *lookup_symbol(target_ulong orig_addr);
> -#endif
> +#endif /* NEED_CPU_H */

Perhaps the file that includes disas/disas.h can instead include cpu.h 
too?  Most of them already do:

$ git grep -L include.*cpu.h $(git grep -l disas/disas.h)
bsd-user/elfload.c
hw/core/loader.c
linux-user/elfload.c
vl.c

Of these, vl.c and linux-user/elfload.c should not include disas/disas.h 
at all, and hw/core/loader.c is !NEED_CPU_H.  So there are just two 
files where you can add a #include "cpu.h" manually.

>  struct syminfo;
>  struct elf32_sym;
> diff --git a/include/exec/cpu-all.h b/include/exec/cpu-all.h
> index 4cb4b4a..7045732 100644
> --- a/include/exec/cpu-all.h
> +++ b/include/exec/cpu-all.h
> @@ -490,4 +490,10 @@ void qemu_mutex_unlock_ramlist(void);
>  int cpu_memory_rw_debug(CPUState *cpu, target_ulong addr,
>                          uint8_t *buf, int len, int is_write);
>
> +/* CPU save/load.  */
> +#ifdef CPU_SAVE_VERSION
> +void cpu_save(QEMUFile *f, void *opaque);
> +int cpu_load(QEMUFile *f, void *opaque, int version_id);
> +#endif

Good.

>  #endif /* CPU_ALL_H */
> diff --git a/include/exec/gdbstub.h b/include/exec/gdbstub.h
> index a608a26..14addcb 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" /* target-xxx/cpu.h, required for target_ulong,
> +                    CPUArchState */
>  typedef void (*gdb_syscall_complete_cb)(CPUState *cpu,
>                                          target_ulong ret, target_ulong err);
>
> @@ -76,7 +78,7 @@ static inline int gdb_get_reg64(uint8_t *mem_buf, uint64_t val)
>  #define ldtul_p(addr) ldl_p(addr)
>  #endif
>
> -#endif
> +#endif /* NEED_CPU_H */
>
>  #ifdef CONFIG_USER_ONLY
>  int gdbserver_start(int);

Same here: I'd rather add a cpu.h inclusion to the following files:

cpus.c
target-alpha/gdbstub.c
target-arm/gdbstub.c
target-arm/gdbstub64.c
target-cris/gdbstub.c
target-i386/gdbstub.c
target-lm32/gdbstub.c
target-m68k/gdbstub.c
target-microblaze/gdbstub.c
target-mips/gdbstub.c
target-openrisc/gdbstub.c
target-ppc/gdbstub.c
target-ppc/translate_init.c
target-s390x/gdbstub.c
target-sh4/gdbstub.c
target-sparc/gdbstub.c
target-xtensa/gdbstub.c


> diff --git a/include/exec/ram_addr.h b/include/exec/ram_addr.h
> index 2edfa96..09e2aa6 100644
> --- a/include/exec/ram_addr.h
> +++ b/include/exec/ram_addr.h
> @@ -19,6 +19,11 @@
>  #ifndef RAM_ADDR_H
>  #define RAM_ADDR_H
>
> +#ifndef NEED_CPU_H
> +#error target-xxx/cpu.h must be included because target-specific are required
> +#endif
> +#include "cpu.h" /* target-xxx/cpu.h, required for TARGET_PAGE_BITS etc */

As above, this #ifndef is not needed.

>  #ifndef CONFIG_USER_ONLY
>  #include "hw/xen/xen.h"
>
> diff --git a/include/hw/arm/omap.h b/include/hw/arm/omap.h
> index b9655ee..580510f 100644
> --- a/include/hw/arm/omap.h
> +++ b/include/hw/arm/omap.h
> @@ -17,10 +17,16 @@
>   * with this program; if not, see <http://www.gnu.org/licenses/>.
>   */
>  #ifndef hw_omap_h
> +
>  #include "exec/memory.h"
>  # define hw_omap_h		"omap.h"
>  #include "hw/irq.h"
>
> +#ifndef NEED_CPU_H
> +#error target-xxx/cpu.h must be included because target-specific are required
> +#endif

#ifndef not needed.

> +#include "cpu.h" /* target-xxx/cpu.h, required for ARMCPU etc */
> +
>  # define OMAP_EMIFS_BASE	0x00000000
>  # define OMAP2_Q0_BASE		0x00000000
>  # define OMAP_CS0_BASE		0x00000000
> diff --git a/include/hw/i386/apic.h b/include/hw/i386/apic.h
> index 1d48e02..a0e6922 100644
> --- a/include/hw/i386/apic.h
> +++ b/include/hw/i386/apic.h
> @@ -1,6 +1,12 @@
>  #ifndef APIC_H
>  #define APIC_H
>
> +#ifndef NEED_CPU_H
> +#error target-xxx/cpu.h must be included because target-specific are required
> +#endif

#ifndef not needed.

> +#include "cpu.h" /* target-xxx/cpu.h, required for X86CPU, target_ulong,
> +                    TPRAccess */

Should be included after qemu-common.h.

>  #include "qemu-common.h"
>
>  /* apic.c */
> diff --git a/include/hw/i386/apic_internal.h b/include/hw/i386/apic_internal.h
> index 70542a6..a1569a1 100644
> --- a/include/hw/i386/apic_internal.h
> +++ b/include/hw/i386/apic_internal.h
> @@ -20,6 +20,12 @@
>  #ifndef QEMU_APIC_INTERNAL_H
>  #define QEMU_APIC_INTERNAL_H
>
> +#ifndef NEED_CPU_H
> +#error target-xxx/cpu.h must be included because target-specific are required
> +#endif

#ifndef not needed.

> +#include "cpu.h" /* target-xxx/cpu.h, required for X86CPU, target_ulong,
> +                    TPRAccess */
> +
>  #include "exec/memory.h"
>  #include "hw/cpu/icc_bus.h"
>  #include "qemu/timer.h"
> diff --git a/include/hw/xen/xen.h b/include/hw/xen/xen.h
> index e1f88bf..34773b9 100644
> --- a/include/hw/xen/xen.h
> +++ b/include/hw/xen/xen.h
> @@ -9,7 +9,7 @@
>  #include <inttypes.h>
>
>  #include "hw/irq.h"
> -#include "qemu-common.h"
> +#include "exec/cpu-common.h" /* for ram_addr_t */

Ok.

>  /* xen-machine.c */
>  enum xen_mode {
> diff --git a/include/migration/vmstate.h b/include/migration/vmstate.h
> index ded8e23..040cc75 100644
> --- a/include/migration/vmstate.h
> +++ b/include/migration/vmstate.h
> @@ -138,8 +138,19 @@ struct VMStateDescription {
>
>  #ifdef CONFIG_USER_ONLY
>  extern const VMStateDescription vmstate_dummy;
> +#define vmstate_cpu_common vmstate_dummy
> +#else
> +extern const struct VMStateDescription vmstate_cpu_common;
>  #endif
>
> +#define VMSTATE_CPU() {                                                     \
> +    .name = "parent_obj",                                                   \
> +    .size = sizeof(CPUState),                                               \
> +    .vmsd = &vmstate_cpu_common,                                            \
> +    .flags = VMS_STRUCT,                                                    \
> +    .offset = 0,                                                            \
> +}
> +
>  extern const VMStateInfo vmstate_info_bool;
>
>  extern const VMStateInfo vmstate_info_int8;
> diff --git a/include/qemu-common.h b/include/qemu-common.h
> index c8a58a8..cd33b2c 100644
> --- a/include/qemu-common.h
> +++ b/include/qemu-common.h
> @@ -111,11 +111,6 @@ extern int use_icount;
>  #include "qemu/osdep.h"
>  #include "qemu/bswap.h"
>
> -/* FIXME: Remove NEED_CPU_H.  */
> -#ifdef NEED_CPU_H
> -#include "cpu.h"
> -#endif /* !defined(NEED_CPU_H) */

Ok.

>  /* main function, renamed */
>  #if defined(CONFIG_COCOA)
>  int qemu_main(int argc, char **argv, char **envp);
> @@ -273,12 +268,6 @@ bool tcg_enabled(void);
>
>  void cpu_exec_init_all(void);
>
> -/* CPU save/load.  */
> -#ifdef CPU_SAVE_VERSION
> -void cpu_save(QEMUFile *f, void *opaque);
> -int cpu_load(QEMUFile *f, void *opaque, int version_id);
> -#endif
> -

Ok.

>  /* Unblock cpu */
>  void qemu_cpu_kick_self(void);
>
> diff --git a/include/qom/cpu.h b/include/qom/cpu.h
> index 367eda1..f0157e3 100644
> --- a/include/qom/cpu.h
> +++ b/include/qom/cpu.h
> @@ -510,18 +510,4 @@ void qemu_init_vcpu(CPUState *cpu);
>   */
>  void cpu_single_step(CPUState *cpu, int enabled);
>
> -#ifdef CONFIG_SOFTMMU
> -extern const struct VMStateDescription vmstate_cpu_common;
> -#else
> -#define vmstate_cpu_common vmstate_dummy
> -#endif
> -
> -#define VMSTATE_CPU() {                                                     \
> -    .name = "parent_obj",                                                   \
> -    .size = sizeof(CPUState),                                               \
> -    .vmsd = &vmstate_cpu_common,                                            \
> -    .flags = VMS_STRUCT,                                                    \
> -    .offset = 0,                                                            \
> -}
> -

Like Andreas I don't like this particularly.  You can add 
migration/vmstate.h to qom/cpu.h instead.

>  #endif
> diff --git a/include/sysemu/kvm.h b/include/sysemu/kvm.h
> index a02d67c..112721d 100644
> --- a/include/sysemu/kvm.h
> +++ b/include/sysemu/kvm.h
> @@ -19,6 +19,15 @@
>  #include "qemu/queue.h"
>  #include "qom/cpu.h"
>
> +/* Ideally, for every appearance of NEED_CPU_H, there must be followed by
> + * the inclusion of "target-xxx/cpu.h".
> + *
> + * FIXME: find another logic other than using NEED_CPU_H.
> + */
> +#ifdef NEED_CPU_H
> +#include "config-target.h" /* for CONFIG_KVM */
> +#endif

I think this is okay.

> +
>  #ifdef CONFIG_KVM
>  #include <linux/kvm.h>
>  #include <linux/kvm_para.h>
> @@ -169,6 +178,7 @@ int kvm_init_vcpu(CPUState *cpu);
>  int kvm_cpu_exec(CPUState *cpu);
>
>  #ifdef NEED_CPU_H
> +#include "cpu.h" /* target-xxx/cpu.h, required for target_ulong */
>
>  void kvm_setup_guest_memory(void *start, size_t size);
>  void kvm_flush_coalesced_mmio_buffer(void);

Perhaps move debugging-related definitions to a new file 
sysemu/kvm-debug.h and include it only from gdbstub.c, kvm-all.c, 
kvm-stub.c, target-*/kvm.c.

> diff --git a/tcg/tcg.h b/tcg/tcg.h
> index f7efcb4..4dea41a 100644
> --- a/tcg/tcg.h
> +++ b/tcg/tcg.h
> @@ -29,6 +29,12 @@
>  #include "qemu/bitops.h"
>  #include "tcg-target.h"
>
> +#ifndef NEED_CPU_H
> +#error target-xxx/cpu.h must be included because target-specific are required
> +#endif
> +#include "cpu.h" /* target-xxx/cpu.h, required for CPUArchState,
> +                    TARGET_LONG_BITS in tcg-opc.h */

#ifndef not needed.

Paolo

>  /* Default target word size to pointer size.  */
>  #ifndef TCG_TARGET_REG_BITS
>  # if UINTPTR_MAX == UINT32_MAX
>

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

* Re: [Qemu-devel] [Discussion 03/10] NEED_CPU_H: remove unnecessary use of NEED_CPU_H
  2014-03-04  2:47 ` [Qemu-devel] [Discussion 03/10] NEED_CPU_H: remove unnecessary use of NEED_CPU_H Xuebing Wang
@ 2014-03-04 10:20   ` Paolo Bonzini
  0 siblings, 0 replies; 37+ messages in thread
From: Paolo Bonzini @ 2014-03-04 10:20 UTC (permalink / raw)
  To: Xuebing Wang, qemu-devel; +Cc: afaerber, stefanha

Il 04/03/2014 03:47, Xuebing Wang ha scritto:
> Note: there is a FIXME to be addressed in this patch.
>
> For every appearance of NEED_CPU_H, there must be '#include "cpu.h"' to
> include "target-xxx/cpu.h", because the code below NEED_CPU_H depends on
> architecture-specific information.
>
> Signed-off-by: Xuebing Wang <xbing6@gmail.com>

Here I disagree.  I think that if cpu.h is needed by a header, it should 
be included by whoever needs that header.

> ---
>  include/exec/cpu-common.h |    5 +++++
>  include/hw/hw.h           |   13 +++++++++----
>  include/hw/xen/xen.h      |    2 +-
>  include/qemu/log.h        |    7 ++++---
>  include/sysemu/kvm.h      |    2 +-
>  ui/input.c                |    2 --
>  6 files changed, 20 insertions(+), 11 deletions(-)
>
> diff --git a/include/exec/cpu-common.h b/include/exec/cpu-common.h
> index a21b65a..a696667 100644
> --- a/include/exec/cpu-common.h
> +++ b/include/exec/cpu-common.h
> @@ -98,6 +98,11 @@ 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);
>
> +/*
> + * FIXME: although it's nice to keep ld/st APIs together with above,
> + *        below violates the idea that every NEED_CPU_H should be followed
> + *        by inclusion of "target-xxx/cpu.h"
> + */
>  #ifdef NEED_CPU_H
>  uint32_t lduw_phys(AddressSpace *as, hwaddr addr);
>  uint32_t ldl_phys(AddressSpace *as, hwaddr addr);
> diff --git a/include/hw/hw.h b/include/hw/hw.h
> index 33bdb92..3accd44 100644
> --- a/include/hw/hw.h
> +++ b/include/hw/hw.h
> @@ -4,7 +4,7 @@
>
>  #include "qemu-common.h"
>
> -#if !defined(CONFIG_USER_ONLY) && !defined(NEED_CPU_H)
> +#if !defined(CONFIG_USER_ONLY)
>  #include "exec/cpu-common.h"
>  #endif
>
> @@ -15,6 +15,8 @@
>  #include "qemu/log.h"
>
>  #ifdef NEED_CPU_H
> +#include "cpu.h" /* target-xxx/cpu.h, required for TARGET_LONG_BITS */
> +
>  #if TARGET_LONG_BITS == 64
>  #define qemu_put_betl qemu_put_be64
>  #define qemu_get_betl qemu_get_be64
> @@ -34,7 +36,7 @@
>  #define qemu_put_sbetls qemu_put_sbe32s
>  #define qemu_get_sbetls qemu_get_sbe32s
>  #endif
> -#endif
> +#endif /* NEED_CPU_H */
>
>  typedef void QEMUResetHandler(void *opaque);
>
> @@ -48,6 +50,8 @@ void qemu_register_boot_set(QEMUBootSetHandler *func, void *opaque);
>  int qemu_boot_set(const char *boot_order);
>
>  #ifdef NEED_CPU_H
> +#include "cpu.h" /* target-xxx/cpu.h, required for TARGET_LONG_BITS */
> +
>  #if TARGET_LONG_BITS == 64
>  #define VMSTATE_UINTTL_V(_f, _s, _v)                                  \
>      VMSTATE_UINT64_V(_f, _s, _v)
> @@ -63,6 +67,7 @@ int qemu_boot_set(const char *boot_order);
>  #define VMSTATE_UINTTL_ARRAY_V(_f, _s, _n, _v)                        \
>      VMSTATE_UINT32_ARRAY_V(_f, _s, _n, _v)
>  #endif
> +
>  #define VMSTATE_UINTTL(_f, _s)                                        \
>      VMSTATE_UINTTL_V(_f, _s, 0)
>  #define VMSTATE_UINTTL_EQUAL(_f, _s)                                  \
> @@ -70,6 +75,6 @@ int qemu_boot_set(const char *boot_order);
>  #define VMSTATE_UINTTL_ARRAY(_f, _s, _n)                              \
>      VMSTATE_UINTTL_ARRAY_V(_f, _s, _n, 0)
>
> -#endif
> +#endif /* NEED_CPU_H */
>
> -#endif
> +#endif /* QEMU_HW_H */
> diff --git a/include/hw/xen/xen.h b/include/hw/xen/xen.h
> index 34773b9..638817b 100644
> --- a/include/hw/xen/xen.h
> +++ b/include/hw/xen/xen.h
> @@ -40,7 +40,7 @@ int xen_init(void);
>  int xen_hvm_init(MemoryRegion **ram_memory);
>  void xenstore_store_pv_console_info(int i, struct CharDriverState *chr);
>
> -#if defined(NEED_CPU_H) && !defined(CONFIG_USER_ONLY)
> +#if !defined(CONFIG_USER_ONLY)
>  void xen_ram_alloc(ram_addr_t ram_addr, ram_addr_t size,
>                     struct MemoryRegion *mr);
>  void xen_modified_memory(ram_addr_t start, ram_addr_t length);
> diff --git a/include/qemu/log.h b/include/qemu/log.h
> index d515424..715accb 100644
> --- a/include/qemu/log.h
> +++ b/include/qemu/log.h
> @@ -6,9 +6,7 @@
>  #include <stdio.h>
>  #include "qemu/compiler.h"
>  #include "qom/cpu.h"
> -#ifdef NEED_CPU_H
>  #include "disas/disas.h"
> -#endif
>
>  /* Private global variables, don't use */
>  extern FILE *qemu_logfile;
> @@ -102,6 +100,9 @@ static inline void log_cpu_state_mask(int mask, CPUState *cpu, int flags)
>  }
>
>  #ifdef NEED_CPU_H
> +#include "cpu.h" /* target-xxx/cpu.h, required for target_ulong,
> +                    CPUArchState */
> +
>  /* disas() and target_disas() to qemu_logfile: */
>  static inline void log_target_disas(CPUArchState *env, target_ulong start,
>                                      target_ulong len, int flags)
> @@ -121,7 +122,7 @@ static inline void log_page_dump(void)
>      page_dump(qemu_logfile);
>  }
>  #endif
> -#endif
> +#endif /* NEED_CPU_H */
>
>
>  /* Maintenance: */
> diff --git a/include/sysemu/kvm.h b/include/sysemu/kvm.h
> index 112721d..d1e5389 100644
> --- a/include/sysemu/kvm.h
> +++ b/include/sysemu/kvm.h
> @@ -58,7 +58,7 @@ extern bool kvm_gsi_routing_allowed;
>  extern bool kvm_gsi_direct_mapping;
>  extern bool kvm_readonly_mem_allowed;
>
> -#if defined CONFIG_KVM || !defined NEED_CPU_H
> +#if defined CONFIG_KVM
>  #define kvm_enabled()           (kvm_allowed)

This is wrong.  There are files that do not need cpu.h and need 
kvm_enabled().

Paolo

>  /**
>   * kvm_irqchip_in_kernel:
> diff --git a/ui/input.c b/ui/input.c
> index 1c70f60..b6d216d 100644
> --- a/ui/input.c
> +++ b/ui/input.c
> @@ -187,7 +187,6 @@ static const int key_defs[] = {
>
>      [Q_KEY_CODE_INSERT] = 0xd2,
>      [Q_KEY_CODE_DELETE] = 0xd3,
> -#ifdef NEED_CPU_H
>  #if defined(TARGET_SPARC) && !defined(TARGET_SPARC64)
>      [Q_KEY_CODE_STOP] = 0xf0,
>      [Q_KEY_CODE_AGAIN] = 0xf1,
> @@ -205,7 +204,6 @@ static const int key_defs[] = {
>      [Q_KEY_CODE_META_R] = 0xfd,
>      [Q_KEY_CODE_COMPOSE] = 0xfe,
>  #endif
> -#endif
>      [Q_KEY_CODE_MAX] = 0,
>  };
>
>

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

* Re: [Qemu-devel] [Discussion 04/10] memory_mapping: make this architecture-independent
  2014-03-04  2:47 ` [Qemu-devel] [Discussion 04/10] memory_mapping: make this architecture-independent Xuebing Wang
@ 2014-03-04 10:22   ` Paolo Bonzini
  2014-03-04 11:05   ` Peter Maydell
  1 sibling, 0 replies; 37+ messages in thread
From: Paolo Bonzini @ 2014-03-04 10:22 UTC (permalink / raw)
  To: Xuebing Wang, qemu-devel; +Cc: afaerber, stefanha

Il 04/03/2014 03:47, Xuebing Wang ha scritto:
> Use vaddr (instead of target_ulong) for virtual address. See document HACKING
> for more information about vaddr and target_ulong.
>
> Signed-off-by: Xuebing Wang <xbing6@gmail.com>
> ---
>  include/sysemu/memory_mapping.h |    3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/include/sysemu/memory_mapping.h b/include/sysemu/memory_mapping.h
> index a75d59a..4a5f7be 100644
> --- a/include/sysemu/memory_mapping.h
> +++ b/include/sysemu/memory_mapping.h
> @@ -16,6 +16,7 @@
>
>  #include "qemu/queue.h"
>  #include "qemu/typedefs.h"
> +#include "qom/cpu.h" /* for vaddr */
>
>  typedef struct GuestPhysBlock {
>      /* visible to guest, reflects PCI hole, etc */
> @@ -39,7 +40,7 @@ typedef struct GuestPhysBlockList {
>  /* The physical and virtual address in the memory mapping are contiguous. */
>  typedef struct MemoryMapping {
>      hwaddr phys_addr;
> -    target_ulong virt_addr;
> +    vaddr virt_addr;
>      ram_addr_t length;
>      QTAILQ_ENTRY(MemoryMapping) next;
>  } MemoryMapping;
>

Makes sense.

Paolo

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

* Re: [Qemu-devel] [Discussion 05/10] NEED_CPU_H: remove unnecessary inclusion of "cpu.h" in root
  2014-03-04  2:47 ` [Qemu-devel] [Discussion 05/10] NEED_CPU_H: remove unnecessary inclusion of "cpu.h" in root Xuebing Wang
@ 2014-03-04 10:24   ` Paolo Bonzini
  0 siblings, 0 replies; 37+ messages in thread
From: Paolo Bonzini @ 2014-03-04 10:24 UTC (permalink / raw)
  To: Xuebing Wang, qemu-devel; +Cc: afaerber, stefanha

Il 04/03/2014 03:47, Xuebing Wang ha scritto:
> Enforce the strict associativity between NEED_CPU_H and "inclusion of cpu.h",
> for every appearance of '#include "cpu.h"', there must have the check of
> NEED_CPU_H, and conversely.

As mentioned earlier, the #ifndef is unnecessary.  It is already 
provided by include/exec/cpu-defs.h

> This patch only checks file in qemu root directory by:
> grep -nw "cpu.h" *.[ch] .
>
> Note: remove unnecessary inclusion of "cpu-all.h" too. "cpu-all.h" is
> architecture-specific, should ONLY be included from target-xxx/*
> - 'git grep -nw "cpu-all.h"' confirms this

Should be a separate patch.  I agree with removing unnecessary #includes 
in general, but please check that the include is _really_ removed and 
not just included indirectly now.

Paolo

> Signed-off-by: Xuebing Wang <xbing6@gmail.com>
> ---
>  arch_init.c      |    1 -
>  cpu-exec.c       |    7 ++++++-
>  cputlb.c         |    6 +++++-
>  disas.c          |    7 ++++++-
>  dump.c           |    2 --
>  exec.c           |    2 --
>  gdbstub.c        |    8 +++++++-
>  kvm-stub.c       |    1 -
>  memory_mapping.c |    6 +++---
>  monitor.c        |    1 -
>  translate-all.c  |    7 ++++++-
>  user-exec.c      |    7 ++++++-
>  12 files changed, 39 insertions(+), 16 deletions(-)
>
> diff --git a/arch_init.c b/arch_init.c
> index fe17279..76e8630 100644
> --- a/arch_init.c
> +++ b/arch_init.c
> @@ -47,7 +47,6 @@
>  #include "qemu/config-file.h"
>  #include "qmp-commands.h"
>  #include "trace.h"
> -#include "exec/cpu-all.h"
>  #include "exec/ram_addr.h"
>  #include "hw/acpi/acpi.h"
>  #include "qemu/host-utils.h"
> diff --git a/cpu-exec.c b/cpu-exec.c
> index 1b0f617..858825f 100644
> --- a/cpu-exec.c
> +++ b/cpu-exec.c
> @@ -16,8 +16,13 @@
>   * 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 NEED_CPU_H
> +#error target-xxx/cpu.h must be included because target-specific are required
> +#endif
> +#include "cpu.h" /* target-xxx/cpu.h, required for CPUArchState etc */
> +
>  #include "config.h"
> -#include "cpu.h"
>  #include "disas/disas.h"
>  #include "tcg.h"
>  #include "qemu/atomic.h"
> diff --git a/cputlb.c b/cputlb.c
> index 0fbaa39..3c6cb16 100644
> --- a/cputlb.c
> +++ b/cputlb.c
> @@ -17,8 +17,12 @@
>   * License along with this library; if not, see <http://www.gnu.org/licenses/>.
>   */
>
> +#ifndef NEED_CPU_H
> +#error target-xxx/cpu.h must be included because target-specific are required
> +#endif
> +#include "cpu.h" /* target-xxx/cpu.h, required for CPUArchState etc */
> +
>  #include "config.h"
> -#include "cpu.h"
>  #include "exec/exec-all.h"
>  #include "exec/memory.h"
>  #include "exec/address-spaces.h"
> diff --git a/disas.c b/disas.c
> index 79e6944..8dc51c8 100644
> --- a/disas.c
> +++ b/disas.c
> @@ -1,10 +1,15 @@
>  /* General "disassemble this chunk" code.  Used for debugging. */
> +
> +#ifndef NEED_CPU_H
> +#error target-xxx/cpu.h must be included because target-specific are required
> +#endif
> +#include "cpu.h" /* target-xxx/cpu.h, required for CPUArchState etc */
> +
>  #include "config.h"
>  #include "disas/bfd.h"
>  #include "elf.h"
>  #include <errno.h>
>
> -#include "cpu.h"
>  #include "disas/disas.h"
>
>  typedef struct CPUDebug {
> diff --git a/dump.c b/dump.c
> index 80a9116..d75c2ea 100644
> --- a/dump.c
> +++ b/dump.c
> @@ -13,8 +13,6 @@
>
>  #include "qemu-common.h"
>  #include "elf.h"
> -#include "cpu.h"
> -#include "exec/cpu-all.h"
>  #include "exec/hwaddr.h"
>  #include "monitor/monitor.h"
>  #include "sysemu/kvm.h"
> diff --git a/exec.c b/exec.c
> index b69fd29..3df2ffc 100644
> --- a/exec.c
> +++ b/exec.c
> @@ -25,7 +25,6 @@
>  #endif
>
>  #include "qemu-common.h"
> -#include "cpu.h"
>  #include "tcg.h"
>  #include "hw/hw.h"
>  #include "hw/qdev.h"
> @@ -44,7 +43,6 @@
>  #include "sysemu/xen-mapcache.h"
>  #include "trace.h"
>  #endif
> -#include "exec/cpu-all.h"
>
>  #include "exec/cputlb.h"
>  #include "translate-all.h"
> diff --git a/gdbstub.c b/gdbstub.c
> index e8ab0b2..a96add1 100644
> --- a/gdbstub.c
> +++ b/gdbstub.c
> @@ -16,6 +16,13 @@
>   * 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 NEED_CPU_H
> +#error target-xxx/cpu.h must be included because target-specific are required
> +#endif
> +#include "cpu.h" /* target-xxx/cpu.h, required for CPUArchState etc */
> +/* TODO: to remove using CPUArchState to make thie file arch-independent. */
> +
>  #include "config.h"
>  #include "qemu-common.h"
>  #ifdef CONFIG_USER_ONLY
> @@ -37,7 +44,6 @@
>
>  #define MAX_PACKET_LENGTH 4096
>
> -#include "cpu.h"
>  #include "qemu/sockets.h"
>  #include "sysemu/kvm.h"
>
> diff --git a/kvm-stub.c b/kvm-stub.c
> index e979f76..581350a 100644
> --- a/kvm-stub.c
> +++ b/kvm-stub.c
> @@ -12,7 +12,6 @@
>
>  #include "qemu-common.h"
>  #include "hw/hw.h"
> -#include "cpu.h"
>  #include "sysemu/kvm.h"
>
>  #ifndef CONFIG_USER_ONLY
> diff --git a/memory_mapping.c b/memory_mapping.c
> index 87a6ed5..b17eea1 100644
> --- a/memory_mapping.c
> +++ b/memory_mapping.c
> @@ -13,11 +13,11 @@
>
>  #include <glib.h>
>
> -#include "cpu.h"
> -#include "exec/cpu-all.h"
> -#include "sysemu/memory_mapping.h"
> +#include "qemu-common.h"
> +#include "exec/cpu-common.h" /* for ram_addr_t */
>  #include "exec/memory.h"
>  #include "exec/address-spaces.h"
> +#include "sysemu/memory_mapping.h"
>
>  //#define DEBUG_GUEST_PHYS_REGION_ADD
>
> diff --git a/monitor.c b/monitor.c
> index aebcbd8..1a8dd24 100644
> --- a/monitor.c
> +++ b/monitor.c
> @@ -58,7 +58,6 @@
>  #include "qapi/qmp/json-parser.h"
>  #include <qom/object_interfaces.h>
>  #include "qemu/osdep.h"
> -#include "cpu.h"
>  #include "trace.h"
>  #include "trace/control.h"
>  #ifdef CONFIG_TRACE_SIMPLE
> diff --git a/translate-all.c b/translate-all.c
> index 1ac0246..be220fb 100644
> --- a/translate-all.c
> +++ b/translate-all.c
> @@ -16,6 +16,12 @@
>   * 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 NEED_CPU_H
> +#error target-xxx/cpu.h must be included because target-specific are required
> +#endif
> +#include "cpu.h" /* target-xxx/cpu.h, required for CPUArchState etc */
> +
>  #ifdef _WIN32
>  #include <windows.h>
>  #else
> @@ -32,7 +38,6 @@
>
>  #include "qemu-common.h"
>  #define NO_CPU_IO_DEFS
> -#include "cpu.h"
>  #include "disas/disas.h"
>  #include "tcg.h"
>  #if defined(CONFIG_USER_ONLY)
> diff --git a/user-exec.c b/user-exec.c
> index 82bfa66..c4c1e3f 100644
> --- a/user-exec.c
> +++ b/user-exec.c
> @@ -16,8 +16,13 @@
>   * 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 NEED_CPU_H
> +#error target-xxx/cpu.h must be included because target-specific are required
> +#endif
> +#include "cpu.h" /* target-xxx/cpu.h, required for CPUArchState etc */
> +
>  #include "config.h"
> -#include "cpu.h"
>  #include "disas/disas.h"
>  #include "tcg.h"
>  #include "qemu/bitops.h"
>

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

* Re: [Qemu-devel] [Discussion 06/10] memory: move contents in include/exec/address-spaces.h => memory.h
  2014-03-04  2:47 ` [Qemu-devel] [Discussion 06/10] memory: move contents in include/exec/address-spaces.h => memory.h Xuebing Wang
@ 2014-03-04 10:26   ` Paolo Bonzini
  0 siblings, 0 replies; 37+ messages in thread
From: Paolo Bonzini @ 2014-03-04 10:26 UTC (permalink / raw)
  To: Xuebing Wang, qemu-devel; +Cc: afaerber, stefanha

Il 04/03/2014 03:47, Xuebing Wang ha scritto:
> In preparation for removing include/exec/address-spaces.h

Why?

Paolo

> Signed-off-by: Xuebing Wang <xbing6@gmail.com>
> ---
>  include/exec/address-spaces.h |   29 -----------------------------
>  include/exec/memory.h         |   19 +++++++++++++++----
>  include/hw/sh4/sh_intc.h      |    1 +
>  3 files changed, 16 insertions(+), 33 deletions(-)
>
> diff --git a/include/exec/address-spaces.h b/include/exec/address-spaces.h
> index 3d12cdd..c6e5d51 100644
> --- a/include/exec/address-spaces.h
> +++ b/include/exec/address-spaces.h
> @@ -10,32 +10,3 @@
>   * the COPYING file in the top-level directory.
>   *
>   */
> -
> -#ifndef EXEC_MEMORY_H
> -#define EXEC_MEMORY_H
> -
> -/*
> - * Internal interfaces between memory.c/exec.c/vl.c.  Do not #include unless
> - * you're one of them.
> - */
> -
> -#include "exec/memory.h"
> -
> -#ifndef CONFIG_USER_ONLY
> -
> -/* Get the root memory region.  This interface should only be used temporarily
> - * until a proper bus interface is available.
> - */
> -MemoryRegion *get_system_memory(void);
> -
> -/* Get the root I/O port region.  This interface should only be used
> - * temporarily until a proper bus interface is available.
> - */
> -MemoryRegion *get_system_io(void);
> -
> -extern AddressSpace address_space_memory;
> -extern AddressSpace address_space_io;
> -
> -#endif
> -
> -#endif
> diff --git a/include/exec/memory.h b/include/exec/memory.h
> index 9101fc3..bd75af9 100644
> --- a/include/exec/memory.h
> +++ b/include/exec/memory.h
> @@ -25,9 +25,7 @@
>  #include <stdbool.h>
>  #include "qemu-common.h"
>  #include "exec/cpu-common.h"
> -#ifndef CONFIG_USER_ONLY
>  #include "exec/hwaddr.h"
> -#endif
>  #include "qemu/queue.h"
>  #include "qemu/int128.h"
>  #include "qemu/notify.h"
> @@ -1052,6 +1050,19 @@ void address_space_unmap(AddressSpace *as, void *buffer, hwaddr len,
>                           int is_write, hwaddr access_len);
>
>
> -#endif
> +/* Get the root memory region.  This interface should only be used temporarily
> + * until a proper bus interface is available.
> + */
> +MemoryRegion *get_system_memory(void);
> +
> +/* Get the root I/O port region.  This interface should only be used
> + * temporarily until a proper bus interface is available.
> + */
> +MemoryRegion *get_system_io(void);
> +
> +extern AddressSpace address_space_memory;
> +extern AddressSpace address_space_io;
> +
> +#endif /* !CONFIG_USER_ONLY */
>
> -#endif
> +#endif /* MEMORY_H */
> diff --git a/include/hw/sh4/sh_intc.h b/include/hw/sh4/sh_intc.h
> index b7ddcb0..644acb7 100644
> --- a/include/hw/sh4/sh_intc.h
> +++ b/include/hw/sh4/sh_intc.h
> @@ -4,6 +4,7 @@
>  #include "qemu-common.h"
>  #include "hw/irq.h"
>  #include "exec/address-spaces.h"
> +#include "exec/memory.h"
>
>  typedef unsigned char intc_enum;
>
>

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

* Re: [Qemu-devel] [Discussion 08/10] exec: move TranslationBlock API from exec-all.h => translate.h
  2014-03-04  2:47 ` [Qemu-devel] [Discussion 08/10] exec: move TranslationBlock API from exec-all.h => translate.h Xuebing Wang
@ 2014-03-04 10:27   ` Paolo Bonzini
  0 siblings, 0 replies; 37+ messages in thread
From: Paolo Bonzini @ 2014-03-04 10:27 UTC (permalink / raw)
  To: Xuebing Wang, qemu-devel; +Cc: afaerber, stefanha

Il 04/03/2014 03:47, Xuebing Wang ha scritto:
> Signed-off-by: Xuebing Wang <xbing6@gmail.com>
> ---
>  include/exec/exec-all.h  |  302 +--------------------------------------------
>  include/exec/translate.h |  306 ++++++++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 307 insertions(+), 301 deletions(-)
>  create mode 100644 include/exec/translate.h

Very good idea.

Paolo

> diff --git a/include/exec/exec-all.h b/include/exec/exec-all.h
> index a387922..68a888f 100644
> --- a/include/exec/exec-all.h
> +++ b/include/exec/exec-all.h
> @@ -20,307 +20,7 @@
>  #ifndef _EXEC_ALL_H_
>  #define _EXEC_ALL_H_
>
> -#include "qemu-common.h"
> -
> -/* allow to see translation results - the slowdown should be negligible, so we leave it */
> -#define DEBUG_DISAS
> -
> -/* Page tracking code uses ram addresses in system mode, and virtual
> -   addresses in userspace mode.  Define tb_page_addr_t to be an appropriate
> -   type.  */
> -#if defined(CONFIG_USER_ONLY)
> -typedef abi_ulong tb_page_addr_t;
> -#else
> -typedef ram_addr_t tb_page_addr_t;
> -#endif
> -
> -/* is_jmp field values */
> -#define DISAS_NEXT    0 /* next instruction can be analyzed */
> -#define DISAS_JUMP    1 /* only pc was modified dynamically */
> -#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 208
> -
> -#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)
> -
> -/* Maximum size a TCG op can expand to.  This is complicated because a
> -   single op may require several host instructions and register reloads.
> -   For now take a wild guess at 192 bytes, which should allow at least
> -   a couple of fixup instructions per argument.  */
> -#define TCG_MAX_OP_SIZE 192
> -
> -#define OPPARAM_BUF_SIZE (OPC_BUF_SIZE * MAX_OPC_PARAM)
> -
> -#include "qemu/log.h"
> -
> -void gen_intermediate_code(CPUArchState *env, struct TranslationBlock *tb);
> -void gen_intermediate_code_pc(CPUArchState *env, struct TranslationBlock *tb);
> -void restore_state_to_opc(CPUArchState *env, struct TranslationBlock *tb,
> -                          int pc_pos);
> -
> -void cpu_gen_init(void);
> -int cpu_gen_code(CPUArchState *env, struct TranslationBlock *tb,
> -                 int *gen_code_size_ptr);
> -bool cpu_restore_state(CPUArchState *env, uintptr_t searched_pc);
> -void page_size_init(void);
> -
> -void QEMU_NORETURN cpu_resume_from_signal(CPUArchState *env1, void *puc);
> -void QEMU_NORETURN cpu_io_recompile(CPUArchState *env, uintptr_t retaddr);
> -TranslationBlock *tb_gen_code(CPUArchState *env,
> -                              target_ulong pc, target_ulong cs_base, int flags,
> -                              int cflags);
> -void cpu_exec_init(CPUArchState *env);
> -void QEMU_NORETURN cpu_loop_exit(CPUArchState *env1);
> -int page_unprotect(target_ulong address, uintptr_t pc, void *puc);
> -void tb_invalidate_phys_page_range(tb_page_addr_t start, tb_page_addr_t end,
> -                                   int is_cpu_write_access);
> -void tb_invalidate_phys_range(tb_page_addr_t start, tb_page_addr_t end,
> -                              int is_cpu_write_access);
> -#if !defined(CONFIG_USER_ONLY)
> -void tcg_cpu_address_space_init(CPUState *cpu, AddressSpace *as);
> -/* cputlb.c */
> -void tlb_flush_page(CPUArchState *env, target_ulong addr);
> -void tlb_flush(CPUArchState *env, int flush_global);
> -void tlb_set_page(CPUArchState *env, target_ulong vaddr,
> -                  hwaddr paddr, int prot,
> -                  int mmu_idx, target_ulong size);
> -void tb_invalidate_phys_addr(AddressSpace *as, hwaddr addr);
> -#else
> -static inline void tlb_flush_page(CPUArchState *env, target_ulong addr)
> -{
> -}
> -
> -static inline void tlb_flush(CPUArchState *env, int flush_global)
> -{
> -}
> -#endif
> -
> -#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 */
> -/* XXX: use a per code average code fragment size and modulate it
> -   according to the host CPU */
> -#if defined(CONFIG_SOFTMMU)
> -#define CODE_GEN_AVG_BLOCK_SIZE 128
> -#else
> -#define CODE_GEN_AVG_BLOCK_SIZE 64
> -#endif
> -
> -#if defined(__arm__) || defined(_ARCH_PPC) \
> -    || defined(__x86_64__) || defined(__i386__) \
> -    || defined(__sparc__) || defined(__aarch64__) \
> -    || defined(CONFIG_TCG_INTERPRETER)
> -#define USE_DIRECT_JUMP
> -#endif
> -
> -struct TranslationBlock {
> -    target_ulong pc;   /* simulated PC corresponding to this block (EIP + CS base) */
> -    target_ulong cs_base; /* CS base for this block */
> -    uint64_t flags; /* flags defining in which context the code was generated */
> -    uint16_t size;      /* size of target code for this block (1 <=
> -                           size <= TARGET_PAGE_SIZE) */
> -    uint16_t cflags;    /* compile flags */
> -#define CF_COUNT_MASK  0x7fff
> -#define CF_LAST_IO     0x8000 /* Last insn may be an IO access.  */
> -
> -    uint8_t *tc_ptr;    /* pointer to the translated code */
> -    /* next matching tb for physical address. */
> -    struct TranslationBlock *phys_hash_next;
> -    /* first and second physical page containing code. The lower bit
> -       of the pointer tells the index in page_next[] */
> -    struct TranslationBlock *page_next[2];
> -    tb_page_addr_t page_addr[2];
> -
> -    /* the following data are used to directly call another TB from
> -       the code of this one. */
> -    uint16_t tb_next_offset[2]; /* offset of original jump target */
> -#ifdef USE_DIRECT_JUMP
> -    uint16_t tb_jmp_offset[2]; /* offset of jump instruction */
> -#else
> -    uintptr_t tb_next[2]; /* address of jump generated code */
> -#endif
> -    /* list of TBs jumping to this one. This is a circular list using
> -       the two least significant bits of the pointers to tell what is
> -       the next pointer: 0 = jmp_next[0], 1 = jmp_next[1], 2 =
> -       jmp_first */
> -    struct TranslationBlock *jmp_next[2];
> -    struct TranslationBlock *jmp_first;
> -    uint32_t icount;
> -};
> -
> -#include "exec/spinlock.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 */
> -    spinlock_t tb_lock;
> -
> -    /* statistics */
> -    int tb_flush_count;
> -    int tb_phys_invalidate_count;
> -
> -    int tb_invalidated_flag;
> -};
> -
> -static inline unsigned int tb_jmp_cache_hash_page(target_ulong pc)
> -{
> -    target_ulong tmp;
> -    tmp = pc ^ (pc >> (TARGET_PAGE_BITS - TB_JMP_PAGE_BITS));
> -    return (tmp >> (TARGET_PAGE_BITS - TB_JMP_PAGE_BITS)) & TB_JMP_PAGE_MASK;
> -}
> -
> -static inline unsigned int tb_jmp_cache_hash_func(target_ulong pc)
> -{
> -    target_ulong tmp;
> -    tmp = pc ^ (pc >> (TARGET_PAGE_BITS - TB_JMP_PAGE_BITS));
> -    return (((tmp >> (TARGET_PAGE_BITS - TB_JMP_PAGE_BITS)) & TB_JMP_PAGE_MASK)
> -	    | (tmp & TB_JMP_ADDR_MASK));
> -}
> -
> -static inline unsigned int tb_phys_hash_func(tb_page_addr_t pc)
> -{
> -    return (pc >> 2) & (CODE_GEN_PHYS_HASH_SIZE - 1);
> -}
> -
> -void tb_free(TranslationBlock *tb);
> -void tb_flush(CPUArchState *env);
> -void tb_phys_invalidate(TranslationBlock *tb, tb_page_addr_t page_addr);
> -
> -#if defined(USE_DIRECT_JUMP)
> -
> -#if defined(CONFIG_TCG_INTERPRETER)
> -static inline void tb_set_jmp_target1(uintptr_t jmp_addr, uintptr_t addr)
> -{
> -    /* patch the branch destination */
> -    *(uint32_t *)jmp_addr = addr - (jmp_addr + 4);
> -    /* no need to flush icache explicitly */
> -}
> -#elif defined(_ARCH_PPC)
> -void ppc_tb_set_jmp_target(unsigned long jmp_addr, unsigned long addr);
> -#define tb_set_jmp_target1 ppc_tb_set_jmp_target
> -#elif defined(__i386__) || defined(__x86_64__)
> -static inline void tb_set_jmp_target1(uintptr_t jmp_addr, uintptr_t addr)
> -{
> -    /* patch the branch destination */
> -    *(uint32_t *)jmp_addr = addr - (jmp_addr + 4);
> -    /* no need to flush icache explicitly */
> -}
> -#elif defined(__aarch64__)
> -void aarch64_tb_set_jmp_target(uintptr_t jmp_addr, uintptr_t addr);
> -#define tb_set_jmp_target1 aarch64_tb_set_jmp_target
> -#elif defined(__arm__)
> -static inline void tb_set_jmp_target1(uintptr_t jmp_addr, uintptr_t addr)
> -{
> -#if !QEMU_GNUC_PREREQ(4, 1)
> -    register unsigned long _beg __asm ("a1");
> -    register unsigned long _end __asm ("a2");
> -    register unsigned long _flg __asm ("a3");
> -#endif
> -
> -    /* we could use a ldr pc, [pc, #-4] kind of branch and avoid the flush */
> -    *(uint32_t *)jmp_addr =
> -        (*(uint32_t *)jmp_addr & ~0xffffff)
> -        | (((addr - (jmp_addr + 8)) >> 2) & 0xffffff);
> -
> -#if QEMU_GNUC_PREREQ(4, 1)
> -    __builtin___clear_cache((char *) jmp_addr, (char *) jmp_addr + 4);
> -#else
> -    /* flush icache */
> -    _beg = jmp_addr;
> -    _end = jmp_addr + 4;
> -    _flg = 0;
> -    __asm __volatile__ ("swi 0x9f0002" : : "r" (_beg), "r" (_end), "r" (_flg));
> -#endif
> -}
> -#elif defined(__sparc__)
> -void tb_set_jmp_target1(uintptr_t jmp_addr, uintptr_t addr);
> -#else
> -#error tb_set_jmp_target1 is missing
> -#endif
> -
> -static inline void tb_set_jmp_target(TranslationBlock *tb,
> -                                     int n, uintptr_t addr)
> -{
> -    uint16_t offset = tb->tb_jmp_offset[n];
> -    tb_set_jmp_target1((uintptr_t)(tb->tc_ptr + offset), addr);
> -}
> -
> -#else
> -
> -/* set the jump target */
> -static inline void tb_set_jmp_target(TranslationBlock *tb,
> -                                     int n, uintptr_t addr)
> -{
> -    tb->tb_next[n] = addr;
> -}
> -
> -#endif
> -
> -static inline void tb_add_jump(TranslationBlock *tb, int n,
> -                               TranslationBlock *tb_next)
> -{
> -    /* NOTE: this test is only needed for thread safety */
> -    if (!tb->jmp_next[n]) {
> -        /* patch the native jump address */
> -        tb_set_jmp_target(tb, n, (uintptr_t)tb_next->tc_ptr);
> -
> -        /* add in TB jmp circular list */
> -        tb->jmp_next[n] = tb_next->jmp_first;
> -        tb_next->jmp_first = (TranslationBlock *)((uintptr_t)(tb) | (n));
> -    }
> -}
> -
> -/* GETRA is the true target of the return instruction that we'll execute,
> -   defined here for simplicity of defining the follow-up macros.  */
> -#if defined(CONFIG_TCG_INTERPRETER)
> -extern uintptr_t tci_tb_ptr;
> -# define GETRA() tci_tb_ptr
> -#else
> -# define GETRA() \
> -    ((uintptr_t)__builtin_extract_return_addr(__builtin_return_address(0)))
> -#endif
> -
> -/* The true return address will often point to a host insn that is part of
> -   the next translated guest insn.  Adjust the address backward to point to
> -   the middle of the call insn.  Subtracting one would do the job except for
> -   several compressed mode architectures (arm, mips) which set the low bit
> -   to indicate the compressed mode; subtracting two works around that.  It
> -   is also the case that there are no host isas that contain a call insn
> -   smaller than 4 bytes, so we don't worry about special-casing this.  */
> -#if defined(CONFIG_TCG_INTERPRETER)
> -# define GETPC_ADJ   0
> -#else
> -# define GETPC_ADJ   2
> -#endif
> -
> -#define GETPC()  (GETRA() - GETPC_ADJ)
> +#include "exec/translate.h"
>
>  #if !defined(CONFIG_USER_ONLY)
>
> diff --git a/include/exec/translate.h b/include/exec/translate.h
> new file mode 100644
> index 0000000..9e877f2
> --- /dev/null
> +++ b/include/exec/translate.h
> @@ -0,0 +1,306 @@
> +#ifndef EXEC_TRANSLATE_H
> +#define EXEC_TRANSLATE_H
> +
> +#include "qemu-common.h"
> +
> +/* allow to see translation results - the slowdown should be negligible, so we leave it */
> +#define DEBUG_DISAS
> +
> +/* Page tracking code uses ram addresses in system mode, and virtual
> +   addresses in userspace mode.  Define tb_page_addr_t to be an appropriate
> +   type.  */
> +#if defined(CONFIG_USER_ONLY)
> +typedef abi_ulong tb_page_addr_t;
> +#else
> +typedef ram_addr_t tb_page_addr_t;
> +#endif
> +
> +/* is_jmp field values */
> +#define DISAS_NEXT    0 /* next instruction can be analyzed */
> +#define DISAS_JUMP    1 /* only pc was modified dynamically */
> +#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 208
> +
> +#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)
> +
> +/* Maximum size a TCG op can expand to.  This is complicated because a
> +   single op may require several host instructions and register reloads.
> +   For now take a wild guess at 192 bytes, which should allow at least
> +   a couple of fixup instructions per argument.  */
> +#define TCG_MAX_OP_SIZE 192
> +
> +#define OPPARAM_BUF_SIZE (OPC_BUF_SIZE * MAX_OPC_PARAM)
> +
> +#include "qemu/log.h"
> +
> +void gen_intermediate_code(CPUArchState *env, struct TranslationBlock *tb);
> +void gen_intermediate_code_pc(CPUArchState *env, struct TranslationBlock *tb);
> +void restore_state_to_opc(CPUArchState *env, struct TranslationBlock *tb,
> +                          int pc_pos);
> +
> +void cpu_gen_init(void);
> +int cpu_gen_code(CPUArchState *env, struct TranslationBlock *tb,
> +                 int *gen_code_size_ptr);
> +bool cpu_restore_state(CPUArchState *env, uintptr_t searched_pc);
> +void page_size_init(void);
> +
> +void QEMU_NORETURN cpu_resume_from_signal(CPUArchState *env1, void *puc);
> +void QEMU_NORETURN cpu_io_recompile(CPUArchState *env, uintptr_t retaddr);
> +TranslationBlock *tb_gen_code(CPUArchState *env,
> +                              target_ulong pc, target_ulong cs_base, int flags,
> +                              int cflags);
> +void cpu_exec_init(CPUArchState *env);
> +void QEMU_NORETURN cpu_loop_exit(CPUArchState *env1);
> +int page_unprotect(target_ulong address, uintptr_t pc, void *puc);
> +void tb_invalidate_phys_page_range(tb_page_addr_t start, tb_page_addr_t end,
> +                                   int is_cpu_write_access);
> +void tb_invalidate_phys_range(tb_page_addr_t start, tb_page_addr_t end,
> +                              int is_cpu_write_access);
> +#if !defined(CONFIG_USER_ONLY)
> +void tcg_cpu_address_space_init(CPUState *cpu, AddressSpace *as);
> +/* cputlb.c */
> +void tlb_flush_page(CPUArchState *env, target_ulong addr);
> +void tlb_flush(CPUArchState *env, int flush_global);
> +void tlb_set_page(CPUArchState *env, target_ulong vaddr,
> +                  hwaddr paddr, int prot,
> +                  int mmu_idx, target_ulong size);
> +void tb_invalidate_phys_addr(AddressSpace *as, hwaddr addr);
> +#else
> +static inline void tlb_flush_page(CPUArchState *env, target_ulong addr)
> +{
> +}
> +
> +static inline void tlb_flush(CPUArchState *env, int flush_global)
> +{
> +}
> +#endif
> +
> +#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 */
> +/* XXX: use a per code average code fragment size and modulate it
> +   according to the host CPU */
> +#if defined(CONFIG_SOFTMMU)
> +#define CODE_GEN_AVG_BLOCK_SIZE 128
> +#else
> +#define CODE_GEN_AVG_BLOCK_SIZE 64
> +#endif
> +
> +#if defined(__arm__) || defined(_ARCH_PPC) \
> +    || defined(__x86_64__) || defined(__i386__) \
> +    || defined(__sparc__) || defined(__aarch64__) \
> +    || defined(CONFIG_TCG_INTERPRETER)
> +#define USE_DIRECT_JUMP
> +#endif
> +
> +struct TranslationBlock {
> +    target_ulong pc;   /* simulated PC corresponding to this block (EIP + CS base) */
> +    target_ulong cs_base; /* CS base for this block */
> +    uint64_t flags; /* flags defining in which context the code was generated */
> +    uint16_t size;      /* size of target code for this block (1 <=
> +                           size <= TARGET_PAGE_SIZE) */
> +    uint16_t cflags;    /* compile flags */
> +#define CF_COUNT_MASK  0x7fff
> +#define CF_LAST_IO     0x8000 /* Last insn may be an IO access.  */
> +
> +    uint8_t *tc_ptr;    /* pointer to the translated code */
> +    /* next matching tb for physical address. */
> +    struct TranslationBlock *phys_hash_next;
> +    /* first and second physical page containing code. The lower bit
> +       of the pointer tells the index in page_next[] */
> +    struct TranslationBlock *page_next[2];
> +    tb_page_addr_t page_addr[2];
> +
> +    /* the following data are used to directly call another TB from
> +       the code of this one. */
> +    uint16_t tb_next_offset[2]; /* offset of original jump target */
> +#ifdef USE_DIRECT_JUMP
> +    uint16_t tb_jmp_offset[2]; /* offset of jump instruction */
> +#else
> +    uintptr_t tb_next[2]; /* address of jump generated code */
> +#endif
> +    /* list of TBs jumping to this one. This is a circular list using
> +       the two least significant bits of the pointers to tell what is
> +       the next pointer: 0 = jmp_next[0], 1 = jmp_next[1], 2 =
> +       jmp_first */
> +    struct TranslationBlock *jmp_next[2];
> +    struct TranslationBlock *jmp_first;
> +    uint32_t icount;
> +};
> +
> +#include "exec/spinlock.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 */
> +    spinlock_t tb_lock;
> +
> +    /* statistics */
> +    int tb_flush_count;
> +    int tb_phys_invalidate_count;
> +
> +    int tb_invalidated_flag;
> +};
> +
> +static inline unsigned int tb_jmp_cache_hash_page(target_ulong pc)
> +{
> +    target_ulong tmp;
> +    tmp = pc ^ (pc >> (TARGET_PAGE_BITS - TB_JMP_PAGE_BITS));
> +    return (tmp >> (TARGET_PAGE_BITS - TB_JMP_PAGE_BITS)) & TB_JMP_PAGE_MASK;
> +}
> +
> +static inline unsigned int tb_jmp_cache_hash_func(target_ulong pc)
> +{
> +    target_ulong tmp;
> +    tmp = pc ^ (pc >> (TARGET_PAGE_BITS - TB_JMP_PAGE_BITS));
> +    return (((tmp >> (TARGET_PAGE_BITS - TB_JMP_PAGE_BITS)) & TB_JMP_PAGE_MASK)
> +	    | (tmp & TB_JMP_ADDR_MASK));
> +}
> +
> +static inline unsigned int tb_phys_hash_func(tb_page_addr_t pc)
> +{
> +    return (pc >> 2) & (CODE_GEN_PHYS_HASH_SIZE - 1);
> +}
> +
> +void tb_free(TranslationBlock *tb);
> +void tb_flush(CPUArchState *env);
> +void tb_phys_invalidate(TranslationBlock *tb, tb_page_addr_t page_addr);
> +
> +#if defined(USE_DIRECT_JUMP)
> +
> +#if defined(CONFIG_TCG_INTERPRETER)
> +static inline void tb_set_jmp_target1(uintptr_t jmp_addr, uintptr_t addr)
> +{
> +    /* patch the branch destination */
> +    *(uint32_t *)jmp_addr = addr - (jmp_addr + 4);
> +    /* no need to flush icache explicitly */
> +}
> +#elif defined(_ARCH_PPC)
> +void ppc_tb_set_jmp_target(unsigned long jmp_addr, unsigned long addr);
> +#define tb_set_jmp_target1 ppc_tb_set_jmp_target
> +#elif defined(__i386__) || defined(__x86_64__)
> +static inline void tb_set_jmp_target1(uintptr_t jmp_addr, uintptr_t addr)
> +{
> +    /* patch the branch destination */
> +    *(uint32_t *)jmp_addr = addr - (jmp_addr + 4);
> +    /* no need to flush icache explicitly */
> +}
> +#elif defined(__aarch64__)
> +void aarch64_tb_set_jmp_target(uintptr_t jmp_addr, uintptr_t addr);
> +#define tb_set_jmp_target1 aarch64_tb_set_jmp_target
> +#elif defined(__arm__)
> +static inline void tb_set_jmp_target1(uintptr_t jmp_addr, uintptr_t addr)
> +{
> +#if !QEMU_GNUC_PREREQ(4, 1)
> +    register unsigned long _beg __asm ("a1");
> +    register unsigned long _end __asm ("a2");
> +    register unsigned long _flg __asm ("a3");
> +#endif
> +
> +    /* we could use a ldr pc, [pc, #-4] kind of branch and avoid the flush */
> +    *(uint32_t *)jmp_addr =
> +        (*(uint32_t *)jmp_addr & ~0xffffff)
> +        | (((addr - (jmp_addr + 8)) >> 2) & 0xffffff);
> +
> +#if QEMU_GNUC_PREREQ(4, 1)
> +    __builtin___clear_cache((char *) jmp_addr, (char *) jmp_addr + 4);
> +#else
> +    /* flush icache */
> +    _beg = jmp_addr;
> +    _end = jmp_addr + 4;
> +    _flg = 0;
> +    __asm __volatile__ ("swi 0x9f0002" : : "r" (_beg), "r" (_end), "r" (_flg));
> +#endif
> +}
> +#elif defined(__sparc__)
> +void tb_set_jmp_target1(uintptr_t jmp_addr, uintptr_t addr);
> +#else
> +#error tb_set_jmp_target1 is missing
> +#endif
> +
> +static inline void tb_set_jmp_target(TranslationBlock *tb,
> +                                     int n, uintptr_t addr)
> +{
> +    uint16_t offset = tb->tb_jmp_offset[n];
> +    tb_set_jmp_target1((uintptr_t)(tb->tc_ptr + offset), addr);
> +}
> +
> +#else
> +
> +/* set the jump target */
> +static inline void tb_set_jmp_target(TranslationBlock *tb,
> +                                     int n, uintptr_t addr)
> +{
> +    tb->tb_next[n] = addr;
> +}
> +
> +#endif
> +
> +static inline void tb_add_jump(TranslationBlock *tb, int n,
> +                               TranslationBlock *tb_next)
> +{
> +    /* NOTE: this test is only needed for thread safety */
> +    if (!tb->jmp_next[n]) {
> +        /* patch the native jump address */
> +        tb_set_jmp_target(tb, n, (uintptr_t)tb_next->tc_ptr);
> +
> +        /* add in TB jmp circular list */
> +        tb->jmp_next[n] = tb_next->jmp_first;
> +        tb_next->jmp_first = (TranslationBlock *)((uintptr_t)(tb) | (n));
> +    }
> +}
> +
> +/* GETRA is the true target of the return instruction that we'll execute,
> +   defined here for simplicity of defining the follow-up macros.  */
> +#if defined(CONFIG_TCG_INTERPRETER)
> +extern uintptr_t tci_tb_ptr;
> +# define GETRA() tci_tb_ptr
> +#else
> +# define GETRA() \
> +    ((uintptr_t)__builtin_extract_return_addr(__builtin_return_address(0)))
> +#endif
> +
> +/* The true return address will often point to a host insn that is part of
> +   the next translated guest insn.  Adjust the address backward to point to
> +   the middle of the call insn.  Subtracting one would do the job except for
> +   several compressed mode architectures (arm, mips) which set the low bit
> +   to indicate the compressed mode; subtracting two works around that.  It
> +   is also the case that there are no host isas that contain a call insn
> +   smaller than 4 bytes, so we don't worry about special-casing this.  */
> +#if defined(CONFIG_TCG_INTERPRETER)
> +# define GETPC_ADJ   0
> +#else
> +# define GETPC_ADJ   2
> +#endif
> +
> +#define GETPC()  (GETRA() - GETPC_ADJ)
> +
> +#endif /* EXEC_TRANSLATE_H */
>

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

* Re: [Qemu-devel] [Discussion 09/10] exec: remove the unnecessary include of "exec-all.h"
  2014-03-04  2:47 ` [Qemu-devel] [Discussion 09/10] exec: remove the unnecessary include of "exec-all.h" Xuebing Wang
@ 2014-03-04 10:27   ` Paolo Bonzini
  2014-03-04 11:11   ` Peter Maydell
  1 sibling, 0 replies; 37+ messages in thread
From: Paolo Bonzini @ 2014-03-04 10:27 UTC (permalink / raw)
  To: Xuebing Wang, qemu-devel; +Cc: afaerber, stefanha

Il 04/03/2014 03:47, Xuebing Wang ha scritto:
> include/exec/exec-all.h should ONLY be included in target-xxx/*
> -   'git grep -nw exec-all.h' confirms this

Ok.

Paolo

> Signed-off-by: Xuebing Wang <xbing6@gmail.com>
> ---
>  cputlb.c   |    1 -
>  tcg/README |    2 +-
>  tci.c      |    2 +-
>  3 files changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/cputlb.c b/cputlb.c
> index 724bdda..f1458a6 100644
> --- a/cputlb.c
> +++ b/cputlb.c
> @@ -23,7 +23,6 @@
>  #include "cpu.h" /* target-xxx/cpu.h, required for CPUArchState etc */
>
>  #include "config.h"
> -#include "exec/exec-all.h"
>  #include "exec/memory.h"
>
>  #include "exec/cputlb.h"
> diff --git a/tcg/README b/tcg/README
> index f178212..0788bdc 100644
> --- a/tcg/README
> +++ b/tcg/README
> @@ -530,7 +530,7 @@ register.
>    inline TCG may still be faster for longer sequences.
>
>  - The hard limit on the number of TCG instructions you can generate
> -  per guest instruction is set by MAX_OP_PER_INSTR in exec-all.h --
> +  per guest instruction is set by MAX_OP_PER_INSTR in translate.h --
>    you cannot exceed this without risking a buffer overrun.
>
>  - Use the 'discard' instruction if you know that TCG won't be able to
> diff --git a/tci.c b/tci.c
> index 0202ed9..7b9d0af 100644
> --- a/tci.c
> +++ b/tci.c
> @@ -25,7 +25,7 @@
>  #endif
>
>  #include "qemu-common.h"
> -#include "exec/exec-all.h"           /* MAX_OPC_PARAM_IARGS */
> +#include "exec/translate.h"           /* MAX_OPC_PARAM_IARGS */
>  #include "tcg-op.h"
>
>  /* Marker for missing code. */
>

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

* Re: [Qemu-devel] [Discussion 10/10] translate: remove file translate-all.h
  2014-03-04  2:47 ` [Qemu-devel] [Discussion 10/10] translate: remove file translate-all.h Xuebing Wang
@ 2014-03-04 10:29   ` Paolo Bonzini
  0 siblings, 0 replies; 37+ messages in thread
From: Paolo Bonzini @ 2014-03-04 10:29 UTC (permalink / raw)
  To: Xuebing Wang, qemu-devel; +Cc: afaerber, stefanha

Il 04/03/2014 03:47, Xuebing Wang ha scritto:
> This patch does below:
> -   Move the declaration of 2 translate functions from translate-all.h into
>     include/exec/translate.h
> -   remove file translate-all.h

No, this is backwards. :)

translate-all.h is a private interface between exec.c and translate-all.c.

What you really want is to remove the inclusion of exec/translate.h from 
exec/exec-all.h.  And possibly also the inclusion of exec/exec-all.h 
from */cpu.h.  Both of these are quite complex, however.

Paolo

> Signed-off-by: Xuebing Wang <xbing6@gmail.com>
> ---
>  exec.c                   |    2 --
>  include/exec/translate.h |    4 ++++
>  translate-all.c          |    2 +-
>  translate-all.h          |   27 ---------------------------
>  4 files changed, 5 insertions(+), 30 deletions(-)
>  delete mode 100644 translate-all.h
>
> diff --git a/exec.c b/exec.c
> index ffbd26c..ee52b3b 100644
> --- a/exec.c
> +++ b/exec.c
> @@ -44,8 +44,6 @@
>  #endif
>
>  #include "exec/cputlb.h"
> -#include "translate-all.h"
> -
>  #include "exec/memory-internal.h"
>  #include "exec/ram_addr.h"
>  #include "qemu/cache-utils.h"
> diff --git a/include/exec/translate.h b/include/exec/translate.h
> index 9e877f2..42895b4 100644
> --- a/include/exec/translate.h
> +++ b/include/exec/translate.h
> @@ -303,4 +303,8 @@ extern uintptr_t tci_tb_ptr;
>
>  #define GETPC()  (GETRA() - GETPC_ADJ)
>
> +/* translate-all.c */
> +void tb_invalidate_phys_page_fast(tb_page_addr_t start, int len);
> +void tb_check_watchpoint(CPUArchState *env);
> +
>  #endif /* EXEC_TRANSLATE_H */
> diff --git a/translate-all.c b/translate-all.c
> index 98e215f..975f823 100644
> --- a/translate-all.c
> +++ b/translate-all.c
> @@ -61,7 +61,7 @@
>  #endif
>
>  #include "exec/cputlb.h"
> -#include "translate-all.h"
> +#include "exec/translate.h"
>  #include "qemu/timer.h"
>
>  //#define DEBUG_TB_INVALIDATE
> diff --git a/translate-all.h b/translate-all.h
> deleted file mode 100644
> index f7e5932..0000000
> --- a/translate-all.h
> +++ /dev/null
> @@ -1,27 +0,0 @@
> -/*
> - *  Translated block handling
> - *
> - *  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 TRANSLATE_ALL_H
> -#define TRANSLATE_ALL_H
> -
> -/* translate-all.c */
> -void tb_invalidate_phys_page_fast(tb_page_addr_t start, int len);
> -void cpu_unlink_tb(CPUState *cpu);
> -void tb_check_watchpoint(CPUArchState *env);
> -
> -#endif /* TRANSLATE_ALL_H */
>

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

* Re: [Qemu-devel] [Discussion 04/10] memory_mapping: make this architecture-independent
  2014-03-04  2:47 ` [Qemu-devel] [Discussion 04/10] memory_mapping: make this architecture-independent Xuebing Wang
  2014-03-04 10:22   ` Paolo Bonzini
@ 2014-03-04 11:05   ` Peter Maydell
  1 sibling, 0 replies; 37+ messages in thread
From: Peter Maydell @ 2014-03-04 11:05 UTC (permalink / raw)
  To: Xuebing Wang
  Cc: Paolo Bonzini, QEMU Developers, Stefan Hajnoczi,
	Andreas Färber

On 4 March 2014 02:47, Xuebing Wang <xbing6@gmail.com> wrote:
> Use vaddr (instead of target_ulong) for virtual address. See document HACKING
> for more information about vaddr and target_ulong.
>
> Signed-off-by: Xuebing Wang <xbing6@gmail.com>
> ---
>  include/sysemu/memory_mapping.h |    3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/include/sysemu/memory_mapping.h b/include/sysemu/memory_mapping.h
> index a75d59a..4a5f7be 100644
> --- a/include/sysemu/memory_mapping.h
> +++ b/include/sysemu/memory_mapping.h
> @@ -16,6 +16,7 @@
>
>  #include "qemu/queue.h"
>  #include "qemu/typedefs.h"
> +#include "qom/cpu.h" /* for vaddr */
>
>  typedef struct GuestPhysBlock {
>      /* visible to guest, reflects PCI hole, etc */
> @@ -39,7 +40,7 @@ typedef struct GuestPhysBlockList {
>  /* The physical and virtual address in the memory mapping are contiguous. */
>  typedef struct MemoryMapping {
>      hwaddr phys_addr;
> -    target_ulong virt_addr;
> +    vaddr virt_addr;
>      ram_addr_t length;
>      QTAILQ_ENTRY(MemoryMapping) next;
>  } MemoryMapping;
> --
> 1.7.9.5

If we're going to do this we should be consistent in this API:
at the moment most of the functions (private or otherwise)
in memory_mapping.c use "hwaddr" for virtual addresses.
It seems like a good idea, though.

thanks
-- PMM

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

* Re: [Qemu-devel] [Discussion 09/10] exec: remove the unnecessary include of "exec-all.h"
  2014-03-04  2:47 ` [Qemu-devel] [Discussion 09/10] exec: remove the unnecessary include of "exec-all.h" Xuebing Wang
  2014-03-04 10:27   ` Paolo Bonzini
@ 2014-03-04 11:11   ` Peter Maydell
  2014-03-04 11:16     ` Peter Maydell
  1 sibling, 1 reply; 37+ messages in thread
From: Peter Maydell @ 2014-03-04 11:11 UTC (permalink / raw)
  To: Xuebing Wang
  Cc: Paolo Bonzini, QEMU Developers, Stefan Hajnoczi,
	Andreas Färber

On 4 March 2014 02:47, Xuebing Wang <xbing6@gmail.com> wrote:
> include/exec/exec-all.h should ONLY be included in target-xxx/*

Why?

This header file defines a number of functions and types
that are used outside target-xxx/. At the moment we implicitly
rely on cpu.h pulling them in. Maybe it would be nice to split
out the things that only the target frontends care about from
APIs used by other parts of QEMU, but that's not what this patch
is doing.

thanks
-- PMM

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

* Re: [Qemu-devel] [Discussion 09/10] exec: remove the unnecessary include of "exec-all.h"
  2014-03-04 11:11   ` Peter Maydell
@ 2014-03-04 11:16     ` Peter Maydell
  0 siblings, 0 replies; 37+ messages in thread
From: Peter Maydell @ 2014-03-04 11:16 UTC (permalink / raw)
  To: Xuebing Wang
  Cc: Paolo Bonzini, QEMU Developers, Stefan Hajnoczi,
	Andreas Färber

On 4 March 2014 11:11, Peter Maydell <peter.maydell@linaro.org> wrote:
> On 4 March 2014 02:47, Xuebing Wang <xbing6@gmail.com> wrote:
>> include/exec/exec-all.h should ONLY be included in target-xxx/*
>
> Why?
>
> This header file defines a number of functions and types
> that are used outside target-xxx/. At the moment we implicitly
> rely on cpu.h pulling them in.

My question still stands, but this bit is wrong:

> Maybe it would be nice to split
> out the things that only the target frontends care about from
> APIs used by other parts of QEMU, but that's not what this patch
> is doing.

...because that is what patch 8 does. Sorry, read those out of order.

thanks
-- PMM

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

* Re: [Qemu-devel] [Discussion 02/10] NEED_CPU_H: remove '#include "cpu.h"' from include/qemu-common.h
  2014-03-04 10:19   ` Paolo Bonzini
@ 2014-03-04 11:54     ` Xuebing wang
  2014-03-04 12:02     ` Xuebing wang
                       ` (3 subsequent siblings)
  4 siblings, 0 replies; 37+ messages in thread
From: Xuebing wang @ 2014-03-04 11:54 UTC (permalink / raw)
  To: Paolo Bonzini, qemu-devel; +Cc: afaerber, stefanha

Hi Paolo, thanks for reviewing.


On 03/04/2014 06:19 PM, Paolo Bonzini wrote:
> Hi,
>
> in general I agree with this patch.  I have a few comments, and I 
> suggest that you split it in multiple patches so that it's easier to 
> get it in when each part is ready.

I spent some time trying to reduce it. I may be wrong, but this is the 
smallest patch I can get to get all targets (linuxuser vs softmmu, kvm 
enable/disable) build.

>
>> diff --git a/hw/dma/soc_dma.c b/hw/dma/soc_dma.c
>> index c06aabb..950f3ec 100644
>> --- a/hw/dma/soc_dma.c
>> +++ b/hw/dma/soc_dma.c
>> @@ -21,6 +21,11 @@
>>  #include "qemu/timer.h"
>>  #include "hw/arm/soc_dma.h"
>>
>> +#ifndef NEED_CPU_H
>> +#error target-xxx/cpu.h must be included because target-specific are 
>> required
>> +#endif
>
> Not needed; include/exec/cpu-defs.h already has a similar #error.

I guess this is my personal preference.

My original idea is to emphasize that this *whole* file is 
"target-specific", as "target-independent" vs "target-specific" is 
important for qemu framework (everything except target-xxx, tcg backend 
and hw/arch*/). Ideally all qemu framework is designed to be 
target-independent, right?

In my docs/api-hierarchy.txt, I am trying my best to illustrate what are 
"target-independent", and what are "target-specific".

cpu-defs.h is NOT included in this file.

The idea is the same for the rest "#ifndef NEED_CPU_H"

     Why use "#ifndef NEED_CPU_H, then #error ...", is because 
"target-xxx/cpu.h"
     is better included for the whole file.

     If "target-xxx/cpu.h" is only needed for part of the file, use
     "#ifdef NEED_CPU_H, then #include "cpu.h"".


Thanks.

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

* Re: [Qemu-devel] [Discussion 01/10] docs: add docs/api-hierarchy.txt
  2014-03-04  9:58     ` Xuebing wang
@ 2014-03-04 11:57       ` Stefan Hajnoczi
  0 siblings, 0 replies; 37+ messages in thread
From: Stefan Hajnoczi @ 2014-03-04 11:57 UTC (permalink / raw)
  To: Xuebing wang; +Cc: Stefan Hajnoczi, qemu-devel, afaerber, pbonzini

On Tue, Mar 04, 2014 at 05:58:13PM +0800, Xuebing wang wrote:
> 
> On 03/04/2014 05:42 PM, Stefan Hajnoczi wrote:
> >On Tue, Mar 04, 2014 at 10:47:21AM +0800, Xuebing Wang wrote:
> >>Signed-off-by: Xuebing Wang <xbing6@gmail.com>
> >>---
> >>  docs/api-hierarchy.txt |   93 ++++++++++++++++++++++++++++++++++++++++++++++++
> >>  1 file changed, 93 insertions(+)
> >>  create mode 100644 docs/api-hierarchy.txt
> >This type of documentation gets outdated really quickly.  I'm not sure
> >it should be merged.
> >
> >Documenting the various APIs as doc comments in the code would have a
> >better chance of staying up-to-date.
> >
> 
> Thanks. But, doc comments in the code don't show the hierarchy and
> their dependencies (or inheriting relationship).
> 
> Any idea how to draw the hierarchy to show the big picture of the
> APIs (as a high-level API design doc)? :-)

We do have high-level documentation for specific modules.  For example,
see include/qom/object.h.  It documents more than just individual
functions.  So if you want to find out about QEMU Object Model, then
object.h has the documentation you need to get the big picture *and*
understand the APIs.

The relationships between modules are a different issue.  I don't think
it's worth trying to document them because they will get out of date.
What's worse than no documentation?  Incorrect documentation.

QEMU does not have a stable API, things can change at any time.  This
has many benefits but also the drawback that documentation gets outdated
quickly.  I don't think it's a good idea to give the impression that
things are stable when they are not.

In other words, module-level documentation is good but high-level API
design doesn't exist because we don't have a stable API.

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

* Re: [Qemu-devel] [Discussion 02/10] NEED_CPU_H: remove '#include "cpu.h"' from include/qemu-common.h
  2014-03-04 10:19   ` Paolo Bonzini
  2014-03-04 11:54     ` Xuebing wang
@ 2014-03-04 12:02     ` Xuebing wang
  2014-03-04 12:09       ` Paolo Bonzini
  2014-03-04 12:09     ` Xuebing wang
                       ` (2 subsequent siblings)
  4 siblings, 1 reply; 37+ messages in thread
From: Xuebing wang @ 2014-03-04 12:02 UTC (permalink / raw)
  To: Paolo Bonzini, qemu-devel; +Cc: afaerber, stefanha


>> diff --git a/include/disas/disas.h b/include/disas/disas.h
>> index c13ca9a..e5cdfd7 100644
>> --- a/include/disas/disas.h
>> +++ b/include/disas/disas.h
>> @@ -1,9 +1,9 @@
>>  #ifndef _QEMU_DISAS_H
>>  #define _QEMU_DISAS_H
>>
>> -#include "qemu-common.h"
>> -
>>  #ifdef NEED_CPU_H
>> +#include "cpu.h" /* target-xxx/cpu.h, required for target_ulong,
>> +                    CPUArchState */
>>  /* Disassemble this for me please... (debugging). */
>>  void disas(FILE *out, void *code, unsigned long size);
>>  void target_disas(FILE *out, CPUArchState *env, target_ulong code,
>> @@ -14,7 +14,7 @@ void monitor_disas(Monitor *mon, CPUArchState *env,
>>
>>  /* Look up symbol for debugging purpose.  Returns "" if unknown. */
>>  const char *lookup_symbol(target_ulong orig_addr);
>> -#endif
>> +#endif /* NEED_CPU_H */
>
> Perhaps the file that includes disas/disas.h can instead include cpu.h 
> too?  Most of them already do:
>
> $ git grep -L include.*cpu.h $(git grep -l disas/disas.h)
> bsd-user/elfload.c
> hw/core/loader.c
> linux-user/elfload.c
> vl.c
>
> Of these, vl.c and linux-user/elfload.c should not include 
> disas/disas.h at all, and hw/core/loader.c is !NEED_CPU_H.  So there 
> are just two files where you can add a #include "cpu.h" manually.
>

My idea is to keep disas/disas.h correct just by itself, regardless how 
it's used by *.c files.

I have almost zero knowledge about static code analyzer, I am not sure 
whether disas.h can pass it without
including "cpu.h"

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

* Re: [Qemu-devel] [Discussion 02/10] NEED_CPU_H: remove '#include "cpu.h"' from include/qemu-common.h
  2014-03-04 10:19   ` Paolo Bonzini
  2014-03-04 11:54     ` Xuebing wang
  2014-03-04 12:02     ` Xuebing wang
@ 2014-03-04 12:09     ` Xuebing wang
  2014-03-04 12:34       ` Peter Maydell
  2014-03-04 12:19     ` Xuebing wang
  2014-03-04 12:26     ` Xuebing wang
  4 siblings, 1 reply; 37+ messages in thread
From: Xuebing wang @ 2014-03-04 12:09 UTC (permalink / raw)
  To: Paolo Bonzini, qemu-devel; +Cc: afaerber, stefanha


>> diff --git a/include/exec/gdbstub.h b/include/exec/gdbstub.h
>> index a608a26..14addcb 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" /* target-xxx/cpu.h, required for target_ulong,
>> +                    CPUArchState */
>>  typedef void (*gdb_syscall_complete_cb)(CPUState *cpu,
>>                                          target_ulong ret, 
>> target_ulong err);
>>
>> @@ -76,7 +78,7 @@ static inline int gdb_get_reg64(uint8_t *mem_buf, 
>> uint64_t val)
>>  #define ldtul_p(addr) ldl_p(addr)
>>  #endif
>>
>> -#endif
>> +#endif /* NEED_CPU_H */
>>
>>  #ifdef CONFIG_USER_ONLY
>>  int gdbserver_start(int);
>
> Same here: I'd rather add a cpu.h inclusion to the following files:
>
> cpus.c
> target-alpha/gdbstub.c
> target-arm/gdbstub.c
> target-arm/gdbstub64.c
> target-cris/gdbstub.c
> target-i386/gdbstub.c
> target-lm32/gdbstub.c
> target-m68k/gdbstub.c
> target-microblaze/gdbstub.c
> target-mips/gdbstub.c
> target-openrisc/gdbstub.c
> target-ppc/gdbstub.c
> target-ppc/translate_init.c
> target-s390x/gdbstub.c
> target-sh4/gdbstub.c
> target-sparc/gdbstub.c
> target-xtensa/gdbstub.c
>

I personally prefer keeping gdbstub.h correct by itself. I am not sure 
if this is only my personal preference or not.

target-*/gdbstub.c implementers only need to know gdbstub hooks (thus 
gdbstub API), they don't care "cpu.h", although knowledge of "cpu.h" helps.

Agree?

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

* Re: [Qemu-devel] [Discussion 02/10] NEED_CPU_H: remove '#include "cpu.h"' from include/qemu-common.h
  2014-03-04 12:02     ` Xuebing wang
@ 2014-03-04 12:09       ` Paolo Bonzini
  0 siblings, 0 replies; 37+ messages in thread
From: Paolo Bonzini @ 2014-03-04 12:09 UTC (permalink / raw)
  To: Xuebing wang, qemu-devel; +Cc: afaerber, stefanha

Il 04/03/2014 13:02, Xuebing wang ha scritto:
>>
>> Of these, vl.c and linux-user/elfload.c should not include
>> disas/disas.h at all, and hw/core/loader.c is !NEED_CPU_H.  So there
>> are just two files where you can add a #include "cpu.h" manually.
>>
>
> My idea is to keep disas/disas.h correct just by itself, regardless how
> it's used by *.c files.

In general, it's a good idea to make headers self-contained by 
recursively including whatever's necessary.

However, there are a few very central headers that are just too 
complicated to make self-consistent without introducing circular references.

In particular, for QEMU these are qemu-common.h and cpu.h (and also 
others, such as exec-all.h but perhaps the solution there is to split 
them).  It's much simpler to ask people to include these two files in 
the C files.

Paolo

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

* Re: [Qemu-devel] [Discussion 02/10] NEED_CPU_H: remove '#include "cpu.h"' from include/qemu-common.h
  2014-03-04 10:19   ` Paolo Bonzini
                       ` (2 preceding siblings ...)
  2014-03-04 12:09     ` Xuebing wang
@ 2014-03-04 12:19     ` Xuebing wang
  2014-03-04 12:23       ` Paolo Bonzini
  2014-03-04 12:26     ` Xuebing wang
  4 siblings, 1 reply; 37+ messages in thread
From: Xuebing wang @ 2014-03-04 12:19 UTC (permalink / raw)
  To: Paolo Bonzini, qemu-devel; +Cc: afaerber, stefanha


>> index 367eda1..f0157e3 100644
>> --- a/include/qom/cpu.h
>> +++ b/include/qom/cpu.h
>> @@ -510,18 +510,4 @@ void qemu_init_vcpu(CPUState *cpu);
>>   */
>>  void cpu_single_step(CPUState *cpu, int enabled);
>>
>> -#ifdef CONFIG_SOFTMMU
>> -extern const struct VMStateDescription vmstate_cpu_common;
>> -#else
>> -#define vmstate_cpu_common vmstate_dummy
>> -#endif
>> -
>> -#define VMSTATE_CPU() 
>> {                                                     \
>> -    .name = "parent_obj", \
>> -    .size = sizeof(CPUState), \
>> -    .vmsd = &vmstate_cpu_common, \
>> -    .flags = 
>> VMS_STRUCT,                                                    \
>> -    .offset = 
>> 0,                                                            \
>> -}
>> -
>
> Like Andreas I don't like this particularly.  You can add 
> migration/vmstate.h to qom/cpu.h instead.
>

In my humble opinion, qom/cpu is part of virtual machine along with 
other hw peripherals, thus I'd prefer vmstate to depend on qom/cpu.

 From object oriented design perspective, qom/cpu is one-level lower 
than the modeling of virtual machine, do you agree?

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

* Re: [Qemu-devel] [Discussion 02/10] NEED_CPU_H: remove '#include "cpu.h"' from include/qemu-common.h
  2014-03-04 12:19     ` Xuebing wang
@ 2014-03-04 12:23       ` Paolo Bonzini
  0 siblings, 0 replies; 37+ messages in thread
From: Paolo Bonzini @ 2014-03-04 12:23 UTC (permalink / raw)
  To: Xuebing wang, qemu-devel; +Cc: afaerber, stefanha

Il 04/03/2014 13:19, Xuebing wang ha scritto:
>>
>> Like Andreas I don't like this particularly.  You can add
>> migration/vmstate.h to qom/cpu.h instead.
>>
>
> In my humble opinion, qom/cpu is part of virtual machine along with
> other hw peripherals, thus I'd prefer vmstate to depend on qom/cpu.
>
> From object oriented design perspective, qom/cpu is one-level lower than
> the modeling of virtual machine, do you agree?

vmstate is just the name of the infrastructure that takes a description 
of a struct's fields and serializes it onto a QEMUFile.  If you look at 
include/migration, there's nothing that is specific to virtual machines 
except perhaps the declaration of two functions vmstate_register_ram and 
vmstate_unregister_ram.

Paolo

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

* Re: [Qemu-devel] [Discussion 02/10] NEED_CPU_H: remove '#include "cpu.h"' from include/qemu-common.h
  2014-03-04 10:19   ` Paolo Bonzini
                       ` (3 preceding siblings ...)
  2014-03-04 12:19     ` Xuebing wang
@ 2014-03-04 12:26     ` Xuebing wang
  2014-03-04 12:29       ` Paolo Bonzini
  4 siblings, 1 reply; 37+ messages in thread
From: Xuebing wang @ 2014-03-04 12:26 UTC (permalink / raw)
  To: Paolo Bonzini, qemu-devel; +Cc: afaerber, stefanha


>>  #ifdef CONFIG_KVM
>>  #include <linux/kvm.h>
>>  #include <linux/kvm_para.h>
>> @@ -169,6 +178,7 @@ int kvm_init_vcpu(CPUState *cpu);
>>  int kvm_cpu_exec(CPUState *cpu);
>>
>>  #ifdef NEED_CPU_H
>> +#include "cpu.h" /* target-xxx/cpu.h, required for target_ulong */
>>
>>  void kvm_setup_guest_memory(void *start, size_t size);
>>  void kvm_flush_coalesced_mmio_buffer(void);
>
> Perhaps move debugging-related definitions to a new file 
> sysemu/kvm-debug.h and include it only from gdbstub.c, kvm-all.c, 
> kvm-stub.c, target-*/kvm.c.
>

Thanks for suggestion. This patch is strictly confined to "NEED_CPU_H" 
and making qemu build. :-)

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

* Re: [Qemu-devel] [Discussion 02/10] NEED_CPU_H: remove '#include "cpu.h"' from include/qemu-common.h
  2014-03-04 12:26     ` Xuebing wang
@ 2014-03-04 12:29       ` Paolo Bonzini
  0 siblings, 0 replies; 37+ messages in thread
From: Paolo Bonzini @ 2014-03-04 12:29 UTC (permalink / raw)
  To: Xuebing wang, qemu-devel; +Cc: afaerber, stefanha

Il 04/03/2014 13:26, Xuebing wang ha scritto:
>>>
>>>  #ifdef NEED_CPU_H
>>> +#include "cpu.h" /* target-xxx/cpu.h, required for target_ulong */
>>>
>>>  void kvm_setup_guest_memory(void *start, size_t size);
>>>  void kvm_flush_coalesced_mmio_buffer(void);
>>
>> Perhaps move debugging-related definitions to a new file
>> sysemu/kvm-debug.h and include it only from gdbstub.c, kvm-all.c,
>> kvm-stub.c, target-*/kvm.c.
>>
>
> Thanks for suggestion. This patch is strictly confined to "NEED_CPU_H"
> and making qemu build. :-)

Making QEMU build is not a good idea if it complicates things.  Adding 
dependencies to a file complicates things.  What you're doing here is 
taking dependencies out of one central file (qemu-common.h) and adding 
it to a dozen peripheral files.  This complicates things.

Removing "#ifdef NEED_CPU_H" can be a good idea, but it has to make 
things simpler, otherwise it is not a good idea anymore.

Paolo

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

* Re: [Qemu-devel] [Discussion 02/10] NEED_CPU_H: remove '#include "cpu.h"' from include/qemu-common.h
  2014-03-04 12:09     ` Xuebing wang
@ 2014-03-04 12:34       ` Peter Maydell
  2014-03-04 12:40         ` Xuebing wang
  0 siblings, 1 reply; 37+ messages in thread
From: Peter Maydell @ 2014-03-04 12:34 UTC (permalink / raw)
  To: Xuebing wang
  Cc: Paolo Bonzini, QEMU Developers, Stefan Hajnoczi,
	Andreas Färber

On 4 March 2014 12:09, Xuebing wang <xbing6@gmail.com> wrote:
> target-*/gdbstub.c implementers only need to know gdbstub hooks (thus
> gdbstub API), they don't care "cpu.h", although knowledge of "cpu.h" helps.

The gdbstub.c code is just a tiny part of the target-* frontend; there
is no way that anybody working on the gdbstub isn't going to know
already about the cpu.h interfaces. In particular, the code in those
files is generally implementing the gdbstub interfaces by looking
at the internal details of the target CPU. The only reason they don't
just include cpu.h is simply that at the moment qemu-common.h
does it for them.

thanks
-- PMM

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

* Re: [Qemu-devel] [Discussion 02/10] NEED_CPU_H: remove '#include "cpu.h"' from include/qemu-common.h
  2014-03-04 12:34       ` Peter Maydell
@ 2014-03-04 12:40         ` Xuebing wang
  0 siblings, 0 replies; 37+ messages in thread
From: Xuebing wang @ 2014-03-04 12:40 UTC (permalink / raw)
  To: Peter Maydell
  Cc: Paolo Bonzini, QEMU Developers, Stefan Hajnoczi,
	Andreas Färber

Hi Peter,

Thanks. You are correct, I don't know what I was thinking. :-)


On 03/04/2014 08:34 PM, Peter Maydell wrote:
> On 4 March 2014 12:09, Xuebing wang <xbing6@gmail.com> wrote:
>> target-*/gdbstub.c implementers only need to know gdbstub hooks (thus
>> gdbstub API), they don't care "cpu.h", although knowledge of "cpu.h" helps.
> The gdbstub.c code is just a tiny part of the target-* frontend; there
> is no way that anybody working on the gdbstub isn't going to know
> already about the cpu.h interfaces. In particular, the code in those
> files is generally implementing the gdbstub interfaces by looking
> at the internal details of the target CPU. The only reason they don't
> just include cpu.h is simply that at the moment qemu-common.h
> does it for them.
>
> thanks
> -- PMM
>

-- 
Thanks,
Xuebing Wang

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

end of thread, other threads:[~2014-03-04 12:41 UTC | newest]

Thread overview: 37+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-04  2:47 [Qemu-devel] [Discussion 00/10] about API hierarchy Xuebing Wang
2014-03-04  2:47 ` [Qemu-devel] [Discussion 01/10] docs: add docs/api-hierarchy.txt Xuebing Wang
2014-03-04  9:42   ` Stefan Hajnoczi
2014-03-04  9:58     ` Xuebing wang
2014-03-04 11:57       ` Stefan Hajnoczi
2014-03-04  2:47 ` [Qemu-devel] [Discussion 02/10] NEED_CPU_H: remove '#include "cpu.h"' from include/qemu-common.h Xuebing Wang
2014-03-04 10:19   ` Paolo Bonzini
2014-03-04 11:54     ` Xuebing wang
2014-03-04 12:02     ` Xuebing wang
2014-03-04 12:09       ` Paolo Bonzini
2014-03-04 12:09     ` Xuebing wang
2014-03-04 12:34       ` Peter Maydell
2014-03-04 12:40         ` Xuebing wang
2014-03-04 12:19     ` Xuebing wang
2014-03-04 12:23       ` Paolo Bonzini
2014-03-04 12:26     ` Xuebing wang
2014-03-04 12:29       ` Paolo Bonzini
2014-03-04  2:47 ` [Qemu-devel] [Discussion 03/10] NEED_CPU_H: remove unnecessary use of NEED_CPU_H Xuebing Wang
2014-03-04 10:20   ` Paolo Bonzini
2014-03-04  2:47 ` [Qemu-devel] [Discussion 04/10] memory_mapping: make this architecture-independent Xuebing Wang
2014-03-04 10:22   ` Paolo Bonzini
2014-03-04 11:05   ` Peter Maydell
2014-03-04  2:47 ` [Qemu-devel] [Discussion 05/10] NEED_CPU_H: remove unnecessary inclusion of "cpu.h" in root Xuebing Wang
2014-03-04 10:24   ` Paolo Bonzini
2014-03-04  2:47 ` [Qemu-devel] [Discussion 06/10] memory: move contents in include/exec/address-spaces.h => memory.h Xuebing Wang
2014-03-04 10:26   ` Paolo Bonzini
2014-03-04  2:47 ` [Qemu-devel] [Discussion 07/10] memory: remove file include/exec/address-spaces.h Xuebing Wang
2014-03-04  2:47 ` [Qemu-devel] [Discussion 08/10] exec: move TranslationBlock API from exec-all.h => translate.h Xuebing Wang
2014-03-04 10:27   ` Paolo Bonzini
2014-03-04  2:47 ` [Qemu-devel] [Discussion 09/10] exec: remove the unnecessary include of "exec-all.h" Xuebing Wang
2014-03-04 10:27   ` Paolo Bonzini
2014-03-04 11:11   ` Peter Maydell
2014-03-04 11:16     ` Peter Maydell
2014-03-04  2:47 ` [Qemu-devel] [Discussion 10/10] translate: remove file translate-all.h Xuebing Wang
2014-03-04 10:29   ` Paolo Bonzini
2014-03-04  3:45 ` [Qemu-devel] [Discussion 00/10] about API hierarchy Andreas Färber
2014-03-04  5:37   ` Xuebing wang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).