target: Make 'cpu-qom.h' really target agnostic
v2 cover target: Make 'cpu-qom.h' really target agnostic
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: <[email protected]>
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
Signature · 1 line
2.41.0
PATCH v2 1/16 target: Unify QOM style
Enforce the style described by commit 067109a11c ("docs/devel:
mention the spacing requirement for QOM"):
The first declaration of a storage or class structure should always be the parent and leave a visual space between that declaration and the new code. It is also useful to separate backing for properties (options driven by the user) and internal state to make navigation easier.
--- target/alpha/cpu-qom.h | 2 -- target/alpha/cpu.h | 2 -- target/arm/cpu-qom.h | 4 ---- target/arm/cpu.h | 2 -- target/avr/cpu-qom.h | 3 +-- target/avr/cpu.h | 2 -- target/cris/cpu-qom.h | 2 -- target/cris/cpu.h | 2 -- target/hexagon/cpu.h | 5 +---- target/hppa/cpu-qom.h | 2 -- target/hppa/cpu.h | 2 -- target/i386/cpu-qom.h | 2 -- target/i386/cpu.h | 2 -- target/loongarch/cpu.h | 4 ---- target/m68k/cpu-qom.h | 2 -- target/m68k/cpu.h | 2 -- target/microblaze/cpu-qom.h | 2 -- target/microblaze/cpu.h | 2 -- target/mips/cpu-qom.h | 2 -- target/mips/cpu.h | 2 -- target/nios2/cpu.h | 4 ---- target/openrisc/cpu.h | 4 ---- target/ppc/cpu.h | 2 -- target/riscv/cpu-qom.h | 3 +-- target/riscv/cpu.h | 2 -- target/rx/cpu-qom.h | 2 -- target/rx/cpu.h | 2 -- target/s390x/cpu-qom.h | 3 +-- target/s390x/cpu.h | 2 -- target/sh4/cpu-qom.h | 2 -- target/sh4/cpu.h | 2 -- target/sparc/cpu-qom.h | 2 -- target/sparc/cpu.h | 2 -- target/tricore/cpu-qom.h | 2 -- target/tricore/cpu.h | 2 -- target/xtensa/cpu-qom.h | 2 -- target/xtensa/cpu.h | 2 -- 37 files changed, 4 insertions(+), 84 deletions(-)
target/alpha/cpu-qom.h +0 -2
@@ -35,9 +35,7 @@ OBJECT_DECLARE_CPU_TYPE(AlphaCPU, AlphaCPUClass, ALPHA_CPU)* An Alpha CPU model. */ struct AlphaCPUClass { -/*< private >*/ CPUClass parent_class; -/*< public >*/ DeviceRealize parent_realize;DeviceReset parent_reset;
target/alpha/cpu.h +0 -2
@@ -259,9 +259,7 @@ typedef struct CPUArchState {* An Alpha CPU. */ struct ArchCPU { -/*< private >*/ CPUState parent_obj; -/*< public >*/ CPUAlphaState env;
target/arm/cpu-qom.h +0 -4
@@ -46,9 +46,7 @@ void aarch64_cpu_register(const ARMCPUInfo *info);* An ARM CPU model. */ struct ARMCPUClass { -/*< private >*/ CPUClass parent_class; -/*< public >*/ const ARMCPUInfo *info;DeviceRealize parent_realize;
@@ -62,9 +60,7 @@ DECLARE_CLASS_CHECKERS(AArch64CPUClass, AARCH64_CPU, TYPE_AARCH64_CPU)struct AArch64CPUClass { -/*< private >*/ ARMCPUClass parent_class; -/*< public >*/ };void register_cp_regs_for_features (ARMCPU *cpu);
target/arm/cpu.h +0 -2
@@ -852,9 +852,7 @@ typedef struct {* An ARM CPU core. */ struct ArchCPU { -/*< private >*/ CPUState parent_obj; -/*< public >*/ CPUARMState env;
target/avr/cpu-qom.h +1 -2
@@ -36,9 +36,8 @@ OBJECT_DECLARE_CPU_TYPE(AVRCPU, AVRCPUClass, AVR_CPU)* A AVR CPU model. */ struct AVRCPUClass { -/*< private >*/ CPUClass parent_class; -/*< public >*/ +DeviceRealize parent_realize;ResettablePhases parent_phases; };
target/avr/cpu.h +0 -2
@@ -144,9 +144,7 @@ typedef struct CPUArchState {* A AVR CPU. */ struct ArchCPU { -/*< private >*/ CPUState parent_obj; -/*< public >*/ CPUAVRState env; };
target/cris/cpu-qom.h +0 -2
@@ -36,9 +36,7 @@ OBJECT_DECLARE_CPU_TYPE(CRISCPU, CRISCPUClass, CRIS_CPU)* A CRIS CPU model. */ struct CRISCPUClass { -/*< private >*/ CPUClass parent_class; -/*< public >*/ DeviceRealize parent_realize;ResettablePhases parent_phases;
target/cris/cpu.h +0 -2
@@ -174,9 +174,7 @@ typedef struct CPUArchState {* A CRIS CPU. */ struct ArchCPU { -/*< private >*/ CPUState parent_obj; -/*< public >*/ CPUCRISState env; };
target/hexagon/cpu.h +1 -4
@@ -130,17 +130,14 @@ typedef struct CPUArchState { OBJECT_DECLARE_CPU_TYPE(HexagonCPU, HexagonCPUClass, HEXAGON_CPU)typedef struct HexagonCPUClass { -/*< private >*/ CPUClass parent_class; -/*< public >*/ +DeviceRealize parent_realize;ResettablePhases parent_phases; }HexagonCPUClass ;struct ArchCPU { -/*< private >*/ CPUState parent_obj; -/*< public >*/ CPUHexagonState env;
target/hppa/cpu-qom.h +0 -2
@@ -35,9 +35,7 @@ OBJECT_DECLARE_CPU_TYPE(HPPACPU, HPPACPUClass, HPPA_CPU)* An HPPA CPU model. */ struct HPPACPUClass { -/*< private >*/ CPUClass parent_class; -/*< public >*/ DeviceRealize parent_realize;DeviceReset parent_reset;
target/hppa/cpu.h +0 -2
@@ -233,9 +233,7 @@ typedef struct CPUArchState {* An HPPA CPU. */ struct ArchCPU { -/*< private >*/ CPUState parent_obj; -/*< public >*/ CPUHPPAState env;QEMUTimer *alarm_timer;
target/i386/cpu-qom.h +0 -2
@@ -47,9 +47,7 @@ typedef struct X86CPUModel X86CPUModel;* An x86 CPU model or family. */ struct X86CPUClass { -/*< private >*/ CPUClass parent_class; -/*< public >*/ /* CPU definition, automatically loaded by instance_init if not NULL. * Should be eventually replaced by subclass-specific property defaults.
target/i386/cpu.h +0 -2
@@ -1897,9 +1897,7 @@ struct kvm_msrs;* An x86 CPU. */ struct ArchCPU { -/*< private >*/ CPUState parent_obj; -/*< public >*/ CPUX86State env;VMChangeStateEntry *vmsentry;
target/loongarch/cpu.h +0 -4
@@ -371,9 +371,7 @@ typedef struct CPUArchState {* A LoongArch CPU. */ struct ArchCPU { -/*< private >*/ CPUState parent_obj; -/*< public >*/ CPULoongArchState env;QEMUTimer timer;
@@ -398,9 +396,7 @@ OBJECT_DECLARE_CPU_TYPE(LoongArchCPU, LoongArchCPUClass,* A LoongArch CPU model. */ struct LoongArchCPUClass { -/*< private >*/ CPUClass parent_class; -/*< public >*/ DeviceRealize parent_realize;ResettablePhases parent_phases;
target/m68k/cpu-qom.h +0 -2
@@ -35,9 +35,7 @@ OBJECT_DECLARE_CPU_TYPE(M68kCPU, M68kCPUClass, M68K_CPU)* A Motorola 68k CPU model. */ struct M68kCPUClass { -/*< private >*/ CPUClass parent_class; -/*< public >*/ DeviceRealize parent_realize;ResettablePhases parent_phases;
target/m68k/cpu.h +0 -2
@@ -164,9 +164,7 @@ typedef struct CPUArchState {* A Motorola 68k CPU. */ struct ArchCPU { -/*< private >*/ CPUState parent_obj; -/*< public >*/ CPUM68KState env; };
target/microblaze/cpu-qom.h +0 -2
@@ -35,9 +35,7 @@ OBJECT_DECLARE_CPU_TYPE(MicroBlazeCPU, MicroBlazeCPUClass, MICROBLAZE_CPU)* A MicroBlaze CPU model. */ struct MicroBlazeCPUClass { -/*< private >*/ CPUClass parent_class; -/*< public >*/ DeviceRealize parent_realize;ResettablePhases parent_phases;
target/microblaze/cpu.h +0 -2
@@ -343,9 +343,7 @@ typedef struct {* A MicroBlaze CPU. */ struct ArchCPU { -/*< private >*/ CPUState parent_obj; -/*< public >*/ CPUMBState env;
target/mips/cpu-qom.h +0 -2
@@ -39,9 +39,7 @@ OBJECT_DECLARE_CPU_TYPE(MIPSCPU, MIPSCPUClass, MIPS_CPU)* A MIPS CPU model. */ struct MIPSCPUClass { -/*< private >*/ CPUClass parent_class; -/*< public >*/ DeviceRealize parent_realize;ResettablePhases parent_phases;
target/mips/cpu.h +0 -2
@@ -1209,9 +1209,7 @@ typedef struct CPUArchState {* A MIPS CPU. */ struct ArchCPU { -/*< private >*/ CPUState parent_obj; -/*< public >*/ CPUMIPSState env;
target/nios2/cpu.h +0 -4
@@ -42,9 +42,7 @@ OBJECT_DECLARE_CPU_TYPE(Nios2CPU, Nios2CPUClass, NIOS2_CPU)* A Nios2 CPU model. */ struct Nios2CPUClass { -/*< private >*/ CPUClass parent_class; -/*< public >*/ DeviceRealize parent_realize;ResettablePhases parent_phases;
@@ -214,9 +212,7 @@ typedef struct {* A Nios2 CPU. */ struct ArchCPU { -/*< private >*/ CPUState parent_obj; -/*< public >*/ CPUNios2State env;
target/openrisc/cpu.h +0 -4
@@ -39,9 +39,7 @@ OBJECT_DECLARE_CPU_TYPE(OpenRISCCPU, OpenRISCCPUClass, OPENRISC_CPU)* A OpenRISC CPU model. */ struct OpenRISCCPUClass { -/*< private >*/ CPUClass parent_class; -/*< public >*/ DeviceRealize parent_realize;ResettablePhases parent_phases;
@@ -301,9 +299,7 @@ typedef struct CPUArchState {* A OpenRISC CPU. */ struct ArchCPU { -/*< private >*/ CPUState parent_obj; -/*< public >*/ CPUOpenRISCState env; };
target/ppc/cpu.h +0 -2
@@ -1407,9 +1407,7 @@ typedef struct PPCVirtualHypervisorClass PPCVirtualHypervisorClass;* A PowerPC CPU. */ struct ArchCPU { -/*< private >*/ CPUState parent_obj; -/*< public >*/ CPUPPCState env;
target/riscv/cpu-qom.h +1 -2
@@ -63,9 +63,8 @@ OBJECT_DECLARE_CPU_TYPE(RISCVCPU, RISCVCPUClass, RISCV_CPU)* A RISCV CPU model. */ struct RISCVCPUClass { -/*< private >*/ CPUClass parent_class; -/*< public >*/ +DeviceRealize parent_realize;ResettablePhases parent_phases; };
target/riscv/cpu.h +0 -2
@@ -389,9 +389,7 @@ struct CPUArchState {* A RISCV CPU. */ struct ArchCPU { -/* < private > */ CPUState parent_obj; -/* < public > */ CPURISCVState env;
target/rx/cpu-qom.h +0 -2
@@ -36,9 +36,7 @@ OBJECT_DECLARE_CPU_TYPE(RXCPU, RXCPUClass, RX_CPU)* A RX CPU model. */ struct RXCPUClass { -/*< private >*/ CPUClass parent_class; -/*< public >*/ DeviceRealize parent_realize;ResettablePhases parent_phases;
target/rx/cpu.h +0 -2
@@ -107,9 +107,7 @@ typedef struct CPUArchState {* A RX CPU */ struct ArchCPU { -/*< private >*/ CPUState parent_obj; -/*< public >*/ CPURXState env; };
target/s390x/cpu-qom.h +1 -2
@@ -49,9 +49,8 @@ typedef enum cpu_reset_type {* An S/390 CPU model. */ struct S390CPUClass { -/*< private >*/ CPUClass parent_class; -/*< public >*/ +const S390CPUDef *cpu_def;bool kvm_required;bool is_static;
target/s390x/cpu.h +0 -2
@@ -166,9 +166,7 @@ static inline uint64_t *get_freg(CPUS390XState *cs, int nr)* An S/390 CPU. */ struct ArchCPU { -/*< private >*/ CPUState parent_obj; -/*< public >*/ CPUS390XState env;S390CPUModel *model;
target/sh4/cpu-qom.h +0 -2
@@ -42,9 +42,7 @@ OBJECT_DECLARE_CPU_TYPE(SuperHCPU, SuperHCPUClass, SUPERH_CPU)* A SuperH CPU model. */ struct SuperHCPUClass { -/*< private >*/ CPUClass parent_class; -/*< public >*/ DeviceRealize parent_realize;ResettablePhases parent_phases;
target/sh4/cpu.h +0 -2
@@ -204,9 +204,7 @@ typedef struct CPUArchState {* A SuperH CPU. */ struct ArchCPU { -/*< private >*/ CPUState parent_obj; -/*< public >*/ CPUSH4State env; };
target/sparc/cpu-qom.h +0 -2
@@ -40,9 +40,7 @@ typedef struct sparc_def_t sparc_def_t;* A SPARC CPU model. */ struct SPARCCPUClass { -/*< private >*/ CPUClass parent_class; -/*< public >*/ DeviceRealize parent_realize;ResettablePhases parent_phases;
target/sparc/cpu.h +0 -2
@@ -557,9 +557,7 @@ struct CPUArchState {* A SPARC CPU. */ struct ArchCPU { -/*< private >*/ CPUState parent_obj; -/*< public >*/ CPUSPARCState env; };
target/tricore/cpu-qom.h +0 -2
@@ -27,9 +27,7 @@ OBJECT_DECLARE_CPU_TYPE(TriCoreCPU, TriCoreCPUClass, TRICORE_CPU)struct TriCoreCPUClass { -/*< private >*/ CPUClass parent_class; -/*< public >*/ DeviceRealize parent_realize;ResettablePhases parent_phases;
target/tricore/cpu.h +0 -2
@@ -63,9 +63,7 @@ typedef struct CPUArchState {* A TriCore CPU. */ struct ArchCPU { -/*< private >*/ CPUState parent_obj; -/*< public >*/ CPUTriCoreState env; };
target/xtensa/cpu-qom.h +0 -2
@@ -47,9 +47,7 @@ typedef struct XtensaConfig XtensaConfig;* An Xtensa CPU model. */ struct XtensaCPUClass { -/*< private >*/ CPUClass parent_class; -/*< public >*/ DeviceRealize parent_realize;ResettablePhases parent_phases;
target/xtensa/cpu.h +0 -2
@@ -556,9 +556,7 @@ struct CPUArchState {* An Xtensa CPU. */ struct ArchCPU { -/*< private >*/ CPUState parent_obj; -/*< public >*/ CPUXtensaState env;Clock *clock;
Signature · 1 line
2.41.0
Re: [PATCH v2 01/16] target: Unify QOM style
Quoted 10 lines · Philippe Mathieu-Daudé
Enforce the style described by commit
067109a11c("docs/devel:
mention the spacing requirement for QOM"):The first declaration of a storage or class structure should always be the parent and leave a visual space between that declaration and the new code. It is also useful to separate backing for properties (options driven by the user) and internal state to make navigation easier.
Signed-off-by Philippe Mathieu-Daudé <[email protected]>
r~
Re: [PATCH v2 01/16] target: Unify QOM style
In reply to Philippe Mathieu-DaudéQuoted 46 lines · Philippe Mathieu-Daudé
Date: Fri, 13 Oct 2023 16:01:00 +0200
From: Philippe Mathieu-Daudé <[email protected]>
Subject: [PATCH v2 01/16] target: Unify QOM style
X-Mailer: git-send-email 2.41.0Enforce the style described by commit
067109a11c("docs/devel:
mention the spacing requirement for QOM"):The first declaration of a storage or class structure should always be the parent and leave a visual space between that declaration and the new code. It is also useful to separate backing for properties (options driven by the user) and internal state to make navigation easier.
Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- target/alpha/cpu-qom.h | 2 -- target/alpha/cpu.h | 2 -- target/arm/cpu-qom.h | 4 ---- target/arm/cpu.h | 2 -- target/avr/cpu-qom.h | 3 +-- target/avr/cpu.h | 2 -- target/cris/cpu-qom.h | 2 -- target/cris/cpu.h | 2 -- target/hexagon/cpu.h | 5 +---- target/hppa/cpu-qom.h | 2 -- target/hppa/cpu.h | 2 -- target/i386/cpu-qom.h | 2 -- target/i386/cpu.h | 2 -- target/loongarch/cpu.h | 4 ---- target/m68k/cpu-qom.h | 2 -- target/m68k/cpu.h | 2 -- target/microblaze/cpu-qom.h | 2 -- target/microblaze/cpu.h | 2 -- target/mips/cpu-qom.h | 2 -- target/mips/cpu.h | 2 -- target/nios2/cpu.h | 4 ---- target/openrisc/cpu.h | 4 ---- target/ppc/cpu.h | 2 -- target/riscv/cpu-qom.h | 3 +-- target/riscv/cpu.h | 2 -- target/rx/cpu-qom.h | 2 -- target/rx/cpu.h | 2 -- target/s390x/cpu-qom.h | 3 +-- target/s390x/cpu.h | 2 -- target/sh4/cpu-qom.h | 2 --
Quoted 8 lines
target/sh4/cpu.h | 2 -- target/sparc/cpu-qom.h | 2 -- target/sparc/cpu.h | 2 -- target/tricore/cpu-qom.h | 2 -- target/tricore/cpu.h | 2 -- target/xtensa/cpu-qom.h | 2 -- target/xtensa/cpu.h | 2 -- 37 files changed, 4 insertions(+), 84 deletions(-)
Quoted 576 lines
target/alpha/cpu-qom.h +0
-2@@ -35,9 +35,7 @@ OBJECT_DECLARE_CPU_TYPE(AlphaCPU, AlphaCPUClass, ALPHA_CPU)* An Alpha CPU model. */ struct AlphaCPUClass { -/*< private >*/ CPUClass parent_class; -/*< public >*/ DeviceRealize parent_realize;DeviceReset parent_reset;target/alpha/cpu.h +0
-2@@ -259,9 +259,7 @@ typedef struct CPUArchState {* An Alpha CPU. */ struct ArchCPU { -/*< private >*/ CPUState parent_obj; -/*< public >*/ CPUAlphaState env;target/arm/cpu-qom.h +0
-4@@ -46,9 +46,7 @@ void aarch64_cpu_register(const ARMCPUInfo *info);* An ARM CPU model. */ struct ARMCPUClass { -/*< private >*/ CPUClass parent_class; -/*< public >*/ const ARMCPUInfo *info;DeviceRealize parent_realize;@@ -62,9 +60,7 @@ DECLARE_CLASS_CHECKERS(AArch64CPUClass, AARCH64_CPU, TYPE_AARCH64_CPU)struct AArch64CPUClass { -/*< private >*/ ARMCPUClass parent_class; -/*< public >*/ };void register_cp_regs_for_features (ARMCPU *cpu);target/arm/cpu.h +0
-2@@ -852,9 +852,7 @@ typedef struct {* An ARM CPU core. */ struct ArchCPU { -/*< private >*/ CPUState parent_obj; -/*< public >*/ CPUARMState env;target/avr/cpu-qom.h +1
-2@@ -36,9 +36,8 @@ OBJECT_DECLARE_CPU_TYPE(AVRCPU, AVRCPUClass, AVR_CPU)* A AVR CPU model. */ struct AVRCPUClass { -/*< private >*/ CPUClass parent_class; -/*< public >*/ +DeviceRealize parent_realize;ResettablePhases parent_phases; };target/avr/cpu.h +0
-2@@ -144,9 +144,7 @@ typedef struct CPUArchState {* A AVR CPU. */ struct ArchCPU { -/*< private >*/ CPUState parent_obj; -/*< public >*/ CPUAVRState env; };target/cris/cpu-qom.h +0
-2@@ -36,9 +36,7 @@ OBJECT_DECLARE_CPU_TYPE(CRISCPU, CRISCPUClass, CRIS_CPU)* A CRIS CPU model. */ struct CRISCPUClass { -/*< private >*/ CPUClass parent_class; -/*< public >*/ DeviceRealize parent_realize;ResettablePhases parent_phases;target/cris/cpu.h +0
-2@@ -174,9 +174,7 @@ typedef struct CPUArchState {* A CRIS CPU. */ struct ArchCPU { -/*< private >*/ CPUState parent_obj; -/*< public >*/ CPUCRISState env; };target/hexagon/cpu.h +1
-4@@ -130,17 +130,14 @@ typedef struct CPUArchState { OBJECT_DECLARE_CPU_TYPE(HexagonCPU, HexagonCPUClass, HEXAGON_CPU)typedef struct HexagonCPUClass { -/*< private >*/ CPUClass parent_class; -/*< public >*/ +DeviceRealize parent_realize;ResettablePhases parent_phases; }HexagonCPUClass ;struct ArchCPU { -/*< private >*/ CPUState parent_obj; -/*< public >*/ CPUHexagonState env;target/hppa/cpu-qom.h +0
-2@@ -35,9 +35,7 @@ OBJECT_DECLARE_CPU_TYPE(HPPACPU, HPPACPUClass, HPPA_CPU)* An HPPA CPU model. */ struct HPPACPUClass { -/*< private >*/ CPUClass parent_class; -/*< public >*/ DeviceRealize parent_realize;DeviceReset parent_reset;target/hppa/cpu.h +0
-2@@ -233,9 +233,7 @@ typedef struct CPUArchState {* An HPPA CPU. */ struct ArchCPU { -/*< private >*/ CPUState parent_obj; -/*< public >*/ CPUHPPAState env;QEMUTimer *alarm_timer;target/i386/cpu-qom.h +0
-2@@ -47,9 +47,7 @@ typedef struct X86CPUModel X86CPUModel;* An x86 CPU model or family. */ struct X86CPUClass { -/*< private >*/ CPUClass parent_class; -/*< public >*/ /* CPU definition, automatically loaded by instance_init if not NULL. * Should be eventually replaced by subclass-specific property defaults. target/i386/cpu.h +0
-2@@ -1897,9 +1897,7 @@ struct kvm_msrs;* An x86 CPU. */ struct ArchCPU { -/*< private >*/ CPUState parent_obj; -/*< public >*/ CPUX86State env;VMChangeStateEntry *vmsentry;target/loongarch/cpu.h +0
-4@@ -371,9 +371,7 @@ typedef struct CPUArchState {* A LoongArch CPU. */ struct ArchCPU { -/*< private >*/ CPUState parent_obj; -/*< public >*/ CPULoongArchState env;QEMUTimer timer;@@ -398,9 +396,7 @@ OBJECT_DECLARE_CPU_TYPE(LoongArchCPU, LoongArchCPUClass,* A LoongArch CPU model. */ struct LoongArchCPUClass { -/*< private >*/ CPUClass parent_class; -/*< public >*/ DeviceRealize parent_realize;ResettablePhases parent_phases;target/m68k/cpu-qom.h +0
-2@@ -35,9 +35,7 @@ OBJECT_DECLARE_CPU_TYPE(M68kCPU, M68kCPUClass, M68K_CPU)* A Motorola 68k CPU model. */ struct M68kCPUClass { -/*< private >*/ CPUClass parent_class; -/*< public >*/ DeviceRealize parent_realize;ResettablePhases parent_phases;target/m68k/cpu.h +0
-2@@ -164,9 +164,7 @@ typedef struct CPUArchState {* A Motorola 68k CPU. */ struct ArchCPU { -/*< private >*/ CPUState parent_obj; -/*< public >*/ CPUM68KState env; };target/microblaze/cpu-qom.h +0
-2@@ -35,9 +35,7 @@ OBJECT_DECLARE_CPU_TYPE(MicroBlazeCPU, MicroBlazeCPUClass, MICROBLAZE_CPU)* A MicroBlaze CPU model. */ struct MicroBlazeCPUClass { -/*< private >*/ CPUClass parent_class; -/*< public >*/ DeviceRealize parent_realize;ResettablePhases parent_phases;target/microblaze/cpu.h +0
-2@@ -343,9 +343,7 @@ typedef struct {* A MicroBlaze CPU. */ struct ArchCPU { -/*< private >*/ CPUState parent_obj; -/*< public >*/ CPUMBState env;target/mips/cpu-qom.h +0
-2@@ -39,9 +39,7 @@ OBJECT_DECLARE_CPU_TYPE(MIPSCPU, MIPSCPUClass, MIPS_CPU)* A MIPS CPU model. */ struct MIPSCPUClass { -/*< private >*/ CPUClass parent_class; -/*< public >*/ DeviceRealize parent_realize;ResettablePhases parent_phases;target/mips/cpu.h +0
-2@@ -1209,9 +1209,7 @@ typedef struct CPUArchState {* A MIPS CPU. */ struct ArchCPU { -/*< private >*/ CPUState parent_obj; -/*< public >*/ CPUMIPSState env;target/nios2/cpu.h +0
-4@@ -42,9 +42,7 @@ OBJECT_DECLARE_CPU_TYPE(Nios2CPU, Nios2CPUClass, NIOS2_CPU)* A Nios2 CPU model. */ struct Nios2CPUClass { -/*< private >*/ CPUClass parent_class; -/*< public >*/ DeviceRealize parent_realize;ResettablePhases parent_phases;@@ -214,9 +212,7 @@ typedef struct {* A Nios2 CPU. */ struct ArchCPU { -/*< private >*/ CPUState parent_obj; -/*< public >*/ CPUNios2State env;target/openrisc/cpu.h +0
-4@@ -39,9 +39,7 @@ OBJECT_DECLARE_CPU_TYPE(OpenRISCCPU, OpenRISCCPUClass, OPENRISC_CPU)* A OpenRISC CPU model. */ struct OpenRISCCPUClass { -/*< private >*/ CPUClass parent_class; -/*< public >*/ DeviceRealize parent_realize;ResettablePhases parent_phases;@@ -301,9 +299,7 @@ typedef struct CPUArchState {* A OpenRISC CPU. */ struct ArchCPU { -/*< private >*/ CPUState parent_obj; -/*< public >*/ CPUOpenRISCState env; };target/ppc/cpu.h +0
-2@@ -1407,9 +1407,7 @@ typedef struct PPCVirtualHypervisorClass PPCVirtualHypervisorClass;* A PowerPC CPU. */ struct ArchCPU { -/*< private >*/ CPUState parent_obj; -/*< public >*/ CPUPPCState env;target/riscv/cpu-qom.h +1
-2@@ -63,9 +63,8 @@ OBJECT_DECLARE_CPU_TYPE(RISCVCPU, RISCVCPUClass, RISCV_CPU)* A RISCV CPU model. */ struct RISCVCPUClass { -/*< private >*/ CPUClass parent_class; -/*< public >*/ +DeviceRealize parent_realize;ResettablePhases parent_phases; };target/riscv/cpu.h +0
-2@@ -389,9 +389,7 @@ struct CPUArchState {* A RISCV CPU. */ struct ArchCPU { -/* < private > */ CPUState parent_obj; -/* < public > */ CPURISCVState env;target/rx/cpu-qom.h +0
-2@@ -36,9 +36,7 @@ OBJECT_DECLARE_CPU_TYPE(RXCPU, RXCPUClass, RX_CPU)* A RX CPU model. */ struct RXCPUClass { -/*< private >*/ CPUClass parent_class; -/*< public >*/ DeviceRealize parent_realize;ResettablePhases parent_phases;target/rx/cpu.h +0
-2@@ -107,9 +107,7 @@ typedef struct CPUArchState {* A RX CPU */ struct ArchCPU { -/*< private >*/ CPUState parent_obj; -/*< public >*/ CPURXState env; };target/s390x/cpu-qom.h +1
-2@@ -49,9 +49,8 @@ typedef enum cpu_reset_type {* An S/390 CPU model. */ struct S390CPUClass { -/*< private >*/ CPUClass parent_class; -/*< public >*/ +const S390CPUDef *cpu_def;bool kvm_required;bool is_static;target/s390x/cpu.h +0
-2@@ -166,9 +166,7 @@ static inline uint64_t *get_freg(CPUS390XState *cs, int nr)* An S/390 CPU. */ struct ArchCPU { -/*< private >*/ CPUState parent_obj; -/*< public >*/ CPUS390XState env;S390CPUModel *model;target/sh4/cpu-qom.h +0
-2@@ -42,9 +42,7 @@ OBJECT_DECLARE_CPU_TYPE(SuperHCPU, SuperHCPUClass, SUPERH_CPU)* A SuperH CPU model. */ struct SuperHCPUClass { -/*< private >*/ CPUClass parent_class; -/*< public >*/ DeviceRealize parent_realize;ResettablePhases parent_phases;target/sh4/cpu.h +0
-2@@ -204,9 +204,7 @@ typedef struct CPUArchState {* A SuperH CPU. */ struct ArchCPU { -/*< private >*/ CPUState parent_obj; -/*< public >*/ CPUSH4State env; };target/sparc/cpu-qom.h +0
-2@@ -40,9 +40,7 @@ typedef struct sparc_def_t sparc_def_t;* A SPARC CPU model. */ struct SPARCCPUClass { -/*< private >*/ CPUClass parent_class; -/*< public >*/ DeviceRealize parent_realize;ResettablePhases parent_phases;target/sparc/cpu.h +0
-2@@ -557,9 +557,7 @@ struct CPUArchState {* A SPARC CPU. */ struct ArchCPU { -/*< private >*/ CPUState parent_obj; -/*< public >*/ CPUSPARCState env; };target/tricore/cpu-qom.h +0
-2@@ -27,9 +27,7 @@ OBJECT_DECLARE_CPU_TYPE(TriCoreCPU, TriCoreCPUClass, TRICORE_CPU)struct TriCoreCPUClass { -/*< private >*/ CPUClass parent_class; -/*< public >*/ DeviceRealize parent_realize;ResettablePhases parent_phases;target/tricore/cpu.h +0
-2@@ -63,9 +63,7 @@ typedef struct CPUArchState {* A TriCore CPU. */ struct ArchCPU { -/*< private >*/ CPUState parent_obj; -/*< public >*/ CPUTriCoreState env; };target/xtensa/cpu-qom.h +0
-2@@ -47,9 +47,7 @@ typedef struct XtensaConfig XtensaConfig;* An Xtensa CPU model. */ struct XtensaCPUClass { -/*< private >*/ CPUClass parent_class; -/*< public >*/ DeviceRealize parent_realize;ResettablePhases parent_phases;target/xtensa/cpu.h +0
-2@@ -556,9 +556,7 @@ struct CPUArchState {* An Xtensa CPU. */ struct ArchCPU { -/*< private >*/ CPUState parent_obj; -/*< public >*/ CPUXtensaState env;Clock *clock;Signature · 1 line
2.41.0
PATCH v2 2/16 target: Mention 'cpu-qom.h' is target agnostic
In reply to Philippe Mathieu-Daudé"target/foo/cpu-qom.h" is supposed to be target agnostic (include-able by any target). Add such mention in the header.
--- target/arm/cpu-qom.h | 2 +- target/hppa/cpu-qom.h | 2 +- target/microblaze/cpu-qom.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)
target/arm/cpu-qom.h +1 -1
@@ -1,5 +1,5 @@/* -* QEMU ARM CPU +* QEMU ARM CPU QOM header (target agnostic) * * Copyright (c) 2012 SUSE LINUX Products GmbH *
target/hppa/cpu-qom.h +1 -1
@@ -1,5 +1,5 @@/* -* QEMU HPPA CPU +* QEMU HPPA CPU QOM header (target agnostic) * * Copyright (c) 2016 Richard Henderson <[email protected]> *
target/microblaze/cpu-qom.h +1 -1
@@ -1,5 +1,5 @@/* -* QEMU MicroBlaze CPU +* QEMU MicroBlaze CPU QOM header (target agnostic) * * Copyright (c) 2012 SUSE LINUX Products GmbH *
Signature · 1 line
2.41.0
Re: [PATCH v2 02/16] target: Mention 'cpu-qom.h' is target agnostic
Hi Philippe,
Quoted 9 lines · Philippe Mathieu-Daudé
Date: Fri, 13 Oct 2023 16:01:01 +0200
From: Philippe Mathieu-Daudé <[email protected]>
Subject: [PATCH v2 02/16] target: Mention 'cpu-qom.h' is target agnostic
X-Mailer: git-send-email 2.41.0"
target/foo/cpu-qom.h" is supposed to be target agnostic (include-able by any target). Add such mention in the header.
Quoted 7 lines
Signed-off-by Philippe Mathieu-Daudé <[email protected]>Reviewed-by Richard Henderson <[email protected]>--- target/arm/cpu-qom.h | 2 +- target/hppa/cpu-qom.h | 2 +- target/microblaze/cpu-qom.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)
Why not mention this description for other qom-cpu.h in this series, e.g., target/i386/cpu-qom.h.
Otherwise,
Quoted 39 lines
target/arm/cpu-qom.h +1
-1@@ -1,5 +1,5 @@/* -* QEMU ARM CPU +* QEMU ARM CPU QOM header (target agnostic) * * Copyright (c) 2012 SUSE LINUX Products GmbH * target/hppa/cpu-qom.h +1
-1@@ -1,5 +1,5 @@/* -* QEMU HPPA CPU +* QEMU HPPA CPU QOM header (target agnostic) * * Copyright (c) 2016 Richard Henderson <[email protected]> * target/microblaze/cpu-qom.h +1
-1@@ -1,5 +1,5 @@/* -* QEMU MicroBlaze CPU +* QEMU MicroBlaze CPU QOM header (target agnostic) * * Copyright (c) 2012 SUSE LINUX Products GmbH * Signature · 1 line
2.41.0
Re: [PATCH v2 02/16] target: Mention 'cpu-qom.h' is target agnostic
Quoted 20 lines · Zhao Liu
Hi Philippe,
Quoted 9 lines · Philippe Mathieu-Daudé
Date: Fri, 13 Oct 2023 16:01:01 +0200
From: Philippe Mathieu-Daudé <[email protected]>
Subject: [PATCH v2 02/16] target: Mention 'cpu-qom.h' is target agnostic
X-Mailer: git-send-email 2.41.0"
target/foo/cpu-qom.h" is supposed to be target agnostic (include-able by any target). Add such mention in the header.Quoted 7 lines
Signed-off-by Philippe Mathieu-Daudé <[email protected]>Reviewed-by Richard Henderson <[email protected]>--- target/arm/cpu-qom.h | 2 +- target/hppa/cpu-qom.h | 2 +- target/microblaze/cpu-qom.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)
Quoted 2 lines
Why not mention this description for other
qom-cpu.hin this series, e.g.,target/i386/cpu-qom.h.
OK, will add a comment in each patch.
Quoted 3 lines
Otherwise,
Reviewed-by Zhao Liu <[email protected]>
Thanks!
PATCH v2 3/16 target/arm: Move internal declarations from 'cpu-qom.h' to 'cpu.h'
In reply to Philippe Mathieu-DaudéThese definitions and declarations are only used by target/arm/, no need to expose them to generic hw/.
--- target/arm/cpu-qom.h | 28 ---------------------------- target/arm/cpu.h | 28 ++++++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 28 deletions(-)
target/arm/cpu-qom.h +0 -28
@@ -35,9 +35,6 @@ typedef struct ARMCPUInfo {void (*class_init)(ObjectClass *oc,void *data); } ARMCPUInfo; -void arm_cpu_register (const ARMCPUInfo *info); -void aarch64_cpu_register (const ARMCPUInfo *info); -/** * ARMCPUClass: * @parent_realize: The parent class' realize handler.
@@ -63,29 +60,4 @@ struct AArch64CPUClass { ARMCPUClass parent_class; }; -void register_cp_regs_for_features (ARMCPU *cpu); -void init_cpreg_list (ARMCPU *cpu); - -/* Callback functions for the generic timer's timers. */ -void arm_gt_ptimer_cb (void *opaque); -void arm_gt_vtimer_cb (void *opaque); -void arm_gt_htimer_cb (void *opaque); -void arm_gt_stimer_cb (void *opaque); -void arm_gt_hvtimer_cb (void *opaque); - -#define ARM_AFF0_SHIFT 0 -#define ARM_AFF0_MASK (0xFFULL << ARM_AFF0_SHIFT) -#define ARM_AFF1_SHIFT 8 -#define ARM_AFF1_MASK (0xFFULL << ARM_AFF1_SHIFT) -#define ARM_AFF2_SHIFT 16 -#define ARM_AFF2_MASK (0xFFULL << ARM_AFF2_SHIFT) -#define ARM_AFF3_SHIFT 32 -#define ARM_AFF3_MASK (0xFFULL << ARM_AFF3_SHIFT) -#define ARM_DEFAULT_CPUS_PER_CLUSTER 8 - -#define ARM32_AFFINITY_MASK (ARM_AFF0_MASK|ARM_AFF1_MASK|ARM_AFF2_MASK) -#define ARM64_AFFINITY_MASK \ - (ARM_AFF0_MASK|ARM_AFF1_MASK|ARM_AFF2_MASK|ARM_AFF3_MASK) -#define ARM64_AFFINITY_INVALID (~ARM64_AFFINITY_MASK) -#endif
target/arm/cpu.h +28 -0
@@ -1116,11 +1116,39 @@ struct ArchCPU {uint64_t gt_cntfrq_hz; }; +/* Callback functions for the generic timer's timers. */ +void arm_gt_ptimer_cb (void *opaque); +void arm_gt_vtimer_cb (void *opaque); +void arm_gt_htimer_cb (void *opaque); +void arm_gt_stimer_cb (void *opaque); +void arm_gt_hvtimer_cb (void *opaque); +unsigned int gt_cntfrq_period_ns (ARMCPU *cpu);void gt_rme_post_el_change (ARMCPU *cpu,void *opaque);void arm_cpu_post_init (Object *obj); +void arm_cpu_register (const ARMCPUInfo *info); +void aarch64_cpu_register (const ARMCPUInfo *info); + +void register_cp_regs_for_features (ARMCPU *cpu); +void init_cpreg_list (ARMCPU *cpu); + +#define ARM_AFF0_SHIFT 0 +#define ARM_AFF0_MASK (0xFFULL << ARM_AFF0_SHIFT) +#define ARM_AFF1_SHIFT 8 +#define ARM_AFF1_MASK (0xFFULL << ARM_AFF1_SHIFT) +#define ARM_AFF2_SHIFT 16 +#define ARM_AFF2_MASK (0xFFULL << ARM_AFF2_SHIFT) +#define ARM_AFF3_SHIFT 32 +#define ARM_AFF3_MASK (0xFFULL << ARM_AFF3_SHIFT) +#define ARM_DEFAULT_CPUS_PER_CLUSTER 8 + +#define ARM32_AFFINITY_MASK (ARM_AFF0_MASK|ARM_AFF1_MASK|ARM_AFF2_MASK) +#define ARM64_AFFINITY_MASK \ + (ARM_AFF0_MASK|ARM_AFF1_MASK|ARM_AFF2_MASK|ARM_AFF3_MASK) +#define ARM64_AFFINITY_INVALID (~ARM64_AFFINITY_MASK) +uint64_t arm_cpu_mp_affinity (int idx,uint8_t clustersz);#ifndef CONFIG_USER_ONLY
Signature · 1 line
2.41.0
Re: [PATCH v2 03/16] target/arm: Move internal declarations from 'cpu-qom.h' to 'cpu.h'
Quoted 68 lines · Philippe Mathieu-Daudé
These definitions and declarations are only used by target/arm/, no need to expose them to generic hw/.
Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- target/arm/cpu-qom.h | 28 ---------------------------- target/arm/cpu.h | 28 ++++++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 28 deletions(-)target/arm/cpu-qom.h +0
-28@@ -35,9 +35,6 @@ typedef struct ARMCPUInfo {void (*class_init)(ObjectClass *oc,void *data); } ARMCPUInfo; -void arm_cpu_register (const ARMCPUInfo *info); -void aarch64_cpu_register (const ARMCPUInfo *info); -/** * ARMCPUClass: * @parent_realize: The parent class' realize handler. @@ -63,29 +60,4 @@ struct AArch64CPUClass { ARMCPUClass parent_class; }; -void register_cp_regs_for_features (ARMCPU *cpu); -void init_cpreg_list (ARMCPU *cpu); - -/* Callback functions for the generic timer's timers. */ -void arm_gt_ptimer_cb (void *opaque); -void arm_gt_vtimer_cb (void *opaque); -void arm_gt_htimer_cb (void *opaque); -void arm_gt_stimer_cb (void *opaque); -void arm_gt_hvtimer_cb (void *opaque); - -#define ARM_AFF0_SHIFT 0 -#define ARM_AFF0_MASK (0xFFULL << ARM_AFF0_SHIFT) -#define ARM_AFF1_SHIFT 8 -#define ARM_AFF1_MASK (0xFFULL << ARM_AFF1_SHIFT) -#define ARM_AFF2_SHIFT 16 -#define ARM_AFF2_MASK (0xFFULL << ARM_AFF2_SHIFT) -#define ARM_AFF3_SHIFT 32 -#define ARM_AFF3_MASK (0xFFULL << ARM_AFF3_SHIFT) -#define ARM_DEFAULT_CPUS_PER_CLUSTER 8 - -#define ARM32_AFFINITY_MASK (ARM_AFF0_MASK|ARM_AFF1_MASK|ARM_AFF2_MASK) -#define ARM64_AFFINITY_MASK \ - (ARM_AFF0_MASK|ARM_AFF1_MASK|ARM_AFF2_MASK|ARM_AFF3_MASK) -#define ARM64_AFFINITY_INVALID (~ARM64_AFFINITY_MASK) -#endif target/arm/cpu.h +7
-0@@ -1116,11 +1116,39 @@ struct ArchCPU {uint64_t gt_cntfrq_hz; }; +/* Callback functions for the generic timer's timers. */ +void arm_gt_ptimer_cb (void *opaque); +void arm_gt_vtimer_cb (void *opaque); +void arm_gt_htimer_cb (void *opaque); +void arm_gt_stimer_cb (void *opaque); +void arm_gt_hvtimer_cb (void *opaque); +
target/arm/cpu.h struct ArchCPU { · line 1135
Quoted 10 lines
target/arm/cpu.h +5
-0unsigned int gt_cntfrq_period_ns (ARMCPU *cpu);void gt_rme_post_el_change (ARMCPU *cpu,void *opaque);void arm_cpu_post_init (Object *obj); +void arm_cpu_register (const ARMCPUInfo *info); +void aarch64_cpu_register (const ARMCPUInfo *info); + +void register_cp_regs_for_features (ARMCPU *cpu); +void init_cpreg_list (ARMCPU *cpu);
These can go to internals.h.
Otherwise,
r~
Quoted 19 lines
target/arm/cpu.h +16
-0+ +#define ARM_AFF0_SHIFT 0 +#define ARM_AFF0_MASK (0xFFULL << ARM_AFF0_SHIFT) +#define ARM_AFF1_SHIFT 8 +#define ARM_AFF1_MASK (0xFFULL << ARM_AFF1_SHIFT) +#define ARM_AFF2_SHIFT 16 +#define ARM_AFF2_MASK (0xFFULL << ARM_AFF2_SHIFT) +#define ARM_AFF3_SHIFT 32 +#define ARM_AFF3_MASK (0xFFULL << ARM_AFF3_SHIFT) +#define ARM_DEFAULT_CPUS_PER_CLUSTER 8 + +#define ARM32_AFFINITY_MASK (ARM_AFF0_MASK|ARM_AFF1_MASK|ARM_AFF2_MASK) +#define ARM64_AFFINITY_MASK \ + (ARM_AFF0_MASK|ARM_AFF1_MASK|ARM_AFF2_MASK|ARM_AFF3_MASK) +#define ARM64_AFFINITY_INVALID (~ARM64_AFFINITY_MASK) +uint64_t arm_cpu_mp_affinity (int idx,uint8_t clustersz);#ifndef CONFIG_USER_ONLY
Re: [PATCH v2 03/16] target/arm: Move internal declarations from 'cpu-qom.h' to 'cpu.h'
Quoted 27 lines · Richard Henderson
Quoted 26 lines · Philippe Mathieu-Daudé
These definitions and declarations are only used by target/arm/, no need to expose them to generic hw/.
Signed-off-by Philippe Mathieu-Daudé <[email protected]>---
target/arm/cpu-qom.h| 28 ---------------------------- target/arm/cpu.h | 28 ++++++++++++++++++++++++++++2 files changed, 28 insertions(+), 28 deletions(-)target/arm/cpu.h +7
-0@@ -1116,11 +1116,39 @@ struct ArchCPU { uint64_t gt_cntfrq_hz; }; +/* Callback functions for the generic timer's timers. */ +void arm_gt_ptimer_cb (void *opaque); +void arm_gt_vtimer_cb (void *opaque); +void arm_gt_htimer_cb (void *opaque); +void arm_gt_stimer_cb (void *opaque); +void arm_gt_hvtimer_cb (void *opaque); + unsigned int gt_cntfrq_period_ns(ARMCPU *cpu); void gt_rme_post_el_change(ARMCPU *cpu, void *opaque);
Quoted 8 lines
target/arm/cpu.h struct ArchCPU { · line 1132
Quoted 6 lines
target/arm/cpu.h +5
-0void arm_cpu_post_init(Object *obj); +void arm_cpu_register (const ARMCPUInfo *info); +void aarch64_cpu_register (const ARMCPUInfo *info); + +void register_cp_regs_for_features (ARMCPU *cpu); +void init_cpreg_list (ARMCPU *cpu);These can go to
internals.h.
OK, I'm squashing:
-- >8 --
target/arm/cpu.h +0 -6
@@ -1153,12 +1153,6 @@ void gt_rme_post_el_change(ARMCPU *cpu, void *opaque);void arm_cpu_post_init (Object *obj); -void arm_cpu_register (const ARMCPUInfo *info); -void aarch64_cpu_register (const ARMCPUInfo *info); - -void register_cp_regs_for_features (ARMCPU *cpu); -void init_cpreg_list (ARMCPU *cpu); -#define ARM_AFF0_SHIFT 0#define ARM_AFF0_MASK (0xFFULL << ARM_AFF0_SHIFT)#define ARM_AFF1_SHIFT 8
target/arm/internals.h +6 -0
@@ -182,6 +182,12 @@ static inline int r14_bank_number(int mode)return (mode ==ARM_CPU_MODE_HYP ) ?BANK_USRSYS :bank_number (mode); } +void arm_cpu_register (const ARMCPUInfo *info); +void aarch64_cpu_register (const ARMCPUInfo *info); + +void register_cp_regs_for_features (ARMCPU *cpu); +void init_cpreg_list (ARMCPU *cpu); +void arm_cpu_register_gdb_regs_for_features (ARMCPU *cpu);void arm_translate_init (void );
---
Quoted 3 lines
Otherwise,
Reviewed-by Richard Henderson <[email protected]>
Thanks!
PATCH v2 4/16 target/ppc: Remove CPU_RESOLVING_TYPE from 'cpu-qom.h'
In reply to Philippe Mathieu-DaudéCPU_RESOLVING_TYPE is a per-target definition, and is irrelevant for other targets. Move it to "cpu.h".
--- target/ppc/cpu-qom.h | 3 +-- target/ppc/cpu.h | 2 ++ 2 files changed, 3 insertions(+), 2 deletions(-)
target/ppc/cpu-qom.h +1 -2
@@ -1,5 +1,5 @@/* -* QEMU PowerPC CPU +* QEMU PowerPC CPU QOM header (target agnostic) * * Copyright (c) 2012 SUSE LINUX Products GmbH *
@@ -32,7 +32,6 @@ OBJECT_DECLARE_CPU_TYPE(PowerPCCPU, PowerPCCPUClass, POWERPC_CPU)#define POWERPC_CPU_TYPE_SUFFIX "-" TYPE_POWERPC_CPU#define POWERPC_CPU_TYPE_NAME (model) model POWERPC_CPU_TYPE_SUFFIX -#define CPU_RESOLVING_TYPE TYPE_POWERPC_CPU#define TYPE_HOST_POWERPC_CPU POWERPC_CPU_TYPE_NAME("host")
target/ppc/cpu.h +2 -0
@@ -27,6 +27,8 @@#include "qom/object.h" #include "hw/registerfields.h" +#define CPU_RESOLVING_TYPE TYPE_POWERPC_CPU +#define TCG_GUEST_DEFAULT_MO 0#define TARGET_PAGE_BITS_64K 16
Signature · 1 line
2.41.0
PATCH v2 5/16 target/riscv: Remove CPU_RESOLVING_TYPE from 'cpu-qom.h'
In reply to Philippe Mathieu-DaudéCPU_RESOLVING_TYPE is a per-target definition, and is irrelevant for other targets. Move it to "cpu.h".
--- target/riscv/cpu-qom.h | 1 - target/riscv/cpu.h | 2 ++ 2 files changed, 2 insertions(+), 1 deletion(-)
target/riscv/cpu-qom.h +0 -1
@@ -27,7 +27,6 @@#define RISCV_CPU_TYPE_SUFFIX "-" TYPE_RISCV_CPU#define RISCV_CPU_TYPE_NAME (name) (name RISCV_CPU_TYPE_SUFFIX) -#define CPU_RESOLVING_TYPE TYPE_RISCV_CPU#define TYPE_RISCV_CPU_ANY RISCV_CPU_TYPE_NAME("any")#define TYPE_RISCV_CPU_MAX RISCV_CPU_TYPE_NAME("max")
target/riscv/cpu.h +2 -0
@@ -32,6 +32,8 @@#include "qapi/qapi-types-common.h" #include "cpu-qom.h" +#define CPU_RESOLVING_TYPE TYPE_RISCV_CPU +#define TCG_GUEST_DEFAULT_MO 0/*
Signature · 1 line
2.41.0
PATCH v2 6/16 target: Declare FOO_CPU_TYPE_NAME/SUFFIX in 'cpu-qom.h'
In reply to Philippe Mathieu-DaudéHegerogeneous code needs access to the FOO_CPU_TYPE_NAME() macro to resolve target CPU types. Move the declaration (along with the required FOO_CPU_TYPE_SUFFIX) to "cpu-qom.h".
--- target/alpha/cpu-qom.h | 5 ++++- target/alpha/cpu.h | 2 -- target/avr/cpu-qom.h | 5 ++++- target/avr/cpu.h | 2 -- target/cris/cpu-qom.h | 5 ++++- target/cris/cpu.h | 2 -- target/i386/cpu-qom.h | 3 +++ target/i386/cpu.h | 2 -- target/m68k/cpu-qom.h | 5 ++++- target/m68k/cpu.h | 2 -- target/mips/cpu-qom.h | 3 +++ target/mips/cpu.h | 2 -- target/rx/cpu-qom.h | 5 ++++- target/rx/cpu.h | 2 -- target/s390x/cpu-qom.h | 5 ++++- target/s390x/cpu.h | 2 -- target/sh4/cpu-qom.h | 5 ++++- target/sh4/cpu.h | 2 -- target/sparc/cpu-qom.h | 5 ++++- target/sparc/cpu.h | 2 -- target/tricore/cpu-qom.h | 5 +++++ target/tricore/cpu.h | 2 -- target/xtensa/cpu-qom.h | 5 ++++- target/xtensa/cpu.h | 2 -- 24 files changed, 47 insertions(+), 33 deletions(-)
target/alpha/cpu-qom.h +4 -1
@@ -1,5 +1,5 @@/* -* QEMU Alpha CPU +* QEMU Alpha CPU QOM header (target agnostic) * * Copyright (c) 2012 SUSE LINUX Products GmbH *
@@ -27,6 +27,9 @@ OBJECT_DECLARE_CPU_TYPE(AlphaCPU, AlphaCPUClass, ALPHA_CPU) +#define ALPHA_CPU_TYPE_SUFFIX "-" TYPE_ALPHA_CPU +#define ALPHA_CPU_TYPE_NAME (model) model ALPHA_CPU_TYPE_SUFFIX +/** * AlphaCPUClass: * @parent_realize: The parent class' realize handler.
target/alpha/cpu.h +0 -2
@@ -426,8 +426,6 @@ enum {void alpha_translate_init (void ); -#define ALPHA_CPU_TYPE_SUFFIX "-" TYPE_ALPHA_CPU -#define ALPHA_CPU_TYPE_NAME (model) model ALPHA_CPU_TYPE_SUFFIX#define CPU_RESOLVING_TYPE TYPE_ALPHA_CPUvoid alpha_cpu_list (void );
target/avr/cpu-qom.h +4 -1
@@ -1,5 +1,5 @@/* -* QEMU AVR CPU +* QEMU AVR CPU QOM header (target agnostic) * * Copyright (c) 2016-2020 Michael Rolnik *
@@ -28,6 +28,9 @@ OBJECT_DECLARE_CPU_TYPE(AVRCPU, AVRCPUClass, AVR_CPU) +#define AVR_CPU_TYPE_SUFFIX "-" TYPE_AVR_CPU +#define AVR_CPU_TYPE_NAME (name) (name AVR_CPU_TYPE_SUFFIX) +/** * AVRCPUClass: * @parent_realize: The parent class' realize handler.
target/avr/cpu.h +0 -2
@@ -28,8 +28,6 @@#error "AVR 8-bit does not support user mode"#endif -#define AVR_CPU_TYPE_SUFFIX "-" TYPE_AVR_CPU -#define AVR_CPU_TYPE_NAME (name) (name AVR_CPU_TYPE_SUFFIX)#define CPU_RESOLVING_TYPE TYPE_AVR_CPU#define TCG_GUEST_DEFAULT_MO 0
target/cris/cpu-qom.h +4 -1
@@ -1,5 +1,5 @@/* -* QEMU CRIS CPU +* QEMU CRIS CPU QOM header (target agnostic) * * Copyright (c) 2012 SUSE LINUX Products GmbH *
@@ -27,6 +27,9 @@ OBJECT_DECLARE_CPU_TYPE(CRISCPU, CRISCPUClass, CRIS_CPU) +#define CRIS_CPU_TYPE_SUFFIX "-" TYPE_CRIS_CPU +#define CRIS_CPU_TYPE_NAME (name) (name CRIS_CPU_TYPE_SUFFIX) +/** * CRISCPUClass: * @parent_realize: The parent class' realize handler.
target/cris/cpu.h +0 -2
@@ -240,8 +240,6 @@ enum {/* CRIS uses 8k pages. */ #define MMAP_SHIFT TARGET_PAGE_BITS -#define CRIS_CPU_TYPE_SUFFIX "-" TYPE_CRIS_CPU -#define CRIS_CPU_TYPE_NAME (name) (name CRIS_CPU_TYPE_SUFFIX)#define CPU_RESOLVING_TYPE TYPE_CRIS_CPU/* MMU modes definitions */
target/i386/cpu-qom.h +3 -0
@@ -32,6 +32,9 @@ OBJECT_DECLARE_CPU_TYPE(X86CPU, X86CPUClass, X86_CPU) +#define X86_CPU_TYPE_SUFFIX "-" TYPE_X86_CPU +#define X86_CPU_TYPE_NAME (name) (name X86_CPU_TYPE_SUFFIX) +typedef struct X86CPUModel X86CPUModel ;/**
target/i386/cpu.h +0 -2
@@ -2239,8 +2239,6 @@ void cpu_x86_update_dr7(CPUX86State *env, uint32_t new_dr7);/* hw/pc.c */ uint64_t cpu_get_tsc (CPUX86State *env); -#define X86_CPU_TYPE_SUFFIX "-" TYPE_X86_CPU -#define X86_CPU_TYPE_NAME (name) (name X86_CPU_TYPE_SUFFIX)#define CPU_RESOLVING_TYPE TYPE_X86_CPU#ifdef TARGET_X86_64
target/m68k/cpu-qom.h +4 -1
@@ -1,5 +1,5 @@/* -* QEMU Motorola 68k CPU +* QEMU Motorola 68k CPU QOM header (target agnostic) * * Copyright (c) 2012 SUSE LINUX Products GmbH *
@@ -27,6 +27,9 @@ OBJECT_DECLARE_CPU_TYPE(M68kCPU, M68kCPUClass, M68K_CPU) +#define M68K_CPU_TYPE_SUFFIX "-" TYPE_M68K_CPU +#define M68K_CPU_TYPE_NAME (model) model M68K_CPU_TYPE_SUFFIX +/* * M68kCPUClass: * @parent_realize: The parent class' realize handler.
target/m68k/cpu.h +0 -2
@@ -561,8 +561,6 @@ enum { ACCESS_DATA = 0x20, /* Data load/store access */ }; -#define M68K_CPU_TYPE_SUFFIX "-" TYPE_M68K_CPU -#define M68K_CPU_TYPE_NAME (model) model M68K_CPU_TYPE_SUFFIX#define CPU_RESOLVING_TYPE TYPE_M68K_CPU#define cpu_list m68k_cpu_list
target/mips/cpu-qom.h +3 -0
@@ -31,6 +31,9 @@ OBJECT_DECLARE_CPU_TYPE(MIPSCPU, MIPSCPUClass, MIPS_CPU) +#define MIPS_CPU_TYPE_SUFFIX "-" TYPE_MIPS_CPU +#define MIPS_CPU_TYPE_NAME (model) model MIPS_CPU_TYPE_SUFFIX +/** * MIPSCPUClass: * @parent_realize: The parent class' realize handler.
target/mips/cpu.h +0 -2
@@ -1301,8 +1301,6 @@ enum {*/ #define CPU_INTERRUPT_WAKE CPU_INTERRUPT_TGT_INT_0 -#define MIPS_CPU_TYPE_SUFFIX "-" TYPE_MIPS_CPU -#define MIPS_CPU_TYPE_NAME (model) model MIPS_CPU_TYPE_SUFFIX#define CPU_RESOLVING_TYPE TYPE_MIPS_CPUbool cpu_type_supports_cps_smp (const char *cpu_type);
target/rx/cpu-qom.h +4 -1
@@ -1,5 +1,5 @@/* -* RX CPU +* QEMU RX CPU QOM header (target agnostic) * * Copyright (c) 2019 Yoshinori Sato *
@@ -28,6 +28,9 @@ OBJECT_DECLARE_CPU_TYPE(RXCPU, RXCPUClass, RX_CPU) +#define RX_CPU_TYPE_SUFFIX "-" TYPE_RX_CPU +#define RX_CPU_TYPE_NAME (model) model RX_CPU_TYPE_SUFFIX +/* * RXCPUClass: * @parent_realize: The parent class' realize handler.
target/rx/cpu.h +0 -2
@@ -112,8 +112,6 @@ struct ArchCPU {CPURXState env; }; -#define RX_CPU_TYPE_SUFFIX "-" TYPE_RX_CPU -#define RX_CPU_TYPE_NAME (model) model RX_CPU_TYPE_SUFFIX#define CPU_RESOLVING_TYPE TYPE_RX_CPUconst char *rx_crname (uint8_t cr);
target/s390x/cpu-qom.h +4 -1
@@ -1,5 +1,5 @@/* -* QEMU S/390 CPU +* QEMU S/390 CPU QOM header (target agnostic) * * Copyright (c) 2012 SUSE LINUX Products GmbH *
@@ -27,6 +27,9 @@ OBJECT_DECLARE_CPU_TYPE(S390CPU, S390CPUClass, S390_CPU) +#define S390_CPU_TYPE_SUFFIX "-" TYPE_S390_CPU +#define S390_CPU_TYPE_NAME (name) (name S390_CPU_TYPE_SUFFIX) +typedef struct S390CPUModel S390CPUModel ;typedef struct S390CPUDef S390CPUDef ;
target/s390x/cpu.h +0 -2
@@ -808,8 +808,6 @@ void s390_set_qemu_cpu_model(uint16_t type, uint8_t gen, uint8_t ec_ga,/* helper.c */ -#define S390_CPU_TYPE_SUFFIX "-" TYPE_S390_CPU -#define S390_CPU_TYPE_NAME (name) (name S390_CPU_TYPE_SUFFIX)#define CPU_RESOLVING_TYPE TYPE_S390_CPU/* interrupt.c */
target/sh4/cpu-qom.h +4 -1
@@ -1,5 +1,5 @@/* -* QEMU SuperH CPU +* QEMU SuperH CPU QOM header (target agnostic) * * Copyright (c) 2012 SUSE LINUX Products GmbH *
@@ -31,6 +31,9 @@ OBJECT_DECLARE_CPU_TYPE(SuperHCPU, SuperHCPUClass, SUPERH_CPU) +#define SUPERH_CPU_TYPE_SUFFIX "-" TYPE_SUPERH_CPU +#define SUPERH_CPU_TYPE_NAME (model) model SUPERH_CPU_TYPE_SUFFIX +/** * SuperHCPUClass: * @parent_realize: The parent class' realize handler.
target/sh4/cpu.h +0 -2
@@ -250,8 +250,6 @@ int cpu_sh4_is_cached(CPUSH4State * env, target_ulong addr);void cpu_load_tlb (CPUSH4State * env); -#define SUPERH_CPU_TYPE_SUFFIX "-" TYPE_SUPERH_CPU -#define SUPERH_CPU_TYPE_NAME (model) model SUPERH_CPU_TYPE_SUFFIX#define CPU_RESOLVING_TYPE TYPE_SUPERH_CPU#define cpu_list sh4_cpu_list
target/sparc/cpu-qom.h +4 -1
@@ -1,5 +1,5 @@/* -* QEMU SPARC CPU +* QEMU SPARC CPU QOM header (target agnostic) * * Copyright (c) 2012 SUSE LINUX Products GmbH *
@@ -31,6 +31,9 @@ OBJECT_DECLARE_CPU_TYPE(SPARCCPU, SPARCCPUClass, SPARC_CPU) +#define SPARC_CPU_TYPE_SUFFIX "-" TYPE_SPARC_CPU +#define SPARC_CPU_TYPE_NAME (model) model SPARC_CPU_TYPE_SUFFIX +typedef struct sparc_def_t sparc_def_t ;/** * SPARCCPUClass:
target/sparc/cpu.h +0 -2
@@ -648,8 +648,6 @@ hwaddr cpu_get_phys_page_nofault(CPUSPARCState *env, target_ulong addr,#endif #endif -#define SPARC_CPU_TYPE_SUFFIX "-" TYPE_SPARC_CPU -#define SPARC_CPU_TYPE_NAME (model) model SPARC_CPU_TYPE_SUFFIX#define CPU_RESOLVING_TYPE TYPE_SPARC_CPU#define cpu_list sparc_cpu_list
target/tricore/cpu-qom.h +5 -0
@@ -1,4 +1,6 @@/* +* QEMU TriCore CPU QOM header (target agnostic) +* * Copyright (c) 2012-2014 Bastian Koppelmann C-Lab/University Paderborn * * This library is free software; you can redistribute it and/or
@@ -26,6 +28,9 @@ OBJECT_DECLARE_CPU_TYPE(TriCoreCPU, TriCoreCPUClass, TRICORE_CPU) +#define TRICORE_CPU_TYPE_SUFFIX "-" TYPE_TRICORE_CPU +#define TRICORE_CPU_TYPE_NAME (model) model TRICORE_CPU_TYPE_SUFFIX +struct TriCoreCPUClass {CPUClass parent_class;
target/tricore/cpu.h +0 -2
@@ -268,8 +268,6 @@ static inline void cpu_get_tb_cpu_state(CPUTriCoreState *env, vaddr *pc, *flags = new_flags; } -#define TRICORE_CPU_TYPE_SUFFIX "-" TYPE_TRICORE_CPU -#define TRICORE_CPU_TYPE_NAME (model) model TRICORE_CPU_TYPE_SUFFIX#define CPU_RESOLVING_TYPE TYPE_TRICORE_CPU/* helpers.c */
target/xtensa/cpu-qom.h +4 -1
@@ -1,5 +1,5 @@/* -* QEMU Xtensa CPU +* QEMU Xtensa CPU QOM header (target agnostic) * * Copyright (c) 2012 SUSE LINUX Products GmbH * All rights reserved.
@@ -36,6 +36,9 @@ OBJECT_DECLARE_CPU_TYPE(XtensaCPU, XtensaCPUClass, XTENSA_CPU) +#define XTENSA_CPU_TYPE_SUFFIX "-" TYPE_XTENSA_CPU +#define XTENSA_CPU_TYPE_NAME (model) model XTENSA_CPU_TYPE_SUFFIX +typedef struct XtensaConfig XtensaConfig ;/**
target/xtensa/cpu.h +0 -2
@@ -586,8 +586,6 @@ G_NORETURN void xtensa_cpu_do_unaligned_access(CPUState *cpu, vaddr addr,#define cpu_list xtensa_cpu_list -#define XTENSA_CPU_TYPE_SUFFIX "-" TYPE_XTENSA_CPU -#define XTENSA_CPU_TYPE_NAME (model) model XTENSA_CPU_TYPE_SUFFIX#define CPU_RESOLVING_TYPE TYPE_XTENSA_CPU#if TARGET_BIG_ENDIAN
Signature · 1 line
2.41.0
PATCH v2 7/16 target/hexagon: Declare QOM definitions in 'cpu-qom.h'
In reply to Philippe Mathieu-Daudé"target/foo/cpu.h" contains the target specific declarations.
A heterogeneous setup need to access target agnostic declarations (at least the QOM ones, to instantiate the objects).
Our convention is to add such target agnostic QOM declarations in the "target/foo/cpu-qom.h" header.
Extract QOM definitions from "cpu.h" to "cpu-qom.h".
--- target/hexagon/cpu-qom.h | 28 ++++++++++++++++++++++++++++ target/hexagon/cpu.h | 15 +-------------- 2 files changed, 29 insertions(+), 14 deletions(-) create mode 100644 target/hexagon/cpu-qom.h
target/hexagon/cpu-qom.h new file +28 -0
@@ -0,0 +1,28 @@ +/* +* QEMU Hexagon CPU QOM header (target agnostic) +* +* Copyright(c) 2019-2023 Qualcomm Innovation Center, Inc. All Rights Reserved. +* +* SPDX-License-Identifier: GPL-2.0-or-later +*/ + +#ifndef QEMU_HEXAGON_CPU_QOM_H +#define QEMU_HEXAGON_CPU_QOM_H + +#include "hw/core/cpu.h" +#include "qom/object.h" + +#define TYPE_HEXAGON_CPU "hexagon-cpu" + +#define HEXAGON_CPU_TYPE_SUFFIX "-" TYPE_HEXAGON_CPU +#define HEXAGON_CPU_TYPE_NAME (name) (name HEXAGON_CPU_TYPE_SUFFIX) + +#define TYPE_HEXAGON_CPU_V67 HEXAGON_CPU_TYPE_NAME("v67") +#define TYPE_HEXAGON_CPU_V68 HEXAGON_CPU_TYPE_NAME("v68") +#define TYPE_HEXAGON_CPU_V69 HEXAGON_CPU_TYPE_NAME("v69") +#define TYPE_HEXAGON_CPU_V71 HEXAGON_CPU_TYPE_NAME("v71") +#define TYPE_HEXAGON_CPU_V73 HEXAGON_CPU_TYPE_NAME("v73") + +OBJECT_DECLARE_CPU_TYPE(HexagonCPU, HexagonCPUClass, HEXAGON_CPU) + +#endif
target/hexagon/cpu.h +1 -14
@@ -20,11 +20,10 @@#include "fpu/softfloat-types.h" +#include "cpu-qom.h" #include "exec/cpu-defs.h" #include "hex_regs.h" #include "mmvec/mmvec.h" -#include "qom/object.h" -#include "hw/core/cpu.h" #include "hw/registerfields.h" #define NUM_PREGS 4
@@ -36,18 +35,8 @@#define PRED_WRITES_MAX 5/* 4 insns + endloop */ #define VSTORES_MAX 2 -#define TYPE_HEXAGON_CPU "hexagon-cpu" - -#define HEXAGON_CPU_TYPE_SUFFIX "-" TYPE_HEXAGON_CPU -#define HEXAGON_CPU_TYPE_NAME (name) (name HEXAGON_CPU_TYPE_SUFFIX)#define CPU_RESOLVING_TYPE TYPE_HEXAGON_CPU -#define TYPE_HEXAGON_CPU_V67 HEXAGON_CPU_TYPE_NAME("v67") -#define TYPE_HEXAGON_CPU_V68 HEXAGON_CPU_TYPE_NAME("v68") -#define TYPE_HEXAGON_CPU_V69 HEXAGON_CPU_TYPE_NAME("v69") -#define TYPE_HEXAGON_CPU_V71 HEXAGON_CPU_TYPE_NAME("v71") -#define TYPE_HEXAGON_CPU_V73 HEXAGON_CPU_TYPE_NAME("v73") -void hexagon_cpu_list (void );#define cpu_list hexagon_cpu_list
@@ -127,8 +116,6 @@ typedef struct CPUArchState {VTCMStoreLog vtcm_log; } CPUHexagonState; -OBJECT_DECLARE_CPU_TYPE(HexagonCPU, HexagonCPUClass, HEXAGON_CPU) - typedef struct HexagonCPUClass { CPUClass parent_class;
Signature · 1 line
2.41.0
Re: [PATCH v2 07/16] target/hexagon: Declare QOM definitions in 'cpu-qom.h'
Quoted 8 lines · Philippe Mathieu-Daudé
"
target/foo/cpu.h" contains the target specific declarations.A heterogeneous setup need to access target agnostic declarations (at least the QOM ones, to instantiate the objects).
Our convention is to add such target agnostic QOM declarations in the "
target/foo/cpu-qom.h" header.
Quoted 8 lines
Extract QOM definitions from "
cpu.h" to "cpu-qom.h".Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- target/hexagon/cpu-qom.h | 28 ++++++++++++++++++++++++++++ target/hexagon/cpu.h | 15 +-------------- 2 files changed, 29 insertions(+), 14 deletions(-)create mode 100644
target/hexagon/cpu-qom.h
r~
RE: [PATCH v2 07/16] target/hexagon: Declare QOM definitions in 'cpu-qom.h'
In reply to Philippe Mathieu-DaudéQuoted 139 lines
-----Original Message-----
From: Philippe Mathieu-Daudé <[email protected]>
Sent: Friday, October 13, 2023 9:01 AM
To: [email protected]
Cc: Eduardo Habkost <[email protected]>; Xiaojuan Yang <[email protected]>; Michael S. Tsirkin <[email protected]>; qemu- [email protected]; Aleksandar Rikalo <[email protected]>; David Hildenbrand <[email protected]>; [email protected]; Edgar E. Iglesias <[email protected]>; Jiaxun Yang <[email protected]>; Song Gao <[email protected]>; Philippe Mathieu-Daudé <[email protected]>; Paolo Bonzini <[email protected]>; Stafford Horne <[email protected]>; Alistair Francis <[email protected]>; Yanan Wang <[email protected]>; Max Filippov <[email protected]>; Artyom Tarasenko <[email protected]>; Marcel Apfelbaum <[email protected]>; Cédric Le Goater <[email protected]>; Laurent Vivier <[email protected]>; Aurelien Jarno <[email protected]>; qemu- [email protected]; Palmer Dabbelt <[email protected]>; Yoshinori Sato <[email protected]>; Bastian Koppelmann <[email protected] paderborn.de>; Bin Meng <[email protected]>; Daniel Henrique Barboza <[email protected]>; Mark Cave-Ayland <mark.cave- [email protected]>; Weiwei Li <[email protected]>; Daniel Henrique Barboza <[email protected]>; Nicholas Piggin <[email protected]>; [email protected]; Liu Zhiwei <[email protected]>; Marek Vasut <[email protected]>; Laurent Vivier <[email protected]>; Peter Maydell <[email protected]>; Brian Cain <[email protected]>; Thomas Huth <[email protected]>; Chris Wulff <[email protected]>; Sergio Lopez <[email protected]>; Richard Henderson <[email protected]>; Ilya Leoshkevich <[email protected]>; Michael Rolnik <[email protected]>
Subject: [PATCH v2 07/16] target/hexagon: Declare QOM definitions in 'cpu-qom.h'WARNING: This email originated from outside of Qualcomm. Please be wary of any links or attachments, and do not enable macros.
"
target/foo/cpu.h" contains the target specific declarations.A heterogeneous setup need to access target agnostic declarations (at least the QOM ones, to instantiate the objects).
Our convention is to add such target agnostic QOM declarations in the "
target/foo/cpu-qom.h" header.Extract QOM definitions from "
cpu.h" to "cpu-qom.h".Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- target/hexagon/cpu-qom.h | 28 ++++++++++++++++++++++++++++ target/hexagon/cpu.h | 15 +-------------- 2 files changed, 29 insertions(+), 14 deletions(-) create mode 100644 target/hexagon/cpu-qom.htarget/hexagon/cpu-qom.h new file +4
-0@@ -0,0 +1,28 @@ +/* +* QEMU Hexagon CPU QOM header (target agnostic) +* +* Copyright(c) 2019-2023 Qualcomm Innovation Center, Inc. All Rights Reserved.
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */target/hexagon/cpu-qom.h new file +11
-0+ +#ifndef QEMU_HEXAGON_CPU_QOM_H +#define QEMU_HEXAGON_CPU_QOM_H + +#include "hw/core/cpu.h" +#include "qom/object.h" + +#define TYPE_HEXAGON_CPU "hexagon-cpu" + +#define HEXAGON_CPU_TYPE_SUFFIX "-" TYPE_HEXAGON_CPU +#define HEXAGON_CPU_TYPE_NAME (name) (name
HEXAGON_CPU_TYPE_SUFFIX)target/hexagon/cpu-qom.h new file +8
-0+ +#define TYPE_HEXAGON_CPU_V67 HEXAGON_CPU_TYPE_NAME("v67") +#define TYPE_HEXAGON_CPU_V68 HEXAGON_CPU_TYPE_NAME("v68") +#define TYPE_HEXAGON_CPU_V69 HEXAGON_CPU_TYPE_NAME("v69") +#define TYPE_HEXAGON_CPU_V71 HEXAGON_CPU_TYPE_NAME("v71") +#define TYPE_HEXAGON_CPU_V73 HEXAGON_CPU_TYPE_NAME("v73") + +OBJECT_DECLARE_CPU_TYPE(HexagonCPU, HexagonCPUClass,
HEXAGON_CPU)target/hexagon/cpu-qom.h new file +2
-0+ +#endif target/hexagon/cpu.h +1
-15@@ -20,11 +20,10 @@#include "fpu/softfloat-types.h" +#include "cpu-qom.h" #include "exec/cpu-defs.h" #include "hex_regs.h" #include "mmvec/mmvec.h" -#include "qom/object.h" -#include "hw/core/cpu.h" #include "hw/registerfields.h" #define NUM_PREGS 4@@ -36,18 +35,8 @@#define PRED_WRITES_MAX 5/* 4 insns + endloop */ #define VSTORES_MAX 2 -#define TYPE_HEXAGON_CPU "hexagon-cpu" - -#define HEXAGON_CPU_TYPE_SUFFIX "-" TYPE_HEXAGON_CPU -#define HEXAGON_CPU_TYPE_NAME (name) (name HEXAGON_CPU_TYPE_SUFFIX)#define CPU_RESOLVING_TYPE TYPE_HEXAGON_CPU -#define TYPE_HEXAGON_CPU_V67 HEXAGON_CPU_TYPE_NAME("v67") -#define TYPE_HEXAGON_CPU_V68 HEXAGON_CPU_TYPE_NAME("v68") -#define TYPE_HEXAGON_CPU_V69 HEXAGON_CPU_TYPE_NAME("v69") -#define TYPE_HEXAGON_CPU_V71 HEXAGON_CPU_TYPE_NAME("v71") -#define TYPE_HEXAGON_CPU_V73 HEXAGON_CPU_TYPE_NAME("v73") -void hexagon_cpu_list (void );#define cpu_list hexagon_cpu_list@@ -127,8 +116,6 @@ typedef struct CPUArchState {VTCMStoreLog vtcm_log; } CPUHexagonState; -OBJECT_DECLARE_CPU_TYPE (HexagonCPU, HexagonCPUClass, HEXAGON_CPU) - typedef struct HexagonCPUClass { CPUClass parent_class; --
Quoted 1 line
2.41.0
PATCH v2 8/16 target/loongarch: Declare QOM definitions in 'cpu-qom.h'
In reply to Philippe Mathieu-Daudé"target/foo/cpu.h" contains the target specific declarations.
A heterogeneous setup need to access target agnostic declarations (at least the QOM ones, to instantiate the objects).
Our convention is to add such target agnostic QOM declarations in the "target/foo/cpu-qom.h" header.
Extract QOM definitions from "cpu.h" to "cpu-qom.h".
--- target/loongarch/cpu-qom.h | 24 ++++++++++++++++++++++++ target/loongarch/cpu.h | 10 +--------- 2 files changed, 25 insertions(+), 9 deletions(-) create mode 100644 target/loongarch/cpu-qom.h
target/loongarch/cpu-qom.h new file +24 -0
@@ -0,0 +1,24 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* +* QEMU LoongArch CPU QOM header (target agnostic) +* +* Copyright (c) 2021 Loongson Technology Corporation Limited +*/ + +#ifndef LOONGARCH_CPU_QOM_H +#define LOONGARCH_CPU_QOM_H + +#include "hw/core/cpu.h" +#include "qom/object.h" + +#define TYPE_LOONGARCH_CPU "loongarch-cpu" +#define TYPE_LOONGARCH32_CPU "loongarch32-cpu" +#define TYPE_LOONGARCH64_CPU "loongarch64-cpu" + +OBJECT_DECLARE_CPU_TYPE (LoongArchCPU, LoongArchCPUClass, + LOONGARCH_CPU) + +#define LOONGARCH_CPU_TYPE_SUFFIX "-" TYPE_LOONGARCH_CPU +#define LOONGARCH_CPU_TYPE_NAME (model) model LOONGARCH_CPU_TYPE_SUFFIX + +#endif
target/loongarch/cpu.h +1 -9
@@ -17,6 +17,7 @@#include "exec/memory.h" #endif #include "cpu-csr.h" +#include "cpu-qom.h" #define IOCSRF_TEMP 0#define IOCSRF_NODECNT 1
@@ -381,13 +382,6 @@ struct ArchCPU {const char *dtb_compatible; }; -#define TYPE_LOONGARCH_CPU "loongarch-cpu" -#define TYPE_LOONGARCH32_CPU "loongarch32-cpu" -#define TYPE_LOONGARCH64_CPU "loongarch64-cpu" - -OBJECT_DECLARE_CPU_TYPE (LoongArchCPU, LoongArchCPUClass, -LOONGARCH_CPU ) -/** * LoongArchCPUClass: * @parent_realize: The parent class' realize handler.
@@ -478,8 +472,6 @@ void loongarch_cpu_list(void);#include "exec/cpu-all.h" -#define LOONGARCH_CPU_TYPE_SUFFIX "-" TYPE_LOONGARCH_CPU -#define LOONGARCH_CPU_TYPE_NAME (model) model LOONGARCH_CPU_TYPE_SUFFIX#define CPU_RESOLVING_TYPE TYPE_LOONGARCH_CPU#endif /* LOONGARCH_CPU_H */
Signature · 1 line
2.41.0
Re: [PATCH v2 08/16] target/loongarch: Declare QOM definitions in 'cpu-qom.h'
Quoted 10 lines · Philippe Mathieu-Daudé
"
target/foo/cpu.h" contains the target specific declarations.A heterogeneous setup need to access target agnostic declarations (at least the QOM ones, to instantiate the objects).
Our convention is to add such target agnostic QOM declarations in the "
target/foo/cpu-qom.h" header.Extract QOM definitions from "
cpu.h" to "cpu-qom.h".
Quoted 7 lines
Reviewed-by Song Gao <[email protected]>Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- target/loongarch/cpu-qom.h | 24 ++++++++++++++++++++++++ target/loongarch/cpu.h | 10 +--------- 2 files changed, 25 insertions(+), 9 deletions(-)create mode 100644
target/loongarch/cpu-qom.h
r~
PATCH v2 9/16 target/nios2: Declare QOM definitions in 'cpu-qom.h'
In reply to Philippe Mathieu-Daudé"target/foo/cpu.h" contains the target specific declarations.
A heterogeneous setup need to access target agnostic declarations (at least the QOM ones, to instantiate the objects).
Our convention is to add such target agnostic QOM declarations in the "target/foo/cpu-qom.h" header.
Extract QOM definitions from "cpu.h" to "cpu-qom.h".
--- target/nios2/cpu-qom.h | 19 +++++++++++++++++++ target/nios2/cpu.h | 7 +------ 2 files changed, 20 insertions(+), 6 deletions(-) create mode 100644 target/nios2/cpu-qom.h
target/nios2/cpu-qom.h new file +19 -0
@@ -0,0 +1,19 @@ +/* +* QEMU Nios II CPU QOM header (target agnostic) +* +* Copyright (c) 2012 Chris Wulff <[email protected]> +* +* SPDX-License-Identifier: LGPL-2.1-or-later +*/ + +#ifndef QEMU_NIOS2_CPU_QOM_H +#define QEMU_NIOS2_CPU_QOM_H + +#include "hw/core/cpu.h" +#include "qom/object.h" + +#define TYPE_NIOS2_CPU "nios2-cpu" + +OBJECT_DECLARE_CPU_TYPE(Nios2CPU, Nios2CPUClass, NIOS2_CPU) + +#endif
target/nios2/cpu.h +1 -6
@@ -21,20 +21,15 @@#ifndef NIOS2_CPU_H #define NIOS2_CPU_H +#include "cpu-qom.h" #include "exec/cpu-defs.h" -#include "hw/core/cpu.h" #include "hw/registerfields.h" -#include "qom/object.h" typedef struct CPUArchState CPUNios2State ;#if !defined(CONFIG_USER_ONLY )#include "mmu.h" #endif -#define TYPE_NIOS2_CPU "nios2-cpu" - -OBJECT_DECLARE_CPU_TYPE (Nios2CPU, Nios2CPUClass,NIOS2_CPU ) -/** * Nios2CPUClass: * @parent_phases: The parent class' reset phase handlers.
Signature · 1 line
2.41.0
Re: [PATCH v2 09/16] target/nios2: Declare QOM definitions in 'cpu-qom.h'
Quoted 8 lines · Philippe Mathieu-Daudé
"
target/foo/cpu.h" contains the target specific declarations.A heterogeneous setup need to access target agnostic declarations (at least the QOM ones, to instantiate the objects).
Our convention is to add such target agnostic QOM declarations in the "
target/foo/cpu-qom.h" header.
Quoted 8 lines
Extract QOM definitions from "
cpu.h" to "cpu-qom.h".Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- target/nios2/cpu-qom.h | 19 +++++++++++++++++++ target/nios2/cpu.h | 7 +------ 2 files changed, 20 insertions(+), 6 deletions(-)create mode 100644
target/nios2/cpu-qom.h
r~
PATCH v2 10/16 target/openrisc: Declare QOM definitions in 'cpu-qom.h'
In reply to Philippe Mathieu-Daudé"target/foo/cpu.h" contains the target specific declarations.
A heterogeneous setup need to access target agnostic declarations (at least the QOM ones, to instantiate the objects).
Our convention is to add such target agnostic QOM declarations in the "target/foo/cpu-qom.h" header.
Extract QOM definitions from "cpu.h" to "cpu-qom.h".
--- target/openrisc/cpu-qom.h | 22 ++++++++++++++++++++++ target/openrisc/cpu.h | 10 +--------- 2 files changed, 23 insertions(+), 9 deletions(-) create mode 100644 target/openrisc/cpu-qom.h
target/openrisc/cpu-qom.h new file +22 -0
@@ -0,0 +1,22 @@ +/* +* QEMU OpenRISC CPU QOM header (target agnostic) +* +* Copyright (c) 2011-2012 Jia Liu <[email protected]> +* +* SPDX-License-Identifier: LGPL-2.1-or-later +*/ + +#ifndef QEMU_OPENRISC_CPU_QOM_H +#define QEMU_OPENRISC_CPU_QOM_H + +#include "hw/core/cpu.h" +#include "qom/object.h" + +#define TYPE_OPENRISC_CPU "or1k-cpu" + +OBJECT_DECLARE_CPU_TYPE(OpenRISCCPU, OpenRISCCPUClass, OPENRISC_CPU) + +#define OPENRISC_CPU_TYPE_SUFFIX "-" TYPE_OPENRISC_CPU +#define OPENRISC_CPU_TYPE_NAME (model) model OPENRISC_CPU_TYPE_SUFFIX + +#endif
target/openrisc/cpu.h +1 -9
@@ -20,17 +20,12 @@#ifndef OPENRISC_CPU_H #define OPENRISC_CPU_H +#include "cpu-qom.h" #include "exec/cpu-defs.h" #include "fpu/softfloat-types.h" -#include "hw/core/cpu.h" -#include "qom/object.h" #define TCG_GUEST_DEFAULT_MO (0) -#define TYPE_OPENRISC_CPU "or1k-cpu" - -OBJECT_DECLARE_CPU_TYPE (OpenRISCCPU, OpenRISCCPUClass,OPENRISC_CPU ) -/** * OpenRISCCPUClass: * @parent_realize: The parent class' realize handler.
@@ -304,7 +299,6 @@ struct ArchCPU {CPUOpenRISCState env; }; -void cpu_openrisc_list (void );void openrisc_cpu_dump_state (CPUState *cpu,FILE *f,int flags);int openrisc_cpu_gdb_read_register (CPUState *cpu,GByteArray *buf,int reg);
@@ -339,8 +333,6 @@ void cpu_openrisc_count_start(OpenRISCCPU *cpu);void cpu_openrisc_count_stop (OpenRISCCPU *cpu);#endif -#define OPENRISC_CPU_TYPE_SUFFIX "-" TYPE_OPENRISC_CPU -#define OPENRISC_CPU_TYPE_NAME (model) model OPENRISC_CPU_TYPE_SUFFIX#define CPU_RESOLVING_TYPE TYPE_OPENRISC_CPU#include "exec/cpu-all.h"
Signature · 1 line
2.41.0
Re: [PATCH v2 10/16] target/openrisc: Declare QOM definitions in 'cpu-qom.h'
Quoted 8 lines · Philippe Mathieu-Daudé
"
target/foo/cpu.h" contains the target specific declarations.A heterogeneous setup need to access target agnostic declarations (at least the QOM ones, to instantiate the objects).
Our convention is to add such target agnostic QOM declarations in the "
target/foo/cpu-qom.h" header.
Quoted 8 lines
Extract QOM definitions from "
cpu.h" to "cpu-qom.h".Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- target/openrisc/cpu-qom.h | 22 ++++++++++++++++++++++ target/openrisc/cpu.h | 10 +--------- 2 files changed, 23 insertions(+), 9 deletions(-)create mode 100644
target/openrisc/cpu-qom.h
r~
PATCH v2 11/16 target/riscv: Move TYPE_RISCV_CPU_BASE definition to 'cpu.h'
In reply to Philippe Mathieu-DaudéTYPE_RISCV_CPU_BASE depends on the TARGET_RISCV32/TARGET_RISCV64 definitions which are target specific. Such target specific definition taints "cpu-qom.h".
Since "cpu-qom.h" must be target agnostic, remove its target specific definition uses by moving TYPE_RISCV_CPU_BASE to "target/riscv/cpu.h".
"target/riscv/cpu-qom.h" is now fully target agnostic.
--- target/riscv/cpu-qom.h | 8 +------- target/riscv/cpu.h | 6 ++++++ 2 files changed, 7 insertions(+), 7 deletions(-)
target/riscv/cpu-qom.h +1 -7
@@ -1,5 +1,5 @@/* -* QEMU RISC-V CPU QOM header +* QEMU RISC-V CPU QOM header (target agnostic) * * Copyright (c) 2023 Ventana Micro Systems Inc. *
@@ -44,12 +44,6 @@#define TYPE_RISCV_CPU_VEYRON_V1 RISCV_CPU_TYPE_NAME("veyron-v1")#define TYPE_RISCV_CPU_HOST RISCV_CPU_TYPE_NAME("host") -#if defined(TARGET_RISCV32 ) -# define TYPE_RISCV_CPU_BASE TYPE_RISCV_CPU_BASE32 -#elif defined(TARGET_RISCV64 ) -# define TYPE_RISCV_CPU_BASE TYPE_RISCV_CPU_BASE64 -#endif -typedef struct CPUArchState CPURISCVState ;OBJECT_DECLARE_CPU_TYPE (RISCVCPU , RISCVCPUClass,RISCV_CPU )
target/riscv/cpu.h +6 -0
@@ -34,6 +34,12 @@#define CPU_RESOLVING_TYPE TYPE_RISCV_CPU +#if defined(TARGET_RISCV32 ) +# define TYPE_RISCV_CPU_BASE TYPE_RISCV_CPU_BASE32 +#elif defined(TARGET_RISCV64 ) +# define TYPE_RISCV_CPU_BASE TYPE_RISCV_CPU_BASE64 +#endif +#define TCG_GUEST_DEFAULT_MO 0/*
Signature · 1 line
2.41.0
Re: [PATCH v2 11/16] target/riscv: Move TYPE_RISCV_CPU_BASE definition to 'cpu.h'
Quoted 10 lines · Philippe Mathieu-Daudé
TYPE_RISCV_CPU_BASEdepends on the TARGET_RISCV32/TARGET_RISCV64 definitions which are target specific. Such target specific definition taints "cpu-qom.h".Since "
cpu-qom.h" must be target agnostic, remove its target specific definition uses by movingTYPE_RISCV_CPU_BASEto "target/riscv/cpu.h"."
target/riscv/cpu-qom.h" is now fully target agnostic.
Quoted 7 lines
Reviewed-by LIU Zhiwei <[email protected]>Reviewed-by Alistair Francis <[email protected]>Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- target/riscv/cpu-qom.h | 8 +------- target/riscv/cpu.h | 6 ++++++ 2 files changed, 7 insertions(+), 7 deletions(-)
r~
PATCH v2 12/16 target: Move ArchCPUClass definition to 'cpu.h'
In reply to Philippe Mathieu-DaudéThe OBJECT_DECLARE_CPU_TYPE() macro forward-declares each ArchCPUClass type. These forward declarations are sufficient for code in hw/ to use the QOM definitions. No need to expose these structure definitions. Keep each local to their target/ by moving them to the corresponding "cpu.h" header.
--- target/alpha/cpu-qom.h | 16 --------------- target/alpha/cpu.h | 13 +++++++++++++ target/arm/cpu-qom.h | 27 ------------------------- target/arm/cpu.h | 25 ++++++++++++++++++++++++ target/avr/cpu-qom.h | 16 --------------- target/avr/cpu.h | 14 +++++++++++++ target/cris/cpu-qom.h | 19 ------------------ target/cris/cpu.h | 16 +++++++++++++++ target/hexagon/cpu-qom.h | 1 - target/hppa/cpu-qom.h | 16 --------------- target/hppa/cpu.h | 14 +++++++++++++ target/i386/cpu-qom.h | 39 ------------------------------------- target/i386/cpu.h | 35 +++++++++++++++++++++++++++++++++ target/loongarch/cpu-qom.h | 1 - target/m68k/cpu-qom.h | 16 --------------- target/m68k/cpu.h | 13 +++++++++++++ target/microblaze/cpu-qom.h | 16 --------------- target/microblaze/cpu.h | 13 +++++++++++++ target/mips/cpu-qom.h | 20 ------------------- target/mips/cpu.h | 17 ++++++++++++++++ target/nios2/cpu-qom.h | 1 - target/openrisc/cpu-qom.h | 1 - target/riscv/cpu-qom.h | 16 +-------------- target/riscv/cpu.h | 14 +++++++++++++ target/rx/cpu-qom.h | 15 -------------- target/rx/cpu.h | 14 +++++++++++++ target/s390x/cpu-qom.h | 37 +---------------------------------- target/s390x/cpu.h | 30 ++++++++++++++++++++++++++++ target/s390x/cpu_models.h | 8 ++++---- target/sh4/cpu-qom.h | 23 ---------------------- target/sh4/cpu.h | 20 +++++++++++++++++++ target/sparc/cpu-qom.h | 18 ----------------- target/sparc/cpu.h | 18 +++++++++++++++-- target/tricore/cpu-qom.h | 10 ---------- target/tricore/cpu.h | 6 ++++++ target/xtensa/cpu-qom.h | 21 -------------------- target/xtensa/cpu.h | 20 +++++++++++++++++-- 37 files changed, 284 insertions(+), 335 deletions(-)
target/alpha/cpu-qom.h +0 -16
@@ -21,7 +21,6 @@#define QEMU_ALPHA_CPU_QOM_H #include "hw/core/cpu.h" -#include "qom/object.h" #define TYPE_ALPHA_CPU "alpha-cpu"
@@ -30,19 +29,4 @@ OBJECT_DECLARE_CPU_TYPE(AlphaCPU, AlphaCPUClass, ALPHA_CPU)#define ALPHA_CPU_TYPE_SUFFIX "-" TYPE_ALPHA_CPU#define ALPHA_CPU_TYPE_NAME (model) model ALPHA_CPU_TYPE_SUFFIX -/** -* AlphaCPUClass: -* @parent_realize: The parent class' realize handler. -* @parent_reset: The parent class' reset handler. -* -* An Alpha CPU model. -*/ -struct AlphaCPUClass { -CPUClass parent_class; - -DeviceRealize parent_realize; -DeviceReset parent_reset; -}; - -#endif
target/alpha/cpu.h +13 -0
@@ -267,6 +267,19 @@ struct ArchCPU {QEMUTimer *alarm_timer; }; +/** +* AlphaCPUClass: +* @parent_realize: The parent class' realize handler. +* @parent_reset: The parent class' reset handler. +* +* An Alpha CPU model. +*/ +struct AlphaCPUClass { +CPUClass parent_class; + +DeviceRealize parent_realize; +DeviceReset parent_reset; +};#ifndef CONFIG_USER_ONLY extern const VMStateDescription vmstate_alpha_cpu;
target/arm/cpu-qom.h +0 -27
@@ -21,7 +21,6 @@#define QEMU_ARM_CPU_QOM_H #include "hw/core/cpu.h" -#include "qom/object.h" #define TYPE_ARM_CPU "arm-cpu"
@@ -29,35 +28,9 @@ OBJECT_DECLARE_CPU_TYPE(ARMCPU, ARMCPUClass, ARM_CPU)#define TYPE_ARM_MAX_CPU "max-" TYPE_ARM_CPU -typedef struct ARMCPUInfo { -const char *name; -void (*initfn)(Object *obj); -void (*class_init)(ObjectClass *oc,void *data); -}ARMCPUInfo ; - -/** -* ARMCPUClass: -* @parent_realize: The parent class' realize handler. -* @parent_phases: The parent class' reset phase handlers. -* -* An ARM CPU model. -*/ -struct ARMCPUClass { -CPUClass parent_class; - -const ARMCPUInfo *info; -DeviceRealize parent_realize; -ResettablePhases parent_phases; -}; - -#define TYPE_AARCH64_CPU "aarch64-cpu"typedef struct AArch64CPUClass AArch64CPUClass ;DECLARE_CLASS_CHECKERS (AArch64CPUClass,AARCH64_CPU , TYPE_AARCH64_CPU) -struct AArch64CPUClass { -ARMCPUClass parent_class; -}; -#endif
target/arm/cpu.h +25 -0
@@ -1116,6 +1116,31 @@ struct ArchCPU {uint64_t gt_cntfrq_hz; }; +typedef struct ARMCPUInfo { +const char *name; +void (*initfn)(Object *obj); +void (*class_init)(ObjectClass *oc,void *data); +}ARMCPUInfo ; + +/** +* ARMCPUClass: +* @parent_realize: The parent class' realize handler. +* @parent_phases: The parent class' reset phase handlers. +* +* An ARM CPU model. +*/ +struct ARMCPUClass { +CPUClass parent_class; + +const ARMCPUInfo *info; +DeviceRealize parent_realize; +ResettablePhases parent_phases; +}; + +struct AArch64CPUClass { +ARMCPUClass parent_class; +}; +/* Callback functions for the generic timer's timers. */ void arm_gt_ptimer_cb (void *opaque);void arm_gt_vtimer_cb (void *opaque);
target/avr/cpu-qom.h +0 -16
@@ -22,7 +22,6 @@#define TARGET_AVR_CPU_QOM_H #include "hw/core/cpu.h" -#include "qom/object.h" #define TYPE_AVR_CPU "avr-cpu"
@@ -31,19 +30,4 @@ OBJECT_DECLARE_CPU_TYPE(AVRCPU, AVRCPUClass, AVR_CPU)#define AVR_CPU_TYPE_SUFFIX "-" TYPE_AVR_CPU#define AVR_CPU_TYPE_NAME (name) (name AVR_CPU_TYPE_SUFFIX) -/** -* AVRCPUClass: -* @parent_realize: The parent class' realize handler. -* @parent_phases: The parent class' reset phase handlers. -* -* A AVR CPU model. -*/ -struct AVRCPUClass { -CPUClass parent_class; - -DeviceRealize parent_realize; -ResettablePhases parent_phases; -}; - -#endif /* TARGET_AVR_CPU_QOM_H */
target/avr/cpu.h +14 -0
@@ -147,6 +147,20 @@ struct ArchCPU {CPUAVRState env; }; +/** +* AVRCPUClass: +* @parent_realize: The parent class' realize handler. +* @parent_phases: The parent class' reset phase handlers. +* +* A AVR CPU model. +*/ +struct AVRCPUClass { +CPUClass parent_class; + +DeviceRealize parent_realize; +ResettablePhases parent_phases; +}; +extern const struct VMStateDescription vms_avr_cpu;void avr_cpu_do_interrupt (CPUState *cpu);
target/cris/cpu-qom.h +0 -19
@@ -21,7 +21,6 @@#define QEMU_CRIS_CPU_QOM_H #include "hw/core/cpu.h" -#include "qom/object.h" #define TYPE_CRIS_CPU "cris-cpu"
@@ -30,22 +29,4 @@ OBJECT_DECLARE_CPU_TYPE(CRISCPU, CRISCPUClass, CRIS_CPU)#define CRIS_CPU_TYPE_SUFFIX "-" TYPE_CRIS_CPU#define CRIS_CPU_TYPE_NAME (name) (name CRIS_CPU_TYPE_SUFFIX) -/** -* CRISCPUClass: -* @parent_realize: The parent class' realize handler. -* @parent_phases: The parent class' reset phase handlers. -* @vr: Version Register value. -* -* A CRIS CPU model. -*/ -struct CRISCPUClass { -CPUClass parent_class; - -DeviceRealize parent_realize; -ResettablePhases parent_phases; - -uint32_t vr; -}; - -#endif
target/cris/cpu.h +16 -0
@@ -179,6 +179,22 @@ struct ArchCPU {CPUCRISState env; }; +/** +* CRISCPUClass: +* @parent_realize: The parent class' realize handler. +* @parent_phases: The parent class' reset phase handlers. +* @vr: Version Register value. +* +* A CRIS CPU model. +*/ +struct CRISCPUClass { +CPUClass parent_class; + +DeviceRealize parent_realize; +ResettablePhases parent_phases; + +uint32_t vr; +};#ifndef CONFIG_USER_ONLY extern const VMStateDescription vmstate_cris_cpu;
target/hexagon/cpu-qom.h +0 -1
@@ -10,7 +10,6 @@#define QEMU_HEXAGON_CPU_QOM_H #include "hw/core/cpu.h" -#include "qom/object.h" #define TYPE_HEXAGON_CPU "hexagon-cpu"
target/hppa/cpu-qom.h +0 -16
@@ -21,25 +21,9 @@#define QEMU_HPPA_CPU_QOM_H #include "hw/core/cpu.h" -#include "qom/object.h" #define TYPE_HPPA_CPU "hppa-cpu" OBJECT_DECLARE_CPU_TYPE(HPPACPU, HPPACPUClass, HPPA_CPU) -/** -* HPPACPUClass: -* @parent_realize: The parent class' realize handler. -* @parent_reset: The parent class' reset handler. -* -* An HPPA CPU model. - */ -struct HPPACPUClass { -CPUClass parent_class; - -DeviceRealize parent_realize; -DeviceReset parent_reset; -}; - -#endif
target/hppa/cpu.h +14 -0
@@ -239,6 +239,20 @@ struct ArchCPU {QEMUTimer *alarm_timer; }; +/** +* HPPACPUClass: +* @parent_realize: The parent class' realize handler. +* @parent_reset: The parent class' reset handler. +* +* An HPPA CPU model. +*/ +struct HPPACPUClass { +CPUClass parent_class; + +DeviceRealize parent_realize; +DeviceReset parent_reset; +}; +#include "exec/cpu-all.h" static inline int cpu_mmu_index (CPUHPPAState *env,bool ifetch)
target/i386/cpu-qom.h +0 -39
@@ -21,8 +21,6 @@#define QEMU_I386_CPU_QOM_H #include "hw/core/cpu.h" -#include "qemu/notify.h" -#include "qom/object.h" #ifdef TARGET_X86_64 #define TYPE_X86_CPU "x86_64-cpu"
@@ -35,41 +33,4 @@ OBJECT_DECLARE_CPU_TYPE(X86CPU, X86CPUClass, X86_CPU)#define X86_CPU_TYPE_SUFFIX "-" TYPE_X86_CPU#define X86_CPU_TYPE_NAME (name) (name X86_CPU_TYPE_SUFFIX) -typedef struct X86CPUModel X86CPUModel ; - -/** -* X86CPUClass: -* @cpu_def: CPU model definition -* @host_cpuid_required: Whether CPU model requires cpuid from host. -* @ordering: Ordering on the "-cpu help" CPU model list. -* @migration_safe: See CpuDefinitionInfo::migration_safe -* @static_model: See CpuDefinitionInfo::static -* @parent_realize: The parent class' realize handler. -* @parent_phases: The parent class' reset phase handlers. -* -* An x86 CPU model or family. -*/ -struct X86CPUClass { -CPUClass parent_class; - -/* CPU definition, automatically loaded by instance_init if not NULL. -* Should be eventually replaced by subclass-specific property defaults. -*/ -X86CPUModel *model; - -bool host_cpuid_required; -int ordering; -bool migration_safe; -bool static_model; - -/* Optional description of CPU model. -* If unavailable, cpu_def->model_id is used */ -const char *model_description; - -DeviceRealize parent_realize; -DeviceUnrealize parent_unrealize; -ResettablePhases parent_phases; -}; - -#endif
target/i386/cpu.h +35 -0
@@ -2037,6 +2037,41 @@ struct ArchCPU {bool xen_vapic; }; +typedef struct X86CPUModel X86CPUModel ; + +/** +* X86CPUClass: +* @cpu_def: CPU model definition +* @host_cpuid_required: Whether CPU model requires cpuid from host. +* @ordering: Ordering on the "-cpu help" CPU model list. +* @migration_safe: See CpuDefinitionInfo::migration_safe +* @static_model: See CpuDefinitionInfo::static +* @parent_realize: The parent class' realize handler. +* @parent_phases: The parent class' reset phase handlers. +* +* An x86 CPU model or family. +*/ +struct X86CPUClass { +CPUClass parent_class; + +/* CPU definition, automatically loaded by instance_init if not NULL. +* Should be eventually replaced by subclass-specific property defaults. +*/ +X86CPUModel *model; + +bool host_cpuid_required; +int ordering; +bool migration_safe; +bool static_model; + +/* Optional description of CPU model. +* If unavailable, cpu_def->model_id is used */ +const char *model_description; + +DeviceRealize parent_realize; +DeviceUnrealize parent_unrealize; +ResettablePhases parent_phases; +};#ifndef CONFIG_USER_ONLY extern const VMStateDescription vmstate_x86_cpu;
target/loongarch/cpu-qom.h +0 -1
@@ -9,7 +9,6 @@#define LOONGARCH_CPU_QOM_H #include "hw/core/cpu.h" -#include "qom/object.h" #define TYPE_LOONGARCH_CPU "loongarch-cpu"#define TYPE_LOONGARCH32_CPU "loongarch32-cpu"
target/m68k/cpu-qom.h +0 -16
@@ -21,7 +21,6 @@#define QEMU_M68K_CPU_QOM_H #include "hw/core/cpu.h" -#include "qom/object.h" #define TYPE_M68K_CPU "m68k-cpu"
@@ -30,19 +29,4 @@ OBJECT_DECLARE_CPU_TYPE(M68kCPU, M68kCPUClass, M68K_CPU)#define M68K_CPU_TYPE_SUFFIX "-" TYPE_M68K_CPU#define M68K_CPU_TYPE_NAME (model) model M68K_CPU_TYPE_SUFFIX -/* -* M68kCPUClass: -* @parent_realize: The parent class' realize handler. -* @parent_phases: The parent class' reset phase handlers. -* -* A Motorola 68k CPU model. -*/ -struct M68kCPUClass { -CPUClass parent_class; - -DeviceRealize parent_realize; -ResettablePhases parent_phases; -}; - -#endif
target/m68k/cpu.h +13 -0
@@ -169,6 +169,19 @@ struct ArchCPU {CPUM68KState env; }; +/* +* M68kCPUClass: +* @parent_realize: The parent class' realize handler. +* @parent_phases: The parent class' reset phase handlers. +* +* A Motorola 68k CPU model. +*/ +struct M68kCPUClass { +CPUClass parent_class; + +DeviceRealize parent_realize; +ResettablePhases parent_phases; +};#ifndef CONFIG_USER_ONLY void m68k_cpu_do_interrupt (CPUState *cpu);
target/microblaze/cpu-qom.h +0 -16
@@ -21,25 +21,9 @@#define QEMU_MICROBLAZE_CPU_QOM_H #include "hw/core/cpu.h" -#include "qom/object.h" #define TYPE_MICROBLAZE_CPU "microblaze-cpu" OBJECT_DECLARE_CPU_TYPE(MicroBlazeCPU, MicroBlazeCPUClass, MICROBLAZE_CPU) -/** -* MicroBlazeCPUClass: -* @parent_realize: The parent class' realize handler. -* @parent_phases: The parent class' reset phase handlers. -* -* A MicroBlaze CPU model. - */ -struct MicroBlazeCPUClass { -CPUClass parent_class; - -DeviceRealize parent_realize; -ResettablePhases parent_phases; -}; - -#endif
target/microblaze/cpu.h +13 -0
@@ -355,6 +355,19 @@ struct ArchCPU {MicroBlazeCPUConfig cfg; }; +/** +* MicroBlazeCPUClass: +* @parent_realize: The parent class' realize handler. +* @parent_phases: The parent class' reset phase handlers. +* +* A MicroBlaze CPU model. +*/ +struct MicroBlazeCPUClass { +CPUClass parent_class; + +DeviceRealize parent_realize; +ResettablePhases parent_phases; +};#ifndef CONFIG_USER_ONLY void mb_cpu_do_interrupt (CPUState *cs);
target/mips/cpu-qom.h +0 -20
@@ -21,7 +21,6 @@#define QEMU_MIPS_CPU_QOM_H #include "hw/core/cpu.h" -#include "qom/object.h" #ifdef TARGET_MIPS64 #define TYPE_MIPS_CPU "mips64-cpu"
@@ -34,23 +33,4 @@ OBJECT_DECLARE_CPU_TYPE(MIPSCPU, MIPSCPUClass, MIPS_CPU)#define MIPS_CPU_TYPE_SUFFIX "-" TYPE_MIPS_CPU#define MIPS_CPU_TYPE_NAME (model) model MIPS_CPU_TYPE_SUFFIX -/** -* MIPSCPUClass: -* @parent_realize: The parent class' realize handler. -* @parent_phases: The parent class' reset phase handlers. -* -* A MIPS CPU model. -*/ -struct MIPSCPUClass { -CPUClass parent_class; - -DeviceRealize parent_realize; -ResettablePhases parent_phases; -const struct mips_def_t *cpu_def; - -/* Used for the jazz board to modify mips_cpu_do_transaction_failed. */ -bool no_data_aborts; -}; - -#endif
target/mips/cpu.h +17 -0
@@ -1217,6 +1217,23 @@ struct ArchCPU {Clock *count_div;/* Divider for CP0_Count clock */ }; +/** +* MIPSCPUClass: +* @parent_realize: The parent class' realize handler. +* @parent_phases: The parent class' reset phase handlers. +* +* A MIPS CPU model. +*/ +struct MIPSCPUClass { +CPUClass parent_class; + +DeviceRealize parent_realize; +ResettablePhases parent_phases; +const struct mips_def_t *cpu_def; + +/* Used for the jazz board to modify mips_cpu_do_transaction_failed. */ +bool no_data_aborts; +};void mips_cpu_list (void );
target/nios2/cpu-qom.h +0 -1
@@ -10,7 +10,6 @@#define QEMU_NIOS2_CPU_QOM_H #include "hw/core/cpu.h" -#include "qom/object.h" #define TYPE_NIOS2_CPU "nios2-cpu"
target/openrisc/cpu-qom.h +0 -1
@@ -10,7 +10,6 @@#define QEMU_OPENRISC_CPU_QOM_H #include "hw/core/cpu.h" -#include "qom/object.h" #define TYPE_OPENRISC_CPU "or1k-cpu"
target/riscv/cpu-qom.h +1 -15
@@ -20,7 +20,6 @@#define RISCV_CPU_QOM_H #include "hw/core/cpu.h" -#include "qom/object.h" #define TYPE_RISCV_CPU "riscv-cpu"#define TYPE_RISCV_DYNAMIC_CPU "riscv-dynamic-cpu"
@@ -44,21 +43,8 @@#define TYPE_RISCV_CPU_VEYRON_V1 RISCV_CPU_TYPE_NAME("veyron-v1")#define TYPE_RISCV_CPU_HOST RISCV_CPU_TYPE_NAME("host") -typedef struct CPUArchState CPURISCVState ; +typedef struct CPUArchState CPURISCVState ;// XXX OBJECT_DECLARE_CPU_TYPE(RISCVCPU, RISCVCPUClass, RISCV_CPU) -/** -* RISCVCPUClass: -* @parent_realize: The parent class' realize handler. -* @parent_phases: The parent class' reset phase handlers. -* -* A RISCV CPU model. - */ -struct RISCVCPUClass { -CPUClass parent_class; - -DeviceRealize parent_realize; -ResettablePhases parent_phases; -};#endif /* RISCV_CPU_QOM_H */
target/riscv/cpu.h +14 -0
@@ -414,6 +414,20 @@ struct ArchCPU {GHashTable *pmu_event_ctr_map; }; +/** +* RISCVCPUClass: +* @parent_realize: The parent class' realize handler. +* @parent_phases: The parent class' reset phase handlers. +* +* A RISCV CPU model. +*/ +struct RISCVCPUClass { +CPUClass parent_class; + +DeviceRealize parent_realize; +ResettablePhases parent_phases; +}; +static inline int riscv_has_ext (CPURISCVState *env,target_ulong ext) {return (env->misa_ext & ext) !=0 ;
target/rx/cpu-qom.h +0 -15
@@ -20,7 +20,6 @@#define RX_CPU_QOM_H #include "hw/core/cpu.h" -#include "qom/object.h" #define TYPE_RX_CPU "rx-cpu"
@@ -31,18 +30,4 @@ OBJECT_DECLARE_CPU_TYPE(RXCPU, RXCPUClass, RX_CPU)#define RX_CPU_TYPE_SUFFIX "-" TYPE_RX_CPU#define RX_CPU_TYPE_NAME (model) model RX_CPU_TYPE_SUFFIX -/* -* RXCPUClass: -* @parent_realize: The parent class' realize handler. -* @parent_phases: The parent class' reset phase handlers. -* -* A RX CPU model. -*/ -struct RXCPUClass { -CPUClass parent_class; - -DeviceRealize parent_realize; -ResettablePhases parent_phases; -}; -#endif
target/rx/cpu.h +14 -0
@@ -112,6 +112,20 @@ struct ArchCPU {CPURXState env; }; +/* +* RXCPUClass: +* @parent_realize: The parent class' realize handler. +* @parent_phases: The parent class' reset phase handlers. +* +* A RX CPU model. +*/ +struct RXCPUClass { +CPUClass parent_class; + +DeviceRealize parent_realize; +ResettablePhases parent_phases; +}; +#define CPU_RESOLVING_TYPE TYPE_RX_CPUconst char *rx_crname (uint8_t cr);
target/s390x/cpu-qom.h +1 -36
@@ -21,7 +21,6 @@#define QEMU_S390_CPU_QOM_H #include "hw/core/cpu.h" -#include "qom/object.h" #define TYPE_S390_CPU "s390x-cpu"
@@ -30,40 +29,6 @@ OBJECT_DECLARE_CPU_TYPE(S390CPU, S390CPUClass, S390_CPU)#define S390_CPU_TYPE_SUFFIX "-" TYPE_S390_CPU#define S390_CPU_TYPE_NAME (name) (name S390_CPU_TYPE_SUFFIX) -typedef struct S390CPUModel S390CPUModel ; -typedef struct S390CPUDef S390CPUDef ; - -typedef struct CPUArchState CPUS390XState ; - -typedef enum cpu_reset_type { -S390_CPU_RESET_NORMAL , -S390_CPU_RESET_INITIAL , -S390_CPU_RESET_CLEAR , -}cpu_reset_type ; - -/** -* S390CPUClass: -* @parent_realize: The parent class' realize handler. -* @parent_reset: The parent class' reset handler. -* @load_normal: Performs a load normal. -* @cpu_reset: Performs a CPU reset. -* @initial_cpu_reset: Performs an initial CPU reset. -* -* An S/390 CPU model. -*/ -struct S390CPUClass { -CPUClass parent_class; - -const S390CPUDef *cpu_def; -bool kvm_required; -bool is_static; -bool is_migration_safe; -const char *desc; - -DeviceRealize parent_realize; -DeviceReset parent_reset; -void (*load_normal)(CPUState *cpu); -void (*reset)(CPUState *cpu,cpu_reset_type type); -}; +typedef struct CPUArchState CPUS390XState ;// XXX #endif
target/s390x/cpu.h +30 -0
@@ -175,6 +175,36 @@ struct ArchCPU {uint32_t irqstate_saved_size; }; +typedef enum cpu_reset_type { +S390_CPU_RESET_NORMAL , +S390_CPU_RESET_INITIAL , +S390_CPU_RESET_CLEAR , +}cpu_reset_type ; + +/** +* S390CPUClass: +* @parent_realize: The parent class' realize handler. +* @parent_reset: The parent class' reset handler. +* @load_normal: Performs a load normal. +* @cpu_reset: Performs a CPU reset. +* @initial_cpu_reset: Performs an initial CPU reset. +* +* An S/390 CPU model. +*/ +struct S390CPUClass { +CPUClass parent_class; + +const S390CPUDef *cpu_def; +bool kvm_required; +bool is_static; +bool is_migration_safe; +const char *desc; + +DeviceRealize parent_realize; +DeviceReset parent_reset; +void (*load_normal)(CPUState *cpu); +void (*reset)(CPUState *cpu,cpu_reset_type type); +};#ifndef CONFIG_USER_ONLY extern const VMStateDescription vmstate_s390_cpu;
target/s390x/cpu_models.h +4 -4
@@ -18,7 +18,7 @@#include "hw/core/cpu.h" /* static CPU definition */ -struct S390CPUDef { +typedef struct S390CPUDef { const char *name; /* name exposed to the user */ const char *desc; /* description exposed to the user */ uint8_t gen; /* hw generation identification */
@@ -38,10 +38,10 @@ struct S390CPUDef {S390FeatBitmap full_feat;/* used to init full_feat from generated data */ S390FeatInit full_init; -}; +} S390CPUDef;/* CPU model based on a CPU definition */ -struct S390CPUModel { +typedef struct S390CPUModel { const S390CPUDef *def; S390FeatBitmap features; /* values copied from the "host" model, can change during migration */
@@ -49,7 +49,7 @@ struct S390CPUModel {uint32_t cpu_id;/* CPU id */ uint8_t cpu_id_format;/* CPU id format bit */ uint8_t cpu_ver;/* CPU version, usually "ff" for kvm */ -}; +} S390CPUModel;/* * CPU ID
target/sh4/cpu-qom.h +0 -23
@@ -21,7 +21,6 @@#define QEMU_SUPERH_CPU_QOM_H #include "hw/core/cpu.h" -#include "qom/object.h" #define TYPE_SUPERH_CPU "superh-cpu"
@@ -34,26 +33,4 @@ OBJECT_DECLARE_CPU_TYPE(SuperHCPU, SuperHCPUClass, SUPERH_CPU)#define SUPERH_CPU_TYPE_SUFFIX "-" TYPE_SUPERH_CPU#define SUPERH_CPU_TYPE_NAME (model) model SUPERH_CPU_TYPE_SUFFIX -/** -* SuperHCPUClass: -* @parent_realize: The parent class' realize handler. -* @parent_phases: The parent class' reset phase handlers. -* @pvr: Processor Version Register -* @prr: Processor Revision Register -* @cvr: Cache Version Register -* -* A SuperH CPU model. -*/ -struct SuperHCPUClass { -CPUClass parent_class; - -DeviceRealize parent_realize; -ResettablePhases parent_phases; - -uint32_t pvr; -uint32_t prr; -uint32_t cvr; -}; - -#endif
target/sh4/cpu.h +20 -0
@@ -209,6 +209,26 @@ struct ArchCPU {CPUSH4State env; }; +/** +* SuperHCPUClass: +* @parent_realize: The parent class' realize handler. +* @parent_phases: The parent class' reset phase handlers. +* @pvr: Processor Version Register +* @prr: Processor Revision Register +* @cvr: Cache Version Register +* +* A SuperH CPU model. +*/ +struct SuperHCPUClass { +CPUClass parent_class; + +DeviceRealize parent_realize; +ResettablePhases parent_phases; + +uint32_t pvr; +uint32_t prr; +uint32_t cvr; +};void superh_cpu_dump_state (CPUState *cpu,FILE *f,int flags);int superh_cpu_gdb_read_register (CPUState *cpu,GByteArray *buf,int reg);
target/sparc/cpu-qom.h +0 -18
@@ -21,7 +21,6 @@#define QEMU_SPARC_CPU_QOM_H #include "hw/core/cpu.h" -#include "qom/object.h" #ifdef TARGET_SPARC64 #define TYPE_SPARC_CPU "sparc64-cpu"
@@ -34,21 +33,4 @@ OBJECT_DECLARE_CPU_TYPE(SPARCCPU, SPARCCPUClass, SPARC_CPU)#define SPARC_CPU_TYPE_SUFFIX "-" TYPE_SPARC_CPU#define SPARC_CPU_TYPE_NAME (model) model SPARC_CPU_TYPE_SUFFIX -typedef struct sparc_def_t sparc_def_t ; -/** -* SPARCCPUClass: -* @parent_realize: The parent class' realize handler. -* @parent_phases: The parent class' reset phase handlers. -* -* A SPARC CPU model. -*/ -struct SPARCCPUClass { -CPUClass parent_class; - -DeviceRealize parent_realize; -ResettablePhases parent_phases; -sparc_def_t *cpu_def; -}; - -#endif
target/sparc/cpu.h +16 -2
@@ -252,7 +252,7 @@ typedef struct trap_state {#endif #define TARGET_INSN_START_EXTRA_WORDS 1 -struct sparc_def_t { +typedef struct sparc_def_t { const char *name; target_ulong iu_version; uint32_t fpu_version;
@@ -266,7 +266,7 @@ struct sparc_def_t {uint32_t features;uint32_t nwindows;uint32_t maxtl; -}; +} sparc_def_t;#define CPU_FEATURE_FLOAT (1 << 0)#define CPU_FEATURE_FLOAT128 (1 << 1)
@@ -562,6 +562,20 @@ struct ArchCPU {CPUSPARCState env; }; +/** +* SPARCCPUClass: +* @parent_realize: The parent class' realize handler. +* @parent_phases: The parent class' reset phase handlers. +* +* A SPARC CPU model. +*/ +struct SPARCCPUClass { +CPUClass parent_class; + +DeviceRealize parent_realize; +ResettablePhases parent_phases; +sparc_def_t *cpu_def; +};#ifndef CONFIG_USER_ONLY extern const VMStateDescription vmstate_sparc_cpu;
target/tricore/cpu-qom.h +0 -10
@@ -21,8 +21,6 @@#define QEMU_TRICORE_CPU_QOM_H #include "hw/core/cpu.h" -#include "qom/object.h" -#define TYPE_TRICORE_CPU "tricore-cpu"
@@ -31,12 +29,4 @@ OBJECT_DECLARE_CPU_TYPE(TriCoreCPU, TriCoreCPUClass, TRICORE_CPU)#define TRICORE_CPU_TYPE_SUFFIX "-" TYPE_TRICORE_CPU#define TRICORE_CPU_TYPE_NAME (model) model TRICORE_CPU_TYPE_SUFFIX -struct TriCoreCPUClass { -CPUClass parent_class; - -DeviceRealize parent_realize; -ResettablePhases parent_phases; -}; - -#endif /* QEMU_TRICORE_CPU_QOM_H */
target/tricore/cpu.h +6 -0
@@ -68,6 +68,12 @@ struct ArchCPU {CPUTriCoreState env; }; +struct TriCoreCPUClass { +CPUClass parent_class; + +DeviceRealize parent_realize; +ResettablePhases parent_phases; +};hwaddr tricore_cpu_get_phys_page_debug (CPUState *cpu,vaddr addr);void tricore_cpu_dump_state (CPUState *cpu,FILE *f,int flags);
target/xtensa/cpu-qom.h +0 -21
@@ -30,7 +30,6 @@#define QEMU_XTENSA_CPU_QOM_H #include "hw/core/cpu.h" -#include "qom/object.h" #define TYPE_XTENSA_CPU "xtensa-cpu"
@@ -39,24 +38,4 @@ OBJECT_DECLARE_CPU_TYPE(XtensaCPU, XtensaCPUClass, XTENSA_CPU)#define XTENSA_CPU_TYPE_SUFFIX "-" TYPE_XTENSA_CPU#define XTENSA_CPU_TYPE_NAME (model) model XTENSA_CPU_TYPE_SUFFIX -typedef struct XtensaConfig XtensaConfig ; - -/** -* XtensaCPUClass: -* @parent_realize: The parent class' realize handler. -* @parent_phases: The parent class' reset phase handlers. -* @config: The CPU core configuration. -* -* An Xtensa CPU model. -*/ -struct XtensaCPUClass { -CPUClass parent_class; - -DeviceRealize parent_realize; -ResettablePhases parent_phases; - -const XtensaConfig *config; -}; - -#endif
target/xtensa/cpu.h +18 -2
@@ -426,7 +426,7 @@ extern const XtensaOpcodeTranslators xtensa_core_opcodes;extern const XtensaOpcodeTranslators xtensa_fpu2000_opcodes;extern const XtensaOpcodeTranslators xtensa_fpu_opcodes; -struct XtensaConfig { +typedef struct XtensaConfig { const char *name; uint64_t options; XtensaGdbRegmap gdb_regmap;
@@ -489,7 +489,7 @@ struct XtensaConfig {const xtensa_mpu_entry *mpu_bg;bool use_first_nan; -}; +} XtensaConfig; typedef struct XtensaConfigList { const XtensaConfig *config;
@@ -562,6 +562,22 @@ struct ArchCPU {Clock *clock; }; +/** +* XtensaCPUClass: +* @parent_realize: The parent class' realize handler. +* @parent_phases: The parent class' reset phase handlers. +* @config: The CPU core configuration. +* +* An Xtensa CPU model. +*/ +struct XtensaCPUClass { +CPUClass parent_class; + +DeviceRealize parent_realize; +ResettablePhases parent_phases; + +const XtensaConfig *config; +};#ifndef CONFIG_USER_ONLY bool xtensa_cpu_tlb_fill(CPUState *cs, vaddr address, int size,
Signature · 1 line
2.41.0
Re: [PATCH v2 12/16] target: Move ArchCPUClass definition to 'cpu.h'
Quoted 39 lines · Philippe Mathieu-Daudé
The
OBJECT_DECLARE_CPU_TYPE()macro forward-declares each ArchCPUClass type. These forward declarations are sufficient for code in hw/ to use the QOM definitions. No need to expose these structure definitions. Keep each local to their target/ by moving them to the corresponding "cpu.h" header.Suggested-by Richard Henderson <[email protected]>Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- target/alpha/cpu-qom.h | 16 --------------- target/alpha/cpu.h | 13 +++++++++++++ target/arm/cpu-qom.h | 27 ------------------------- target/arm/cpu.h | 25 ++++++++++++++++++++++++ target/avr/cpu-qom.h | 16 --------------- target/avr/cpu.h | 14 +++++++++++++ target/cris/cpu-qom.h | 19 ------------------ target/cris/cpu.h | 16 +++++++++++++++ target/hexagon/cpu-qom.h | 1 - target/hppa/cpu-qom.h | 16 --------------- target/hppa/cpu.h | 14 +++++++++++++ target/i386/cpu-qom.h | 39 ------------------------------------- target/i386/cpu.h | 35 +++++++++++++++++++++++++++++++++ target/loongarch/cpu-qom.h | 1 - target/m68k/cpu-qom.h | 16 --------------- target/m68k/cpu.h | 13 +++++++++++++ target/microblaze/cpu-qom.h | 16 --------------- target/microblaze/cpu.h | 13 +++++++++++++ target/mips/cpu-qom.h | 20 ------------------- target/mips/cpu.h | 17 ++++++++++++++++ target/nios2/cpu-qom.h | 1 - target/openrisc/cpu-qom.h | 1 - target/riscv/cpu-qom.h | 16 +-------------- target/riscv/cpu.h | 14 +++++++++++++ target/rx/cpu-qom.h | 15 -------------- target/rx/cpu.h | 14 +++++++++++++ target/s390x/cpu-qom.h | 37 +---------------------------------- target/s390x/cpu.h | 30 ++++++++++++++++++++++++++++ target/s390x/cpu_models.h | 8 ++++---- target/sh4/cpu-qom.h | 23 ----------------------
Quoted 8 lines
target/sh4/cpu.h | 20 +++++++++++++++++++ target/sparc/cpu-qom.h | 18 ----------------- target/sparc/cpu.h | 18 +++++++++++++++-- target/tricore/cpu-qom.h | 10 ---------- target/tricore/cpu.h | 6 ++++++ target/xtensa/cpu-qom.h | 21 -------------------- target/xtensa/cpu.h | 20 +++++++++++++++++-- 37 files changed, 284 insertions(+), 335 deletions(-)
r~
Re: [PATCH v2 12/16] target: Move ArchCPUClass definition to 'cpu.h'
In reply to Philippe Mathieu-DaudéHi Philippe,
Quoted 439 lines · Philippe Mathieu-Daudé
Date: Fri, 13 Oct 2023 16:01:11 +0200
From: Philippe Mathieu-Daudé <[email protected]>
Subject: [PATCH v2 12/16] target: Move ArchCPUClass definition to 'cpu.h'
X-Mailer: git-send-email 2.41.0The
OBJECT_DECLARE_CPU_TYPE()macro forward-declares each ArchCPUClass type. These forward declarations are sufficient for code in hw/ to use the QOM definitions. No need to expose these structure definitions. Keep each local to their target/ by moving them to the corresponding "cpu.h" header.Suggested-by Richard Henderson <[email protected]>Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- target/alpha/cpu-qom.h | 16 --------------- target/alpha/cpu.h | 13 +++++++++++++ target/arm/cpu-qom.h | 27 ------------------------- target/arm/cpu.h | 25 ++++++++++++++++++++++++ target/avr/cpu-qom.h | 16 --------------- target/avr/cpu.h | 14 +++++++++++++ target/cris/cpu-qom.h | 19 ------------------ target/cris/cpu.h | 16 +++++++++++++++ target/hexagon/cpu-qom.h | 1 - target/hppa/cpu-qom.h | 16 --------------- target/hppa/cpu.h | 14 +++++++++++++ target/i386/cpu-qom.h | 39 ------------------------------------- target/i386/cpu.h | 35 +++++++++++++++++++++++++++++++++ target/loongarch/cpu-qom.h | 1 - target/m68k/cpu-qom.h | 16 --------------- target/m68k/cpu.h | 13 +++++++++++++ target/microblaze/cpu-qom.h | 16 --------------- target/microblaze/cpu.h | 13 +++++++++++++ target/mips/cpu-qom.h | 20 ------------------- target/mips/cpu.h | 17 ++++++++++++++++ target/nios2/cpu-qom.h | 1 - target/openrisc/cpu-qom.h | 1 - target/riscv/cpu-qom.h | 16 +-------------- target/riscv/cpu.h | 14 +++++++++++++ target/rx/cpu-qom.h | 15 -------------- target/rx/cpu.h | 14 +++++++++++++ target/s390x/cpu-qom.h | 37 +---------------------------------- target/s390x/cpu.h | 30 ++++++++++++++++++++++++++++ target/s390x/cpu_models.h | 8 ++++---- target/sh4/cpu-qom.h | 23 ---------------------- target/sh4/cpu.h | 20 +++++++++++++++++++ target/sparc/cpu-qom.h | 18 ----------------- target/sparc/cpu.h | 18 +++++++++++++++-- target/tricore/cpu-qom.h | 10 ---------- target/tricore/cpu.h | 6 ++++++ target/xtensa/cpu-qom.h | 21 -------------------- target/xtensa/cpu.h | 20 +++++++++++++++++-- 37 files changed, 284 insertions(+), 335 deletions(-)target/alpha/cpu-qom.h +0
-16@@ -21,7 +21,6 @@#define QEMU_ALPHA_CPU_QOM_H #include "hw/core/cpu.h" -#include "qom/object.h" #define TYPE_ALPHA_CPU "alpha-cpu"@@ -30,19 +29,4 @@ OBJECT_DECLARE_CPU_TYPE(AlphaCPU, AlphaCPUClass, ALPHA_CPU)#define ALPHA_CPU_TYPE_SUFFIX "-" TYPE_ALPHA_CPU#define ALPHA_CPU_TYPE_NAME (model) model ALPHA_CPU_TYPE_SUFFIX -/** -* AlphaCPUClass: -* @parent_realize: The parent class' realize handler. -* @parent_reset: The parent class' reset handler. -* -* An Alpha CPU model. -*/ -struct AlphaCPUClass { -CPUClass parent_class; - -DeviceRealize parent_realize; -DeviceReset parent_reset; -}; - -#endif target/alpha/cpu.h +13
-0@@ -267,6 +267,19 @@ struct ArchCPU {QEMUTimer *alarm_timer; }; +/** +* AlphaCPUClass: +* @parent_realize: The parent class' realize handler. +* @parent_reset: The parent class' reset handler. +* +* An Alpha CPU model. +*/ +struct AlphaCPUClass { +CPUClass parent_class; + +DeviceRealize parent_realize; +DeviceReset parent_reset; +};#ifndef CONFIG_USER_ONLY extern const VMStateDescription vmstate_alpha_cpu;target/arm/cpu-qom.h +0
-27@@ -21,7 +21,6 @@#define QEMU_ARM_CPU_QOM_H #include "hw/core/cpu.h" -#include "qom/object.h" #define TYPE_ARM_CPU "arm-cpu"@@ -29,35 +28,9 @@ OBJECT_DECLARE_CPU_TYPE(ARMCPU, ARMCPUClass, ARM_CPU)#define TYPE_ARM_MAX_CPU "max-" TYPE_ARM_CPU -typedef struct ARMCPUInfo { -const char *name; -void (*initfn)(Object *obj); -void (*class_init)(ObjectClass *oc,void *data); -}ARMCPUInfo ; - -/** -* ARMCPUClass: -* @parent_realize: The parent class' realize handler. -* @parent_phases: The parent class' reset phase handlers. -* -* An ARM CPU model. -*/ -struct ARMCPUClass { -CPUClass parent_class; - -const ARMCPUInfo *info; -DeviceRealize parent_realize; -ResettablePhases parent_phases; -}; - -#define TYPE_AARCH64_CPU "aarch64-cpu"typedef struct AArch64CPUClass AArch64CPUClass ;DECLARE_CLASS_CHECKERS (AArch64CPUClass,AARCH64_CPU , TYPE_AARCH64_CPU) -struct AArch64CPUClass { -ARMCPUClass parent_class; -}; -#endif target/arm/cpu.h +25
-0@@ -1116,6 +1116,31 @@ struct ArchCPU {uint64_t gt_cntfrq_hz; }; +typedef struct ARMCPUInfo { +const char *name; +void (*initfn)(Object *obj); +void (*class_init)(ObjectClass *oc,void *data); +}ARMCPUInfo ; + +/** +* ARMCPUClass: +* @parent_realize: The parent class' realize handler. +* @parent_phases: The parent class' reset phase handlers. +* +* An ARM CPU model. +*/ +struct ARMCPUClass { +CPUClass parent_class; + +const ARMCPUInfo *info; +DeviceRealize parent_realize; +ResettablePhases parent_phases; +}; + +struct AArch64CPUClass { +ARMCPUClass parent_class; +}; +/* Callback functions for the generic timer's timers. */ void arm_gt_ptimer_cb (void *opaque);void arm_gt_vtimer_cb (void *opaque);target/avr/cpu-qom.h +0
-16@@ -22,7 +22,6 @@#define TARGET_AVR_CPU_QOM_H #include "hw/core/cpu.h" -#include "qom/object.h" #define TYPE_AVR_CPU "avr-cpu"@@ -31,19 +30,4 @@ OBJECT_DECLARE_CPU_TYPE(AVRCPU, AVRCPUClass, AVR_CPU)#define AVR_CPU_TYPE_SUFFIX "-" TYPE_AVR_CPU#define AVR_CPU_TYPE_NAME (name) (name AVR_CPU_TYPE_SUFFIX) -/** -* AVRCPUClass: -* @parent_realize: The parent class' realize handler. -* @parent_phases: The parent class' reset phase handlers. -* -* A AVR CPU model. -*/ -struct AVRCPUClass { -CPUClass parent_class; - -DeviceRealize parent_realize; -ResettablePhases parent_phases; -}; - -#endif /* TARGET_AVR_CPU_QOM_H */ target/avr/cpu.h +14
-0@@ -147,6 +147,20 @@ struct ArchCPU {CPUAVRState env; }; +/** +* AVRCPUClass: +* @parent_realize: The parent class' realize handler. +* @parent_phases: The parent class' reset phase handlers. +* +* A AVR CPU model. +*/ +struct AVRCPUClass { +CPUClass parent_class; + +DeviceRealize parent_realize; +ResettablePhases parent_phases; +}; +extern const struct VMStateDescription vms_avr_cpu;void avr_cpu_do_interrupt (CPUState *cpu);target/cris/cpu-qom.h +0
-19@@ -21,7 +21,6 @@#define QEMU_CRIS_CPU_QOM_H #include "hw/core/cpu.h" -#include "qom/object.h" #define TYPE_CRIS_CPU "cris-cpu"@@ -30,22 +29,4 @@ OBJECT_DECLARE_CPU_TYPE(CRISCPU, CRISCPUClass, CRIS_CPU)#define CRIS_CPU_TYPE_SUFFIX "-" TYPE_CRIS_CPU#define CRIS_CPU_TYPE_NAME (name) (name CRIS_CPU_TYPE_SUFFIX) -/** -* CRISCPUClass: -* @parent_realize: The parent class' realize handler. -* @parent_phases: The parent class' reset phase handlers. -* @vr: Version Register value. -* -* A CRIS CPU model. -*/ -struct CRISCPUClass { -CPUClass parent_class; - -DeviceRealize parent_realize; -ResettablePhases parent_phases; - -uint32_t vr; -}; - -#endif target/cris/cpu.h +16
-0@@ -179,6 +179,22 @@ struct ArchCPU {CPUCRISState env; }; +/** +* CRISCPUClass: +* @parent_realize: The parent class' realize handler. +* @parent_phases: The parent class' reset phase handlers. +* @vr: Version Register value. +* +* A CRIS CPU model. +*/ +struct CRISCPUClass { +CPUClass parent_class; + +DeviceRealize parent_realize; +ResettablePhases parent_phases; + +uint32_t vr; +};#ifndef CONFIG_USER_ONLY extern const VMStateDescription vmstate_cris_cpu;target/hexagon/cpu-qom.h +0
-1@@ -10,7 +10,6 @@#define QEMU_HEXAGON_CPU_QOM_H #include "hw/core/cpu.h" -#include "qom/object.h" #define TYPE_HEXAGON_CPU "hexagon-cpu"target/hppa/cpu-qom.h +0
-16@@ -21,25 +21,9 @@#define QEMU_HPPA_CPU_QOM_H #include "hw/core/cpu.h" -#include "qom/object.h" #define TYPE_HPPA_CPU "hppa-cpu" OBJECT_DECLARE_CPU_TYPE(HPPACPU, HPPACPUClass, HPPA_CPU) -/** -* HPPACPUClass: -* @parent_realize: The parent class' realize handler. -* @parent_reset: The parent class' reset handler. -* -* An HPPA CPU model. - */ -struct HPPACPUClass { -CPUClass parent_class; - -DeviceRealize parent_realize; -DeviceReset parent_reset; -}; - -#endif target/hppa/cpu.h +14
-0@@ -239,6 +239,20 @@ struct ArchCPU {QEMUTimer *alarm_timer; }; +/** +* HPPACPUClass: +* @parent_realize: The parent class' realize handler. +* @parent_reset: The parent class' reset handler. +* +* An HPPA CPU model. +*/ +struct HPPACPUClass { +CPUClass parent_class; + +DeviceRealize parent_realize; +DeviceReset parent_reset; +}; +#include "exec/cpu-all.h" static inline int cpu_mmu_index (CPUHPPAState *env,bool ifetch)target/i386/cpu-qom.h +0
-39@@ -21,8 +21,6 @@#define QEMU_I386_CPU_QOM_H #include "hw/core/cpu.h" -#include "qemu/notify.h" -#include "qom/object.h" #ifdef TARGET_X86_64 #define TYPE_X86_CPU "x86_64-cpu"@@ -35,41 +33,4 @@ OBJECT_DECLARE_CPU_TYPE(X86CPU, X86CPUClass, X86_CPU)#define X86_CPU_TYPE_SUFFIX "-" TYPE_X86_CPU#define X86_CPU_TYPE_NAME (name) (name X86_CPU_TYPE_SUFFIX) -typedef struct X86CPUModel X86CPUModel ; - -/** -* X86CPUClass: -* @cpu_def: CPU model definition -* @host_cpuid_required: Whether CPU model requires cpuid from host. -* @ordering: Ordering on the "-cpu help" CPU model list. -* @migration_safe: See CpuDefinitionInfo::migration_safe -* @static_model: See CpuDefinitionInfo::static -* @parent_realize: The parent class' realize handler. -* @parent_phases: The parent class' reset phase handlers. -* -* An x86 CPU model or family. -*/ -struct X86CPUClass { -CPUClass parent_class; - -/* CPU definition, automatically loaded by instance_init if not NULL. -* Should be eventually replaced by subclass-specific property defaults. -*/ -X86CPUModel *model; - -bool host_cpuid_required; -int ordering; -bool migration_safe; -bool static_model; - -/* Optional description of CPU model. -* If unavailable, cpu_def->model_id is used */ -const char *model_description; - -DeviceRealize parent_realize; -DeviceUnrealize parent_unrealize; -ResettablePhases parent_phases; -}; - -#endif target/i386/cpu.h +0
-0
target/i386/cpu.h struct ArchCPU { · line 2040
Quoted 4 lines
target/i386/cpu.h +1
-0@@ -2037,6 +2037,41 @@ struct ArchCPU {bool xen_vapic; }; +typedef struct X86CPUModel X86CPUModel ;
Could we "typedef" this structure at its definition?
Then this explicit "typedef" can also be omitted, just like you did elsewhere.
Quoted 260 lines
target/i386/cpu.h +34
-0+ +/** +* X86CPUClass: +* @cpu_def: CPU model definition +* @host_cpuid_required: Whether CPU model requires cpuid from host. +* @ordering: Ordering on the "-cpu help" CPU model list. +* @migration_safe: See CpuDefinitionInfo::migration_safe +* @static_model: See CpuDefinitionInfo::static +* @parent_realize: The parent class' realize handler. +* @parent_phases: The parent class' reset phase handlers. +* +* An x86 CPU model or family. +*/ +struct X86CPUClass { +CPUClass parent_class; + +/* CPU definition, automatically loaded by instance_init if not NULL. +* Should be eventually replaced by subclass-specific property defaults. +*/ +X86CPUModel *model; + +bool host_cpuid_required; +int ordering; +bool migration_safe; +bool static_model; + +/* Optional description of CPU model. +* If unavailable, cpu_def->model_id is used */ +const char *model_description; + +DeviceRealize parent_realize; +DeviceUnrealize parent_unrealize; +ResettablePhases parent_phases; +};#ifndef CONFIG_USER_ONLY extern const VMStateDescription vmstate_x86_cpu;target/loongarch/cpu-qom.h +0
-1@@ -9,7 +9,6 @@#define LOONGARCH_CPU_QOM_H #include "hw/core/cpu.h" -#include "qom/object.h" #define TYPE_LOONGARCH_CPU "loongarch-cpu"#define TYPE_LOONGARCH32_CPU "loongarch32-cpu"target/m68k/cpu-qom.h +0
-16@@ -21,7 +21,6 @@#define QEMU_M68K_CPU_QOM_H #include "hw/core/cpu.h" -#include "qom/object.h" #define TYPE_M68K_CPU "m68k-cpu"@@ -30,19 +29,4 @@ OBJECT_DECLARE_CPU_TYPE(M68kCPU, M68kCPUClass, M68K_CPU)#define M68K_CPU_TYPE_SUFFIX "-" TYPE_M68K_CPU#define M68K_CPU_TYPE_NAME (model) model M68K_CPU_TYPE_SUFFIX -/* -* M68kCPUClass: -* @parent_realize: The parent class' realize handler. -* @parent_phases: The parent class' reset phase handlers. -* -* A Motorola 68k CPU model. -*/ -struct M68kCPUClass { -CPUClass parent_class; - -DeviceRealize parent_realize; -ResettablePhases parent_phases; -}; - -#endif target/m68k/cpu.h +13
-0@@ -169,6 +169,19 @@ struct ArchCPU {CPUM68KState env; }; +/* +* M68kCPUClass: +* @parent_realize: The parent class' realize handler. +* @parent_phases: The parent class' reset phase handlers. +* +* A Motorola 68k CPU model. +*/ +struct M68kCPUClass { +CPUClass parent_class; + +DeviceRealize parent_realize; +ResettablePhases parent_phases; +};#ifndef CONFIG_USER_ONLY void m68k_cpu_do_interrupt (CPUState *cpu);target/microblaze/cpu-qom.h +0
-16@@ -21,25 +21,9 @@#define QEMU_MICROBLAZE_CPU_QOM_H #include "hw/core/cpu.h" -#include "qom/object.h" #define TYPE_MICROBLAZE_CPU "microblaze-cpu" OBJECT_DECLARE_CPU_TYPE(MicroBlazeCPU, MicroBlazeCPUClass, MICROBLAZE_CPU) -/** -* MicroBlazeCPUClass: -* @parent_realize: The parent class' realize handler. -* @parent_phases: The parent class' reset phase handlers. -* -* A MicroBlaze CPU model. - */ -struct MicroBlazeCPUClass { -CPUClass parent_class; - -DeviceRealize parent_realize; -ResettablePhases parent_phases; -}; - -#endif target/microblaze/cpu.h +13
-0@@ -355,6 +355,19 @@ struct ArchCPU {MicroBlazeCPUConfig cfg; }; +/** +* MicroBlazeCPUClass: +* @parent_realize: The parent class' realize handler. +* @parent_phases: The parent class' reset phase handlers. +* +* A MicroBlaze CPU model. +*/ +struct MicroBlazeCPUClass { +CPUClass parent_class; + +DeviceRealize parent_realize; +ResettablePhases parent_phases; +};#ifndef CONFIG_USER_ONLY void mb_cpu_do_interrupt (CPUState *cs);target/mips/cpu-qom.h +0
-20@@ -21,7 +21,6 @@#define QEMU_MIPS_CPU_QOM_H #include "hw/core/cpu.h" -#include "qom/object.h" #ifdef TARGET_MIPS64 #define TYPE_MIPS_CPU "mips64-cpu"@@ -34,23 +33,4 @@ OBJECT_DECLARE_CPU_TYPE(MIPSCPU, MIPSCPUClass, MIPS_CPU)#define MIPS_CPU_TYPE_SUFFIX "-" TYPE_MIPS_CPU#define MIPS_CPU_TYPE_NAME (model) model MIPS_CPU_TYPE_SUFFIX -/** -* MIPSCPUClass: -* @parent_realize: The parent class' realize handler. -* @parent_phases: The parent class' reset phase handlers. -* -* A MIPS CPU model. -*/ -struct MIPSCPUClass { -CPUClass parent_class; - -DeviceRealize parent_realize; -ResettablePhases parent_phases; -const struct mips_def_t *cpu_def; - -/* Used for the jazz board to modify mips_cpu_do_transaction_failed. */ -bool no_data_aborts; -}; - -#endif target/mips/cpu.h +17
-0@@ -1217,6 +1217,23 @@ struct ArchCPU {Clock *count_div;/* Divider for CP0_Count clock */ }; +/** +* MIPSCPUClass: +* @parent_realize: The parent class' realize handler. +* @parent_phases: The parent class' reset phase handlers. +* +* A MIPS CPU model. +*/ +struct MIPSCPUClass { +CPUClass parent_class; + +DeviceRealize parent_realize; +ResettablePhases parent_phases; +const struct mips_def_t *cpu_def; + +/* Used for the jazz board to modify mips_cpu_do_transaction_failed. */ +bool no_data_aborts; +};void mips_cpu_list (void );target/nios2/cpu-qom.h +0
-1@@ -10,7 +10,6 @@#define QEMU_NIOS2_CPU_QOM_H #include "hw/core/cpu.h" -#include "qom/object.h" #define TYPE_NIOS2_CPU "nios2-cpu"target/openrisc/cpu-qom.h +0
-1@@ -10,7 +10,6 @@#define QEMU_OPENRISC_CPU_QOM_H #include "hw/core/cpu.h" -#include "qom/object.h" #define TYPE_OPENRISC_CPU "or1k-cpu"target/riscv/cpu-qom.h +0
-1@@ -20,7 +20,6 @@#define RISCV_CPU_QOM_H #include "hw/core/cpu.h" -#include "qom/object.h" #define TYPE_RISCV_CPU "riscv-cpu"#define TYPE_RISCV_DYNAMIC_CPU "riscv-dynamic-cpu"
target/riscv/cpu-qom.h line 46
Quoted 5 lines
target/riscv/cpu-qom.h +1
-1@@ -44,21 +43,8 @@#define TYPE_RISCV_CPU_VEYRON_V1 RISCV_CPU_TYPE_NAME("veyron-v1")#define TYPE_RISCV_CPU_HOST RISCV_CPU_TYPE_NAME("host") -typedef struct CPUArchState CPURISCVState ; +typedef struct CPUArchState CPURISCVState ;// XXX
Is "// XXX" redundant?
Quoted 140 lines
target/riscv/cpu-qom.h +0
-13OBJECT_DECLARE_CPU_TYPE(RISCVCPU, RISCVCPUClass, RISCV_CPU) -/** -* RISCVCPUClass: -* @parent_realize: The parent class' realize handler. -* @parent_phases: The parent class' reset phase handlers. -* -* A RISCV CPU model. - */ -struct RISCVCPUClass { -CPUClass parent_class; - -DeviceRealize parent_realize; -ResettablePhases parent_phases; -};#endif /* RISCV_CPU_QOM_H */ target/riscv/cpu.h +14
-0@@ -414,6 +414,20 @@ struct ArchCPU {GHashTable *pmu_event_ctr_map; }; +/** +* RISCVCPUClass: +* @parent_realize: The parent class' realize handler. +* @parent_phases: The parent class' reset phase handlers. +* +* A RISCV CPU model. +*/ +struct RISCVCPUClass { +CPUClass parent_class; + +DeviceRealize parent_realize; +ResettablePhases parent_phases; +}; +static inline int riscv_has_ext (CPURISCVState *env,target_ulong ext) {return (env->misa_ext & ext) !=0 ;target/rx/cpu-qom.h +0
-15@@ -20,7 +20,6 @@#define RX_CPU_QOM_H #include "hw/core/cpu.h" -#include "qom/object.h" #define TYPE_RX_CPU "rx-cpu"@@ -31,18 +30,4 @@ OBJECT_DECLARE_CPU_TYPE(RXCPU, RXCPUClass, RX_CPU)#define RX_CPU_TYPE_SUFFIX "-" TYPE_RX_CPU#define RX_CPU_TYPE_NAME (model) model RX_CPU_TYPE_SUFFIX -/* -* RXCPUClass: -* @parent_realize: The parent class' realize handler. -* @parent_phases: The parent class' reset phase handlers. -* -* A RX CPU model. -*/ -struct RXCPUClass { -CPUClass parent_class; - -DeviceRealize parent_realize; -ResettablePhases parent_phases; -}; -#endif target/rx/cpu.h +14
-0@@ -112,6 +112,20 @@ struct ArchCPU {CPURXState env; }; +/* +* RXCPUClass: +* @parent_realize: The parent class' realize handler. +* @parent_phases: The parent class' reset phase handlers. +* +* A RX CPU model. +*/ +struct RXCPUClass { +CPUClass parent_class; + +DeviceRealize parent_realize; +ResettablePhases parent_phases; +}; +#define CPU_RESOLVING_TYPE TYPE_RX_CPUconst char *rx_crname (uint8_t cr);target/s390x/cpu-qom.h +0
-27@@ -21,7 +21,6 @@#define QEMU_S390_CPU_QOM_H #include "hw/core/cpu.h" -#include "qom/object.h" #define TYPE_S390_CPU "s390x-cpu"@@ -30,40 +29,6 @@ OBJECT_DECLARE_CPU_TYPE(S390CPU, S390CPUClass, S390_CPU)#define S390_CPU_TYPE_SUFFIX "-" TYPE_S390_CPU#define S390_CPU_TYPE_NAME (name) (name S390_CPU_TYPE_SUFFIX) -typedef struct S390CPUModel S390CPUModel ; -typedef struct S390CPUDef S390CPUDef ; - -typedef struct CPUArchState CPUS390XState ; - -typedef enum cpu_reset_type { -S390_CPU_RESET_NORMAL , -S390_CPU_RESET_INITIAL , -S390_CPU_RESET_CLEAR , -}cpu_reset_type ; - -/** -* S390CPUClass: -* @parent_realize: The parent class' realize handler. -* @parent_reset: The parent class' reset handler. -* @load_normal: Performs a load normal. -* @cpu_reset: Performs a CPU reset. -* @initial_cpu_reset: Performs an initial CPU reset. -* -* An S/390 CPU model. -*/ -struct S390CPUClass { -CPUClass parent_class; - -const S390CPUDef *cpu_def; -bool kvm_required;
target/s390x/cpu-qom.h OBJECT_DECLARE_CPU_TYPE(S390CPU, S390CPUClass, S390_CPU) · line 32
Quoted 10 lines
target/s390x/cpu-qom.h +1
-9-bool is_static; -bool is_migration_safe; -const char *desc; - -DeviceRealize parent_realize; -DeviceReset parent_reset; -void (*load_normal)(CPUState *cpu); -void (*reset)(CPUState *cpu,cpu_reset_type type); -}; +typedef struct CPUArchState CPUS390XState ;// XXX
same here.
Just the above nits. Otherwise,
-Zhao
Quoted 355 lines
target/s390x/cpu-qom.h +0
-0#endif target/s390x/cpu.h +30
-0@@ -175,6 +175,36 @@ struct ArchCPU {uint32_t irqstate_saved_size; }; +typedef enum cpu_reset_type { +S390_CPU_RESET_NORMAL , +S390_CPU_RESET_INITIAL , +S390_CPU_RESET_CLEAR , +}cpu_reset_type ; + +/** +* S390CPUClass: +* @parent_realize: The parent class' realize handler. +* @parent_reset: The parent class' reset handler. +* @load_normal: Performs a load normal. +* @cpu_reset: Performs a CPU reset. +* @initial_cpu_reset: Performs an initial CPU reset. +* +* An S/390 CPU model. +*/ +struct S390CPUClass { +CPUClass parent_class; + +const S390CPUDef *cpu_def; +bool kvm_required; +bool is_static; +bool is_migration_safe; +const char *desc; + +DeviceRealize parent_realize; +DeviceReset parent_reset; +void (*load_normal)(CPUState *cpu); +void (*reset)(CPUState *cpu,cpu_reset_type type); +};#ifndef CONFIG_USER_ONLY extern const VMStateDescription vmstate_s390_cpu;target/s390x/cpu_models.h +4
-4@@ -18,7 +18,7 @@#include "hw/core/cpu.h" /* static CPU definition */ -struct S390CPUDef { +typedef struct S390CPUDef { const char *name; /* name exposed to the user */ const char *desc; /* description exposed to the user */ uint8_t gen; /* hw generation identification */@@ -38,10 +38,10 @@ struct S390CPUDef {S390FeatBitmap full_feat;/* used to init full_feat from generated data */ S390FeatInit full_init; -}; +} S390CPUDef;/* CPU model based on a CPU definition */ -struct S390CPUModel { +typedef struct S390CPUModel { const S390CPUDef *def; S390FeatBitmap features; /* values copied from the "host" model, can change during migration */@@ -49,7 +49,7 @@ struct S390CPUModel {uint32_t cpu_id;/* CPU id */ uint8_t cpu_id_format;/* CPU id format bit */ uint8_t cpu_ver;/* CPU version, usually "ff" for kvm */ -}; +} S390CPUModel;/* * CPU ID target/sh4/cpu-qom.h +0
-23@@ -21,7 +21,6 @@#define QEMU_SUPERH_CPU_QOM_H #include "hw/core/cpu.h" -#include "qom/object.h" #define TYPE_SUPERH_CPU "superh-cpu"@@ -34,26 +33,4 @@ OBJECT_DECLARE_CPU_TYPE(SuperHCPU, SuperHCPUClass, SUPERH_CPU)#define SUPERH_CPU_TYPE_SUFFIX "-" TYPE_SUPERH_CPU#define SUPERH_CPU_TYPE_NAME (model) model SUPERH_CPU_TYPE_SUFFIX -/** -* SuperHCPUClass: -* @parent_realize: The parent class' realize handler. -* @parent_phases: The parent class' reset phase handlers. -* @pvr: Processor Version Register -* @prr: Processor Revision Register -* @cvr: Cache Version Register -* -* A SuperH CPU model. -*/ -struct SuperHCPUClass { -CPUClass parent_class; - -DeviceRealize parent_realize; -ResettablePhases parent_phases; - -uint32_t pvr; -uint32_t prr; -uint32_t cvr; -}; - -#endif target/sh4/cpu.h +20
-0@@ -209,6 +209,26 @@ struct ArchCPU {CPUSH4State env; }; +/** +* SuperHCPUClass: +* @parent_realize: The parent class' realize handler. +* @parent_phases: The parent class' reset phase handlers. +* @pvr: Processor Version Register +* @prr: Processor Revision Register +* @cvr: Cache Version Register +* +* A SuperH CPU model. +*/ +struct SuperHCPUClass { +CPUClass parent_class; + +DeviceRealize parent_realize; +ResettablePhases parent_phases; + +uint32_t pvr; +uint32_t prr; +uint32_t cvr; +};void superh_cpu_dump_state (CPUState *cpu,FILE *f,int flags);int superh_cpu_gdb_read_register (CPUState *cpu,GByteArray *buf,int reg);target/sparc/cpu-qom.h +0
-18@@ -21,7 +21,6 @@#define QEMU_SPARC_CPU_QOM_H #include "hw/core/cpu.h" -#include "qom/object.h" #ifdef TARGET_SPARC64 #define TYPE_SPARC_CPU "sparc64-cpu"@@ -34,21 +33,4 @@ OBJECT_DECLARE_CPU_TYPE(SPARCCPU, SPARCCPUClass, SPARC_CPU)#define SPARC_CPU_TYPE_SUFFIX "-" TYPE_SPARC_CPU#define SPARC_CPU_TYPE_NAME (model) model SPARC_CPU_TYPE_SUFFIX -typedef struct sparc_def_t sparc_def_t ; -/** -* SPARCCPUClass: -* @parent_realize: The parent class' realize handler. -* @parent_phases: The parent class' reset phase handlers. -* -* A SPARC CPU model. -*/ -struct SPARCCPUClass { -CPUClass parent_class; - -DeviceRealize parent_realize; -ResettablePhases parent_phases; -sparc_def_t *cpu_def; -}; - -#endif target/sparc/cpu.h +16
-2@@ -252,7 +252,7 @@ typedef struct trap_state {#endif #define TARGET_INSN_START_EXTRA_WORDS 1 -struct sparc_def_t { +typedef struct sparc_def_t { const char *name; target_ulong iu_version; uint32_t fpu_version;@@ -266,7 +266,7 @@ struct sparc_def_t {uint32_t features;uint32_t nwindows;uint32_t maxtl; -}; +} sparc_def_t;#define CPU_FEATURE_FLOAT (1 << 0)#define CPU_FEATURE_FLOAT128 (1 << 1)@@ -562,6 +562,20 @@ struct ArchCPU {CPUSPARCState env; }; +/** +* SPARCCPUClass: +* @parent_realize: The parent class' realize handler. +* @parent_phases: The parent class' reset phase handlers. +* +* A SPARC CPU model. +*/ +struct SPARCCPUClass { +CPUClass parent_class; + +DeviceRealize parent_realize; +ResettablePhases parent_phases; +sparc_def_t *cpu_def; +};#ifndef CONFIG_USER_ONLY extern const VMStateDescription vmstate_sparc_cpu;target/tricore/cpu-qom.h +0
-10@@ -21,8 +21,6 @@#define QEMU_TRICORE_CPU_QOM_H #include "hw/core/cpu.h" -#include "qom/object.h" -#define TYPE_TRICORE_CPU "tricore-cpu"@@ -31,12 +29,4 @@ OBJECT_DECLARE_CPU_TYPE(TriCoreCPU, TriCoreCPUClass, TRICORE_CPU)#define TRICORE_CPU_TYPE_SUFFIX "-" TYPE_TRICORE_CPU#define TRICORE_CPU_TYPE_NAME (model) model TRICORE_CPU_TYPE_SUFFIX -struct TriCoreCPUClass { -CPUClass parent_class; - -DeviceRealize parent_realize; -ResettablePhases parent_phases; -}; - -#endif /* QEMU_TRICORE_CPU_QOM_H */ target/tricore/cpu.h +6
-0@@ -68,6 +68,12 @@ struct ArchCPU {CPUTriCoreState env; }; +struct TriCoreCPUClass { +CPUClass parent_class; + +DeviceRealize parent_realize; +ResettablePhases parent_phases; +};hwaddr tricore_cpu_get_phys_page_debug (CPUState *cpu,vaddr addr);void tricore_cpu_dump_state (CPUState *cpu,FILE *f,int flags);target/xtensa/cpu-qom.h +0
-21@@ -30,7 +30,6 @@#define QEMU_XTENSA_CPU_QOM_H #include "hw/core/cpu.h" -#include "qom/object.h" #define TYPE_XTENSA_CPU "xtensa-cpu"@@ -39,24 +38,4 @@ OBJECT_DECLARE_CPU_TYPE(XtensaCPU, XtensaCPUClass, XTENSA_CPU)#define XTENSA_CPU_TYPE_SUFFIX "-" TYPE_XTENSA_CPU#define XTENSA_CPU_TYPE_NAME (model) model XTENSA_CPU_TYPE_SUFFIX -typedef struct XtensaConfig XtensaConfig ; - -/** -* XtensaCPUClass: -* @parent_realize: The parent class' realize handler. -* @parent_phases: The parent class' reset phase handlers. -* @config: The CPU core configuration. -* -* An Xtensa CPU model. -*/ -struct XtensaCPUClass { -CPUClass parent_class; - -DeviceRealize parent_realize; -ResettablePhases parent_phases; - -const XtensaConfig *config; -}; - -#endif target/xtensa/cpu.h +18
-2@@ -426,7 +426,7 @@ extern const XtensaOpcodeTranslators xtensa_core_opcodes;extern const XtensaOpcodeTranslators xtensa_fpu2000_opcodes;extern const XtensaOpcodeTranslators xtensa_fpu_opcodes; -struct XtensaConfig { +typedef struct XtensaConfig { const char *name; uint64_t options; XtensaGdbRegmap gdb_regmap;@@ -489,7 +489,7 @@ struct XtensaConfig {const xtensa_mpu_entry *mpu_bg;bool use_first_nan; -}; +} XtensaConfig; typedef struct XtensaConfigList { const XtensaConfig *config;@@ -562,6 +562,22 @@ struct ArchCPU {Clock *clock; }; +/** +* XtensaCPUClass: +* @parent_realize: The parent class' realize handler. +* @parent_phases: The parent class' reset phase handlers. +* @config: The CPU core configuration. +* +* An Xtensa CPU model. +*/ +struct XtensaCPUClass { +CPUClass parent_class; + +DeviceRealize parent_realize; +ResettablePhases parent_phases; + +const XtensaConfig *config; +};#ifndef CONFIG_USER_ONLY bool xtensa_cpu_tlb_fill(CPUState *cs, vaddr address, int size,Signature · 1 line
2.41.0
Re: [PATCH v2 12/16] target: Move ArchCPUClass definition to 'cpu.h'
Quoted 120 lines · Zhao Liu
Hi Philippe,
Quoted 117 lines · Philippe Mathieu-Daudé
Date: Fri, 13 Oct 2023 16:01:11 +0200
From: Philippe Mathieu-Daudé <[email protected]>
Subject: [PATCH v2 12/16] target: Move ArchCPUClass definition to 'cpu.h'
X-Mailer: git-send-email 2.41.0The
OBJECT_DECLARE_CPU_TYPE()macro forward-declares each ArchCPUClass type. These forward declarations are sufficient for code in hw/ to use the QOM definitions. No need to expose these structure definitions. Keep each local to their target/ by moving them to the corresponding "cpu.h" header.Suggested-by Richard Henderson <[email protected]>Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- target/alpha/cpu-qom.h | 16 --------------- target/alpha/cpu.h | 13 +++++++++++++ target/arm/cpu-qom.h | 27 ------------------------- target/arm/cpu.h | 25 ++++++++++++++++++++++++ target/avr/cpu-qom.h | 16 --------------- target/avr/cpu.h | 14 +++++++++++++ target/cris/cpu-qom.h | 19 ------------------ target/cris/cpu.h | 16 +++++++++++++++ target/hexagon/cpu-qom.h | 1 - target/hppa/cpu-qom.h | 16 --------------- target/hppa/cpu.h | 14 +++++++++++++ target/i386/cpu-qom.h | 39 ------------------------------------- target/i386/cpu.h | 35 +++++++++++++++++++++++++++++++++ target/loongarch/cpu-qom.h | 1 - target/m68k/cpu-qom.h | 16 --------------- target/m68k/cpu.h | 13 +++++++++++++ target/microblaze/cpu-qom.h | 16 --------------- target/microblaze/cpu.h | 13 +++++++++++++ target/mips/cpu-qom.h | 20 ------------------- target/mips/cpu.h | 17 ++++++++++++++++ target/nios2/cpu-qom.h | 1 - target/openrisc/cpu-qom.h | 1 - target/riscv/cpu-qom.h | 16 +-------------- target/riscv/cpu.h | 14 +++++++++++++ target/rx/cpu-qom.h | 15 -------------- target/rx/cpu.h | 14 +++++++++++++ target/s390x/cpu-qom.h | 37 +---------------------------------- target/s390x/cpu.h | 30 ++++++++++++++++++++++++++++ target/s390x/cpu_models.h | 8 ++++---- target/sh4/cpu-qom.h | 23 ---------------------- target/sh4/cpu.h | 20 +++++++++++++++++++ target/sparc/cpu-qom.h | 18 ----------------- target/sparc/cpu.h | 18 +++++++++++++++-- target/tricore/cpu-qom.h | 10 ---------- target/tricore/cpu.h | 6 ++++++ target/xtensa/cpu-qom.h | 21 -------------------- target/xtensa/cpu.h | 20 +++++++++++++++++-- 37 files changed, 284 insertions(+), 335 deletions(-)target/i386/cpu-qom.h +0
-39@@ -21,8 +21,6 @@#define QEMU_I386_CPU_QOM_H #include "hw/core/cpu.h" -#include "qemu/notify.h" -#include "qom/object.h" #ifdef TARGET_X86_64 #define TYPE_X86_CPU "x86_64-cpu"@@ -35,41 +33,4 @@ OBJECT_DECLARE_CPU_TYPE(X86CPU, X86CPUClass, X86_CPU)#define X86_CPU_TYPE_SUFFIX "-" TYPE_X86_CPU#define X86_CPU_TYPE_NAME (name) (name X86_CPU_TYPE_SUFFIX) -typedef struct X86CPUModel X86CPUModel ; - -/** -* X86CPUClass: -* @cpu_def: CPU model definition -* @host_cpuid_required: Whether CPU model requires cpuid from host. -* @ordering: Ordering on the "-cpu help" CPU model list. -* @migration_safe: See CpuDefinitionInfo::migration_safe -* @static_model: See CpuDefinitionInfo::static -* @parent_realize: The parent class' realize handler. -* @parent_phases: The parent class' reset phase handlers. -* -* An x86 CPU model or family. -*/ -struct X86CPUClass { -CPUClass parent_class; - -/* CPU definition, automatically loaded by instance_init if not NULL. -* Should be eventually replaced by subclass-specific property defaults. -*/ -X86CPUModel *model; - -bool host_cpuid_required; -int ordering; -bool migration_safe; -bool static_model; - -/* Optional description of CPU model. -* If unavailable, cpu_def->model_id is used */ -const char *model_description; - -DeviceRealize parent_realize; -DeviceUnrealize parent_unrealize; -ResettablePhases parent_phases; -}; - -#endif target/i386/cpu.h +0
-0@@ -2037,6 +2037,41 @@ struct ArchCPU {bool xen_vapic; };
Quoted 3 lines
target/i386/cpu.h struct ArchCPU { · line 2040
Quoted 1 line
target/i386/cpu.h +1
-0+typedef struct X86CPUModel X86CPUModel ;Could we "typedef" this structure at its definition?
No, because X86CPUClass uses the declaration in its 'model' field in [*], so we have to forward-declare it first.
Quoted 15 lines
Then this explicit "typedef" can also be omitted, just like you did elsewhere.
Quoted 12 lines
target/i386/cpu.h +12
-0+ +/** +* X86CPUClass: +* @cpu_def: CPU model definition +* @host_cpuid_required: Whether CPU model requires cpuid from host. +* @ordering: Ordering on the "-cpu help" CPU model list. +* @migration_safe: See CpuDefinitionInfo::migration_safe +* @static_model: See CpuDefinitionInfo::static +* @parent_realize: The parent class' realize handler. +* @parent_phases: The parent class' reset phase handlers. +* +* An x86 CPU model or family.
Quoted 8 lines
target/i386/cpu.h struct ArchCPU { · line 2060
Quoted 8 lines
target/i386/cpu.h +8
-0+*/ +struct X86CPUClass { +CPUClass parent_class; + +/* CPU definition, automatically loaded by instance_init if not NULL. +* Should be eventually replaced by subclass-specific property defaults. +*/ +X86CPUModel *model;
[*] ^^^^^^^^^^^
Quoted 31 lines
Quoted 31 lines
target/i386/cpu.h +13
-0+bool host_cpuid_required; +int ordering; +bool migration_safe; +bool static_model; + +/* Optional description of CPU model. +* If unavailable, cpu_def->model_id is used */ +const char *model_description; + +DeviceRealize parent_realize; +DeviceUnrealize parent_unrealize; +ResettablePhases parent_phases; +};target/riscv/cpu-qom.h +0
-1@@ -20,7 +20,6 @@#define RISCV_CPU_QOM_H #include "hw/core/cpu.h" -#include "qom/object.h" #define TYPE_RISCV_CPU "riscv-cpu"#define TYPE_RISCV_DYNAMIC_CPU "riscv-dynamic-cpu"@@ -44,21 +43,8 @@#define TYPE_RISCV_CPU_VEYRON_V1 RISCV_CPU_TYPE_NAME("veyron-v1")#define TYPE_RISCV_CPU_HOST RISCV_CPU_TYPE_NAME("host")
Quoted 4 lines
target/riscv/cpu-qom.h line 46
Quoted 2 lines
target/riscv/cpu-qom.h +1
-1-typedef struct CPUArchState CPURISCVState ; +typedef struct CPUArchState CPURISCVState ;// XXX Is "// XXX" redundant?
Good catch, I forgot about this comment. I now simply moved that to "cpu.h".
Quoted 88 lines
Quoted 88 lines
target/riscv/cpu-qom.h +0
-13OBJECT_DECLARE_CPU_TYPE(RISCVCPU, RISCVCPUClass, RISCV_CPU) -/** -* RISCVCPUClass: -* @parent_realize: The parent class' realize handler. -* @parent_phases: The parent class' reset phase handlers. -* -* A RISCV CPU model. - */ -struct RISCVCPUClass { -CPUClass parent_class; - -DeviceRealize parent_realize; -ResettablePhases parent_phases; -};#endif /* RISCV_CPU_QOM_H */ target/riscv/cpu.h +14
-0@@ -414,6 +414,20 @@ struct ArchCPU {GHashTable *pmu_event_ctr_map; }; +/** +* RISCVCPUClass: +* @parent_realize: The parent class' realize handler. +* @parent_phases: The parent class' reset phase handlers. +* +* A RISCV CPU model. +*/ +struct RISCVCPUClass { +CPUClass parent_class; + +DeviceRealize parent_realize; +ResettablePhases parent_phases; +}; +target/s390x/cpu-qom.h +0
-31@@ -21,7 +21,6 @@#define QEMU_S390_CPU_QOM_H #include "hw/core/cpu.h" -#include "qom/object.h" #define TYPE_S390_CPU "s390x-cpu"@@ -30,40 +29,6 @@ OBJECT_DECLARE_CPU_TYPE(S390CPU, S390CPUClass, S390_CPU)#define S390_CPU_TYPE_SUFFIX "-" TYPE_S390_CPU#define S390_CPU_TYPE_NAME (name) (name S390_CPU_TYPE_SUFFIX) -typedef struct S390CPUModel S390CPUModel ; -typedef struct S390CPUDef S390CPUDef ; - -typedef struct CPUArchState CPUS390XState ; - -typedef enum cpu_reset_type { -S390_CPU_RESET_NORMAL , -S390_CPU_RESET_INITIAL , -S390_CPU_RESET_CLEAR , -}cpu_reset_type ; - -/** -* S390CPUClass: -* @parent_realize: The parent class' realize handler. -* @parent_reset: The parent class' reset handler. -* @load_normal: Performs a load normal. -* @cpu_reset: Performs a CPU reset. -* @initial_cpu_reset: Performs an initial CPU reset. -* -* An S/390 CPU model. -*/ -struct S390CPUClass { -CPUClass parent_class; - -const S390CPUDef *cpu_def; -bool kvm_required; -bool is_static; -bool is_migration_safe; -const char *desc; -
Quoted 8 lines
target/s390x/cpu-qom.h OBJECT_DECLARE_CPU_TYPE(S390CPU, S390CPUClass, S390_CPU) · line 32
Quoted 6 lines
target/s390x/cpu-qom.h +1
-5-DeviceRealize parent_realize; -DeviceReset parent_reset; -void (*load_normal)(CPUState *cpu); -void (*reset)(CPUState *cpu,cpu_reset_type type); -}; +typedef struct CPUArchState CPUS390XState ;// XXX same here.
Oops, I forgot to send the preliminary series required to remove that comment, see:
https://lore.kernel.org/qemu-devel/[email protected]/
Quoted 3 lines
Just the above nits. Otherwise,
Reviewed-by Zhao Liu <[email protected]>
Thanks for your careful review!
PATCH v2 13/16 target/i386: Declare CPU QOM types using DEFINE_TYPES() macro
In reply to Philippe Mathieu-DaudéWhen multiple QOM types are registered in the same file, it is simpler to use the the DEFINE_TYPES() macro. In particular because type array declared with such macro are easier to review.
In few commits we are going to add more types, so replace the type_register_static() to ease further reviews.
--- target/i386/cpu.c | 50 ++++++++++++++++++++++------------------------- 1 file changed, 23 insertions(+), 27 deletions(-)
target/i386/cpu.c +23 -27
@@ -4990,13 +4990,6 @@ static void max_x86_cpu_initfn(Object *obj) &error_abort); } -static const TypeInfo max_x86_cpu_type_info = { - .name =X86_CPU_TYPE_NAME ("max" ), - .parent =TYPE_X86_CPU , - .instance_init = max_x86_cpu_initfn, - .class_init = max_x86_cpu_class_init, -}; -static char *feature_word_description (FeatureWordInfo *f,uint32_t bit) {assert (f->type ==CPUID_FEATURE_WORD || f->type ==MSR_FEATURE_WORD );
@@ -8018,19 +8011,6 @@ static void x86_cpu_common_class_init(ObjectClass *oc, void *data) } } -static const TypeInfo x86_cpu_type_info = { - .name =TYPE_X86_CPU , - .parent =TYPE_CPU , - .instance_size =sizeof (X86CPU ), - .instance_align = __alignof(X86CPU ), - .instance_init = x86_cpu_initfn, - .instance_post_init = x86_cpu_post_initfn, - - .abstract = true, - .class_size =sizeof (X86CPUClass), - .class_init = x86_cpu_common_class_init, -}; -/* "base" CPU model, used by query-cpu-model-expansion */ static void x86_cpu_base_class_init (ObjectClass *oc,void *data) {
@@ -8042,22 +8022,38 @@ static void x86_cpu_base_class_init(ObjectClass *oc, void *data) xcc->ordering =8 ; } -static const TypeInfo x86_base_cpu_type_info = { - .name =X86_CPU_TYPE_NAME ("base" ), - .parent =TYPE_X86_CPU , - .class_init = x86_cpu_base_class_init, +static const TypeInfo x86_cpu_types[] = { + { + .name =TYPE_X86_CPU , + .parent =TYPE_CPU , + .abstract = true, + .instance_size =sizeof (X86CPU ), + .instance_align = __alignof(X86CPU ), + .instance_init = x86_cpu_initfn, + .instance_post_init = x86_cpu_post_initfn, + .class_size =sizeof (X86CPUClass), + .class_init = x86_cpu_common_class_init, + }, { + .name =X86_CPU_TYPE_NAME ("base" ), + .parent =TYPE_X86_CPU , + .class_init = x86_cpu_base_class_init, + }, { + .name =X86_CPU_TYPE_NAME ("max" ), + .parent =TYPE_X86_CPU , + .instance_init = max_x86_cpu_initfn, + .class_init = max_x86_cpu_class_init, + } }; +DEFINE_TYPES (x86_cpu_types) + static void x86_cpu_register_types(void) {int i; -type_register_static (&x86_cpu_type_info);for (i =0 ; i <ARRAY_SIZE (builtin_x86_defs); i++) {x86_register_cpudef_types (&builtin_x86_defs[i]); } -type_register_static (&max_x86_cpu_type_info); -type_register_static (&x86_base_cpu_type_info); }type_init (x86_cpu_register_types)
Signature · 1 line
2.41.0
Re: [PATCH v2 13/16] target/i386: Declare CPU QOM types using DEFINE_TYPES() macro
Quoted 11 lines · Philippe Mathieu-Daudé
Date: Fri, 13 Oct 2023 16:01:12 +0200
From: Philippe Mathieu-Daudé <[email protected]>
Subject: [PATCH v2 13/16] target/i386: Declare CPU QOM types using
DEFINE_TYPES()macro
X-Mailer: git-send-email 2.41.0When multiple QOM types are registered in the same file, it is simpler to use the the
DEFINE_TYPES()macro. In particular because type array declared with such macro are easier to review.
Quoted 8 lines
In few commits we are going to add more types, so replace the
type_register_static()to ease further reviews.Signed-off-by Philippe Mathieu-Daudé <[email protected]>Reviewed-by Richard Henderson <[email protected]>--- target/i386/cpu.c | 50 ++++++++++++++++++++++------------------------- 1 file changed, 23 insertions(+), 27 deletions(-)
Quoted 90 lines
target/i386/cpu.c +23
-27@@ -4990,13 +4990,6 @@ static void max_x86_cpu_initfn(Object *obj) &error_abort); } -static const TypeInfo max_x86_cpu_type_info = { - .name =X86_CPU_TYPE_NAME ("max" ), - .parent =TYPE_X86_CPU , - .instance_init = max_x86_cpu_initfn, - .class_init = max_x86_cpu_class_init, -}; -static char *feature_word_description (FeatureWordInfo *f,uint32_t bit) {assert (f->type ==CPUID_FEATURE_WORD || f->type ==MSR_FEATURE_WORD );@@ -8018,19 +8011,6 @@ static void x86_cpu_common_class_init(ObjectClass *oc, void *data) } } -static const TypeInfo x86_cpu_type_info = { - .name =TYPE_X86_CPU , - .parent =TYPE_CPU , - .instance_size =sizeof (X86CPU ), - .instance_align = __alignof(X86CPU ), - .instance_init = x86_cpu_initfn, - .instance_post_init = x86_cpu_post_initfn, - - .abstract = true, - .class_size =sizeof (X86CPUClass), - .class_init = x86_cpu_common_class_init, -}; -/* "base" CPU model, used by query-cpu-model-expansion */ static void x86_cpu_base_class_init (ObjectClass *oc,void *data) {@@ -8042,22 +8022,38 @@ static void x86_cpu_base_class_init(ObjectClass *oc, void *data) xcc->ordering =8 ; } -static const TypeInfo x86_base_cpu_type_info = { - .name =X86_CPU_TYPE_NAME ("base" ), - .parent =TYPE_X86_CPU , - .class_init = x86_cpu_base_class_init, +static const TypeInfo x86_cpu_types[] = { + { + .name =TYPE_X86_CPU , + .parent =TYPE_CPU , + .abstract = true, + .instance_size =sizeof (X86CPU ), + .instance_align = __alignof(X86CPU ), + .instance_init = x86_cpu_initfn, + .instance_post_init = x86_cpu_post_initfn, + .class_size =sizeof (X86CPUClass), + .class_init = x86_cpu_common_class_init, + }, { + .name =X86_CPU_TYPE_NAME ("base" ), + .parent =TYPE_X86_CPU , + .class_init = x86_cpu_base_class_init, + }, { + .name =X86_CPU_TYPE_NAME ("max" ), + .parent =TYPE_X86_CPU , + .instance_init = max_x86_cpu_initfn, + .class_init = max_x86_cpu_class_init, + } }; +DEFINE_TYPES (x86_cpu_types) + static void x86_cpu_register_types(void) {int i; -type_register_static (&x86_cpu_type_info);for (i =0 ; i <ARRAY_SIZE (builtin_x86_defs); i++) {x86_register_cpudef_types (&builtin_x86_defs[i]); } -type_register_static (&max_x86_cpu_type_info); -type_register_static (&x86_base_cpu_type_info); }type_init (x86_cpu_register_types)Signature · 1 line
2.41.0
PATCH v2 14/16 target/mips: Declare CPU QOM types using DEFINE_TYPES() macro
In reply to Philippe Mathieu-DaudéWhen multiple QOM types are registered in the same file, it is simpler to use the the DEFINE_TYPES() macro. In particular because type array declared with such macro are easier to review.
In few commits we are going to add more types, so replace the type_register_static() to ease further reviews.
--- target/mips/cpu.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-)
target/mips/cpu.c +13 -10
@@ -595,17 +595,21 @@ static void mips_cpu_class_init(ObjectClass *c, void *data)#endif /* CONFIG_TCG */ } -static const TypeInfo mips_cpu_type_info = { - .name =TYPE_MIPS_CPU , - .parent =TYPE_CPU , - .instance_size =sizeof (MIPSCPU ), - .instance_align = __alignof(MIPSCPU ), - .instance_init = mips_cpu_initfn, - .abstract = true, - .class_size =sizeof (MIPSCPUClass), - .class_init = mips_cpu_class_init, +static const TypeInfo mips_cpu_types[] = { + { + .name =TYPE_MIPS_CPU , + .parent =TYPE_CPU , + .instance_size =sizeof (MIPSCPU ), + .instance_align = __alignof(MIPSCPU ), + .instance_init = mips_cpu_initfn, + .abstract = true, + .class_size =sizeof (MIPSCPUClass), + .class_init = mips_cpu_class_init, + } }; +DEFINE_TYPES (mips_cpu_types) + static void mips_cpu_cpudef_class_init(ObjectClass *oc, void *data) {MIPSCPUClass *mcc =MIPS_CPU_CLASS (oc);
@@ -630,7 +634,6 @@ static void mips_cpu_register_types(void) {int i; -type_register_static (&mips_cpu_type_info);for (i =0 ; i < mips_defs_number; i++) {mips_register_cpudef_type (&mips_defs[i]); }
Signature · 1 line
2.41.0
PATCH v2 15/16 target/ppc: Declare CPU QOM types using DEFINE_TYPES() macro
In reply to Philippe Mathieu-DaudéWhen multiple QOM types are registered in the same file, it is simpler to use the the DEFINE_TYPES() macro. In particular because type array declared with such macro are easier to review.
In few commits we are going to add more types, so replace the type_register_static() to ease further reviews.
--- target/ppc/cpu_init.c | 52 +++++++++++++++++++------------------------ 1 file changed, 23 insertions(+), 29 deletions(-)
target/ppc/cpu_init.c +23 -29
@@ -7408,39 +7408,34 @@ static void ppc_cpu_class_init(ObjectClass *oc, void *data)#endif /* CONFIG_TCG */ } -static const TypeInfo ppc_cpu_type_info = { - .name =TYPE_POWERPC_CPU , - .parent =TYPE_CPU , - .instance_size =sizeof (PowerPCCPU), - .instance_align = __alignof__(PowerPCCPU ), - .instance_init = ppc_cpu_instance_init, - .instance_finalize = ppc_cpu_instance_finalize, - .abstract = true, - .class_size =sizeof (PowerPCCPUClass), - .class_init = ppc_cpu_class_init, +static const TypeInfo ppc_cpu_types[] = { + { + .name =TYPE_POWERPC_CPU , + .parent =TYPE_CPU , + .abstract = true, + .instance_size =sizeof (PowerPCCPU), + .instance_align = __alignof__(PowerPCCPU ), + .instance_init = ppc_cpu_instance_init, + .instance_finalize = ppc_cpu_instance_finalize, + .class_size =sizeof (PowerPCCPUClass), + .class_init = ppc_cpu_class_init, #ifndef CONFIG_USER_ONLY - .interfaces = (InterfaceInfo []) { - {TYPE_INTERRUPT_STATS_PROVIDER }, - { } + .interfaces = (InterfaceInfo []) { + {TYPE_INTERRUPT_STATS_PROVIDER }, + { } + }, +#endif + }, +#ifndef CONFIG_USER_ONLY + { + .name =TYPE_PPC_VIRTUAL_HYPERVISOR , + .parent =TYPE_INTERFACE , + .class_size =sizeof (PPCVirtualHypervisorClass), }, #endif }; -#ifndef CONFIG_USER_ONLY -static const TypeInfo ppc_vhyp_type_info = { - .name =TYPE_PPC_VIRTUAL_HYPERVISOR , - .parent =TYPE_INTERFACE , - .class_size =sizeof (PPCVirtualHypervisorClass), -}; -#endif - -static void ppc_cpu_register_types (void ) -{ -type_register_static (&ppc_cpu_type_info); -#ifndef CONFIG_USER_ONLY -type_register_static (&ppc_vhyp_type_info); -#endif -} +DEFINE_TYPES (ppc_cpu_types) void ppc_cpu_dump_state(CPUState *cs, FILE *f, int flags) {
@@ -7635,4 +7630,3 @@ void ppc_cpu_dump_state(CPUState *cs, FILE *f, int flags)#undef RGPL#undef RFPL } -type_init (ppc_cpu_register_types)
Signature · 1 line
2.41.0
PATCH v2 16/16 target/sparc: Declare CPU QOM types using DEFINE_TYPES() macro
In reply to Philippe Mathieu-DaudéWhen multiple QOM types are registered in the same file, it is simpler to use the the DEFINE_TYPES() macro. In particular because type array declared with such macro are easier to review.
In few commits we are going to add more types, so replace the type_register_static() to ease further reviews.
--- target/sparc/cpu.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-)
target/sparc/cpu.c +13 -10
@@ -924,17 +924,21 @@ static void sparc_cpu_class_init(ObjectClass *oc, void *data) cc->tcg_ops = &sparc_tcg_ops; } -static const TypeInfo sparc_cpu_type_info = { - .name =TYPE_SPARC_CPU , - .parent =TYPE_CPU , - .instance_size =sizeof (SPARCCPU ), - .instance_align = __alignof(SPARCCPU ), - .instance_init = sparc_cpu_initfn, - .abstract = true, - .class_size =sizeof (SPARCCPUClass), - .class_init = sparc_cpu_class_init, +static const TypeInfo sparc_cpu_types[] = { + { + .name =TYPE_SPARC_CPU , + .parent =TYPE_CPU , + .instance_size =sizeof (SPARCCPU ), + .instance_align = __alignof(SPARCCPU ), + .instance_init = sparc_cpu_initfn, + .abstract = true, + .class_size =sizeof (SPARCCPUClass), + .class_init = sparc_cpu_class_init, + } }; +DEFINE_TYPES (sparc_cpu_types) + static void sparc_cpu_cpudef_class_init(ObjectClass *oc, void *data) {SPARCCPUClass *scc =SPARC_CPU_CLASS (oc);
@@ -959,7 +963,6 @@ static void sparc_cpu_register_types(void) {int i; -type_register_static (&sparc_cpu_type_info);for (i =0 ; i <ARRAY_SIZE (sparc_defs); i++) {sparc_register_cpudef_type (&sparc_defs[i]); }
Signature · 1 line
2.41.0
Hi Philippe,
Quoted 5 lines · Philippe Mathieu-Daudé
Date: Fri, 13 Oct 2023 16:00:59 +0200
From: Philippe Mathieu-Daudé <[email protected]>
Subject: [PATCH v2 00/16] target: Make 'cpu-qom.h' really target agnostic
X-Mailer: git-send-email 2.41.0
Quoted 7 lines
Since v1:
- Added R-b tags
- Addressed Richard comments
- PostponedOBJECT_DECLARE_CPU_TYPE()changesA heterogeneous machine must be able to instantiate CPUs from different architectures.
Does this mean the different ISA cores in heterogeneous machine? And is this case for TCG?
Quoted 3 lines
In order to do that, the
common hw/ code has to access to the QOM CPU definitions from various architecture.
About this kind of heterogeneous machine with multiple CPUs, is there any initial configuration command line example?
I'm not sure how to configure this case...The main unsure thing is whether the configuration is based on the granularity of the CPU (by "-cpu") or the granularity of the core device (by "-device xxx-core").
-Zhao
Quoted 99 lines
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: <[email protected]>
Introduceqtest_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: RemoveCPU_RESOLVING_TYPEfrom 'cpu-qom.h' target/riscv: RemoveCPU_RESOLVING_TYPEfrom '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: MoveTYPE_RISCV_CPU_BASEdefinition to 'cpu.h'
target: Move ArchCPUClass definition to 'cpu.h' target/i386: Declare CPU QOM types usingDEFINE_TYPES()macro target/mips: Declare CPU QOM types usingDEFINE_TYPES()macro target/ppc: Declare CPU QOM types usingDEFINE_TYPES()macro target/sparc: Declare CPU QOM types usingDEFINE_TYPES()macrotarget/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.hSignature · 1 line
2.41.0
Hi Zhao,
Quoted 13 lines · Zhao Liu
Hi Philippe,
Quoted 10 lines · Philippe Mathieu-Daudé
Date: Fri, 13 Oct 2023 16:00:59 +0200
From: Philippe Mathieu-Daudé <[email protected]>
Subject: [PATCH v2 00/16] target: Make 'cpu-qom.h' really target agnostic
X-Mailer: git-send-email 2.41.0Since v1:
- Added R-b tags
- Addressed Richard comments
- PostponedOBJECT_DECLARE_CPU_TYPE()changes
Quoted 4 lines
Quoted 2 lines
A heterogeneous machine must be able to instantiate CPUs from different architectures.
Does this mean the different ISA cores in heterogeneous machine?
Yes. Currently the ARM target already allows you to do that (multiple ISA cores within the same architecture), see the xlnx-zcu102 and fby35 machines.
Quoted 1 line
And is this case for TCG?
This is *only* for TCG. I expect hardware accel + TCG to be theoretically possible, but no interest has been shown for it. Anyhow this requires heterogeneous TCG as a first step.
Quoted 6 lines
Quoted 3 lines
In order to do that, the
common hw/ code has to access to the QOM CPU definitions from various architecture.About this kind of heterogeneous machine with multiple CPUs, is there any initial configuration command line example?
I'm prototyping in plain C but our plan is to start with a QMP prototype. Command line configuration is not an option, we decided to ignore it. I'll describe that better in a RFC document I should post soon.
Regards,
Phil.
Quoted 6 lines
I'm not sure how to configure this case...The main unsure thing is whether the configuration is based on the granularity of the CPU (by "-cpu") or the granularity of the core device (by "-device xxx-core").
-Zhao
Hi Philippe,
Quoted 21 lines · Philippe Mathieu-Daudé
Date: Fri, 20 Oct 2023 13:30:50 +0200
From: Philippe Mathieu-Daudé <[email protected]>
Subject: Re: [PATCH v2 00/16] target: Make 'cpu-qom.h' really target
agnosticHi Zhao,
Quoted 13 lines · Zhao Liu
Hi Philippe,
Quoted 10 lines · Philippe Mathieu-Daudé
Date: Fri, 13 Oct 2023 16:00:59 +0200
From: Philippe Mathieu-Daudé <[email protected]>
Subject: [PATCH v2 00/16] target: Make 'cpu-qom.h' really target agnostic
X-Mailer: git-send-email 2.41.0Since v1:
- Added R-b tags
- Addressed Richard comments
- PostponedOBJECT_DECLARE_CPU_TYPE()changes
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
A heterogeneous machine must be able to instantiate CPUs from different architectures.
Does this mean the different ISA cores in heterogeneous machine?
Yes. Currently the ARM target already allows you to do that (multiple ISA cores within the same architecture), see the xlnx-zcu102 and fby35 machines.
Okay, I'll have a look at it.
Quoted 6 lines
Quoted 2 lines
And is this case for TCG?
This is *only* for TCG. I expect hardware accel + TCG to be theoretically possible, but no interest has been shown for it. Anyhow this requires heterogeneous TCG as a first step.
Thanks, got it.
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
In order to do that, the
common hw/ code has to access to the QOM CPU definitions from various architecture.
Quoted 7 lines
Quoted 2 lines
About this kind of heterogeneous machine with multiple CPUs, is there any initial configuration command line example?
I'm prototyping in plain C but our plan is to start with a QMP prototype. Command line configuration is not an option, we decided to ignore it. I'll describe that better in a RFC document I should post soon.
Looking forward to your RFC!
For accel, I am currently working in this direction (to convert all CPU topology levels to devices and to create heterogeneous topology via "-device") as the following:
-device cpu-socket,id=sock0 \
-device cpu-die,id=die0,parent=sock0 \
-device cpu-die,id=die1,parent=sock0 \
-device cpu-cluster,id=cluster0,parent=die0 \
-device cpu-cluster,id=cluster1,parent=die0 \
-device x86-intel-core,id=core0,parent=cluster0,threads=3 \
-device x86-intel-atom,id=core1,parent=cluster1,threads=2 \
-device x86-intel-core,id=core2,parent=cluster0,threads=3
At present, I have a prototype and am sorting out the RFC.
From your description, I understand that we have no conflict. Also welcome your thoughts and hope that I can go in the same direction with you. ;-)
Regards,
Zhao