[PATCH-for-10.1 5/6] target/sparc: Register CPUClass:list_cpus

Philippe Mathieu-Daudé posted 6 patches 10 months, 3 weeks ago
There is a newer version of this series
[PATCH-for-10.1 5/6] target/sparc: Register CPUClass:list_cpus
Posted by Philippe Mathieu-Daudé 10 months, 3 weeks ago
Register sparc_cpu_list() as CPUClass:list_cpus callback
and remove the cpu_list definition.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 target/s390x/cpu.h | 1 -
 target/s390x/cpu.c | 1 +
 2 files changed, 1 insertion(+), 1 deletion(-)

diff --git a/target/s390x/cpu.h b/target/s390x/cpu.h
index 5b7992deda6..1aac967a0ce 100644
--- a/target/s390x/cpu.h
+++ b/target/s390x/cpu.h
@@ -902,7 +902,6 @@ static inline uint8_t s390_cpu_get_state(S390CPU *cpu)
 
 /* cpu_models.c */
 void s390_cpu_list(void);
-#define cpu_list s390_cpu_list
 void s390_set_qemu_cpu_model(uint16_t type, uint8_t gen, uint8_t ec_ga,
                              const S390FeatInit feat_init);
 
diff --git a/target/s390x/cpu.c b/target/s390x/cpu.c
index 1f75629ddc2..ac05e82f0ac 100644
--- a/target/s390x/cpu.c
+++ b/target/s390x/cpu.c
@@ -378,6 +378,7 @@ static void s390_cpu_class_init(ObjectClass *oc, void *data)
                                        &scc->parent_phases);
 
     cc->class_by_name = s390_cpu_class_by_name;
+    cc->list_cpus = s390_cpu_list;
     cc->mmu_index = s390x_cpu_mmu_index;
     cc->dump_state = s390_cpu_dump_state;
     cc->query_cpu_fast = s390_query_cpu_fast;
-- 
2.47.1


Re: [PATCH-for-10.1 5/6] target/sparc: Register CPUClass:list_cpus
Posted by Thomas Huth 10 months, 3 weeks ago
On 23/03/2025 23.40, Philippe Mathieu-Daudé wrote:
> Register sparc_cpu_list() as CPUClass:list_cpus callback
> and remove the cpu_list definition.

Copy-n-paste error in both, subject and patch description: This should be 
about s390x, not sparc.

> diff --git a/target/s390x/cpu.h b/target/s390x/cpu.h
> index 5b7992deda6..1aac967a0ce 100644
> --- a/target/s390x/cpu.h
> +++ b/target/s390x/cpu.h
> @@ -902,7 +902,6 @@ static inline uint8_t s390_cpu_get_state(S390CPU *cpu)
>   
>   /* cpu_models.c */
>   void s390_cpu_list(void);

Don't you want to remove the prototype here, too? (and make the function 
static in the .c file)

  Thomas


> -#define cpu_list s390_cpu_list
>   void s390_set_qemu_cpu_model(uint16_t type, uint8_t gen, uint8_t ec_ga,
>                                const S390FeatInit feat_init);
>   
> diff --git a/target/s390x/cpu.c b/target/s390x/cpu.c
> index 1f75629ddc2..ac05e82f0ac 100644
> --- a/target/s390x/cpu.c
> +++ b/target/s390x/cpu.c
> @@ -378,6 +378,7 @@ static void s390_cpu_class_init(ObjectClass *oc, void *data)
>                                          &scc->parent_phases);
>   
>       cc->class_by_name = s390_cpu_class_by_name;
> +    cc->list_cpus = s390_cpu_list;
>       cc->mmu_index = s390x_cpu_mmu_index;
>       cc->dump_state = s390_cpu_dump_state;
>       cc->query_cpu_fast = s390_query_cpu_fast;


Re: [PATCH-for-10.1 5/6] target/sparc: Register CPUClass:list_cpus
Posted by Philippe Mathieu-Daudé 10 months, 3 weeks ago
On 24/3/25 10:30, Thomas Huth wrote:
> On 23/03/2025 23.40, Philippe Mathieu-Daudé wrote:
>> Register sparc_cpu_list() as CPUClass:list_cpus callback
>> and remove the cpu_list definition.
> 
> Copy-n-paste error in both, subject and patch description: This should 
> be about s390x, not sparc.

Oh oops.

>> diff --git a/target/s390x/cpu.h b/target/s390x/cpu.h
>> index 5b7992deda6..1aac967a0ce 100644
>> --- a/target/s390x/cpu.h
>> +++ b/target/s390x/cpu.h
>> @@ -902,7 +902,6 @@ static inline uint8_t s390_cpu_get_state(S390CPU 
>> *cpu)
>>   /* cpu_models.c */
>>   void s390_cpu_list(void);
> 
> Don't you want to remove the prototype here, too? (and make the function 
> static in the .c file)

s390_set_qemu_cpu_model is defined in cpu_models.c,
while CPUClass in cpu.c.

> 
>   Thomas

Re: [PATCH-for-10.1 5/6] target/sparc: Register CPUClass:list_cpus
Posted by Thomas Huth 10 months, 3 weeks ago
On 24/03/2025 17.32, Philippe Mathieu-Daudé wrote:
> On 24/3/25 10:30, Thomas Huth wrote:
>> On 23/03/2025 23.40, Philippe Mathieu-Daudé wrote:
>>> Register sparc_cpu_list() as CPUClass:list_cpus callback
>>> and remove the cpu_list definition.
>>
>> Copy-n-paste error in both, subject and patch description: This should be 
>> about s390x, not sparc.
> 
> Oh oops.
> 
>>> diff --git a/target/s390x/cpu.h b/target/s390x/cpu.h
>>> index 5b7992deda6..1aac967a0ce 100644
>>> --- a/target/s390x/cpu.h
>>> +++ b/target/s390x/cpu.h
>>> @@ -902,7 +902,6 @@ static inline uint8_t s390_cpu_get_state(S390CPU *cpu)
>>>   /* cpu_models.c */
>>>   void s390_cpu_list(void);
>>
>> Don't you want to remove the prototype here, too? (and make the function 
>> static in the .c file)
> 
> s390_set_qemu_cpu_model is defined in cpu_models.c,
> while CPUClass in cpu.c.

Oh, right! So maybe you could move the prototype into cpu_models.h instead?

  Thomas