qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [PATCH 3/3] [VARIANT 2] qapi: Change 'core-id' to 'core' in


From: Peter Krempa
Subject: [Qemu-devel] [PATCH 3/3] [VARIANT 2] qapi: Change 'core-id' to 'core' in 'struct CPUCore'
Date: Thu, 23 Jun 2016 22:23:25 +0200

CpuInstanceProperties uses 'core' as the property name. As docs for
query-hotpluggable-cpus state that the cpu core properties should be
passed back to device_add by management in case new members are added
and thus the names for the fields should be kept in sync.

Signed-off-by: Peter Krempa <address@hidden>
---
 hw/cpu/core.c           |  6 +++---
 hw/ppc/spapr_cpu_core.c | 16 ++++++++--------
 include/hw/cpu/core.h   |  4 ++--
 3 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/hw/cpu/core.c b/hw/cpu/core.c
index eff90c1..8484cab 100644
--- a/hw/cpu/core.c
+++ b/hw/cpu/core.c
@@ -15,7 +15,7 @@ static void core_prop_get_core_id(Object *obj, Visitor *v, 
const char *name,
                                   void *opaque, Error **errp)
 {
     CPUCore *core = CPU_CORE(obj);
-    int64_t value = core->core_id;
+    int64_t value = core->core;

     visit_type_int(v, name, &value, errp);
 }
@@ -33,7 +33,7 @@ static void core_prop_set_core_id(Object *obj, Visitor *v, 
const char *name,
         return;
     }

-    core->core_id = value;
+    core->core = value;
 }

 static void core_prop_get_nr_threads(Object *obj, Visitor *v, const char *name,
@@ -65,7 +65,7 @@ static void cpu_core_instance_init(Object *obj)
 {
     CPUCore *core = CPU_CORE(obj);

-    object_property_add(obj, "core-id", "int", core_prop_get_core_id,
+    object_property_add(obj, "core", "int", core_prop_get_core_id,
                         core_prop_set_core_id, NULL, NULL, NULL);
     object_property_add(obj, "nr-threads", "int", core_prop_get_nr_threads,
                         core_prop_set_nr_threads, NULL, NULL, NULL);
diff --git a/hw/ppc/spapr_cpu_core.c b/hw/ppc/spapr_cpu_core.c
index 3a5da09..74aeda5 100644
--- a/hw/ppc/spapr_cpu_core.c
+++ b/hw/ppc/spapr_cpu_core.c
@@ -118,7 +118,7 @@ static void spapr_core_release(DeviceState *dev, void 
*opaque)
         object_unparent(obj);
     }

-    spapr->cores[cc->core_id / smt] = NULL;
+    spapr->cores[cc->core / smt] = NULL;

     g_free(core->threads);
     object_unparent(OBJECT(dev));
@@ -163,8 +163,8 @@ void spapr_core_plug(HotplugHandler *hotplug_dev, 
DeviceState *dev,
     int index;
     int smt = kvmppc_smt_threads();

-    drc = spapr_dr_connector_by_id(SPAPR_DR_CONNECTOR_TYPE_CPU, cc->core_id);
-    index = cc->core_id / smt;
+    drc = spapr_dr_connector_by_id(SPAPR_DR_CONNECTOR_TYPE_CPU, cc->core);
+    index = cc->core / smt;
     spapr->cores[index] = OBJECT(dev);

     if (!smc->dr_cpu_enabled) {
@@ -239,19 +239,19 @@ void spapr_core_pre_plug(HotplugHandler *hotplug_dev, 
DeviceState *dev,
         goto out;
     }

-    if (cc->core_id % smt) {
-        error_setg(&local_err, "invalid core id %d\n", cc->core_id);
+    if (cc->core % smt) {
+        error_setg(&local_err, "invalid core id %d\n", cc->core);
         goto out;
     }

-    index = cc->core_id / smt;
+    index = cc->core / smt;
     if (index < 0 || index >= spapr_max_cores) {
-        error_setg(&local_err, "core id %d out of range", cc->core_id);
+        error_setg(&local_err, "core id %d out of range", cc->core);
         goto out;
     }

     if (spapr->cores[index]) {
-        error_setg(&local_err, "core %d already populated", cc->core_id);
+        error_setg(&local_err, "core %d already populated", cc->core);
         goto out;
     }

diff --git a/include/hw/cpu/core.h b/include/hw/cpu/core.h
index 79ac79c..3b00c37 100644
--- a/include/hw/cpu/core.h
+++ b/include/hw/cpu/core.h
@@ -22,13 +22,13 @@ typedef struct CPUCore {
     DeviceState parent_obj;

     /*< public >*/
-    int core_id;
+    int core;
     int nr_threads;
 } CPUCore;

 /* Note: topology field names need to be kept in sync with
  * 'CpuInstanceProperties' */

-#define CPU_CORE_PROP_CORE_ID "core-id"
+#define CPU_CORE_PROP_CORE_ID "core"

 #endif
-- 
2.8.3




reply via email to

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