On 10/03/2017 07:37 AM, Igor Mammedov wrote:
> On Mon, 2 Oct 2017 17:35:39 -0300
> Philippe Mathieu-Daudé <f4...@amsat.org> wrote:
> 
>> On 10/02/2017 06:08 AM, Igor Mammedov wrote:
>>> use new XTENSA_CPU_TYPE_NAME to compose CPU type name
>>> to bring xtensa in line with all other targets that
>>> will similar macro.
>>>
>>> Signed-off-by: Igor Mammedov <imamm...@redhat.com>
>>> ---
>>> CC: jcmvb...@gmail.com
>>> ---
>>>   target/xtensa/cpu.h    | 4 ++++
>>>   target/xtensa/cpu.c    | 2 +-
>>>   target/xtensa/helper.c | 2 +-
>>>   3 files changed, 6 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/target/xtensa/cpu.h b/target/xtensa/cpu.h
>>> index 4803331..b17d7d9 100644
>>> --- a/target/xtensa/cpu.h
>>> +++ b/target/xtensa/cpu.h
>>> @@ -469,11 +469,15 @@ void xtensa_cpu_do_unaligned_access(CPUState *cpu, 
>>> vaddr addr,
>>>   #define cpu_signal_handler cpu_xtensa_signal_handler
>>>   #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
>>> +
>>>   #ifdef TARGET_WORDS_BIGENDIAN
>>>   #define XTENSA_DEFAULT_CPU_MODEL "fsf"
>>>   #else
>>>   #define XTENSA_DEFAULT_CPU_MODEL "dc232b"
>>>   #endif
>>> +#define XTENSA_DEFAULT_CPU_TYPE 
>>> XTENSA_CPU_TYPE_NAME(XTENSA_DEFAULT_CPU_MODEL)  
>>
>> I see XTENSA_DEFAULT_CPU_MODEL is used in mc->desc, any idea to be able 
>> to use this instead?
> mc-desc is the reason why I've left XTENSA_DEFAULT_CPU_MODEL as is, and
> having that there were no point in adding yet another ifdef for type,
> XTENSA_DEFAULT_CPU_MODEL works just fine here.

Fine enough,

Reviewed-by: Philippe Mathieu-Daudé <f4...@amsat.org>

> 
>>
>> #ifdef TARGET_WORDS_BIGENDIAN
>> # define XTENSA_DEFAULT_CPU_TYPE XTENSA_CPU_TYPE_NAME("fsf")
>> #else
>> # define XTENSA_DEFAULT_CPU_TYPE XTENSA_CPU_TYPE_NAME("dc232b")
>> #endif
>>
>>>   
>>>   #define cpu_init(cpu_model) cpu_generic_init(TYPE_XTENSA_CPU, cpu_model)
>>>   
>>> diff --git a/target/xtensa/cpu.c b/target/xtensa/cpu.c
>>> index dcdc765..b5f7079 100644
>>> --- a/target/xtensa/cpu.c
>>> +++ b/target/xtensa/cpu.c
>>> @@ -83,7 +83,7 @@ static ObjectClass *xtensa_cpu_class_by_name(const char 
>>> *cpu_model)
>>>       ObjectClass *oc;
>>>       char *typename;
>>>   
>>> -    typename = g_strdup_printf("%s-" TYPE_XTENSA_CPU, cpu_model);
>>> +    typename = g_strdup_printf(XTENSA_CPU_TYPE_NAME("%s"), cpu_model);
>>>       oc = object_class_by_name(typename);
>>>       g_free(typename);
>>>       if (oc == NULL || !object_class_dynamic_cast(oc, TYPE_XTENSA_CPU) ||
>>> diff --git a/target/xtensa/helper.c b/target/xtensa/helper.c
>>> index e8fba20..216f198 100644
>>> --- a/target/xtensa/helper.c
>>> +++ b/target/xtensa/helper.c
>>> @@ -76,7 +76,7 @@ void xtensa_register_core(XtensaConfigList *node)
>>>   
>>>       node->next = xtensa_cores;
>>>       xtensa_cores = node;
>>> -    type.name = g_strdup_printf("%s-" TYPE_XTENSA_CPU, node->config->name);
>>> +    type.name = g_strdup_printf(XTENSA_CPU_TYPE_NAME("%s"), 
>>> node->config->name);
>>>       type_register(&type);
>>>       g_free((gpointer)type.name);
>>>   }
>>>   
> 

Reply via email to