qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 00/16] target: Make 'cpu-qom.h' really target agnostic
@ 2023-10-13 14:00 Philippe Mathieu-Daudé
  2023-10-13 14:01 ` [PATCH v2 01/16] target: Unify QOM style Philippe Mathieu-Daudé
                   ` (16 more replies)
  0 siblings, 17 replies; 36+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-10-13 14:00 UTC (permalink / raw)
  To: qemu-devel
  Cc: Eduardo Habkost, Xiaojuan Yang, Michael S. Tsirkin, qemu-ppc,
	Aleksandar Rikalo, David Hildenbrand, qemu-s390x,
	Edgar E. Iglesias, Jiaxun Yang, Song Gao,
	Philippe Mathieu-Daudé, Paolo Bonzini, Stafford Horne,
	Alistair Francis, Yanan Wang, Max Filippov, Artyom Tarasenko,
	Marcel Apfelbaum, Cédric Le Goater, Laurent Vivier,
	Aurelien Jarno, qemu-riscv, Palmer Dabbelt, Yoshinori Sato,
	Bastian Koppelmann, Bin Meng, Daniel Henrique Barboza,
	Mark Cave-Ayland, Weiwei Li, Daniel Henrique Barboza,
	Nicholas Piggin, qemu-arm, Liu Zhiwei, Marek Vasut,
	Laurent Vivier, Peter Maydell, Brian Cain, Thomas Huth,
	Chris Wulff, Sergio Lopez, Richard Henderson, Ilya Leoshkevich,
	Michael Rolnik

Since v1:
- Added R-b tags
- Addressed Richard comments
- Postponed OBJECT_DECLARE_CPU_TYPE() changes

A heterogeneous machine must be able to instantiate CPUs
from different architectures. In order to do that, the
common hw/ code has to access to the QOM CPU definitions
from various architecture.

Those QOM definitions are published in "target/foo/cpu-qom.h".
All 'cpu-qom.h' must be target agnostic, so hw/ can include
multiple of them in order to create a heterogeneous machine.

This series strengthen all (except PPC...) target 'cpu-qom.h',
making them target agnostic.

For various targets it is just a matter of moving definitions
where they belong (either 'cpu.h' or 'cpu-qom.h').

For few (mips/riscv/sparc/x86) we have to remove the target
specific definitions (which 'taint' the header as target specific).

For mips/sparc/x86 this implies splitting the base target
definition by making it explicit to the build type (32 or 64-bit).

PPC is missing because CPU types are currently registered
indistinctly, and whether a CPU is 32/64 bit can not be detected
at build time (it is done in each cpu_class_init() handler,
*after* the type is registered).

Based-on: <20231010074952.79165-1-philmd@linaro.org>
  Introduce qtest_get_base_arch() / qtest_get_arch_bits()

Philippe Mathieu-Daudé (16):
  target: Unify QOM style
  target: Mention 'cpu-qom.h' is target agnostic
  target/arm: Move internal declarations from 'cpu-qom.h' to 'cpu.h'
  target/ppc: Remove CPU_RESOLVING_TYPE from 'cpu-qom.h'
  target/riscv: Remove CPU_RESOLVING_TYPE from 'cpu-qom.h'
  target: Declare FOO_CPU_TYPE_NAME/SUFFIX in 'cpu-qom.h'
  target/hexagon: Declare QOM definitions in 'cpu-qom.h'
  target/loongarch: Declare QOM definitions in 'cpu-qom.h'
  target/nios2: Declare QOM definitions in 'cpu-qom.h'
  target/openrisc: Declare QOM definitions in 'cpu-qom.h'
  target/riscv: Move TYPE_RISCV_CPU_BASE definition to 'cpu.h'
  target: Move ArchCPUClass definition to 'cpu.h'
  target/i386: Declare CPU QOM types using DEFINE_TYPES() macro
  target/mips: Declare CPU QOM types using DEFINE_TYPES() macro
  target/ppc: Declare CPU QOM types using DEFINE_TYPES() macro
  target/sparc: Declare CPU QOM types using DEFINE_TYPES() macro

 target/alpha/cpu-qom.h      | 21 ++-----------
 target/alpha/cpu.h          | 17 ++++++++---
 target/arm/cpu-qom.h        | 61 +------------------------------------
 target/arm/cpu.h            | 55 +++++++++++++++++++++++++++++++--
 target/avr/cpu-qom.h        | 20 ++----------
 target/avr/cpu.h            | 18 ++++++++---
 target/cris/cpu-qom.h       | 24 ++-------------
 target/cris/cpu.h           | 20 +++++++++---
 target/hexagon/cpu-qom.h    | 27 ++++++++++++++++
 target/hexagon/cpu.h        | 20 ++----------
 target/hppa/cpu-qom.h       | 20 +-----------
 target/hppa/cpu.h           | 16 ++++++++--
 target/i386/cpu-qom.h       | 42 ++-----------------------
 target/i386/cpu.h           | 39 +++++++++++++++++++++---
 target/loongarch/cpu-qom.h  | 23 ++++++++++++++
 target/loongarch/cpu.h      | 14 +--------
 target/m68k/cpu-qom.h       | 21 ++-----------
 target/m68k/cpu.h           | 17 ++++++++---
 target/microblaze/cpu-qom.h | 20 +-----------
 target/microblaze/cpu.h     | 15 +++++++--
 target/mips/cpu-qom.h       | 23 ++------------
 target/mips/cpu.h           | 21 ++++++++++---
 target/nios2/cpu-qom.h      | 18 +++++++++++
 target/nios2/cpu.h          | 11 +------
 target/openrisc/cpu-qom.h   | 21 +++++++++++++
 target/openrisc/cpu.h       | 14 +--------
 target/ppc/cpu-qom.h        |  3 +-
 target/ppc/cpu.h            |  4 +--
 target/riscv/cpu-qom.h      | 26 ++--------------
 target/riscv/cpu.h          | 24 +++++++++++++--
 target/rx/cpu-qom.h         | 20 ++----------
 target/rx/cpu.h             | 18 ++++++++---
 target/s390x/cpu-qom.h      | 41 +++----------------------
 target/s390x/cpu.h          | 34 ++++++++++++++++++---
 target/s390x/cpu_models.h   |  8 ++---
 target/sh4/cpu-qom.h        | 28 ++---------------
 target/sh4/cpu.h            | 24 ++++++++++++---
 target/sparc/cpu-qom.h      | 23 ++------------
 target/sparc/cpu.h          | 22 +++++++++----
 target/tricore/cpu-qom.h    | 15 +++------
 target/tricore/cpu.h        | 10 +++---
 target/xtensa/cpu-qom.h     | 26 ++--------------
 target/xtensa/cpu.h         | 24 +++++++++++----
 target/i386/cpu.c           | 50 ++++++++++++++----------------
 target/mips/cpu.c           | 23 ++++++++------
 target/ppc/cpu_init.c       | 52 ++++++++++++++-----------------
 target/sparc/cpu.c          | 23 ++++++++------
 47 files changed, 528 insertions(+), 588 deletions(-)
 create mode 100644 target/hexagon/cpu-qom.h
 create mode 100644 target/loongarch/cpu-qom.h
 create mode 100644 target/nios2/cpu-qom.h
 create mode 100644 target/openrisc/cpu-qom.h

