All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v2] spar: remove extra type variable
@ 2016-08-09 11:15 Cédric Le Goater
  2016-08-09 11:32 ` Thomas Huth
  2016-08-10  4:47 ` David Gibson
  0 siblings, 2 replies; 3+ messages in thread
From: Cédric Le Goater @ 2016-08-09 11:15 UTC (permalink / raw)
  To: qemu-ppc
  Cc: David Gibson, Bharata B Rao, qemu-devel, Thomas Huth,
	Cédric Le Goater

The sPAPR CPU core typename is already available in the upper
block. Let's use it and move the check upward also.

Signed-off-by: Cédric Le Goater <clg@kaod.org>
---
 hw/ppc/spapr.c |   15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

Index: qemu-dgibson-for-2.8.git/hw/ppc/spapr.c
===================================================================
--- qemu-dgibson-for-2.8.git.orig/hw/ppc/spapr.c
+++ qemu-dgibson-for-2.8.git/hw/ppc/spapr.c
@@ -1772,6 +1772,11 @@ static void ppc_spapr_init(MachineState
     if (mc->query_hotpluggable_cpus) {
         char *type = spapr_get_cpu_core_type(machine->cpu_model);
 
+        if (!object_class_by_name(type)) {
+            error_report("Unable to find sPAPR CPU Core definition");
+            exit(1);
+        }
+
         spapr->cores = g_new0(Object *, spapr_max_cores);
         for (i = 0; i < spapr_max_cores; i++) {
             int core_id = i * smp_threads;
@@ -1783,15 +1788,7 @@ static void ppc_spapr_init(MachineState
             qemu_register_reset(spapr_drc_reset, drc);
 
             if (i < spapr_cores) {
-                char *type = spapr_get_cpu_core_type(machine->cpu_model);
-                Object *core;
-
-                if (!object_class_by_name(type)) {
-                    error_report("Unable to find sPAPR CPU Core definition");
-                    exit(1);
-                }
-
-                core  = object_new(type);
+                Object *core  = object_new(type);
                 object_property_set_int(core, smp_threads, "nr-threads",
                                         &error_fatal);
                 object_property_set_int(core, core_id, CPU_CORE_PROP_CORE_ID,

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH v2] spar: remove extra type variable
  2016-08-09 11:15 [Qemu-devel] [PATCH v2] spar: remove extra type variable Cédric Le Goater
@ 2016-08-09 11:32 ` Thomas Huth
  2016-08-10  4:47 ` David Gibson
  1 sibling, 0 replies; 3+ messages in thread
From: Thomas Huth @ 2016-08-09 11:32 UTC (permalink / raw)
  To: Cédric Le Goater, qemu-ppc; +Cc: David Gibson, Bharata B Rao, qemu-devel

On 09.08.2016 13:15, Cédric Le Goater wrote:
> The sPAPR CPU core typename is already available in the upper
> block. Let's use it and move the check upward also.
> 
> Signed-off-by: Cédric Le Goater <clg@kaod.org>
> ---
>  hw/ppc/spapr.c |   15 ++++++---------
>  1 file changed, 6 insertions(+), 9 deletions(-)
> 
> Index: qemu-dgibson-for-2.8.git/hw/ppc/spapr.c
> ===================================================================
> --- qemu-dgibson-for-2.8.git.orig/hw/ppc/spapr.c
> +++ qemu-dgibson-for-2.8.git/hw/ppc/spapr.c
> @@ -1772,6 +1772,11 @@ static void ppc_spapr_init(MachineState
>      if (mc->query_hotpluggable_cpus) {
>          char *type = spapr_get_cpu_core_type(machine->cpu_model);
>  
> +        if (!object_class_by_name(type)) {
> +            error_report("Unable to find sPAPR CPU Core definition");
> +            exit(1);
> +        }
> +
>          spapr->cores = g_new0(Object *, spapr_max_cores);
>          for (i = 0; i < spapr_max_cores; i++) {
>              int core_id = i * smp_threads;
> @@ -1783,15 +1788,7 @@ static void ppc_spapr_init(MachineState
>              qemu_register_reset(spapr_drc_reset, drc);
>  
>              if (i < spapr_cores) {
> -                char *type = spapr_get_cpu_core_type(machine->cpu_model);
> -                Object *core;
> -
> -                if (!object_class_by_name(type)) {
> -                    error_report("Unable to find sPAPR CPU Core definition");
> -                    exit(1);
> -                }
> -
> -                core  = object_new(type);
> +                Object *core  = object_new(type);
>                  object_property_set_int(core, smp_threads, "nr-threads",
>                                          &error_fatal);
>                  object_property_set_int(core, core_id, CPU_CORE_PROP_CORE_ID,
> 

Reviewed-by: Thomas Huth <thuth@redhat.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH v2] spar: remove extra type variable
  2016-08-09 11:15 [Qemu-devel] [PATCH v2] spar: remove extra type variable Cédric Le Goater
  2016-08-09 11:32 ` Thomas Huth
@ 2016-08-10  4:47 ` David Gibson
  1 sibling, 0 replies; 3+ messages in thread
From: David Gibson @ 2016-08-10  4:47 UTC (permalink / raw)
  To: Cédric Le Goater; +Cc: qemu-ppc, Bharata B Rao, qemu-devel, Thomas Huth

[-- Attachment #1: Type: text/plain, Size: 2131 bytes --]

On Tue, Aug 09, 2016 at 01:15:05PM +0200, Cédric Le Goater wrote:
> The sPAPR CPU core typename is already available in the upper
> block. Let's use it and move the check upward also.
> 
> Signed-off-by: Cédric Le Goater <clg@kaod.org>

I already merged this as part of Thomas' series.

> ---
>  hw/ppc/spapr.c |   15 ++++++---------
>  1 file changed, 6 insertions(+), 9 deletions(-)
> 
> Index: qemu-dgibson-for-2.8.git/hw/ppc/spapr.c
> ===================================================================
> --- qemu-dgibson-for-2.8.git.orig/hw/ppc/spapr.c
> +++ qemu-dgibson-for-2.8.git/hw/ppc/spapr.c
> @@ -1772,6 +1772,11 @@ static void ppc_spapr_init(MachineState
>      if (mc->query_hotpluggable_cpus) {
>          char *type = spapr_get_cpu_core_type(machine->cpu_model);
>  
> +        if (!object_class_by_name(type)) {
> +            error_report("Unable to find sPAPR CPU Core definition");
> +            exit(1);
> +        }
> +
>          spapr->cores = g_new0(Object *, spapr_max_cores);
>          for (i = 0; i < spapr_max_cores; i++) {
>              int core_id = i * smp_threads;
> @@ -1783,15 +1788,7 @@ static void ppc_spapr_init(MachineState
>              qemu_register_reset(spapr_drc_reset, drc);
>  
>              if (i < spapr_cores) {
> -                char *type = spapr_get_cpu_core_type(machine->cpu_model);
> -                Object *core;
> -
> -                if (!object_class_by_name(type)) {
> -                    error_report("Unable to find sPAPR CPU Core definition");
> -                    exit(1);
> -                }
> -
> -                core  = object_new(type);
> +                Object *core  = object_new(type);
>                  object_property_set_int(core, smp_threads, "nr-threads",
>                                          &error_fatal);
>                  object_property_set_int(core, core_id, CPU_CORE_PROP_CORE_ID,
> 

-- 
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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-08-10  5:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-09 11:15 [Qemu-devel] [PATCH v2] spar: remove extra type variable Cédric Le Goater
2016-08-09 11:32 ` Thomas Huth
2016-08-10  4:47 ` David Gibson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.