* [PATCH] hw/arm/virt.c: Fix wrong default cpu type in AARCH64 @ 2025-04-02 13:54 Zhang Chen 2025-04-02 18:42 ` Richard Henderson 0 siblings, 1 reply; 8+ messages in thread From: Zhang Chen @ 2025-04-02 13:54 UTC (permalink / raw) To: qemu-devel, qemu-arm, Peter Maydell; +Cc: Zhang Chen 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(-) 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; -- 2.49.0 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH] hw/arm/virt.c: Fix wrong default cpu type in AARCH64 2025-04-02 13:54 [PATCH] hw/arm/virt.c: Fix wrong default cpu type in AARCH64 Zhang Chen @ 2025-04-02 18:42 ` Richard Henderson 2025-04-03 2:23 ` Zhang Chen 0 siblings, 1 reply; 8+ messages in thread From: Richard Henderson @ 2025-04-02 18:42 UTC (permalink / raw) To: qemu-devel 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; ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] hw/arm/virt.c: Fix wrong default cpu type in AARCH64 2025-04-02 18:42 ` Richard Henderson @ 2025-04-03 2:23 ` Zhang Chen 2025-04-24 8:56 ` Zhang Chen 0 siblings, 1 reply; 8+ messages in thread From: Zhang Chen @ 2025-04-03 2:23 UTC (permalink / raw) To: Richard Henderson; +Cc: qemu-devel 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; > > ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] hw/arm/virt.c: Fix wrong default cpu type in AARCH64 2025-04-03 2:23 ` Zhang Chen @ 2025-04-24 8:56 ` Zhang Chen 2025-04-24 9:58 ` Philippe Mathieu-Daudé 2025-04-28 12:47 ` Peter Maydell 0 siblings, 2 replies; 8+ messages in thread From: Zhang Chen @ 2025-04-24 8:56 UTC (permalink / raw) To: Richard Henderson; +Cc: qemu-devel On Thu, Apr 3, 2025 at 10:23 AM Zhang Chen <zhangckid@gmail.com> wrote: > > 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. > Ping... and let me explain this status, it is not just for the default value. 1. The cpu type "cortex-a15" is not the correct backward compatible setting for AARCH64 target. The ARM cortex-a15 is a 32 bit CPU based on ARMv7-A architecture. It can not boot for AARCH64 target. For example, the Apple M silicon can not boot with the default -cpu value. 2. Most of QEMU docs does not said user *must* supply a -cpu argument. https://www.qemu.org/docs/master/system/qemu-manpage.html Thanks Chen > 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; > > > > ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] hw/arm/virt.c: Fix wrong default cpu type in AARCH64 2025-04-24 8:56 ` Zhang Chen @ 2025-04-24 9:58 ` Philippe Mathieu-Daudé 2025-04-28 3:17 ` Zhang Chen 2025-04-28 12:47 ` Peter Maydell 1 sibling, 1 reply; 8+ messages in thread From: Philippe Mathieu-Daudé @ 2025-04-24 9:58 UTC (permalink / raw) To: Zhang Chen, Richard Henderson Cc: qemu-devel, Daniel P. Berrangé, Andrew Jones, Alexander Graf On 24/4/25 10:56, Zhang Chen wrote: > On Thu, Apr 3, 2025 at 10:23 AM Zhang Chen <zhangckid@gmail.com> wrote: >> >> 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. >> > > Ping... and let me explain this status, it is not just for the default value. > 1. The cpu type "cortex-a15" is not the correct backward compatible > setting for AARCH64 target. IIUC it was meant to be backward compatible for KVM (as in "not TCG"), HVF was not a thing for ARM at this time. > The ARM cortex-a15 is a 32 bit CPU based on ARMv7-A architecture. It > can not boot for AARCH64 target. > For example, the Apple M silicon can not boot with the default -cpu value. A respin of this series might help you, I'll try to remember to Cc you: https://lore.kernel.org/qemu-devel/b883f0ef-6131-4335-b273-90fd3d8cc5e4@linaro.org/ > 2. Most of QEMU docs does not said user *must* supply a -cpu argument. > https://www.qemu.org/docs/master/system/qemu-manpage.html > > Thanks > Chen > >> 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; >>> >>> > ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] hw/arm/virt.c: Fix wrong default cpu type in AARCH64 2025-04-24 9:58 ` Philippe Mathieu-Daudé @ 2025-04-28 3:17 ` Zhang Chen 0 siblings, 0 replies; 8+ messages in thread From: Zhang Chen @ 2025-04-28 3:17 UTC (permalink / raw) To: Philippe Mathieu-Daudé Cc: Richard Henderson, qemu-devel, Daniel P. Berrangé, Andrew Jones, Alexander Graf On Thu, Apr 24, 2025 at 5:58 PM Philippe Mathieu-Daudé <philmd@linaro.org> wrote: > > On 24/4/25 10:56, Zhang Chen wrote: > > On Thu, Apr 3, 2025 at 10:23 AM Zhang Chen <zhangckid@gmail.com> wrote: > >> > >> 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. > >> > > > > Ping... and let me explain this status, it is not just for the default value. > > 1. The cpu type "cortex-a15" is not the correct backward compatible > > setting for AARCH64 target. > > IIUC it was meant to be backward compatible for KVM (as in "not TCG"), > HVF was not a thing for ARM at this time. > > > The ARM cortex-a15 is a 32 bit CPU based on ARMv7-A architecture. It > > can not boot for AARCH64 target. > > For example, the Apple M silicon can not boot with the default -cpu value. > > A respin of this series might help you, I'll try to remember to Cc you: > https://lore.kernel.org/qemu-devel/b883f0ef-6131-4335-b273-90fd3d8cc5e4@linaro.org/ > Thanks Philippe, your patch fix the same issue and looks good for me. Let's drop this patch. Thanks Chen > > 2. Most of QEMU docs does not said user *must* supply a -cpu argument. > > https://www.qemu.org/docs/master/system/qemu-manpage.html > > > > Thanks > > Chen > > > >> 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; > >>> > >>> > > > ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] hw/arm/virt.c: Fix wrong default cpu type in AARCH64 2025-04-24 8:56 ` Zhang Chen 2025-04-24 9:58 ` Philippe Mathieu-Daudé @ 2025-04-28 12:47 ` Peter Maydell 2025-04-29 3:22 ` Zhang Chen 1 sibling, 1 reply; 8+ messages in thread From: Peter Maydell @ 2025-04-28 12:47 UTC (permalink / raw) To: Zhang Chen; +Cc: Richard Henderson, qemu-devel On Thu, 24 Apr 2025 at 09:57, Zhang Chen <zhangckid@gmail.com> wrote: > > On Thu, Apr 3, 2025 at 10:23 AM Zhang Chen <zhangckid@gmail.com> wrote: > > > > 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. > > > > Ping... and let me explain this status, it is not just for the default value. > 1. The cpu type "cortex-a15" is not the correct backward compatible > setting for AARCH64 target. > The ARM cortex-a15 is a 32 bit CPU based on ARMv7-A architecture. It > can not boot for AARCH64 target. > For example, the Apple M silicon can not boot with the default -cpu value. 'qemu-system-aarch64' doesn't mean "I want an AArch64 CPU", it just means that you can select AArch64 machines and CPUs. Almost all command lines that work with qemu-system-arm also do the same thing if run with qemu-system-aarch64. So in this case, "qemu-system-aarch64 -M virt" does the same as "qemu-system-arm -M virt", including the CPU type selected. The Cortex-A15 is now very rarely what anybody wants, but we keep it this way to avoid breaking existing users' command lines. (It works fine if you pass it a 32-bit guest kernel.) thanks -- PMM ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] hw/arm/virt.c: Fix wrong default cpu type in AARCH64 2025-04-28 12:47 ` Peter Maydell @ 2025-04-29 3:22 ` Zhang Chen 0 siblings, 0 replies; 8+ messages in thread From: Zhang Chen @ 2025-04-29 3:22 UTC (permalink / raw) To: Peter Maydell; +Cc: Richard Henderson, qemu-devel On Mon, Apr 28, 2025 at 8:47 PM Peter Maydell <peter.maydell@linaro.org> wrote: > > On Thu, 24 Apr 2025 at 09:57, Zhang Chen <zhangckid@gmail.com> wrote: > > > > On Thu, Apr 3, 2025 at 10:23 AM Zhang Chen <zhangckid@gmail.com> wrote: > > > > > > 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. > > > > > > > Ping... and let me explain this status, it is not just for the default value. > > 1. The cpu type "cortex-a15" is not the correct backward compatible > > setting for AARCH64 target. > > The ARM cortex-a15 is a 32 bit CPU based on ARMv7-A architecture. It > > can not boot for AARCH64 target. > > For example, the Apple M silicon can not boot with the default -cpu value. > > 'qemu-system-aarch64' doesn't mean "I want an AArch64 CPU", it > just means that you can select AArch64 machines and CPUs. Almost > all command lines that work with qemu-system-arm also do the same > thing if run with qemu-system-aarch64. So in this case, > "qemu-system-aarch64 -M virt" does the same as "qemu-system-arm -M virt", > including the CPU type selected. > > The Cortex-A15 is now very rarely what anybody wants, but we > keep it this way to avoid breaking existing users' command lines. > (It works fine if you pass it a 32-bit guest kernel.) Thanks Peter for the detailed explanation. I got the background of the AArch64. I'm just interested in Apple M silicon with HVF recently. Thanks Chen > > thanks > -- PMM ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2025-04-29 3:23 UTC | newest] Thread overview: 8+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2025-04-02 13:54 [PATCH] hw/arm/virt.c: Fix wrong default cpu type in AARCH64 Zhang Chen 2025-04-02 18:42 ` Richard Henderson 2025-04-03 2:23 ` Zhang Chen 2025-04-24 8:56 ` Zhang Chen 2025-04-24 9:58 ` Philippe Mathieu-Daudé 2025-04-28 3:17 ` Zhang Chen 2025-04-28 12:47 ` Peter Maydell 2025-04-29 3:22 ` Zhang Chen
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).