diff mbox series

hw/arm/virt.c: Fix wrong default cpu type in AARCH64

Message ID 20250402135402.14526-1-zhangckid@gmail.com (mailing list archive)
State New
Headers show
Series hw/arm/virt.c: Fix wrong default cpu type in AARCH64 | expand

Commit Message

Zhang Chen April 2, 2025, 1:54 p.m. UTC
Because of the CONFIG_TCG auto enabled, the cpu type "cortex-a15"
is mistakenly set to the default AARCH64 target.

Signed-off-by: Zhang Chen <zhangckid@gmail.com>
---
 hw/arm/virt.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

Richard Henderson April 2, 2025, 6:42 p.m. UTC | #1
On 4/2/25 06:54, Zhang Chen wrote:
> Because of the CONFIG_TCG auto enabled, the cpu type "cortex-a15"
> is mistakenly set to the default AARCH64 target.

This is the correct backward compatible setting.
In essence, it means that you *must* supply a -cpu argument.


r~

> 
> Signed-off-by: Zhang Chen <zhangckid@gmail.com>
> ---
>   hw/arm/virt.c | 5 +++--
>   1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/hw/arm/virt.c b/hw/arm/virt.c
> index a96452f17a..63649e9543 100644
> --- a/hw/arm/virt.c
> +++ b/hw/arm/virt.c
> @@ -3178,9 +3178,10 @@ static void virt_machine_class_init(ObjectClass *oc, void *data)
>       mc->cpu_index_to_instance_props = virt_cpu_index_to_props;
>   #ifdef CONFIG_TCG
>       mc->default_cpu_type = ARM_CPU_TYPE_NAME("cortex-a15");
> -#else
> +#ifdef TARGET_AARCH64
>       mc->default_cpu_type = ARM_CPU_TYPE_NAME("max");
> -#endif
> +#endif /* TARGET_AARCH64 */
> +#endif /* CONFIG_TCG */
>       mc->valid_cpu_types = valid_cpu_types;
>       mc->get_default_cpu_node_id = virt_get_default_cpu_node_id;
>       mc->kvm_type = virt_kvm_type;
Zhang Chen April 3, 2025, 2:23 a.m. UTC | #2
On Thu, Apr 3, 2025 at 2:43 AM Richard Henderson
<richard.henderson@linaro.org> wrote:
>
> On 4/2/25 06:54, Zhang Chen wrote:
> > Because of the CONFIG_TCG auto enabled, the cpu type "cortex-a15"
> > is mistakenly set to the default AARCH64 target.
>
> This is the correct backward compatible setting.
> In essence, it means that you *must* supply a -cpu argument.
>
>

If the "-cpu" is required, the VM should not be started without this argument.
If yes, I will skip this patch and submit another one to make QEMU
refuse to start without this parameter.

Thanks
Chen

> r~
>
> >
> > Signed-off-by: Zhang Chen <zhangckid@gmail.com>
> > ---
> >   hw/arm/virt.c | 5 +++--
> >   1 file changed, 3 insertions(+), 2 deletions(-)
> >
> > diff --git a/hw/arm/virt.c b/hw/arm/virt.c
> > index a96452f17a..63649e9543 100644
> > --- a/hw/arm/virt.c
> > +++ b/hw/arm/virt.c
> > @@ -3178,9 +3178,10 @@ static void virt_machine_class_init(ObjectClass *oc, void *data)
> >       mc->cpu_index_to_instance_props = virt_cpu_index_to_props;
> >   #ifdef CONFIG_TCG
> >       mc->default_cpu_type = ARM_CPU_TYPE_NAME("cortex-a15");
> > -#else
> > +#ifdef TARGET_AARCH64
> >       mc->default_cpu_type = ARM_CPU_TYPE_NAME("max");
> > -#endif
> > +#endif /* TARGET_AARCH64 */
> > +#endif /* CONFIG_TCG */
> >       mc->valid_cpu_types = valid_cpu_types;
> >       mc->get_default_cpu_node_id = virt_get_default_cpu_node_id;
> >       mc->kvm_type = virt_kvm_type;
>
>
diff mbox series

Patch

diff --git a/hw/arm/virt.c b/hw/arm/virt.c
index a96452f17a..63649e9543 100644
--- a/hw/arm/virt.c
+++ b/hw/arm/virt.c
@@ -3178,9 +3178,10 @@  static void virt_machine_class_init(ObjectClass *oc, void *data)
     mc->cpu_index_to_instance_props = virt_cpu_index_to_props;
 #ifdef CONFIG_TCG
     mc->default_cpu_type = ARM_CPU_TYPE_NAME("cortex-a15");
-#else
+#ifdef TARGET_AARCH64
     mc->default_cpu_type = ARM_CPU_TYPE_NAME("max");
-#endif
+#endif /* TARGET_AARCH64 */
+#endif /* CONFIG_TCG */
     mc->valid_cpu_types = valid_cpu_types;
     mc->get_default_cpu_node_id = virt_get_default_cpu_node_id;
     mc->kvm_type = virt_kvm_type;