diff mbox series

[v2,20/23] hw/loongarch/virt: Default to max32 CPU for LoongArch 32 build

Message ID 20241226-la32-fixes1-v2-20-0414594f8cb5@flygoat.com (mailing list archive)
State New
Headers show
Series target/loongarch: LoongArch32 fixes 1 | expand

Commit Message

Jiaxun Yang Dec. 26, 2024, 9:19 p.m. UTC
la464 CPU is not available on LoongArch32. Use max32 which makes
more sense here.

Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
---
 hw/loongarch/virt.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Philippe Mathieu-Daudé Dec. 26, 2024, 10:56 p.m. UTC | #1
On 26/12/24 22:19, Jiaxun Yang wrote:
> la464 CPU is not available on LoongArch32. Use max32 which makes
> more sense here.
> 
> Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
> ---
>   hw/loongarch/virt.c | 4 ++++
>   1 file changed, 4 insertions(+)
> 
> diff --git a/hw/loongarch/virt.c b/hw/loongarch/virt.c
> index 3a905cf71d46e3c5a29672f7bb73faedf1d29444..343d2e745e155d59f0ff17124b3c77ec9b3c111e 100644
> --- a/hw/loongarch/virt.c
> +++ b/hw/loongarch/virt.c
> @@ -1440,7 +1440,11 @@ static void virt_class_init(ObjectClass *oc, void *data)
>       HotplugHandlerClass *hc = HOTPLUG_HANDLER_CLASS(oc);
>   
>       mc->init = virt_init;
> +#if defined(TARGET_LOONGARCH64)
>       mc->default_cpu_type = LOONGARCH_CPU_TYPE_NAME("la464");
> +#elif defined(TARGET_LOONGARCH32)
> +    mc->default_cpu_type = LOONGARCH_CPU_TYPE_NAME("max32");

Why can't we use it on LOONGARCH64?

> +#endif
>       mc->default_ram_id = "loongarch.ram";
>       mc->desc = "QEMU LoongArch Virtual Machine";
>       mc->max_cpus = LOONGARCH_MAX_CPUS;
>
Jiaxun Yang Dec. 26, 2024, 11:03 p.m. UTC | #2
在2024年12月26日十二月 下午10:56,Philippe Mathieu-Daudé写道:
> On 26/12/24 22:19, Jiaxun Yang wrote:
>> la464 CPU is not available on LoongArch32. Use max32 which makes
>> more sense here.
>> 
>> Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
>> ---
>>   hw/loongarch/virt.c | 4 ++++
>>   1 file changed, 4 insertions(+)
>> 
>> diff --git a/hw/loongarch/virt.c b/hw/loongarch/virt.c
>> index 3a905cf71d46e3c5a29672f7bb73faedf1d29444..343d2e745e155d59f0ff17124b3c77ec9b3c111e 100644
>> --- a/hw/loongarch/virt.c
>> +++ b/hw/loongarch/virt.c
>> @@ -1440,7 +1440,11 @@ static void virt_class_init(ObjectClass *oc, void *data)
>>       HotplugHandlerClass *hc = HOTPLUG_HANDLER_CLASS(oc);
>>   
>>       mc->init = virt_init;
>> +#if defined(TARGET_LOONGARCH64)
>>       mc->default_cpu_type = LOONGARCH_CPU_TYPE_NAME("la464");
>> +#elif defined(TARGET_LOONGARCH32)
>> +    mc->default_cpu_type = LOONGARCH_CPU_TYPE_NAME("max32");
>
> Why can't we use it on LOONGARCH64?

I think many users are launching qemu-system-loongarch64 with default CPU,
better not to break them, so we only do max32 as default for
qemu-system-loongarch32.

Thanks
>
>> +#endif
>>       mc->default_ram_id = "loongarch.ram";
>>       mc->desc = "QEMU LoongArch Virtual Machine";
>>       mc->max_cpus = LOONGARCH_MAX_CPUS;
>>
Philippe Mathieu-Daudé Dec. 26, 2024, 11:20 p.m. UTC | #3
On 27/12/24 00:03, Jiaxun Yang wrote:
> 在2024年12月26日十二月 下午10:56,Philippe Mathieu-Daudé写道:
>> On 26/12/24 22:19, Jiaxun Yang wrote:
>>> la464 CPU is not available on LoongArch32. Use max32 which makes
>>> more sense here.
>>>
>>> Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
>>> ---
>>>    hw/loongarch/virt.c | 4 ++++
>>>    1 file changed, 4 insertions(+)
>>>
>>> diff --git a/hw/loongarch/virt.c b/hw/loongarch/virt.c
>>> index 3a905cf71d46e3c5a29672f7bb73faedf1d29444..343d2e745e155d59f0ff17124b3c77ec9b3c111e 100644
>>> --- a/hw/loongarch/virt.c
>>> +++ b/hw/loongarch/virt.c
>>> @@ -1440,7 +1440,11 @@ static void virt_class_init(ObjectClass *oc, void *data)
>>>        HotplugHandlerClass *hc = HOTPLUG_HANDLER_CLASS(oc);
>>>    
>>>        mc->init = virt_init;
>>> +#if defined(TARGET_LOONGARCH64)
>>>        mc->default_cpu_type = LOONGARCH_CPU_TYPE_NAME("la464");
>>> +#elif defined(TARGET_LOONGARCH32)
>>> +    mc->default_cpu_type = LOONGARCH_CPU_TYPE_NAME("max32");
>>
>> Why can't we use it on LOONGARCH64?
> 
> I think many users are launching qemu-system-loongarch64 with default CPU,
> better not to break them, so we only do max32 as default for
> qemu-system-loongarch32.

Don't start with a default cpu on loongarch32! The user will get the
"no default cpu, use -cpu help to display them" and select max32 or any 
other :)
diff mbox series

Patch

diff --git a/hw/loongarch/virt.c b/hw/loongarch/virt.c
index 3a905cf71d46e3c5a29672f7bb73faedf1d29444..343d2e745e155d59f0ff17124b3c77ec9b3c111e 100644
--- a/hw/loongarch/virt.c
+++ b/hw/loongarch/virt.c
@@ -1440,7 +1440,11 @@  static void virt_class_init(ObjectClass *oc, void *data)
     HotplugHandlerClass *hc = HOTPLUG_HANDLER_CLASS(oc);
 
     mc->init = virt_init;
+#if defined(TARGET_LOONGARCH64)
     mc->default_cpu_type = LOONGARCH_CPU_TYPE_NAME("la464");
+#elif defined(TARGET_LOONGARCH32)
+    mc->default_cpu_type = LOONGARCH_CPU_TYPE_NAME("max32");
+#endif
     mc->default_ram_id = "loongarch.ram";
     mc->desc = "QEMU LoongArch Virtual Machine";
     mc->max_cpus = LOONGARCH_MAX_CPUS;