On Mon, Nov 12, 2012 at 10:18:29PM +0000, Peter Maydell wrote: > On 12 November 2012 22:16, Eduardo Habkost <ehabk...@redhat.com> wrote: > > > > Sorry for replying to a patch 7 months later, but I just have a question > > related to how we will handle CPU model classes on all targets: > > > > On Sat, Apr 14, 2012 at 05:42:10PM +0100, Peter Maydell wrote: > >> Register subclasses for each ARM CPU implementation (with the > >> exception of "pxa270", which is an alias for "pxa270-a0"). > >> > >> Let arm_cpu_list() enumerate CPU subclasses in alphabetical order, > >> except for special value "any". > >> > >> Replace cpu_arm_find_by_name()'s string -> CPUID lookup by storing the > >> CPUID (aka MIDR, Main ID Register) value in the class. > >> > >> Signed-off-by: Andreas Färber <afaer...@suse.de> > >> Signed-off-by: Peter Maydell <peter.mayd...@linaro.org> > >> --- > >> target-arm/cpu-qom.h | 12 +++ > >> target-arm/cpu.c | 226 > >> +++++++++++++++++++++++++++++++++++++++++++++++++- > >> target-arm/helper.c | 109 ++++++++++-------------- > >> 3 files changed, 282 insertions(+), 65 deletions(-) > >> > >> diff --git a/target-arm/cpu-qom.h b/target-arm/cpu-qom.h > >> index 42d2a6b..a4bcb31 100644 > >> --- a/target-arm/cpu-qom.h > >> +++ b/target-arm/cpu-qom.h > >> @@ -58,6 +58,18 @@ typedef struct ARMCPU { > > [...] > >> +typedef struct ARMCPUInfo { > >> + const char *name; > >> + void (*initfn)(Object *obj); > >> +} ARMCPUInfo; > >> + > >> +static const ARMCPUInfo arm_cpus[] = { > > [...] > >> + { .name = "any", .initfn = arm_any_initfn }, > >> +}; > >> + > > > > Do we really want to use "any" as the class name? > > Probably not, since it would make it tricky to (in some future > utopia) have a QEMU which supported more than one CPU architecture > in the same binary if they all wanted to use "any"...
In that case, "cpu-any" wouldn't work, either. What about "<arch>-cpu-<model>"? > > > Maybe we should use > > "cpu-<model>" as the namespace for the CPU model class names? > > Sounds reasonable. > > -- PMM -- Eduardo