Message ID | 20190417025944.16154-4-ehabkost@redhat.com |
---|---|
State | New |
Headers | show |
Series | Remove qdev_get_machine() call from ppc_cpu_parse_featurestr() | expand |
On Tue, Apr 16, 2019 at 11:59:42PM -0300, Eduardo Habkost wrote: > The return value of cpu_get_model() is just a CPU model name and > never includes extra options. We don't need to call > parse_cpu_option(). > > Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Reviewed-by: David Gibson <david@gibson.dropbear.id.au> > --- > linux-user/main.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/linux-user/main.c b/linux-user/main.c > index 20e0f51cfa..d74108e05c 100644 > --- a/linux-user/main.c > +++ b/linux-user/main.c > @@ -592,6 +592,7 @@ int main(int argc, char **argv, char **envp) > TaskState *ts; > CPUArchState *env; > CPUState *cpu; > + CPUClass *cc; > int optind; > char **target_environ, **wrk; > char **target_argv; > @@ -660,7 +661,8 @@ int main(int argc, char **argv, char **envp) > if (cpu_model == NULL) { > cpu_model = cpu_get_model(get_elf_eflags(execfd)); > } > - cpu_type = parse_cpu_option(cpu_model); > + cc = lookup_cpu_class(cpu_model, &error_fatal); > + cpu_type = object_class_get_name(OBJECT_CLASS(cc)); > > /* init tcg before creating CPUs and to get qemu_host_page_size */ > tcg_exec_init(0);
On Tue, Apr 16, 2019 at 11:59:42PM -0300, Eduardo Habkost wrote: > The return value of cpu_get_model() is just a CPU model name and > never includes extra options. We don't need to call > parse_cpu_option(). Oops. I was wrong. linux-user also supports extra features in the "-cpu" option, so we do need to call parse_cpu_option(). e.g.: this worked before: $ qemu-x86_64 -cpu Nehalem,+popcnt /bin/true and now this is broken: $ qemu-x86_64 -cpu Nehalem,+popcnt /bin/true unable to find CPU model 'Nehalem,+popcnt' I will drop patches 2-5 from my queue. Sorry for the noise.
diff --git a/linux-user/main.c b/linux-user/main.c index 20e0f51cfa..d74108e05c 100644 --- a/linux-user/main.c +++ b/linux-user/main.c @@ -592,6 +592,7 @@ int main(int argc, char **argv, char **envp) TaskState *ts; CPUArchState *env; CPUState *cpu; + CPUClass *cc; int optind; char **target_environ, **wrk; char **target_argv; @@ -660,7 +661,8 @@ int main(int argc, char **argv, char **envp) if (cpu_model == NULL) { cpu_model = cpu_get_model(get_elf_eflags(execfd)); } - cpu_type = parse_cpu_option(cpu_model); + cc = lookup_cpu_class(cpu_model, &error_fatal); + cpu_type = object_class_get_name(OBJECT_CLASS(cc)); /* init tcg before creating CPUs and to get qemu_host_page_size */ tcg_exec_init(0);
The return value of cpu_get_model() is just a CPU model name and never includes extra options. We don't need to call parse_cpu_option(). Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> --- linux-user/main.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)