[Qemu-devel] [PATCH 4/5] bsd-user: Use lookup_cpu_class()

Eduardo Habkost posted 5 patches 6 years, 9 months ago
Maintainers: Eduardo Habkost <ehabkost@redhat.com>, Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>, Laurent Vivier <laurent@vivier.eu>, Artyom Tarasenko <atar4qemu@gmail.com>, Richard Henderson <rth@twiddle.net>, Riku Voipio <riku.voipio@iki.fi>, David Gibson <david@gibson.dropbear.id.au>, Paolo Bonzini <pbonzini@redhat.com>
[Qemu-devel] [PATCH 4/5] bsd-user: Use lookup_cpu_class()
Posted by Eduardo Habkost 6 years, 9 months ago
The hardcoded CPU models in the code are just CPU models and
don't include any extra options.  We don't need to call
parse_cpu_options().

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 bsd-user/main.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/bsd-user/main.c b/bsd-user/main.c
index a6c055f5fb..d2915a9951 100644
--- a/bsd-user/main.c
+++ b/bsd-user/main.c
@@ -732,6 +732,7 @@ int main(int argc, char **argv)
     TaskState ts1, *ts = &ts1;
     CPUArchState *env;
     CPUState *cpu;
+    CPUClass *cc;
     int optind;
     const char *r;
     int gdbstub_port = 0;
@@ -903,7 +904,8 @@ int main(int argc, char **argv)
     /* init tcg before creating CPUs and to get qemu_host_page_size */
     tcg_exec_init(0);
 
-    cpu_type = parse_cpu_option(cpu_model);
+    cc = lookup_cpu_class(cpu_model, &error_fatal);
+    cpu_type = object_class_get_name(OBJECT_CLASS(cc));
     cpu = cpu_create(cpu_type);
     env = cpu->env_ptr;
 #if defined(TARGET_SPARC) || defined(TARGET_PPC)
-- 
2.18.0.rc1.1.g3f1ff2140


Re: [Qemu-devel] [PATCH 4/5] bsd-user: Use lookup_cpu_class()
Posted by David Gibson 6 years, 9 months ago
On Tue, Apr 16, 2019 at 11:59:43PM -0300, Eduardo Habkost wrote:
> The hardcoded CPU models in the code are just CPU models and
> don't include any extra options.  We don't need to call
> parse_cpu_options().
> 
> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>

Reviewed-by: David Gibson <david@gibson.dropbear.id.au>

> ---
>  bsd-user/main.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/bsd-user/main.c b/bsd-user/main.c
> index a6c055f5fb..d2915a9951 100644
> --- a/bsd-user/main.c
> +++ b/bsd-user/main.c
> @@ -732,6 +732,7 @@ int main(int argc, char **argv)
>      TaskState ts1, *ts = &ts1;
>      CPUArchState *env;
>      CPUState *cpu;
> +    CPUClass *cc;
>      int optind;
>      const char *r;
>      int gdbstub_port = 0;
> @@ -903,7 +904,8 @@ int main(int argc, char **argv)
>      /* init tcg before creating CPUs and to get qemu_host_page_size */
>      tcg_exec_init(0);
>  
> -    cpu_type = parse_cpu_option(cpu_model);
> +    cc = lookup_cpu_class(cpu_model, &error_fatal);
> +    cpu_type = object_class_get_name(OBJECT_CLASS(cc));
>      cpu = cpu_create(cpu_type);
>      env = cpu->env_ptr;
>  #if defined(TARGET_SPARC) || defined(TARGET_PPC)

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson