From: Gavin Shan <gshan@redhat.com>
To: "Philippe Mathieu-Daudé" <philmd@linaro.org>,
"Marcin Juszkiewicz" <marcin.juszkiewicz@linaro.org>,
"Peter Maydell" <peter.maydell@linaro.org>
Cc: qemu-arm@nongnu.org, qemu-devel@nongnu.org, pbonzini@redhat.com,
eduardo@habkost.net, marcel.apfelbaum@gmail.com,
wangyanan55@huawei.com, shan.gavin@gmail.com
Subject: Re: [PATCH 0/3] hw/arm/virt: Use generic CPU invalidation
Date: Fri, 14 Jul 2023 10:51:29 +1000 [thread overview]
Message-ID: <ad1d9972-bb77-b7ad-4a89-2cb7019a79a7@redhat.com> (raw)
In-Reply-To: <7ad244d7-2e29-74b4-e8bf-949925697880@linaro.org>
Hi Philippe,
On 7/14/23 02:29, Philippe Mathieu-Daudé wrote:
> On 13/7/23 14:34, Gavin Shan wrote:
>> On 7/13/23 21:52, Marcin Juszkiewicz wrote:
>>> W dniu 13.07.2023 o 13:44, Peter Maydell pisze:
>>>
>>>> I see this isn't a change in this patch, but given that
>>>> what the user specifies is not "cortex-a8-arm-cpu" but
>>>> "cortex-a8", why do we include the "-arm-cpu" suffix in
>>>> the error messages? It's not valid syntax to say
>>>> "-cpu cortex-a8-arm-cpu", so it's a bit misleading...
>>>
>>> Internally those cpu names are "max-{TYPE_ARM_CPU}" and similar for other architectures.
>>>
>>> I like the change but it (IMHO) needs to cut "-{TYPE_*_CPU}" string from names:
>>>
>>> 13:37 marcin@applejack:qemu$ ./build/aarch64-softmmu/qemu-system-aarch64 -M virt -cpu cortex-r5
>>> qemu-system-aarch64: Invalid CPU type: cortex-r5-arm-cpu
>>> The valid types are: cortex-a7-arm-cpu, cortex-a15-arm-cpu, cortex-a35-arm-cpu, cortex-a55-arm-cpu, cortex-a72-arm-cpu, cortex-a76-arm-cpu, a64fx-arm-cpu, neoverse-n1-arm-cpu, neoverse-v1-arm-cpu, cortex-a53-arm-cpu, cortex-a57-arm-cpu, host-arm-cpu, max-arm-cpu
>>>
>>> 13:37 marcin@applejack:qemu$ ./build/aarch64-softmmu/qemu-system-aarch64 -M virt -cpu cortex-a57-arm-cpu
>>> qemu-system-aarch64: unable to find CPU model 'cortex-a57-arm-cpu'
>>>
>>
>> The suffix of CPU types are provided in hw/arm/virt.c::valid_cpu_types in PATCH[2].
>> In the generic validation, the complete CPU type is used. The error message also
>> have complete CPU type there.
>
> In some places (arm_cpu_list_entry, arm_cpu_add_definition) we use:
>
> g_strndup(typename, strlen(typename) - strlen("-" TYPE_ARM_CPU))
>
> Maybe extract as a helper? cpu_typename_name()? :)
>
Yeah, it's definitely a good idea. The helper is needed by all architectures,
not ARM alone. The following CPU types don't have explicit definition of
XXXX_CPU_TYPE_SUFFIX. We need take "-" TYPE_CPU as the suffix.
target/microblaze/cpu.c TYPE_MICROBLAZE_CPU
target/hppa/cpu.c TYPE_HPPA_CPU
target/nios2/cpu.c TYPE_NIOS2_CPU
target/microblaze/cpu-qom.h:#define TYPE_MICROBLAZE_CPU "microblaze-cpu"
target/hppa/cpu-qom.h: #define TYPE_HPPA_CPU "hppa-cpu"
target/nios2/cpu.h: #define TYPE_NIOS2_CPU "nios2-cpu"
I think the function name can be cpu_model_name() since we have called it
as 'model' in cpu.c::parse_cpu_option(). Something like below. Please let
me know if you have more comments.
target/xxxx/cpu.h
-----------------
static inline char *cpu_model_name(const char *typename)
{
return g_strndup(typename, strlen(typename) - strlen(TYPE_XXX_CPU_SUFFIX));
}
Thanks,
Gavin
next prev parent reply other threads:[~2023-07-14 0:53 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-13 5:44 [PATCH 0/3] hw/arm/virt: Use generic CPU invalidation Gavin Shan
2023-07-13 5:45 ` [PATCH 1/3] machine: Factor CPU type invalidation out into helper Gavin Shan
2023-07-14 12:07 ` Igor Mammedov
2023-07-18 6:11 ` Gavin Shan
2023-07-24 14:39 ` Igor Mammedov
2023-07-13 5:45 ` [PATCH 2/3] hw/arm/virt: Use generic CPU type invalidation Gavin Shan
2023-07-14 11:59 ` Igor Mammedov
2023-07-18 6:17 ` Gavin Shan
2023-07-13 5:45 ` [PATCH 3/3] hw/arm/virt: Support host CPU type only when KVM or HVF is configured Gavin Shan
2023-07-13 12:46 ` Cornelia Huck
2023-07-13 13:16 ` Gavin Shan
2023-07-13 11:44 ` [PATCH 0/3] hw/arm/virt: Use generic CPU invalidation Peter Maydell
2023-07-13 11:52 ` Marcin Juszkiewicz
2023-07-13 11:59 ` Peter Maydell
2023-07-14 11:50 ` Igor Mammedov
2023-07-14 12:56 ` Peter Maydell
2023-07-17 12:44 ` Igor Mammedov
2023-07-18 10:31 ` Gavin Shan
2023-07-24 15:06 ` Igor Mammedov
2023-07-24 15:14 ` Peter Maydell
2023-07-25 6:46 ` Igor Mammedov
2023-07-13 12:34 ` Gavin Shan
2023-07-13 12:44 ` Marcin Juszkiewicz
2023-07-13 13:00 ` Gavin Shan
2023-07-13 16:29 ` Philippe Mathieu-Daudé
2023-07-14 0:51 ` Gavin Shan [this message]
2023-07-14 9:14 ` Gavin Shan
2023-07-13 19:27 ` Richard Henderson
2023-07-14 0:54 ` Gavin Shan
2023-07-13 12:42 ` Gavin Shan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ad1d9972-bb77-b7ad-4a89-2cb7019a79a7@redhat.com \
--to=gshan@redhat.com \
--cc=eduardo@habkost.net \
--cc=marcel.apfelbaum@gmail.com \
--cc=marcin.juszkiewicz@linaro.org \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=philmd@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=shan.gavin@gmail.com \
--cc=wangyanan55@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).