diff mbox series

[v3,3/6] target/ppc: Move CPU QOM definitions to cpu-qom.h

Message ID 20230627115124.19632-4-philmd@linaro.org
State New
Headers show
Series target/ppc: Few cleanups in kvm_ppc.h | expand

Commit Message

Philippe Mathieu-Daudé June 27, 2023, 11:51 a.m. UTC
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 target/ppc/cpu-qom.h | 5 +++++
 target/ppc/cpu.h     | 6 ------
 2 files changed, 5 insertions(+), 6 deletions(-)

Comments

Greg Kurz June 28, 2023, 3:05 p.m. UTC | #1
On Tue, 27 Jun 2023 13:51:21 +0200
Philippe Mathieu-Daudé <philmd@linaro.org> wrote:

> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>  target/ppc/cpu-qom.h | 5 +++++
>  target/ppc/cpu.h     | 6 ------
>  2 files changed, 5 insertions(+), 6 deletions(-)
> 
> diff --git a/target/ppc/cpu-qom.h b/target/ppc/cpu-qom.h
> index 9666f54f65..c2bff349cc 100644
> --- a/target/ppc/cpu-qom.h
> +++ b/target/ppc/cpu-qom.h
> @@ -31,6 +31,11 @@
>  
>  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 cpu_list ppc_cpu_list
> +
>  ObjectClass *ppc_cpu_class_by_name(const char *name);
>  
>  typedef struct CPUArchState CPUPPCState;
> diff --git a/target/ppc/cpu.h b/target/ppc/cpu.h
> index af12c93ebc..e91e1774e5 100644
> --- a/target/ppc/cpu.h
> +++ b/target/ppc/cpu.h
> @@ -1468,12 +1468,6 @@ static inline uint64_t ppc_dump_gpr(CPUPPCState *env, int gprn)
>  int ppc_dcr_read(ppc_dcr_t *dcr_env, int dcrn, uint32_t *valp);
>  int ppc_dcr_write(ppc_dcr_t *dcr_env, int dcrn, uint32_t val);
>  
> -#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
> -

These seem appropriate to be moved to "cpu-qom.h".

> -#define cpu_list ppc_cpu_list

This one is much older according to git blame :

c913706581460 target/ppc/cpu.h (Igor Mammedov                 2017-08-30 1469) #define POWERPC_CPU_TYPE_SUFFIX "-" TYPE_POWERPC_CPU
c913706581460 target/ppc/cpu.h (Igor Mammedov                 2017-08-30 1470) #define POWERPC_CPU_TYPE_NAME(model) model POWERPC_CPU_TYPE_SUFFIX
0dacec874fa3b target/ppc/cpu.h (Igor Mammedov                 2018-02-07 1471) #define CPU_RESOLVING_TYPE TYPE_POWERPC_CPU
c913706581460 target/ppc/cpu.h (Igor Mammedov                 2017-08-30 1472) 
c732abe222795 target-ppc/cpu.h (Jocelyn Mayer                 2007-10-12 1473) #define cpu_list ppc_cpu_list

It is some plumbing used for `-cpu help`, not exactly QOM stuff.
Maybe keep it in "cpu.h" as all other targets do ?

> -
>  /* MMU modes definitions */
>  #define MMU_USER_IDX 0
>  static inline int cpu_mmu_index(CPUPPCState *env, bool ifetch)
Cédric Le Goater June 29, 2023, 5:03 a.m. UTC | #2
On 6/27/23 13:51, Philippe Mathieu-Daudé wrote:
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>




Reviewed-by: Cédric Le Goater <clg@kaod.org>

Thanks,

C.



> ---
>   target/ppc/cpu-qom.h | 5 +++++
>   target/ppc/cpu.h     | 6 ------
>   2 files changed, 5 insertions(+), 6 deletions(-)
> 
> diff --git a/target/ppc/cpu-qom.h b/target/ppc/cpu-qom.h
> index 9666f54f65..c2bff349cc 100644
> --- a/target/ppc/cpu-qom.h
> +++ b/target/ppc/cpu-qom.h
> @@ -31,6 +31,11 @@
>   
>   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 cpu_list ppc_cpu_list
> +
>   ObjectClass *ppc_cpu_class_by_name(const char *name);
>   
>   typedef struct CPUArchState CPUPPCState;
> diff --git a/target/ppc/cpu.h b/target/ppc/cpu.h
> index af12c93ebc..e91e1774e5 100644
> --- a/target/ppc/cpu.h
> +++ b/target/ppc/cpu.h
> @@ -1468,12 +1468,6 @@ static inline uint64_t ppc_dump_gpr(CPUPPCState *env, int gprn)
>   int ppc_dcr_read(ppc_dcr_t *dcr_env, int dcrn, uint32_t *valp);
>   int ppc_dcr_write(ppc_dcr_t *dcr_env, int dcrn, uint32_t val);
>   
> -#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 cpu_list ppc_cpu_list
> -
>   /* MMU modes definitions */
>   #define MMU_USER_IDX 0
>   static inline int cpu_mmu_index(CPUPPCState *env, bool ifetch)
Daniel Henrique Barboza June 30, 2023, 2:06 p.m. UTC | #3
Phil,

