qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 00/24] generalize parsing of cpu_model (part 4)


From: Peter Maydell
Subject: Re: [Qemu-devel] [PATCH 00/24] generalize parsing of cpu_model (part 4)
Date: Thu, 18 Jan 2018 13:10:13 +0000

On 18 January 2018 at 13:06, Igor Mammedov <address@hidden> wrote:
> I've looked and such case is rather an exception,
> I can fix it up in 2 ways:
> 1st:
>   target/arm/cpu.h
>   +#if !defined(CONFIG_USER_ONLY)
>   +#define TARGET_DEFAULT_CPU_TYPE TYPE_ARM_CPU
>   +else
>   +#define TARGET_DEFAULT_CPU_TYPE ARM_CPU_TYPE_NAME("any")
>   +#endif

This is weird, because TYPE_ARM_CPU isn't really
a sensible thing to use for anything, so you've really set
it up as a "this is only of any use for null-machine.c",
in which case you should just do that in null-machine.c.

> or 2nd is to compile in "any" type in system mode
> (which most targets do), roughly it would amount to:
>   target/arm/cpu.c
>   @@ -1671,10 +1671,8 @@ static const ARMCPUInfo arm_cpus[] = {
>      { .name = "pxa270-b1",   .initfn = pxa270b1_initfn },
>      { .name = "pxa270-c0",   .initfn = pxa270c0_initfn },
>      { .name = "pxa270-c5",   .initfn = pxa270c5_initfn },
>   -#ifdef CONFIG_USER_ONLY
>      { .name = "any",         .initfn = arm_any_initfn },
>    #endif
>   -#endif
>      { .name = NULL }
>    };

This is definitely wrong. We deliberately don't provide "any"
in system mode, because it's not a sensible thing for users
to try to use with board emulation. We disabled it some while
back to avoid users trying it by accident and getting confused.

In general, for Arm you really need to know which CPU you want
to use and why. So:
 linux-user and bsd-user: should use "any"
 board models: should use whatever CPU that board is designed for
 null-machine: if it genuinely doesn't care, then pick one at random

But there is no single sensible "default CPU type" at an architecture
level, which is why you can't define a TARGET_DEFAULT_CPU_TYPE
in target/arm/cpu.h. Any code that thinks it wants that should
instead be defining it own default that makes sense for that
context.

thanks
-- PMM



reply via email to

[Prev in Thread] Current Thread [Next in Thread]