Skip to content

RFC decouple board headers from cpu.h

Paolo Bonzini qemu-devel 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest6 patches 4 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/6arm: use "struct ARMCPU" in header fileshw/arm/strongarm.h include/hw/arm/arm.h include/hw/arm/exynos4210.h +2 more+19 -122 replies
2/6mips: use struct CPUMIPSState to avoid need for cpu.hinclude/hw/mips/cpudevs.h+4 -20 replies
3/6ppc: use struct to avoid the need for cpu.hinclude/hw/ppc/ppc.h include/hw/ppc/ppc4xx.h linux-user/main.c +1 more+38 -290 replies
4/6alpha: use AlphaCPU as an opaque typehw/alpha/alpha_sys.h+2 -10 replies
5/6coldfire: use "struct M68kCPU" in header filesinclude/hw/m68k/mcf.h+3 -20 replies
6/6sh: use SuperHCPU struct to avoid cpu.h dependencyinclude/hw/sh4/sh.h+2 -10 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [Qemu-devel] [RFC PATCH 0/6] decouple board headers from cpu.h

Hi,

a while ago I started removing cpu.h dependencies from several headers in QEMU. In particular, I wanted to put an end to qemu-common.h's including cpu.h and vice versa. This is useful for two reasons: 1) because both headers bring in a lot of dependencies and thus very small changes can cause complete recompilations of target-dependent code;
2) in order to remove indirect inclusions of other header files, which often come from cpu.h itself.

These patches are perhaps the only somewhat controversial part. Generally, we add opaque typedefs to typedefs.h in order to avoid indirect header inclusions. However, this might not be desirable for target specific types such as FooCPU. These types are used mostly in headers for boards, and thus this series uses struct explicitly in those headers. Adding a typedef breaks on older compilers that do not like redefinitions of typedefs.

Everything else is just extremely boring: code movement out of our catch-all header files, or pushing #includes down to the users.

Opinions?

Paolo

Paolo Bonzini (6):
arm: use "struct ARMCPU" in header files
mips: use struct CPUMIPSState to avoid need for cpu.h
ppc: use struct to avoid the need for cpu.h
alpha: use AlphaCPU as an opaque type
coldfire: use "struct M68kCPU" in header files
sh: use SuperHCPU struct to avoid cpu.h dependency

 hw/alpha/alpha_sys.h        |  3 ++-
 hw/arm/strongarm.h          |  2 +-
 include/hw/arm/arm.h        | 12 +++++++-----
 include/hw/arm/exynos4210.h |  5 +++--
 include/hw/arm/omap.h       |  4 +++-
 include/hw/arm/pxa.h        |  8 +++++---
 include/hw/m68k/mcf.h       |  5 +++--
 include/hw/mips/cpudevs.h   |  6 ++++--
 include/hw/ppc/ppc.h        | 36 +++++++++++++++++++++---------------
 include/hw/ppc/ppc4xx.h     | 17 +++++++++++------
 include/hw/sh4/sh.h         |  3 ++-
 linux-user/main.c           |  4 ++--
 target-ppc/cpu.h            | 10 ++++------
 13 files changed, 68 insertions(+), 47 deletions(-)
Signature · 1 line
1.8.3.1