Re: [Qemu-devel] [PATCH 02/35] tcg: Split out target/arch/cpu-param.h

2019-03-26 Thread Alistair Francis
On Sat, Mar 23, 2019 at 12:44 PM Richard Henderson
 wrote:
>
> For all targets, into this new file move TARGET_LONG_BITS,
> TARGET_PAGE_BITS, TARGET_PHYS_ADDR_SPACE_BITS,
> TARGET_VIRT_ADDR_SPACE_BITS, and NB_MMU_MODES.
>
> Include this new file from exec/cpu-defs.h.
>
> This now removes the somewhat odd requirement that target/arch/cpu.h
> defines TARGET_LONG_BITS before including exec/cpu-defs.h, so push the
> bulk of the includes within target/arch/cpu.h to the top.
>
> Signed-off-by: Richard Henderson 

For RISC-V:

Acked-by: Alistair Francis 

Alistair

> ---
>  include/exec/cpu-defs.h   | 22 +-
>  target/alpha/cpu-param.h  | 19 +++
>  target/alpha/cpu.h| 23 +--
>  target/arm/cpu-param.h| 22 ++
>  target/arm/cpu.h  | 33 +++--
>  target/cris/cpu-param.h   |  5 +
>  target/cris/cpu.h | 11 +--
>  target/hppa/cpu-param.h   | 22 ++
>  target/hppa/cpu.h | 24 +---
>  target/i386/cpu-param.h   | 14 ++
>  target/i386/cpu.h | 21 -
>  target/lm32/cpu-param.h   |  5 +
>  target/lm32/cpu.h | 12 +++-
>  target/m68k/cpu-param.h   |  9 +
>  target/m68k/cpu.h | 16 ++--
>  target/microblaze/cpu-param.h |  6 ++
>  target/microblaze/cpu.h   | 14 ++
>  target/mips/cpu-param.h   | 18 ++
>  target/mips/cpu.h |  3 +--
>  target/mips/mips-defs.h   | 15 ---
>  target/moxie/cpu-param.h  |  5 +
>  target/moxie/cpu.h| 12 +---
>  target/nios2/cpu-param.h  |  9 +
>  target/nios2/cpu.h| 17 ++---
>  target/openrisc/cpu-param.h   |  5 +
>  target/openrisc/cpu.h | 14 +++---
>  target/ppc/cpu-param.h| 25 +
>  target/ppc/cpu.h  | 35 ++-
>  target/riscv/cpu-param.h  | 11 +++
>  target/riscv/cpu.h| 21 -
>  target/s390x/cpu-param.h  |  5 +
>  target/s390x/cpu.h| 11 +--
>  target/sh4/cpu-param.h|  9 +
>  target/sh4/cpu.h  | 14 +-
>  target/sparc/cpu-param.h  | 17 +
>  target/sparc/cpu.h| 20 ++--
>  target/tilegx/cpu-param.h |  5 +
>  target/tilegx/cpu.h   |  9 +
>  target/tricore/cpu-param.h|  5 +
>  target/tricore/cpu.h  |  4 +---
>  target/tricore/tricore-defs.h |  5 -
>  target/unicore32/cpu-param.h  |  5 +
>  target/unicore32/cpu.h| 10 +-
>  target/xtensa/cpu-param.h |  9 +
>  target/xtensa/cpu.h   | 21 +
>  45 files changed, 289 insertions(+), 328 deletions(-)
>  create mode 100644 target/alpha/cpu-param.h
>  create mode 100644 target/arm/cpu-param.h
>  create mode 100644 target/cris/cpu-param.h
>  create mode 100644 target/hppa/cpu-param.h
>  create mode 100644 target/i386/cpu-param.h
>  create mode 100644 target/lm32/cpu-param.h
>  create mode 100644 target/m68k/cpu-param.h
>  create mode 100644 target/microblaze/cpu-param.h
>  create mode 100644 target/mips/cpu-param.h
>  create mode 100644 target/moxie/cpu-param.h
>  create mode 100644 target/nios2/cpu-param.h
>  create mode 100644 target/openrisc/cpu-param.h
>  create mode 100644 target/ppc/cpu-param.h
>  create mode 100644 target/riscv/cpu-param.h
>  create mode 100644 target/s390x/cpu-param.h
>  create mode 100644 target/sh4/cpu-param.h
>  create mode 100644 target/sparc/cpu-param.h
>  create mode 100644 target/tilegx/cpu-param.h
>  create mode 100644 target/tricore/cpu-param.h
>  create mode 100644 target/unicore32/cpu-param.h
>  create mode 100644 target/xtensa/cpu-param.h
>
> diff --git a/include/exec/cpu-defs.h b/include/exec/cpu-defs.h
> index 52d150aaf1..2694481769 100644
> --- a/include/exec/cpu-defs.h
> +++ b/include/exec/cpu-defs.h
> @@ -34,8 +34,28 @@
>  #endif
>  #include "exec/memattrs.h"
>
> +#include "cpu-param.h"
> +
>  #ifndef TARGET_LONG_BITS
> -#error TARGET_LONG_BITS must be defined before including this header
> +# error TARGET_LONG_BITS must be defined in cpu-param.h
> +#endif
> +#ifndef NB_MMU_MODES
> +# error NB_MMU_MODES must be defined in cpu-param.h
> +#endif
> +#ifndef TARGET_PHYS_ADDR_SPACE_BITS
> +# error TARGET_PHYS_ADDR_SPACE_BITS must be defined in cpu-param.h
> +#endif
> +#ifndef TARGET_VIRT_ADDR_SPACE_BITS
> +# error TARGET_VIRT_ADDR_SPACE_BITS must be defined in cpu-param.h
> +#endif
> +#ifndef TARGET_PAGE_BITS
> +# ifdef TARGET_PAGE_BITS_VARY
> +#  ifndef TARGET_PAGE_BITS_MIN
> +#   error TARGET_PAGE_BITS_MIN must be defined in cpu-param.h
> +#  endif
> +# else
> +#  error TARGET_PAGE_BITS must be defined in cpu-param.h
> +# 

