From patchwork Fri Jun 17 06:36:38 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Gibson X-Patchwork-Id: 636814 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 3rW9zP1cjTz9sdm for ; Fri, 17 Jun 2016 16:57:05 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=gibson.dropbear.id.au header.i=@gibson.dropbear.id.au header.b=qHRQBfoD; dkim-atps=neutral Received: from localhost ([::1]:54328 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bDniB-0002Rq-8x for incoming@patchwork.ozlabs.org; Fri, 17 Jun 2016 02:57:03 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50455) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bDnN5-0005cM-3H for qemu-devel@nongnu.org; Fri, 17 Jun 2016 02:35:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bDnMz-0008H1-O5 for qemu-devel@nongnu.org; Fri, 17 Jun 2016 02:35:13 -0400 Received: from ozlabs.org ([103.22.144.67]:60496) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bDnMz-0008EQ-3S; Fri, 17 Jun 2016 02:35:09 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 3rW9Tv3hftz9t2Q; Fri, 17 Jun 2016 16:34:58 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1466145299; bh=NZOt10V6Hh5/E5yYjrRF/4di+tJmKJOQWp5cn3fUOyQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qHRQBfoD56EvYswqiPZNzyVaulMCmh6jbg9baRrVRVKmhJV8UDHOlEM654zPXxf3c g5VVoaaJe6pj9WHHwgaCw6xgPN70n4QT+galy11zdIBlDcw7DU4dwicCD7KhFgULoh jk3egZ93MUPVLtkpA7832xAW/aFHUNl+KRVf7kRk= From: David Gibson To: peter.maydell@linaro.org Date: Fri, 17 Jun 2016 16:36:38 +1000 Message-Id: <1466145399-32209-18-git-send-email-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1466145399-32209-1-git-send-email-david@gibson.dropbear.id.au> References: <1466145399-32209-1-git-send-email-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 103.22.144.67 Subject: [Qemu-devel] [PULL 17/18] hmp: Add 'info hotpluggable-cpus' HMP command 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: qemu-devel@nongnu.org, aik@ozlabs.ru, mdroth@linux.vnet.ibm.com, agraf@suse.de, qemu-ppc@nongnu.org, bharata@linux.vnet.ibm.com, imammedo@redhat.com, David Gibson Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Bharata B Rao This is the HMP equivalent for QMP query-hotpluggable-cpus. Signed-off-by: Bharata B Rao Reviewed-by: David Gibson [dwg: Fixed problem with printf formats on 32-bit host] Signed-off-by: David Gibson --- hmp-commands-info.hx | 14 ++++++++++++++ hmp.c | 42 ++++++++++++++++++++++++++++++++++++++++++ hmp.h | 1 + 3 files changed, 57 insertions(+) diff --git a/hmp-commands-info.hx b/hmp-commands-info.hx index 52539c3..7da9e6c 100644 --- a/hmp-commands-info.hx +++ b/hmp-commands-info.hx @@ -800,6 +800,20 @@ STEXI Display the latest dump status. ETEXI + { + .name = "hotpluggable-cpus", + .args_type = "", + .params = "", + .help = "Show information about hotpluggable CPUs", + .mhandler.cmd = hmp_hotpluggable_cpus, + }, + +STEXI +@item info hotpluggable-cpus +@findex hotpluggable-cpus +Show information about hotpluggable CPUs +ETEXI + STEXI @end table ETEXI diff --git a/hmp.c b/hmp.c index 30897af..997a768 100644 --- a/hmp.c +++ b/hmp.c @@ -2433,3 +2433,45 @@ void hmp_info_dump(Monitor *mon, const QDict *qdict) qapi_free_DumpQueryResult(result); } + +void hmp_hotpluggable_cpus(Monitor *mon, const QDict *qdict) +{ + Error *err = NULL; + HotpluggableCPUList *l = qmp_query_hotpluggable_cpus(&err); + HotpluggableCPUList *saved = l; + CpuInstanceProperties *c; + + if (err != NULL) { + hmp_handle_error(mon, &err); + return; + } + + monitor_printf(mon, "Hotpluggable CPUs:\n"); + while (l) { + monitor_printf(mon, " type: \"%s\"\n", l->value->type); + monitor_printf(mon, " vcpus_count: \"%" PRIu64 "\"\n", + l->value->vcpus_count); + if (l->value->has_qom_path) { + monitor_printf(mon, " qom_path: \"%s\"\n", l->value->qom_path); + } + + c = l->value->props; + monitor_printf(mon, " CPUInstance Properties:\n"); + if (c->has_node) { + monitor_printf(mon, " node: \"%" PRIu64 "\"\n", c->node); + } + if (c->has_socket) { + monitor_printf(mon, " socket: \"%" PRIu64 "\"\n", c->socket); + } + if (c->has_core) { + monitor_printf(mon, " core: \"%" PRIu64 "\"\n", c->core); + } + if (c->has_thread) { + monitor_printf(mon, " thread: \"%" PRIu64 "\"\n", c->thread); + } + + l = l->next; + } + + qapi_free_HotpluggableCPUList(saved); +} diff --git a/hmp.h b/hmp.h index 093d65f..f5d9749 100644 --- a/hmp.h +++ b/hmp.h @@ -132,5 +132,6 @@ void hmp_rocker_ports(Monitor *mon, const QDict *qdict); void hmp_rocker_of_dpa_flows(Monitor *mon, const QDict *qdict); void hmp_rocker_of_dpa_groups(Monitor *mon, const QDict *qdict); void hmp_info_dump(Monitor *mon, const QDict *qdict); +void hmp_hotpluggable_cpus(Monitor *mon, const QDict *qdict); #endif