From patchwork Thu Jul 7 15:17:13 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Krempa X-Patchwork-Id: 645927 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 3rlh8p0yG5z9s5w for ; Fri, 8 Jul 2016 01:18:34 +1000 (AEST) Received: from localhost ([::1]:40556 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bLB4R-0007aQ-Sw for incoming@patchwork.ozlabs.org; Thu, 07 Jul 2016 11:18:31 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59561) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bLB3B-0006jb-8L for qemu-devel@nongnu.org; Thu, 07 Jul 2016 11:17:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bLB35-0005Sh-SA for qemu-devel@nongnu.org; Thu, 07 Jul 2016 11:17:12 -0400 Received: from mx1.redhat.com ([209.132.183.28]:34447) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bLB35-0005Sb-KL for qemu-devel@nongnu.org; Thu, 07 Jul 2016 11:17:07 -0400 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) (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 491E680085 for ; Thu, 7 Jul 2016 15:17:07 +0000 (UTC) Received: from angien.brq.redhat.com (dhcp129-133.brq.redhat.com [10.34.129.133]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u67FH4ZE002169; Thu, 7 Jul 2016 11:17:06 -0400 From: Peter Krempa To: qemu-devel@nongnu.org Date: Thu, 7 Jul 2016 17:17:13 +0200 Message-Id: <59c8f2c8e80d705fb4981bddd9fe703c1205346c.1467904342.git.pkrempa@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Thu, 07 Jul 2016 15:17:07 +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] [RFC PATCH 1/2] qapi: Add vcpu id to query-hotpluggable-cpus output 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: dgibson@redhat.com, Peter Krempa , imammedo@redhat.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Add 'vcpu index' to the output of query hotpluggable cpus. This output is identical to the linear cpu index taken by the 'cpus' attribute passed to -numa. This will allow to reliably map the cpu number to a given topology element without making mgmt apps to reimplement the mapping. Signed-off-by: Peter Krempa --- hmp.c | 1 + hw/i386/pc.c | 1 + hw/ppc/spapr.c | 1 + qapi-schema.json | 2 ++ 4 files changed, 5 insertions(+) diff --git a/hmp.c b/hmp.c index 0cf5baa..613601e 100644 --- a/hmp.c +++ b/hmp.c @@ -2450,6 +2450,7 @@ void hmp_hotpluggable_cpus(Monitor *mon, const QDict *qdict) monitor_printf(mon, " type: \"%s\"\n", l->value->type); monitor_printf(mon, " vcpus_count: \"%" PRIu64 "\"\n", l->value->vcpus_count); + monitor_printf(mon, " vcpu_id: \"%" PRIu64 "\"\n", l->value->vcpu_id); if (l->value->has_qom_path) { monitor_printf(mon, " qom_path: \"%s\"\n", l->value->qom_path); } diff --git a/hw/i386/pc.c b/hw/i386/pc.c index f293a0c..4ba02c4 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -2131,6 +2131,7 @@ static HotpluggableCPUList *pc_query_hotpluggable_cpus(MachineState *machine) cpu_item->type = g_strdup(cpu_type); cpu_item->vcpus_count = 1; + cpu_item->vcpu_id = i; cpu_props->has_socket_id = true; cpu_props->socket_id = topo.pkg_id; cpu_props->has_core_id = true; diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 7f33a1b..d1f5195 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -2378,6 +2378,7 @@ static HotpluggableCPUList *spapr_query_hotpluggable_cpus(MachineState *machine) cpu_item->type = spapr_get_cpu_core_type(machine->cpu_model); cpu_item->vcpus_count = smp_threads; + cpu_item->vcpu_id = i; cpu_props->has_core_id = true; cpu_props->core_id = i * smt; /* TODO: add 'has_node/node' here to describe diff --git a/qapi-schema.json b/qapi-schema.json index ba3bf14..6db9294 100644 --- a/qapi-schema.json +++ b/qapi-schema.json @@ -4292,6 +4292,7 @@ # @type: CPU object type for usage with device_add command # @props: list of properties to be used for hotplugging CPU # @vcpus-count: number of logical VCPU threads @HotpluggableCPU provides +# @vcpu-id: linear index of the vcpu # @qom-path: #optional link to existing CPU object if CPU is present or # omitted if CPU is not present. # @@ -4300,6 +4301,7 @@ { 'struct': 'HotpluggableCPU', 'data': { 'type': 'str', 'vcpus-count': 'int', + 'vcpu-id': 'int', 'props': 'CpuInstanceProperties', '*qom-path': 'str' }