[Qemu-devel] [PATCH 02/35] tcg: Split out target/arch/cpu-param.h

2019-03-23 Thread Richard Henderson
For all targets, into this new file move TARGET_LONG_BITS,
TARGET_PAGE_BITS, TARGET_PHYS_ADDR_SPACE_BITS,
TARGET_VIRT_ADDR_SPACE_BITS, and NB_MMU_MODES.

Include this new file from exec/cpu-defs.h.

This now removes the somewhat odd requirement that target/arch/cpu.h
defines TARGET_LONG_BITS before including exec/cpu-defs.h, so push the
bulk of the includes within target/arch/cpu.h to the top.

Signed-off-by: Richard Henderson 
---
 include/exec/cpu-defs.h   | 22 +-
 target/alpha/cpu-param.h  | 19 +++
 target/alpha/cpu.h| 23 +--
 target/arm/cpu-param.h| 22 ++
 target/arm/cpu.h  | 33 +++--
 target/cris/cpu-param.h   |  5 +
 target/cris/cpu.h | 11 +--
 target/hppa/cpu-param.h   | 22 ++
 target/hppa/cpu.h | 24 +---
 target/i386/cpu-param.h   | 14 ++
 target/i386/cpu.h | 21 -
 target/lm32/cpu-param.h   |  5 +
 target/lm32/cpu.h | 12 +++-
 target/m68k/cpu-param.h   |  9 +
 target/m68k/cpu.h | 16 ++--
 target/microblaze/cpu-param.h |  6 ++
 target/microblaze/cpu.h   | 14 ++
 target/mips/cpu-param.h   | 18 ++
 target/mips/cpu.h |  3 +--
 target/mips/mips-defs.h   | 15 ---
 target/moxie/cpu-param.h  |  5 +
 target/moxie/cpu.h| 12 +---
 target/nios2/cpu-param.h  |  9 +
 target/nios2/cpu.h| 17 ++---
 target/openrisc/cpu-param.h   |  5 +
 target/openrisc/cpu.h | 14 +++---
 target/ppc/cpu-param.h| 25 +
 target/ppc/cpu.h  | 35 ++-
 target/riscv/cpu-param.h  | 11 +++
 target/riscv/cpu.h| 21 -
 target/s390x/cpu-param.h  |  5 +
 target/s390x/cpu.h| 11 +--
 target/sh4/cpu-param.h|  9 +
 target/sh4/cpu.h  | 14 +-
 target/sparc/cpu-param.h  | 17 +
 target/sparc/cpu.h| 20 ++--
 target/tilegx/cpu-param.h |  5 +
 target/tilegx/cpu.h   |  9 +
 target/tricore/cpu-param.h|  5 +
 target/tricore/cpu.h  |  4 +---
 target/tricore/tricore-defs.h |  5 -
 target/unicore32/cpu-param.h  |  5 +
 target/unicore32/cpu.h| 10 +-
 target/xtensa/cpu-param.h |  9 +
 target/xtensa/cpu.h   | 21 +
 45 files changed, 289 insertions(+), 328 deletions(-)
 create mode 100644 target/alpha/cpu-param.h
 create mode 100644 target/arm/cpu-param.h
 create mode 100644 target/cris/cpu-param.h
 create mode 100644 target/hppa/cpu-param.h
 create mode 100644 target/i386/cpu-param.h
 create mode 100644 target/lm32/cpu-param.h
 create mode 100644 target/m68k/cpu-param.h
 create mode 100644 target/microblaze/cpu-param.h
 create mode 100644 target/mips/cpu-param.h
 create mode 100644 target/moxie/cpu-param.h
 create mode 100644 target/nios2/cpu-param.h
 create mode 100644 target/openrisc/cpu-param.h
 create mode 100644 target/ppc/cpu-param.h
 create mode 100644 target/riscv/cpu-param.h
 create mode 100644 target/s390x/cpu-param.h
 create mode 100644 target/sh4/cpu-param.h
 create mode 100644 target/sparc/cpu-param.h
 create mode 100644 target/tilegx/cpu-param.h
 create mode 100644 target/tricore/cpu-param.h
 create mode 100644 target/unicore32/cpu-param.h
 create mode 100644 target/xtensa/cpu-param.h

