From patchwork Thu Jun 23 20:23:25 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Krempa X-Patchwork-Id: 639886 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3rbCcm6Z7Hz9sBf for ; Fri, 24 Jun 2016 06:24:56 +1000 (AEST) Received: from localhost ([::1]:39186 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bGBBG-00078U-Ql for incoming@patchwork.ozlabs.org; Thu, 23 Jun 2016 16:24:54 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54066) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bGBA9-0005yw-Me for qemu-devel@nongnu.org; Thu, 23 Jun 2016 16:23:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bGBA3-0004wv-NO for qemu-devel@nongnu.org; Thu, 23 Jun 2016 16:23:44 -0400 Received: from mx1.redhat.com ([209.132.183.28]:42831) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bGBA3-0004vm-2A for qemu-devel@nongnu.org; Thu, 23 Jun 2016 16:23:39 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A230E7F6B4 for ; Thu, 23 Jun 2016 20:23:38 +0000 (UTC) Received: from angien.brq.redhat.com (dhcp129-199.brq.redhat.com [10.34.129.199]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u5NKNP9L032377; Thu, 23 Jun 2016 16:23:37 -0400 From: Peter Krempa To: qemu-devel@nongnu.org Date: Thu, 23 Jun 2016 22:23:25 +0200 Message-Id: <991ed6d9955c506a6dae5fc6fdd3ca47e5329a3e.1466713052.git.pkrempa@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Thu, 23 Jun 2016 20:23:38 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 3/3] [VARIANT 2] qapi: Change 'core-id' to 'core' in 'struct CPUCore' X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Igor Mammedov , Peter Krempa , David Gibson Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" 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 --- 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