-- 
2.41.0



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

end of thread, other threads:[~2023-11-06 14:59 UTC | newest]

Thread overview: 36+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-13 14:00 [PATCH v2 00/16] target: Make 'cpu-qom.h' really target agnostic Philippe Mathieu-Daudé
2023-10-13 14:01 ` [PATCH v2 01/16] target: Unify QOM style Philippe Mathieu-Daudé
2023-10-13 14:24   ` Richard Henderson
2023-10-20  5:56   ` Zhao Liu
2023-10-13 14:01 ` [PATCH v2 02/16] target: Mention 'cpu-qom.h' is target agnostic Philippe Mathieu-Daudé
2023-10-20  7:14   ` Zhao Liu
2023-11-06  7:17     ` Philippe Mathieu-Daudé
2023-10-13 14:01 ` [PATCH v2 03/16] target/arm: Move internal declarations from 'cpu-qom.h' to 'cpu.h' Philippe Mathieu-Daudé
2023-10-13 14:27   ` Richard Henderson
2023-10-16  9:39     ` Philippe Mathieu-Daudé
2023-10-13 14:01 ` [PATCH v2 04/16] target/ppc: Remove CPU_RESOLVING_TYPE from 'cpu-qom.h' Philippe Mathieu-Daudé
2023-10-13 14:01 ` [PATCH v2 05/16] target/riscv: " Philippe Mathieu-Daudé
2023-10-13 14:01 ` [PATCH v2 06/16] target: Declare FOO_CPU_TYPE_NAME/SUFFIX in 'cpu-qom.h' Philippe Mathieu-Daudé
2023-10-13 14:01 ` [PATCH v2 07/16] target/hexagon: Declare QOM definitions " Philippe Mathieu-Daudé
2023-10-13 14:28   ` Richard Henderson
2023-10-26 19:11   ` Brian Cain
2023-10-13 14:01 ` [PATCH v2 08/16] target/loongarch: " Philippe Mathieu-Daudé
2023-10-13 14:30   ` Richard Henderson
2023-10-13 14:01 ` [PATCH v2 09/16] target/nios2: " Philippe Mathieu-Daudé
2023-10-13 14:30   ` Richard Henderson
2023-10-13 14:01 ` [PATCH v2 10/16] target/openrisc: " Philippe Mathieu-Daudé
2023-10-13 14:31   ` Richard Henderson
2023-10-13 14:01 ` [PATCH v2 11/16] target/riscv: Move TYPE_RISCV_CPU_BASE definition to 'cpu.h' Philippe Mathieu-Daudé
2023-10-13 14:32   ` Richard Henderson
2023-10-13 14:01 ` [PATCH v2 12/16] target: Move ArchCPUClass " Philippe Mathieu-Daudé
2023-10-13 14:36   ` Richard Henderson
2023-10-20  8:03   ` Zhao Liu
2023-11-06 14:58     ` Philippe Mathieu-Daudé
2023-10-13 14:01 ` [PATCH v2 13/16] target/i386: Declare CPU QOM types using DEFINE_TYPES() macro Philippe Mathieu-Daudé
2023-10-20  5:54   ` Zhao Liu
2023-10-13 14:01 ` [PATCH v2 14/16] target/mips: " Philippe Mathieu-Daudé
2023-10-13 14:01 ` [PATCH v2 15/16] target/ppc: " Philippe Mathieu-Daudé
2023-10-13 14:01 ` [PATCH v2 16/16] target/sparc: " Philippe Mathieu-Daudé
2023-10-20  5:50 ` [PATCH v2 00/16] target: Make 'cpu-qom.h' really target agnostic Zhao Liu
2023-10-20 11:30   ` Philippe Mathieu-Daudé
2023-10-20 16:08     ` Zhao Liu

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).