diff --git a/include/exec/cpu-defs.h b/include/exec/cpu-defs.h
index 52d150aaf1..2694481769 100644
--- a/include/exec/cpu-defs.h
+++ b/include/exec/cpu-defs.h
@@ -34,8 +34,28 @@
 #endif
 #include "exec/memattrs.h"
 
+#include "cpu-param.h"
+
 #ifndef TARGET_LONG_BITS
-#error TARGET_LONG_BITS must be defined before including this header
+# error TARGET_LONG_BITS must be defined in cpu-param.h
+#endif
+#ifndef NB_MMU_MODES
+# error NB_MMU_MODES must be defined in cpu-param.h
+#endif
+#ifndef TARGET_PHYS_ADDR_SPACE_BITS
+# error TARGET_PHYS_ADDR_SPACE_BITS must be defined in cpu-param.h
+#endif
+#ifndef TARGET_VIRT_ADDR_SPACE_BITS
+# error TARGET_VIRT_ADDR_SPACE_BITS must be defined in cpu-param.h
+#endif
+#ifndef TARGET_PAGE_BITS
+# ifdef TARGET_PAGE_BITS_VARY
+#  ifndef TARGET_PAGE_BITS_MIN
+#   error TARGET_PAGE_BITS_MIN must be defined in cpu-param.h
+#  endif
+# else
+#  error TARGET_PAGE_BITS must be defined in cpu-param.h
+# endif
 #endif
 
 #define TARGET_LONG_SIZE (TARGET_LONG_BITS / 8)
diff --git a/target/alpha/cpu-param.h b/target/alpha/cpu-param.h
new file mode 100644
index 00..6e76e740e2
--- /dev/null
+++ b/target/alpha/cpu-param.h
@@ -0,0 +1,19 @@
+#define TARGET_LONG_BITS 64
+#define TARGET_PAGE_BITS 13
+#ifdef CONFIG_USER_ONLY
+/*
+ *