On 6/28/23 12:05, Greg Kurz wrote:
> On Tue, 27 Jun 2023 13:51:21 +0200
> Philippe Mathieu-Daudé <philmd@linaro.org> wrote:
> 
>> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
>> ---
>>   target/ppc/cpu-qom.h | 5 +++++
>>   target/ppc/cpu.h     | 6 ------
>>   2 files changed, 5 insertions(+), 6 deletions(-)
>>
>> diff --git a/target/ppc/cpu-qom.h b/target/ppc/cpu-qom.h
>> index 9666f54f65..c2bff349cc 100644
>> --- a/target/ppc/cpu-qom.h
>> +++ b/target/ppc/cpu-qom.h
>> @@ -31,6 +31,11 @@
>>   
>>   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 cpu_list ppc_cpu_list
>> +
>>   ObjectClass *ppc_cpu_class_by_name(const char *name);
>>   
>>   typedef struct CPUArchState CPUPPCState;
>> diff --git a/target/ppc/cpu.h b/target/ppc/cpu.h
>> index af12c93ebc..e91e1774e5 100644
>> --- a/target/ppc/cpu.h
>> +++ b/target/ppc/cpu.h
>> @@ -1468,12 +1468,6 @@ static inline uint64_t ppc_dump_gpr(CPUPPCState *env, int gprn)
>>   int ppc_dcr_read(ppc_dcr_t *dcr_env, int dcrn, uint32_t *valp);
>>   int ppc_dcr_write(ppc_dcr_t *dcr_env, int dcrn, uint32_t val);
>>   
>> -#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
>> -
> 
> These seem appropriate to be moved to "cpu-qom.h".
> 
>> -#define cpu_list ppc_cpu_list
> 
> This one is much older according to git blame :
> 
> c913706581460 target/ppc/cpu.h (Igor Mammedov                 2017-08-30 1469) #define POWERPC_CPU_TYPE_SUFFIX "-" TYPE_POWERPC_CPU
> c913706581460 target/ppc/cpu.h (Igor Mammedov                 2017-08-30 1470) #define POWERPC_CPU_TYPE_NAME(model) model POWERPC_CPU_TYPE_SUFFIX
> 0dacec874fa3b target/ppc/cpu.h (Igor Mammedov                 2018-02-07 1471) #define CPU_RESOLVING_TYPE TYPE_POWERPC_CPU
> c913706581460 target/ppc/cpu.h (Igor Mammedov                 2017-08-30 1472)
> c732abe222795 target-ppc/cpu.h (Jocelyn Mayer                 2007-10-12 1473) #define cpu_list ppc_cpu_list
> 
> It is some plumbing used for `-cpu help`, not exactly QOM stuff.
> Maybe keep it in "cpu.h" as all other targets do ?

Greg has a point:

$ git grep '#define cpu_list'
target/alpha/cpu.h:#define cpu_list alpha_cpu_list
target/arm/cpu.h:#define cpu_list arm_cpu_list
target/avr/cpu.h:#define cpu_list avr_cpu_list
target/cris/cpu.h:#define cpu_list cris_cpu_list
target/hexagon/cpu.h:#define cpu_list hexagon_cpu_list
target/i386/cpu.h:#define cpu_list x86_cpu_list
target/loongarch/cpu.h:#define cpu_list loongarch_cpu_list
target/m68k/cpu.h:#define cpu_list m68k_cpu_list
target/mips/cpu.h:#define cpu_list mips_cpu_list
target/openrisc/cpu.h:#define cpu_list cpu_openrisc_list
target/ppc/cpu.h:#define cpu_list ppc_cpu_list
target/riscv/cpu.h:#define cpu_list riscv_cpu_list
target/rx/cpu.h:#define cpu_list rx_cpu_list
target/s390x/cpu.h:#define cpu_list s390_cpu_list
target/sh4/cpu.h:#define cpu_list sh4_cpu_list
target/sparc/cpu.h:#define cpu_list sparc_cpu_list
target/tricore/cpu.h:#define cpu_list tricore_cpu_list
target/xtensa/cpu.h:#define cpu_list xtensa_cpu_list

I'm not against moving this define to cpu-qom.h per se but I believe that, for the sake
of consistency, this change should be done in a single swoop across all archs.

For now, if you agree with keeping the 'cpu_list' define in cpu.h, I'll queue this up
and amend it in-tree.


Thanks,

Daniel

> 
>> -
>>   /* MMU modes definitions */
>>   #define MMU_USER_IDX 0
>>   static inline int cpu_mmu_index(CPUPPCState *env, bool ifetch)
> 
> 
>
diff mbox series

Patch

diff --git a/target/ppc/cpu-qom.h b/target/ppc/cpu-qom.h
index 9666f54f65..c2bff349cc 100644
--- a/target/ppc/cpu-qom.h
+++ b/target/ppc/cpu-qom.h
@@ -31,6 +31,11 @@ 
 
 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 cpu_list ppc_cpu_list
+
 ObjectClass *ppc_cpu_class_by_name(const char *name);
 
 typedef struct CPUArchState CPUPPCState;
diff --git a/target/ppc/cpu.h b/target/ppc/cpu.h
index af12c93ebc..e91e1774e5 100644
--- a/target/ppc/cpu.h
+++ b/target/ppc/cpu.h
@@ -1468,12 +1468,6 @@  static inline uint64_t ppc_dump_gpr(CPUPPCState *env, int gprn)
 int ppc_dcr_read(ppc_dcr_t *dcr_env, int dcrn, uint32_t *valp);
 int ppc_dcr_write(ppc_dcr_t *dcr_env, int dcrn, uint32_t val);
 
-#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 cpu_list ppc_cpu_list
-
 /* MMU modes definitions */
 #define MMU_USER_IDX 0
 static inline int cpu_mmu_index(CPUPPCState *env, bool ifetch)