From patchwork Wed Jun 19 20:10:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Markus Armbruster X-Patchwork-Id: 1118986 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 45Tbhl2B8yz9sBp for ; Thu, 20 Jun 2019 06:12:23 +1000 (AEST) Received: from localhost ([::1]:41660 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hdgwL-0004NZ-6a for incoming@patchwork.ozlabs.org; Wed, 19 Jun 2019 16:12:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35392) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hdgvC-0004Kb-3L for qemu-devel@nongnu.org; Wed, 19 Jun 2019 16:11:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hdgv7-0001AK-NL for qemu-devel@nongnu.org; Wed, 19 Jun 2019 16:11:04 -0400 Received: from mx1.redhat.com ([209.132.183.28]:38530) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hdgv7-00010k-1B for qemu-devel@nongnu.org; Wed, 19 Jun 2019 16:11:01 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 569BE223899; Wed, 19 Jun 2019 20:10:52 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-116-85.ams2.redhat.com [10.36.116.85]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1DDD06013D; Wed, 19 Jun 2019 20:10:52 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 8917011386A3; Wed, 19 Jun 2019 22:10:50 +0200 (CEST) From: Markus Armbruster To: qemu-devel@nongnu.org Date: Wed, 19 Jun 2019 22:10:34 +0200 Message-Id: <20190619201050.19040-2-armbru@redhat.com> In-Reply-To: <20190619201050.19040-1-armbru@redhat.com> References: <20190619201050.19040-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Wed, 19 Jun 2019 20:10:52 +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 01/17] MAINTAINERS: new maintainers for QOM X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, "Daniel P . Berrange" , Eduardo Habkost , Paolo Bonzini , =?utf-8?q?Andreas_F=C3=A4rber?= Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Paolo Bonzini QOM is not a particularly active subsystem now: 51 commits in two years. But, we need active maintainers to review and merge patches, and Git shows the following top committers taking on QOM: Markus Armbruster Eduardo Habkost Paolo Bonzini Marc-André Lureau Eric Blake I volunteer myself, and also volunteer Eduardo and Daniel as reviewers since they understand the code well. Cc: Andreas Färber Cc: Daniel P. Berrange Cc: Eduardo Habkost Suggested-by: Markus Armbruster Signed-off-by: Paolo Bonzini Message-Id: <20190607113737.13473-1-pbonzini@redhat.com> Signed-off-by: Markus Armbruster Reviewed-by: Daniel P. Berrangé --- MAINTAINERS | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/MAINTAINERS b/MAINTAINERS index d32c5c2313..63390eadb5 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -2029,9 +2029,10 @@ F: docs/interop/qemu-ga-ref.texi T: git https://github.com/mdroth/qemu.git qga QOM -M: Andreas Färber +M: Paolo Bonzini +R: Daniel P. Berrange +R: Eduardo Habkost S: Supported -T: git https://github.com/afaerber/qemu-cpu.git qom-next F: include/qom/ X: include/qom/cpu.h F: qom/ From patchwork Wed Jun 19 20:10:35 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Markus Armbruster X-Patchwork-Id: 1118984 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 45Tbhj5ZhHz9s5c for ; Thu, 20 Jun 2019 06:12:18 +1000 (AEST) Received: from localhost ([::1]:41656 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hdgwJ-0004JX-Gp for incoming@patchwork.ozlabs.org; Wed, 19 Jun 2019 16:12:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35256) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hdgv5-0004JF-M3 for qemu-devel@nongnu.org; Wed, 19 Jun 2019 16:11:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hdgv4-00015y-49 for qemu-devel@nongnu.org; Wed, 19 Jun 2019 16:10:59 -0400 Received: from mx1.redhat.com ([209.132.183.28]:34724) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hdgv3-00010n-7S for qemu-devel@nongnu.org; Wed, 19 Jun 2019 16:10:57 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5E3A230860B9 for ; Wed, 19 Jun 2019 20:10:52 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-116-85.ams2.redhat.com [10.36.116.85]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2B05760142; Wed, 19 Jun 2019 20:10:52 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 90BC811386B0; Wed, 19 Jun 2019 22:10:50 +0200 (CEST) From: Markus Armbruster To: qemu-devel@nongnu.org Date: Wed, 19 Jun 2019 22:10:35 +0200 Message-Id: <20190619201050.19040-3-armbru@redhat.com> In-Reply-To: <20190619201050.19040-1-armbru@redhat.com> References: <20190619201050.19040-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Wed, 19 Jun 2019 20:10:52 +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 02/17] Makefile: Don't add monitor/ twice to common-obj-y X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Both commit f1b3ccfaa68 "monitor: Move {hmp, qmp}.c to monitor/{hmp, qmp}-cmds.c" and commit 7e3c0deab1b "monitor: Split out monitor/qmp.c" added monitor/ to common-obj-y ifeq ($(CONFIG_SOFTMMU),y). Revert the second addition. Signed-off-by: Markus Armbruster Reviewed-by: Daniel P. Berrangé --- Makefile.objs | 1 - 1 file changed, 1 deletion(-) diff --git a/Makefile.objs b/Makefile.objs index 658cfc9d9f..7494d6143b 100644 --- a/Makefile.objs +++ b/Makefile.objs @@ -85,7 +85,6 @@ common-obj-$(CONFIG_FDT) += device_tree.o # qapi common-obj-y += qapi/ -common-obj-y += monitor/ endif ####################################################################### From patchwork Wed Jun 19 20:10:36 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Markus Armbruster X-Patchwork-Id: 1118994 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 45TbvM0QR5z9s4V for ; Thu, 20 Jun 2019 06:21:33 +1000 (AEST) Received: from localhost ([::1]:41718 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hdh5H-0004LK-W3 for incoming@patchwork.ozlabs.org; Wed, 19 Jun 2019 16:21:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35397) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hdgvC-0004Kr-Ag for qemu-devel@nongnu.org; Wed, 19 Jun 2019 16:11:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hdgv7-00019K-4B for qemu-devel@nongnu.org; Wed, 19 Jun 2019 16:11:04 -0400 Received: from mx1.redhat.com ([209.132.183.28]:46162) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hdgv5-000110-MR for qemu-devel@nongnu.org; Wed, 19 Jun 2019 16:10:59 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7DA2530F1BA0 for ; Wed, 19 Jun 2019 20:10:52 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-116-85.ams2.redhat.com [10.36.116.85]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 25F165C21E; Wed, 19 Jun 2019 20:10:52 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 9D2CA11385FA; Wed, 19 Jun 2019 22:10:50 +0200 (CEST) From: Markus Armbruster To: qemu-devel@nongnu.org Date: Wed, 19 Jun 2019 22:10:36 +0200 Message-Id: <20190619201050.19040-4-armbru@redhat.com> In-Reply-To: <20190619201050.19040-1-armbru@redhat.com> References: <20190619201050.19040-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.43]); Wed, 19 Jun 2019 20:10:52 +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 03/17] hmp: Move hmp.h to include/monitor/ X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, "Dr. David Alan Gilbert" Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Cc: "Dr. David Alan Gilbert" Signed-off-by: Markus Armbruster Reviewed-by: Daniel P. Berrangé Reviewed-by: Dr. David Alan Gilbert --- hmp.h => include/monitor/hmp.h | 0 monitor/hmp-cmds.c | 2 +- monitor/misc.c | 2 +- target/i386/monitor.c | 2 +- target/nios2/monitor.c | 2 +- target/ppc/monitor.c | 2 +- target/sh4/monitor.c | 2 +- target/sparc/monitor.c | 2 +- target/xtensa/monitor.c | 2 +- 9 files changed, 8 insertions(+), 8 deletions(-) rename hmp.h => include/monitor/hmp.h (100%) diff --git a/hmp.h b/include/monitor/hmp.h similarity index 100% rename from hmp.h rename to include/monitor/hmp.h diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c index c283dde0e9..5082fcd016 100644 --- a/monitor/hmp-cmds.c +++ b/monitor/hmp-cmds.c @@ -14,7 +14,7 @@ */ #include "qemu/osdep.h" -#include "hmp.h" +#include "monitor/hmp.h" #include "net/net.h" #include "net/eth.h" #include "chardev/char.h" diff --git a/monitor/misc.c b/monitor/misc.c index bf9faceb86..2fb6896e84 100644 --- a/monitor/misc.c +++ b/monitor/misc.c @@ -56,13 +56,13 @@ #include "qom/object_interfaces.h" #include "trace/control.h" #include "monitor/hmp-target.h" +#include "monitor/hmp.h" #ifdef CONFIG_TRACE_SIMPLE #include "trace/simple.h" #endif #include "exec/memory.h" #include "exec/exec-all.h" #include "qemu/option.h" -#include "hmp.h" #include "qemu/thread.h" #include "block/qapi.h" #include "qapi/qapi-commands.h" diff --git a/target/i386/monitor.c b/target/i386/monitor.c index 56e2dbece7..1f3b532fc2 100644 --- a/target/i386/monitor.c +++ b/target/i386/monitor.c @@ -26,11 +26,11 @@ #include "cpu.h" #include "monitor/monitor.h" #include "monitor/hmp-target.h" +#include "monitor/hmp.h" #include "qapi/qmp/qdict.h" #include "hw/i386/pc.h" #include "sysemu/kvm.h" #include "sysemu/sev.h" -#include "hmp.h" #include "qapi/error.h" #include "sev_i386.h" #include "qapi/qapi-commands-misc.h" diff --git a/target/nios2/monitor.c b/target/nios2/monitor.c index d5e3393716..6646836df5 100644 --- a/target/nios2/monitor.c +++ b/target/nios2/monitor.c @@ -25,7 +25,7 @@ #include "cpu.h" #include "monitor/monitor.h" #include "monitor/hmp-target.h" -#include "hmp.h" +#include "monitor/hmp.h" void hmp_info_tlb(Monitor *mon, const QDict *qdict) { diff --git a/target/ppc/monitor.c b/target/ppc/monitor.c index 7f8360d903..a5a177d717 100644 --- a/target/ppc/monitor.c +++ b/target/ppc/monitor.c @@ -27,7 +27,7 @@ #include "monitor/monitor.h" #include "qemu/ctype.h" #include "monitor/hmp-target.h" -#include "hmp.h" +#include "monitor/hmp.h" static target_long monitor_get_ccr(const struct MonitorDef *md, int val) { diff --git a/target/sh4/monitor.c b/target/sh4/monitor.c index 4c7f36c9cc..918a5ccfc6 100644 --- a/target/sh4/monitor.c +++ b/target/sh4/monitor.c @@ -25,7 +25,7 @@ #include "cpu.h" #include "monitor/monitor.h" #include "monitor/hmp-target.h" -#include "hmp.h" +#include "monitor/hmp.h" static void print_tlb(Monitor *mon, int idx, tlb_t *tlb) { diff --git a/target/sparc/monitor.c b/target/sparc/monitor.c index 3ec3b51a3d..a7ea287cbc 100644 --- a/target/sparc/monitor.c +++ b/target/sparc/monitor.c @@ -25,7 +25,7 @@ #include "cpu.h" #include "monitor/monitor.h" #include "monitor/hmp-target.h" -#include "hmp.h" +#include "monitor/hmp.h" void hmp_info_tlb(Monitor *mon, const QDict *qdict) diff --git a/target/xtensa/monitor.c b/target/xtensa/monitor.c index cf7957bb63..608173c238 100644 --- a/target/xtensa/monitor.c +++ b/target/xtensa/monitor.c @@ -25,7 +25,7 @@ #include "cpu.h" #include "monitor/monitor.h" #include "monitor/hmp-target.h" -#include "hmp.h" +#include "monitor/hmp.h" void hmp_info_tlb(Monitor *mon, const QDict *qdict) { From patchwork Wed Jun 19 20:10:37 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Markus Armbruster X-Patchwork-Id: 1118996 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 45TbvN50thz9s4V for ; Thu, 20 Jun 2019 06:21:30 +1000 (AEST) Received: from localhost ([::1]:41710 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hdh5E-000429-3N for incoming@patchwork.ozlabs.org; Wed, 19 Jun 2019 16:21:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35431) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hdgvE-0004M0-KS for qemu-devel@nongnu.org; Wed, 19 Jun 2019 16:11:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hdgv7-00019V-6l for qemu-devel@nongnu.org; Wed, 19 Jun 2019 16:11:07 -0400 Received: from mx1.redhat.com ([209.132.183.28]:46166) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hdgv5-000118-Jz for qemu-devel@nongnu.org; Wed, 19 Jun 2019 16:11:00 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B4E7D30F1BA5 for ; Wed, 19 Jun 2019 20:10:52 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-116-85.ams2.redhat.com [10.36.116.85]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2B0B3601A5; Wed, 19 Jun 2019 20:10:52 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id A9FE0113861C; Wed, 19 Jun 2019 22:10:50 +0200 (CEST) From: Markus Armbruster To: qemu-devel@nongnu.org Date: Wed, 19 Jun 2019 22:10:37 +0200 Message-Id: <20190619201050.19040-5-armbru@redhat.com> In-Reply-To: <20190619201050.19040-1-armbru@redhat.com> References: <20190619201050.19040-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.43]); Wed, 19 Jun 2019 20:10:52 +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 04/17] qapi: Split qom.json and qdev.json off misc.json X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, Paolo Bonzini , "Daniel P. Berrange" , Eduardo Habkost Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Move commands object-add, object-del, qom-get, qom-list, qom-list-properties, qom-list-types, and qom-set with their types from misc.json to new qom.json. Add qom.json to MAINTAINERS section QOM. Move commands device-list-properties, device_add, device-del, and event DEVICE_DELETED from misc.json to new qdev.json. qdev.json remains uncovered by MAINTAINERS, like the rest of qdev. Cc: Paolo Bonzini Cc: "Daniel P. Berrange" Cc: Eduardo Habkost Signed-off-by: Markus Armbruster Reviewed-by: Daniel P. Berrangé Reviewed-by: Daniel P. Berrangé --- MAINTAINERS | 1 + hw/block/xen-block.c | 2 +- hw/core/qdev.c | 2 +- monitor/hmp-cmds.c | 1 + monitor/qmp-cmds.c | 1 + qapi/Makefile.objs | 5 +- qapi/misc.json | 351 ------------------------------------------ qapi/qapi-schema.json | 2 + qapi/qdev.json | 125 +++++++++++++++ qapi/qom.json | 244 +++++++++++++++++++++++++++++ qdev-monitor.c | 2 +- 11 files changed, 380 insertions(+), 356 deletions(-) create mode 100644 qapi/qdev.json create mode 100644 qapi/qom.json diff --git a/MAINTAINERS b/MAINTAINERS index 63390eadb5..1aef0afaf7 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -2035,6 +2035,7 @@ R: Eduardo Habkost S: Supported F: include/qom/ X: include/qom/cpu.h +F: qapi/qom.json F: qom/ X: qom/cpu.c F: tests/check-qom-interface.c diff --git a/hw/block/xen-block.c b/hw/block/xen-block.c index 4de537aef4..654b79f921 100644 --- a/hw/block/xen-block.c +++ b/hw/block/xen-block.c @@ -11,7 +11,7 @@ #include "qemu/option.h" #include "qapi/error.h" #include "qapi/qapi-commands-block-core.h" -#include "qapi/qapi-commands-misc.h" +#include "qapi/qapi-commands-qom.h" #include "qapi/qapi-visit-block-core.h" #include "qapi/qobject-input-visitor.h" #include "qapi/visitor.h" diff --git a/hw/core/qdev.c b/hw/core/qdev.c index f9b6efe509..94ebc0a4a1 100644 --- a/hw/core/qdev.c +++ b/hw/core/qdev.c @@ -29,7 +29,7 @@ #include "hw/qdev.h" #include "sysemu/sysemu.h" #include "qapi/error.h" -#include "qapi/qapi-events-misc.h" +#include "qapi/qapi-events-qdev.h" #include "qapi/qmp/qerror.h" #include "qapi/visitor.h" #include "qemu/error-report.h" diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c index 5082fcd016..d94ab7563e 100644 --- a/monitor/hmp-cmds.c +++ b/monitor/hmp-cmds.c @@ -34,6 +34,7 @@ #include "qapi/qapi-commands-migration.h" #include "qapi/qapi-commands-misc.h" #include "qapi/qapi-commands-net.h" +#include "qapi/qapi-commands-qdev.h" #include "qapi/qapi-commands-rocker.h" #include "qapi/qapi-commands-run-state.h" #include "qapi/qapi-commands-tpm.h" diff --git a/monitor/qmp-cmds.c b/monitor/qmp-cmds.c index f1b1e4f08b..ae7f201dc0 100644 --- a/monitor/qmp-cmds.c +++ b/monitor/qmp-cmds.c @@ -34,6 +34,7 @@ #include "qapi/error.h" #include "qapi/qapi-commands-block-core.h" #include "qapi/qapi-commands-misc.h" +#include "qapi/qapi-commands-qdev.h" #include "qapi/qapi-commands-ui.h" #include "qapi/qmp/qdict.h" #include "qapi/qmp/qerror.h" diff --git a/qapi/Makefile.objs b/qapi/Makefile.objs index 729e5185c5..40b1dcffc4 100644 --- a/qapi/Makefile.objs +++ b/qapi/Makefile.objs @@ -6,8 +6,9 @@ util-obj-y += qmp-event.o util-obj-y += qapi-util.o QAPI_COMMON_MODULES = audio authz block-core block char common crypto -QAPI_COMMON_MODULES += introspect job migration misc net rdma rocker -QAPI_COMMON_MODULES += run-state sockets tpm trace transaction ui +QAPI_COMMON_MODULES += introspect job migration misc net +QAPI_COMMON_MODULES += qdev qom rdma rocker run-state sockets tpm +QAPI_COMMON_MODULES += trace transaction ui QAPI_TARGET_MODULES = target QAPI_MODULES = $(QAPI_COMMON_MODULES) $(QAPI_TARGET_MODULES) diff --git a/qapi/misc.json b/qapi/misc.json index dc4cf9da20..5fbda70ad8 100644 --- a/qapi/misc.json +++ b/qapi/misc.json @@ -1342,140 +1342,6 @@ 'data': {'command-line': 'str', '*cpu-index': 'int'}, 'returns': 'str' } -## -# @ObjectPropertyInfo: -# -# @name: the name of the property -# -# @type: the type of the property. This will typically come in one of four -# forms: -# -# 1) A primitive type such as 'u8', 'u16', 'bool', 'str', or 'double'. -# These types are mapped to the appropriate JSON type. -# -# 2) A child type in the form 'child' where subtype is a qdev -# device type name. Child properties create the composition tree. -# -# 3) A link type in the form 'link' where subtype is a qdev -# device type name. Link properties form the device model graph. -# -# @description: if specified, the description of the property. -# -# Since: 1.2 -## -{ 'struct': 'ObjectPropertyInfo', - 'data': { 'name': 'str', 'type': 'str', '*description': 'str' } } - -## -# @qom-list: -# -# This command will list any properties of a object given a path in the object -# model. -# -# @path: the path within the object model. See @qom-get for a description of -# this parameter. -# -# Returns: a list of @ObjectPropertyInfo that describe the properties of the -# object. -# -# Since: 1.2 -# -# Example: -# -# -> { "execute": "qom-list", -# "arguments": { "path": "/chardevs" } } -# <- { "return": [ { "name": "type", "type": "string" }, -# { "name": "parallel0", "type": "child" }, -# { "name": "serial0", "type": "child" }, -# { "name": "mon0", "type": "child" } ] } -# -## -{ 'command': 'qom-list', - 'data': { 'path': 'str' }, - 'returns': [ 'ObjectPropertyInfo' ], - 'allow-preconfig': true } - -## -# @qom-get: -# -# This command will get a property from a object model path and return the -# value. -# -# @path: The path within the object model. There are two forms of supported -# paths--absolute and partial paths. -# -# Absolute paths are derived from the root object and can follow child<> -# or link<> properties. Since they can follow link<> properties, they -# can be arbitrarily long. Absolute paths look like absolute filenames -# and are prefixed with a leading slash. -# -# Partial paths look like relative filenames. They do not begin -# with a prefix. The matching rules for partial paths are subtle but -# designed to make specifying objects easy. At each level of the -# composition tree, the partial path is matched as an absolute path. -# The first match is not returned. At least two matches are searched -# for. A successful result is only returned if only one match is -# found. If more than one match is found, a flag is return to -# indicate that the match was ambiguous. -# -# @property: The property name to read -# -# Returns: The property value. The type depends on the property -# type. child<> and link<> properties are returned as #str -# pathnames. All integer property types (u8, u16, etc) are -# returned as #int. -# -# Since: 1.2 -# -# Example: -# -# 1. Use absolute path -# -# -> { "execute": "qom-get", -# "arguments": { "path": "/machine/unattached/device[0]", -# "property": "hotplugged" } } -# <- { "return": false } -# -# 2. Use partial path -# -# -> { "execute": "qom-get", -# "arguments": { "path": "unattached/sysbus", -# "property": "type" } } -# <- { "return": "System" } -# -## -{ 'command': 'qom-get', - 'data': { 'path': 'str', 'property': 'str' }, - 'returns': 'any', - 'allow-preconfig': true } - -## -# @qom-set: -# -# This command will set a property from a object model path. -# -# @path: see @qom-get for a description of this parameter -# -# @property: the property name to set -# -# @value: a value who's type is appropriate for the property type. See @qom-get -# for a description of type mapping. -# -# Since: 1.2 -# -# Example: -# -# -> { "execute": "qom-set", -# "arguments": { "path": "/machine", -# "property": "graphics", -# "value": false } } -# <- { "return": {} } -# -## -{ 'command': 'qom-set', - 'data': { 'path': 'str', 'property': 'str', 'value': 'any' }, - 'allow-preconfig': true } - ## # @change: # @@ -1524,80 +1390,6 @@ { 'command': 'change', 'data': {'device': 'str', 'target': 'str', '*arg': 'str'} } -## -# @ObjectTypeInfo: -# -# This structure describes a search result from @qom-list-types -# -# @name: the type name found in the search -# -# @abstract: the type is abstract and can't be directly instantiated. -# Omitted if false. (since 2.10) -# -# @parent: Name of parent type, if any (since 2.10) -# -# Since: 1.1 -## -{ 'struct': 'ObjectTypeInfo', - 'data': { 'name': 'str', '*abstract': 'bool', '*parent': 'str' } } - -## -# @qom-list-types: -# -# This command will return a list of types given search parameters -# -# @implements: if specified, only return types that implement this type name -# -# @abstract: if true, include abstract types in the results -# -# Returns: a list of @ObjectTypeInfo or an empty list if no results are found -# -# Since: 1.1 -## -{ 'command': 'qom-list-types', - 'data': { '*implements': 'str', '*abstract': 'bool' }, - 'returns': [ 'ObjectTypeInfo' ], - 'allow-preconfig': true } - -## -# @device-list-properties: -# -# List properties associated with a device. -# -# @typename: the type name of a device -# -# Returns: a list of ObjectPropertyInfo describing a devices properties -# -# Note: objects can create properties at runtime, for example to describe -# links between different devices and/or objects. These properties -# are not included in the output of this command. -# -# Since: 1.2 -## -{ 'command': 'device-list-properties', - 'data': { 'typename': 'str'}, - 'returns': [ 'ObjectPropertyInfo' ] } - -## -# @qom-list-properties: -# -# List properties associated with a QOM object. -# -# @typename: the type name of an object -# -# Note: objects can create properties at runtime, for example to describe -# links between different devices and/or objects. These properties -# are not included in the output of this command. -# -# Returns: a list of ObjectPropertyInfo describing object properties -# -# Since: 2.12 -## -{ 'command': 'qom-list-properties', - 'data': { 'typename': 'str'}, - 'returns': [ 'ObjectPropertyInfo' ], - 'allow-preconfig': true } - ## # @xen-set-global-dirty-log: # @@ -1618,102 +1410,6 @@ ## { 'command': 'xen-set-global-dirty-log', 'data': { 'enable': 'bool' } } -## -# @device_add: -# -# @driver: the name of the new device's driver -# -# @bus: the device's parent bus (device tree path) -# -# @id: the device's ID, must be unique -# -# Additional arguments depend on the type. -# -# Add a device. -# -# Notes: -# 1. For detailed information about this command, please refer to the -# 'docs/qdev-device-use.txt' file. -# -# 2. It's possible to list device properties by running QEMU with the -# "-device DEVICE,help" command-line argument, where DEVICE is the -# device's name -# -# Example: -# -# -> { "execute": "device_add", -# "arguments": { "driver": "e1000", "id": "net1", -# "bus": "pci.0", -# "mac": "52:54:00:12:34:56" } } -# <- { "return": {} } -# -# TODO: This command effectively bypasses QAPI completely due to its -# "additional arguments" business. It shouldn't have been added to -# the schema in this form. It should be qapified properly, or -# replaced by a properly qapified command. -# -# Since: 0.13 -## -{ 'command': 'device_add', - 'data': {'driver': 'str', '*bus': 'str', '*id': 'str'}, - 'gen': false } # so we can get the additional arguments - -## -# @device_del: -# -# Remove a device from a guest -# -# @id: the device's ID or QOM path -# -# Returns: Nothing on success -# If @id is not a valid device, DeviceNotFound -# -# Notes: When this command completes, the device may not be removed from the -# guest. Hot removal is an operation that requires guest cooperation. -# This command merely requests that the guest begin the hot removal -# process. Completion of the device removal process is signaled with a -# DEVICE_DELETED event. Guest reset will automatically complete removal -# for all devices. -# -# Since: 0.14.0 -# -# Example: -# -# -> { "execute": "device_del", -# "arguments": { "id": "net1" } } -# <- { "return": {} } -# -# -> { "execute": "device_del", -# "arguments": { "id": "/machine/peripheral-anon/device[0]" } } -# <- { "return": {} } -# -## -{ 'command': 'device_del', 'data': {'id': 'str'} } - -## -# @DEVICE_DELETED: -# -# Emitted whenever the device removal completion is acknowledged by the guest. -# At this point, it's safe to reuse the specified device ID. Device removal can -# be initiated by the guest or by HMP/QMP commands. -# -# @device: device name -# -# @path: device path -# -# Since: 1.5 -# -# Example: -# -# <- { "event": "DEVICE_DELETED", -# "data": { "device": "virtio-net-pci-0", -# "path": "/machine/peripheral/virtio-net-pci-0" }, -# "timestamp": { "seconds": 1265044230, "microseconds": 450486 } } -# -## -{ 'event': 'DEVICE_DELETED', - 'data': { '*device': 'str', 'path': 'str' } } - ## # @DumpGuestMemoryFormat: # @@ -1906,53 +1602,6 @@ { 'command': 'query-dump-guest-memory-capability', 'returns': 'DumpGuestMemoryCapability' } -## -# @object-add: -# -# Create a QOM object. -# -# @qom-type: the class name for the object to be created -# -# @id: the name of the new object -# -# @props: a dictionary of properties to be passed to the backend -# -# Returns: Nothing on success -# Error if @qom-type is not a valid class name -# -# Since: 2.0 -# -# Example: -# -# -> { "execute": "object-add", -# "arguments": { "qom-type": "rng-random", "id": "rng1", -# "props": { "filename": "/dev/hwrng" } } } -# <- { "return": {} } -# -## -{ 'command': 'object-add', - 'data': {'qom-type': 'str', 'id': 'str', '*props': 'any'} } - -## -# @object-del: -# -# Remove a QOM object. -# -# @id: the name of the QOM object to remove -# -# Returns: Nothing on success -# Error if @id is not a valid id for a QOM object -# -# Since: 2.0 -# -# Example: -# -# -> { "execute": "object-del", "arguments": { "id": "rng1" } } -# <- { "return": {} } -# -## -{ 'command': 'object-del', 'data': {'id': 'str'} } - ## # @getfd: # diff --git a/qapi/qapi-schema.json b/qapi/qapi-schema.json index 4bd1223637..d6cf90a85a 100644 --- a/qapi/qapi-schema.json +++ b/qapi/qapi-schema.json @@ -97,6 +97,8 @@ { 'include': 'transaction.json' } { 'include': 'trace.json' } { 'include': 'introspect.json' } +{ 'include': 'qom.json' } +{ 'include': 'qdev.json' } { 'include': 'misc.json' } { 'include': 'target.json' } { 'include': 'audio.json' } diff --git a/qapi/qdev.json b/qapi/qdev.json new file mode 100644 index 0000000000..c6d05032f4 --- /dev/null +++ b/qapi/qdev.json @@ -0,0 +1,125 @@ +# -*- Mode: Python -*- +# +# This work is licensed under the terms of the GNU GPL, version 2 or later. +# See the COPYING file in the top-level directory. + +## +# = Device infrastructure (qdev) +## + +{ 'include': 'qom.json' } + +## +# @device-list-properties: +# +# List properties associated with a device. +# +# @typename: the type name of a device +# +# Returns: a list of ObjectPropertyInfo describing a devices properties +# +# Note: objects can create properties at runtime, for example to describe +# links between different devices and/or objects. These properties +# are not included in the output of this command. +# +# Since: 1.2 +## +{ 'command': 'device-list-properties', + 'data': { 'typename': 'str'}, + 'returns': [ 'ObjectPropertyInfo' ] } + +## +# @device_add: +# +# @driver: the name of the new device's driver +# +# @bus: the device's parent bus (device tree path) +# +# @id: the device's ID, must be unique +# +# Additional arguments depend on the type. +# +# Add a device. +# +# Notes: +# 1. For detailed information about this command, please refer to the +# 'docs/qdev-device-use.txt' file. +# +# 2. It's possible to list device properties by running QEMU with the +# "-device DEVICE,help" command-line argument, where DEVICE is the +# device's name +# +# Example: +# +# -> { "execute": "device_add", +# "arguments": { "driver": "e1000", "id": "net1", +# "bus": "pci.0", +# "mac": "52:54:00:12:34:56" } } +# <- { "return": {} } +# +# TODO: This command effectively bypasses QAPI completely due to its +# "additional arguments" business. It shouldn't have been added to +# the schema in this form. It should be qapified properly, or +# replaced by a properly qapified command. +# +# Since: 0.13 +## +{ 'command': 'device_add', + 'data': {'driver': 'str', '*bus': 'str', '*id': 'str'}, + 'gen': false } # so we can get the additional arguments + +## +# @device_del: +# +# Remove a device from a guest +# +# @id: the device's ID or QOM path +# +# Returns: Nothing on success +# If @id is not a valid device, DeviceNotFound +# +# Notes: When this command completes, the device may not be removed from the +# guest. Hot removal is an operation that requires guest cooperation. +# This command merely requests that the guest begin the hot removal +# process. Completion of the device removal process is signaled with a +# DEVICE_DELETED event. Guest reset will automatically complete removal +# for all devices. +# +# Since: 0.14.0 +# +# Example: +# +# -> { "execute": "device_del", +# "arguments": { "id": "net1" } } +# <- { "return": {} } +# +# -> { "execute": "device_del", +# "arguments": { "id": "/machine/peripheral-anon/device[0]" } } +# <- { "return": {} } +# +## +{ 'command': 'device_del', 'data': {'id': 'str'} } + +## +# @DEVICE_DELETED: +# +# Emitted whenever the device removal completion is acknowledged by the guest. +# At this point, it's safe to reuse the specified device ID. Device removal can +# be initiated by the guest or by HMP/QMP commands. +# +# @device: device name +# +# @path: device path +# +# Since: 1.5 +# +# Example: +# +# <- { "event": "DEVICE_DELETED", +# "data": { "device": "virtio-net-pci-0", +# "path": "/machine/peripheral/virtio-net-pci-0" }, +# "timestamp": { "seconds": 1265044230, "microseconds": 450486 } } +# +## +{ 'event': 'DEVICE_DELETED', + 'data': { '*device': 'str', 'path': 'str' } } diff --git a/qapi/qom.json b/qapi/qom.json new file mode 100644 index 0000000000..32db96ffc4 --- /dev/null +++ b/qapi/qom.json @@ -0,0 +1,244 @@ +# -*- Mode: Python -*- +# +# This work is licensed under the terms of the GNU GPL, version 2 or later. +# See the COPYING file in the top-level directory. + +## +# = QEMU Object Model (QOM) +## + +## +# @ObjectPropertyInfo: +# +# @name: the name of the property +# +# @type: the type of the property. This will typically come in one of four +# forms: +# +# 1) A primitive type such as 'u8', 'u16', 'bool', 'str', or 'double'. +# These types are mapped to the appropriate JSON type. +# +# 2) A child type in the form 'child' where subtype is a qdev +# device type name. Child properties create the composition tree. +# +# 3) A link type in the form 'link' where subtype is a qdev +# device type name. Link properties form the device model graph. +# +# @description: if specified, the description of the property. +# +# Since: 1.2 +## +{ 'struct': 'ObjectPropertyInfo', + 'data': { 'name': 'str', 'type': 'str', '*description': 'str' } } + +## +# @qom-list: +# +# This command will list any properties of a object given a path in the object +# model. +# +# @path: the path within the object model. See @qom-get for a description of +# this parameter. +# +# Returns: a list of @ObjectPropertyInfo that describe the properties of the +# object. +# +# Since: 1.2 +# +# Example: +# +# -> { "execute": "qom-list", +# "arguments": { "path": "/chardevs" } } +# <- { "return": [ { "name": "type", "type": "string" }, +# { "name": "parallel0", "type": "child" }, +# { "name": "serial0", "type": "child" }, +# { "name": "mon0", "type": "child" } ] } +# +## +{ 'command': 'qom-list', + 'data': { 'path': 'str' }, + 'returns': [ 'ObjectPropertyInfo' ], + 'allow-preconfig': true } + +## +# @qom-get: +# +# This command will get a property from a object model path and return the +# value. +# +# @path: The path within the object model. There are two forms of supported +# paths--absolute and partial paths. +# +# Absolute paths are derived from the root object and can follow child<> +# or link<> properties. Since they can follow link<> properties, they +# can be arbitrarily long. Absolute paths look like absolute filenames +# and are prefixed with a leading slash. +# +# Partial paths look like relative filenames. They do not begin +# with a prefix. The matching rules for partial paths are subtle but +# designed to make specifying objects easy. At each level of the +# composition tree, the partial path is matched as an absolute path. +# The first match is not returned. At least two matches are searched +# for. A successful result is only returned if only one match is +# found. If more than one match is found, a flag is return to +# indicate that the match was ambiguous. +# +# @property: The property name to read +# +# Returns: The property value. The type depends on the property +# type. child<> and link<> properties are returned as #str +# pathnames. All integer property types (u8, u16, etc) are +# returned as #int. +# +# Since: 1.2 +# +# Example: +# +# 1. Use absolute path +# +# -> { "execute": "qom-get", +# "arguments": { "path": "/machine/unattached/device[0]", +# "property": "hotplugged" } } +# <- { "return": false } +# +# 2. Use partial path +# +# -> { "execute": "qom-get", +# "arguments": { "path": "unattached/sysbus", +# "property": "type" } } +# <- { "return": "System" } +# +## +{ 'command': 'qom-get', + 'data': { 'path': 'str', 'property': 'str' }, + 'returns': 'any', + 'allow-preconfig': true } + +## +# @qom-set: +# +# This command will set a property from a object model path. +# +# @path: see @qom-get for a description of this parameter +# +# @property: the property name to set +# +# @value: a value who's type is appropriate for the property type. See @qom-get +# for a description of type mapping. +# +# Since: 1.2 +# +# Example: +# +# -> { "execute": "qom-set", +# "arguments": { "path": "/machine", +# "property": "graphics", +# "value": false } } +# <- { "return": {} } +# +## +{ 'command': 'qom-set', + 'data': { 'path': 'str', 'property': 'str', 'value': 'any' }, + 'allow-preconfig': true } + +## +# @ObjectTypeInfo: +# +# This structure describes a search result from @qom-list-types +# +# @name: the type name found in the search +# +# @abstract: the type is abstract and can't be directly instantiated. +# Omitted if false. (since 2.10) +# +# @parent: Name of parent type, if any (since 2.10) +# +# Since: 1.1 +## +{ 'struct': 'ObjectTypeInfo', + 'data': { 'name': 'str', '*abstract': 'bool', '*parent': 'str' } } + +## +# @qom-list-types: +# +# This command will return a list of types given search parameters +# +# @implements: if specified, only return types that implement this type name +# +# @abstract: if true, include abstract types in the results +# +# Returns: a list of @ObjectTypeInfo or an empty list if no results are found +# +# Since: 1.1 +## +{ 'command': 'qom-list-types', + 'data': { '*implements': 'str', '*abstract': 'bool' }, + 'returns': [ 'ObjectTypeInfo' ], + 'allow-preconfig': true } + +## +# @qom-list-properties: +# +# List properties associated with a QOM object. +# +# @typename: the type name of an object +# +# Note: objects can create properties at runtime, for example to describe +# links between different devices and/or objects. These properties +# are not included in the output of this command. +# +# Returns: a list of ObjectPropertyInfo describing object properties +# +# Since: 2.12 +## +{ 'command': 'qom-list-properties', + 'data': { 'typename': 'str'}, + 'returns': [ 'ObjectPropertyInfo' ], + 'allow-preconfig': true } + +## +# @object-add: +# +# Create a QOM object. +# +# @qom-type: the class name for the object to be created +# +# @id: the name of the new object +# +# @props: a dictionary of properties to be passed to the backend +# +# Returns: Nothing on success +# Error if @qom-type is not a valid class name +# +# Since: 2.0 +# +# Example: +# +# -> { "execute": "object-add", +# "arguments": { "qom-type": "rng-random", "id": "rng1", +# "props": { "filename": "/dev/hwrng" } } } +# <- { "return": {} } +# +## +{ 'command': 'object-add', + 'data': {'qom-type': 'str', 'id': 'str', '*props': 'any'} } + +## +# @object-del: +# +# Remove a QOM object. +# +# @id: the name of the QOM object to remove +# +# Returns: Nothing on success +# Error if @id is not a valid id for a QOM object +# +# Since: 2.0 +# +# Example: +# +# -> { "execute": "object-del", "arguments": { "id": "rng1" } } +# <- { "return": {} } +# +## +{ 'command': 'object-del', 'data': {'id': 'str'} } diff --git a/qdev-monitor.c b/qdev-monitor.c index 373b9ad445..63a87e9632 100644 --- a/qdev-monitor.c +++ b/qdev-monitor.c @@ -24,7 +24,7 @@ #include "monitor/qdev.h" #include "sysemu/arch_init.h" #include "qapi/error.h" -#include "qapi/qapi-commands-misc.h" +#include "qapi/qapi-commands-qdev.h" #include "qapi/qmp/qdict.h" #include "qapi/qmp/qerror.h" #include "qemu/config-file.h" From patchwork Wed Jun 19 20:10:38 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Markus Armbruster X-Patchwork-Id: 1118995 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 45TbvN3JYLz9s7h for ; Thu, 20 Jun 2019 06:21:33 +1000 (AEST) Received: from localhost ([::1]:41716 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hdh5H-0004Dn-9f for incoming@patchwork.ozlabs.org; Wed, 19 Jun 2019 16:21:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35297) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hdgv7-0004JJ-6j for qemu-devel@nongnu.org; Wed, 19 Jun 2019 16:11:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hdgv4-000163-4X for qemu-devel@nongnu.org; Wed, 19 Jun 2019 16:11:01 -0400 Received: from mx1.redhat.com ([209.132.183.28]:52238) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hdgv3-00012R-8o for qemu-devel@nongnu.org; Wed, 19 Jun 2019 16:10:57 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1EC07307D9D1 for ; Wed, 19 Jun 2019 20:10:54 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-116-85.ams2.redhat.com [10.36.116.85]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9439D19C79; Wed, 19 Jun 2019 20:10:53 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id B03A111385C7; Wed, 19 Jun 2019 22:10:50 +0200 (CEST) From: Markus Armbruster To: qemu-devel@nongnu.org Date: Wed, 19 Jun 2019 22:10:38 +0200 Message-Id: <20190619201050.19040-6-armbru@redhat.com> In-Reply-To: <20190619201050.19040-1-armbru@redhat.com> References: <20190619201050.19040-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); Wed, 19 Jun 2019 20:10:54 +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 05/17] qom: Move QMP command handlers to qom/ X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, Paolo Bonzini , "Daniel P. Berrange" , Eduardo Habkost Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" The handlers for qapi/qom.json's QMP commands are in monitor/qmp-cmds.c. Move them to new qom/qom-qmp-cmds.c, where they are covered by MAINTAINERS section QOM, just like qapi/qom.json. Move along qmp_device_list_properties() even though it's specified in qapi/qdev.json, because it's so similar to qmp_qom_list_properties(). Cc: Paolo Bonzini Cc: "Daniel P. Berrange" Cc: Eduardo Habkost Signed-off-by: Markus Armbruster Reviewed-by: Daniel P. Berrangé --- monitor/qmp-cmds.c | 303 ------------------------------------------ qom/Makefile.objs | 1 + qom/qom-qmp-cmds.c | 323 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 324 insertions(+), 303 deletions(-) create mode 100644 qom/qom-qmp-cmds.c diff --git a/monitor/qmp-cmds.c b/monitor/qmp-cmds.c index ae7f201dc0..884eeaab80 100644 --- a/monitor/qmp-cmds.c +++ b/monitor/qmp-cmds.c @@ -27,20 +27,14 @@ #include "ui/vnc.h" #include "sysemu/kvm.h" #include "sysemu/arch_init.h" -#include "hw/qdev.h" #include "sysemu/blockdev.h" #include "sysemu/block-backend.h" -#include "qom/qom-qobject.h" #include "qapi/error.h" #include "qapi/qapi-commands-block-core.h" #include "qapi/qapi-commands-misc.h" -#include "qapi/qapi-commands-qdev.h" #include "qapi/qapi-commands-ui.h" -#include "qapi/qmp/qdict.h" #include "qapi/qmp/qerror.h" -#include "qapi/qobject-input-visitor.h" #include "hw/boards.h" -#include "qom/object_interfaces.h" #include "hw/mem/memory-device.h" #include "hw/acpi/acpi_dev_interface.h" @@ -197,69 +191,6 @@ void qmp_system_wakeup(Error **errp) qemu_system_wakeup_request(QEMU_WAKEUP_REASON_OTHER, errp); } -ObjectPropertyInfoList *qmp_qom_list(const char *path, Error **errp) -{ - Object *obj; - bool ambiguous = false; - ObjectPropertyInfoList *props = NULL; - ObjectProperty *prop; - ObjectPropertyIterator iter; - - obj = object_resolve_path(path, &ambiguous); - if (obj == NULL) { - if (ambiguous) { - error_setg(errp, "Path '%s' is ambiguous", path); - } else { - error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND, - "Device '%s' not found", path); - } - return NULL; - } - - object_property_iter_init(&iter, obj); - while ((prop = object_property_iter_next(&iter))) { - ObjectPropertyInfoList *entry = g_malloc0(sizeof(*entry)); - - entry->value = g_malloc0(sizeof(ObjectPropertyInfo)); - entry->next = props; - props = entry; - - entry->value->name = g_strdup(prop->name); - entry->value->type = g_strdup(prop->type); - } - - return props; -} - -void qmp_qom_set(const char *path, const char *property, QObject *value, - Error **errp) -{ - Object *obj; - - obj = object_resolve_path(path, NULL); - if (!obj) { - error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND, - "Device '%s' not found", path); - return; - } - - object_property_set_qobject(obj, value, property, errp); -} - -QObject *qmp_qom_get(const char *path, const char *property, Error **errp) -{ - Object *obj; - - obj = object_resolve_path(path, NULL); - if (!obj) { - error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND, - "Device '%s' not found", path); - return NULL; - } - - return object_property_get_qobject(obj, property, errp); -} - void qmp_set_password(const char *protocol, const char *password, bool has_connected, const char *connected, Error **errp) { @@ -408,208 +339,6 @@ void qmp_change(const char *device, const char *target, } } -static void qom_list_types_tramp(ObjectClass *klass, void *data) -{ - ObjectTypeInfoList *e, **pret = data; - ObjectTypeInfo *info; - ObjectClass *parent = object_class_get_parent(klass); - - info = g_malloc0(sizeof(*info)); - info->name = g_strdup(object_class_get_name(klass)); - info->has_abstract = info->abstract = object_class_is_abstract(klass); - if (parent) { - info->has_parent = true; - info->parent = g_strdup(object_class_get_name(parent)); - } - - e = g_malloc0(sizeof(*e)); - e->value = info; - e->next = *pret; - *pret = e; -} - -ObjectTypeInfoList *qmp_qom_list_types(bool has_implements, - const char *implements, - bool has_abstract, - bool abstract, - Error **errp) -{ - ObjectTypeInfoList *ret = NULL; - - object_class_foreach(qom_list_types_tramp, implements, abstract, &ret); - - return ret; -} - -/* Return a DevicePropertyInfo for a qdev property. - * - * If a qdev property with the given name does not exist, use the given default - * type. If the qdev property info should not be shown, return NULL. - * - * The caller must free the return value. - */ -static ObjectPropertyInfo *make_device_property_info(ObjectClass *klass, - const char *name, - const char *default_type, - const char *description) -{ - ObjectPropertyInfo *info; - Property *prop; - - do { - for (prop = DEVICE_CLASS(klass)->props; prop && prop->name; prop++) { - if (strcmp(name, prop->name) != 0) { - continue; - } - - /* - * TODO Properties without a parser are just for dirty hacks. - * qdev_prop_ptr is the only such PropertyInfo. It's marked - * for removal. This conditional should be removed along with - * it. - */ - if (!prop->info->set && !prop->info->create) { - return NULL; /* no way to set it, don't show */ - } - - info = g_malloc0(sizeof(*info)); - info->name = g_strdup(prop->name); - info->type = default_type ? g_strdup(default_type) - : g_strdup(prop->info->name); - info->has_description = !!prop->info->description; - info->description = g_strdup(prop->info->description); - return info; - } - klass = object_class_get_parent(klass); - } while (klass != object_class_by_name(TYPE_DEVICE)); - - /* Not a qdev property, use the default type */ - info = g_malloc0(sizeof(*info)); - info->name = g_strdup(name); - info->type = g_strdup(default_type); - info->has_description = !!description; - info->description = g_strdup(description); - - return info; -} - -ObjectPropertyInfoList *qmp_device_list_properties(const char *typename, - Error **errp) -{ - ObjectClass *klass; - Object *obj; - ObjectProperty *prop; - ObjectPropertyIterator iter; - ObjectPropertyInfoList *prop_list = NULL; - - klass = object_class_by_name(typename); - if (klass == NULL) { - error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND, - "Device '%s' not found", typename); - return NULL; - } - - klass = object_class_dynamic_cast(klass, TYPE_DEVICE); - if (klass == NULL) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "typename", TYPE_DEVICE); - return NULL; - } - - if (object_class_is_abstract(klass)) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "typename", - "non-abstract device type"); - return NULL; - } - - obj = object_new(typename); - - object_property_iter_init(&iter, obj); - while ((prop = object_property_iter_next(&iter))) { - ObjectPropertyInfo *info; - ObjectPropertyInfoList *entry; - - /* Skip Object and DeviceState properties */ - if (strcmp(prop->name, "type") == 0 || - strcmp(prop->name, "realized") == 0 || - strcmp(prop->name, "hotpluggable") == 0 || - strcmp(prop->name, "hotplugged") == 0 || - strcmp(prop->name, "parent_bus") == 0) { - continue; - } - - /* Skip legacy properties since they are just string versions of - * properties that we already list. - */ - if (strstart(prop->name, "legacy-", NULL)) { - continue; - } - - info = make_device_property_info(klass, prop->name, prop->type, - prop->description); - if (!info) { - continue; - } - - entry = g_malloc0(sizeof(*entry)); - entry->value = info; - entry->next = prop_list; - prop_list = entry; - } - - object_unref(obj); - - return prop_list; -} - -ObjectPropertyInfoList *qmp_qom_list_properties(const char *typename, - Error **errp) -{ - ObjectClass *klass; - Object *obj = NULL; - ObjectProperty *prop; - ObjectPropertyIterator iter; - ObjectPropertyInfoList *prop_list = NULL; - - klass = object_class_by_name(typename); - if (klass == NULL) { - error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND, - "Class '%s' not found", typename); - return NULL; - } - - klass = object_class_dynamic_cast(klass, TYPE_OBJECT); - if (klass == NULL) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "typename", TYPE_OBJECT); - return NULL; - } - - if (object_class_is_abstract(klass)) { - object_class_property_iter_init(&iter, klass); - } else { - obj = object_new(typename); - object_property_iter_init(&iter, obj); - } - while ((prop = object_property_iter_next(&iter))) { - ObjectPropertyInfo *info; - ObjectPropertyInfoList *entry; - - info = g_malloc0(sizeof(*info)); - info->name = g_strdup(prop->name); - info->type = g_strdup(prop->type); - info->has_description = !!prop->description; - info->description = g_strdup(prop->description); - - entry = g_malloc0(sizeof(*entry)); - entry->value = info; - entry->next = prop_list; - prop_list = entry; - } - - object_unref(obj); - - return prop_list; -} - void qmp_add_client(const char *protocol, const char *fdname, bool has_skipauth, bool skipauth, bool has_tls, bool tls, Error **errp) @@ -654,38 +383,6 @@ void qmp_add_client(const char *protocol, const char *fdname, } -void qmp_object_add(const char *type, const char *id, - bool has_props, QObject *props, Error **errp) -{ - QDict *pdict; - Visitor *v; - Object *obj; - - if (props) { - pdict = qobject_to(QDict, props); - if (!pdict) { - error_setg(errp, QERR_INVALID_PARAMETER_TYPE, "props", "dict"); - return; - } - qobject_ref(pdict); - } else { - pdict = qdict_new(); - } - - v = qobject_input_visitor_new(QOBJECT(pdict)); - obj = user_creatable_add_type(type, id, pdict, v, errp); - visit_free(v); - if (obj) { - object_unref(obj); - } - qobject_unref(pdict); -} - -void qmp_object_del(const char *id, Error **errp) -{ - user_creatable_del(id, errp); -} - MemoryDeviceInfoList *qmp_query_memory_devices(Error **errp) { return qmp_memory_device_list(); diff --git a/qom/Makefile.objs b/qom/Makefile.objs index 516349eec3..5fb43b842c 100644 --- a/qom/Makefile.objs +++ b/qom/Makefile.objs @@ -2,3 +2,4 @@ qom-obj-y = object.o container.o qom-qobject.o qom-obj-y += object_interfaces.o common-obj-y = cpu.o +common-obj-$(CONFIG_SOFTMMU) += qom-qmp-cmds.o diff --git a/qom/qom-qmp-cmds.c b/qom/qom-qmp-cmds.c new file mode 100644 index 0000000000..e046a0f190 --- /dev/null +++ b/qom/qom-qmp-cmds.c @@ -0,0 +1,323 @@ +/* + * QMP commands related to QOM + * + * Copyright IBM, Corp. 2011 + * + * Authors: + * Anthony Liguori + * + * This work is licensed under the terms of the GNU GPL, version 2. See + * the COPYING file in the top-level directory. + * + * Contributions after 2012-01-13 are licensed under the terms of the + * GNU GPL, version 2 or (at your option) any later version. + */ + +#include "qemu/osdep.h" +#include "hw/qdev.h" +#include "qapi/error.h" +#include "qapi/qapi-commands-qdev.h" +#include "qapi/qapi-commands-qom.h" +#include "qapi/qmp/qdict.h" +#include "qapi/qmp/qerror.h" +#include "qapi/qobject-input-visitor.h" +#include "qemu/cutils.h" +#include "qom/object_interfaces.h" +#include "qom/qom-qobject.h" + +ObjectPropertyInfoList *qmp_qom_list(const char *path, Error **errp) +{ + Object *obj; + bool ambiguous = false; + ObjectPropertyInfoList *props = NULL; + ObjectProperty *prop; + ObjectPropertyIterator iter; + + obj = object_resolve_path(path, &ambiguous); + if (obj == NULL) { + if (ambiguous) { + error_setg(errp, "Path '%s' is ambiguous", path); + } else { + error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND, + "Device '%s' not found", path); + } + return NULL; + } + + object_property_iter_init(&iter, obj); + while ((prop = object_property_iter_next(&iter))) { + ObjectPropertyInfoList *entry = g_malloc0(sizeof(*entry)); + + entry->value = g_malloc0(sizeof(ObjectPropertyInfo)); + entry->next = props; + props = entry; + + entry->value->name = g_strdup(prop->name); + entry->value->type = g_strdup(prop->type); + } + + return props; +} + +void qmp_qom_set(const char *path, const char *property, QObject *value, + Error **errp) +{ + Object *obj; + + obj = object_resolve_path(path, NULL); + if (!obj) { + error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND, + "Device '%s' not found", path); + return; + } + + object_property_set_qobject(obj, value, property, errp); +} + +QObject *qmp_qom_get(const char *path, const char *property, Error **errp) +{ + Object *obj; + + obj = object_resolve_path(path, NULL); + if (!obj) { + error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND, + "Device '%s' not found", path); + return NULL; + } + + return object_property_get_qobject(obj, property, errp); +} + +static void qom_list_types_tramp(ObjectClass *klass, void *data) +{ + ObjectTypeInfoList *e, **pret = data; + ObjectTypeInfo *info; + ObjectClass *parent = object_class_get_parent(klass); + + info = g_malloc0(sizeof(*info)); + info->name = g_strdup(object_class_get_name(klass)); + info->has_abstract = info->abstract = object_class_is_abstract(klass); + if (parent) { + info->has_parent = true; + info->parent = g_strdup(object_class_get_name(parent)); + } + + e = g_malloc0(sizeof(*e)); + e->value = info; + e->next = *pret; + *pret = e; +} + +ObjectTypeInfoList *qmp_qom_list_types(bool has_implements, + const char *implements, + bool has_abstract, + bool abstract, + Error **errp) +{ + ObjectTypeInfoList *ret = NULL; + + object_class_foreach(qom_list_types_tramp, implements, abstract, &ret); + + return ret; +} + +/* Return a DevicePropertyInfo for a qdev property. + * + * If a qdev property with the given name does not exist, use the given default + * type. If the qdev property info should not be shown, return NULL. + * + * The caller must free the return value. + */ +static ObjectPropertyInfo *make_device_property_info(ObjectClass *klass, + const char *name, + const char *default_type, + const char *description) +{ + ObjectPropertyInfo *info; + Property *prop; + + do { + for (prop = DEVICE_CLASS(klass)->props; prop && prop->name; prop++) { + if (strcmp(name, prop->name) != 0) { + continue; + } + + /* + * TODO Properties without a parser are just for dirty hacks. + * qdev_prop_ptr is the only such PropertyInfo. It's marked + * for removal. This conditional should be removed along with + * it. + */ + if (!prop->info->set && !prop->info->create) { + return NULL; /* no way to set it, don't show */ + } + + info = g_malloc0(sizeof(*info)); + info->name = g_strdup(prop->name); + info->type = default_type ? g_strdup(default_type) + : g_strdup(prop->info->name); + info->has_description = !!prop->info->description; + info->description = g_strdup(prop->info->description); + return info; + } + klass = object_class_get_parent(klass); + } while (klass != object_class_by_name(TYPE_DEVICE)); + + /* Not a qdev property, use the default type */ + info = g_malloc0(sizeof(*info)); + info->name = g_strdup(name); + info->type = g_strdup(default_type); + info->has_description = !!description; + info->description = g_strdup(description); + + return info; +} + +ObjectPropertyInfoList *qmp_device_list_properties(const char *typename, + Error **errp) +{ + ObjectClass *klass; + Object *obj; + ObjectProperty *prop; + ObjectPropertyIterator iter; + ObjectPropertyInfoList *prop_list = NULL; + + klass = object_class_by_name(typename); + if (klass == NULL) { + error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND, + "Device '%s' not found", typename); + return NULL; + } + + klass = object_class_dynamic_cast(klass, TYPE_DEVICE); + if (klass == NULL) { + error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "typename", TYPE_DEVICE); + return NULL; + } + + if (object_class_is_abstract(klass)) { + error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "typename", + "non-abstract device type"); + return NULL; + } + + obj = object_new(typename); + + object_property_iter_init(&iter, obj); + while ((prop = object_property_iter_next(&iter))) { + ObjectPropertyInfo *info; + ObjectPropertyInfoList *entry; + + /* Skip Object and DeviceState properties */ + if (strcmp(prop->name, "type") == 0 || + strcmp(prop->name, "realized") == 0 || + strcmp(prop->name, "hotpluggable") == 0 || + strcmp(prop->name, "hotplugged") == 0 || + strcmp(prop->name, "parent_bus") == 0) { + continue; + } + + /* Skip legacy properties since they are just string versions of + * properties that we already list. + */ + if (strstart(prop->name, "legacy-", NULL)) { + continue; + } + + info = make_device_property_info(klass, prop->name, prop->type, + prop->description); + if (!info) { + continue; + } + + entry = g_malloc0(sizeof(*entry)); + entry->value = info; + entry->next = prop_list; + prop_list = entry; + } + + object_unref(obj); + + return prop_list; +} + +ObjectPropertyInfoList *qmp_qom_list_properties(const char *typename, + Error **errp) +{ + ObjectClass *klass; + Object *obj = NULL; + ObjectProperty *prop; + ObjectPropertyIterator iter; + ObjectPropertyInfoList *prop_list = NULL; + + klass = object_class_by_name(typename); + if (klass == NULL) { + error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND, + "Class '%s' not found", typename); + return NULL; + } + + klass = object_class_dynamic_cast(klass, TYPE_OBJECT); + if (klass == NULL) { + error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "typename", TYPE_OBJECT); + return NULL; + } + + if (object_class_is_abstract(klass)) { + object_class_property_iter_init(&iter, klass); + } else { + obj = object_new(typename); + object_property_iter_init(&iter, obj); + } + while ((prop = object_property_iter_next(&iter))) { + ObjectPropertyInfo *info; + ObjectPropertyInfoList *entry; + + info = g_malloc0(sizeof(*info)); + info->name = g_strdup(prop->name); + info->type = g_strdup(prop->type); + info->has_description = !!prop->description; + info->description = g_strdup(prop->description); + + entry = g_malloc0(sizeof(*entry)); + entry->value = info; + entry->next = prop_list; + prop_list = entry; + } + + object_unref(obj); + + return prop_list; +} + +void qmp_object_add(const char *type, const char *id, + bool has_props, QObject *props, Error **errp) +{ + QDict *pdict; + Visitor *v; + Object *obj; + + if (props) { + pdict = qobject_to(QDict, props); + if (!pdict) { + error_setg(errp, QERR_INVALID_PARAMETER_TYPE, "props", "dict"); + return; + } + qobject_ref(pdict); + } else { + pdict = qdict_new(); + } + + v = qobject_input_visitor_new(QOBJECT(pdict)); + obj = user_creatable_add_type(type, id, pdict, v, errp); + visit_free(v); + if (obj) { + object_unref(obj); + } + qobject_unref(pdict); +} + +void qmp_object_del(const char *id, Error **errp) +{ + user_creatable_del(id, errp); +} From patchwork Wed Jun 19 20:10:39 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Markus Armbruster X-Patchwork-Id: 1119003 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 45Tc1n6x5Xz9s4V for ; Thu, 20 Jun 2019 06:27:06 +1000 (AEST) Received: from localhost ([::1]:41766 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hdhAb-00038P-K3 for incoming@patchwork.ozlabs.org; Wed, 19 Jun 2019 16:27:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35421) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hdgvD-0004LO-Is for qemu-devel@nongnu.org; Wed, 19 Jun 2019 16:11:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hdgv7-00019m-8V for qemu-devel@nongnu.org; Wed, 19 Jun 2019 16:11:06 -0400 Received: from mx1.redhat.com ([209.132.183.28]:52234) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hdgv5-00012A-RL for qemu-devel@nongnu.org; Wed, 19 Jun 2019 16:11:00 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id EDC42307D980 for ; Wed, 19 Jun 2019 20:10:53 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-116-85.ams2.redhat.com [10.36.116.85]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 958C560BFB; Wed, 19 Jun 2019 20:10:53 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id B365A1138529; Wed, 19 Jun 2019 22:10:50 +0200 (CEST) From: Markus Armbruster To: qemu-devel@nongnu.org Date: Wed, 19 Jun 2019 22:10:39 +0200 Message-Id: <20190619201050.19040-7-armbru@redhat.com> In-Reply-To: <20190619201050.19040-1-armbru@redhat.com> References: <20190619201050.19040-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); Wed, 19 Jun 2019 20:10:53 +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 06/17] qom: Move HMP command handlers to qom/ X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, "Daniel P. Berrange" , Eduardo Habkost , "Dr. David Alan Gilbert" , Paolo Bonzini Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" There are just two HMP commands related to QOM: qom-list and qom-set. Move their handlers from monitor/hmp-cmds.c to new qom/qom-hmp-cmds.c, where they are covered by MAINTAINERS section QOM. Cc: Paolo Bonzini Cc: "Daniel P. Berrange" Cc: Eduardo Habkost Cc: "Dr. David Alan Gilbert" Signed-off-by: Markus Armbruster Reviewed-by: Daniel P. Berrangé Reviewed-by: Dr. David Alan Gilbert --- include/monitor/hmp.h | 2 ++ monitor/hmp-cmds.c | 50 +--------------------------------- qom/Makefile.objs | 2 +- qom/qom-hmp-cmds.c | 62 +++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 66 insertions(+), 50 deletions(-) create mode 100644 qom/qom-hmp-cmds.c diff --git a/include/monitor/hmp.h b/include/monitor/hmp.h index 1d095d5837..f46ccdaa35 100644 --- a/include/monitor/hmp.h +++ b/include/monitor/hmp.h @@ -16,6 +16,8 @@ #include "qemu/readline.h" +void hmp_handle_error(Monitor *mon, Error **errp); + void hmp_info_name(Monitor *mon, const QDict *qdict); void hmp_info_version(Monitor *mon, const QDict *qdict); void hmp_info_kvm(Monitor *mon, const QDict *qdict); diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c index d94ab7563e..5641036dc3 100644 --- a/monitor/hmp-cmds.c +++ b/monitor/hmp-cmds.c @@ -60,7 +60,7 @@ #include #endif -static void hmp_handle_error(Monitor *mon, Error **errp) +void hmp_handle_error(Monitor *mon, Error **errp) { assert(errp); if (*errp) { @@ -2714,54 +2714,6 @@ void hmp_info_iothreads(Monitor *mon, const QDict *qdict) qapi_free_IOThreadInfoList(info_list); } -void hmp_qom_list(Monitor *mon, const QDict *qdict) -{ - const char *path = qdict_get_try_str(qdict, "path"); - ObjectPropertyInfoList *list; - Error *err = NULL; - - if (path == NULL) { - monitor_printf(mon, "/\n"); - return; - } - - list = qmp_qom_list(path, &err); - if (err == NULL) { - ObjectPropertyInfoList *start = list; - while (list != NULL) { - ObjectPropertyInfo *value = list->value; - - monitor_printf(mon, "%s (%s)\n", - value->name, value->type); - list = list->next; - } - qapi_free_ObjectPropertyInfoList(start); - } - hmp_handle_error(mon, &err); -} - -void hmp_qom_set(Monitor *mon, const QDict *qdict) -{ - const char *path = qdict_get_str(qdict, "path"); - const char *property = qdict_get_str(qdict, "property"); - const char *value = qdict_get_str(qdict, "value"); - Error *err = NULL; - bool ambiguous = false; - Object *obj; - - obj = object_resolve_path(path, &ambiguous); - if (obj == NULL) { - error_set(&err, ERROR_CLASS_DEVICE_NOT_FOUND, - "Device '%s' not found", path); - } else { - if (ambiguous) { - monitor_printf(mon, "Warning: Path '%s' is ambiguous\n", path); - } - object_property_parse(obj, value, property, &err); - } - hmp_handle_error(mon, &err); -} - void hmp_rocker(Monitor *mon, const QDict *qdict) { const char *name = qdict_get_str(qdict, "name"); diff --git a/qom/Makefile.objs b/qom/Makefile.objs index 5fb43b842c..aae478fc21 100644 --- a/qom/Makefile.objs +++ b/qom/Makefile.objs @@ -2,4 +2,4 @@ qom-obj-y = object.o container.o qom-qobject.o qom-obj-y += object_interfaces.o common-obj-y = cpu.o -common-obj-$(CONFIG_SOFTMMU) += qom-qmp-cmds.o +common-obj-$(CONFIG_SOFTMMU) += qom-hmp-cmds.o qom-qmp-cmds.o diff --git a/qom/qom-hmp-cmds.c b/qom/qom-hmp-cmds.c new file mode 100644 index 0000000000..2028a21052 --- /dev/null +++ b/qom/qom-hmp-cmds.c @@ -0,0 +1,62 @@ +/* + * HMP commands related to QOM + * + * This work is licensed under the terms of the GNU GPL, version 2 or + * later. See the COPYING file in the top-level directory. + */ + +#include "qemu/osdep.h" +#include "monitor/hmp.h" +#include "qapi/qapi-commands-qom.h" +#include "qapi/qmp/qdict.h" +#include "monitor/monitor.h" +#include "qom/object.h" +#include "qapi/error.h" + +void hmp_qom_list(Monitor *mon, const QDict *qdict) +{ + const char *path = qdict_get_try_str(qdict, "path"); + ObjectPropertyInfoList *list; + Error *err = NULL; + + if (path == NULL) { + monitor_printf(mon, "/\n"); + return; + } + + list = qmp_qom_list(path, &err); + if (err == NULL) { + ObjectPropertyInfoList *start = list; + while (list != NULL) { + ObjectPropertyInfo *value = list->value; + + monitor_printf(mon, "%s (%s)\n", + value->name, value->type); + list = list->next; + } + qapi_free_ObjectPropertyInfoList(start); + } + hmp_handle_error(mon, &err); +} + +void hmp_qom_set(Monitor *mon, const QDict *qdict) +{ + const char *path = qdict_get_str(qdict, "path"); + const char *property = qdict_get_str(qdict, "property"); + const char *value = qdict_get_str(qdict, "value"); + Error *err = NULL; + bool ambiguous = false; + Object *obj; + + obj = object_resolve_path(path, &ambiguous); + if (obj == NULL) { + error_set(&err, ERROR_CLASS_DEVICE_NOT_FOUND, + "Device '%s' not found", path); + } else { + if (ambiguous) { + monitor_printf(mon, "Warning: Path '%s' is ambiguous\n", path); + } + object_property_parse(obj, value, property, &err); + } + hmp_handle_error(mon, &err); +} From patchwork Wed Jun 19 20:10:40 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Markus Armbruster X-Patchwork-Id: 1118989 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 45TbmC3sl0z9s4V for ; Thu, 20 Jun 2019 06:15:23 +1000 (AEST) Received: from localhost ([::1]:41682 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hdgzH-00089F-Na for incoming@patchwork.ozlabs.org; Wed, 19 Jun 2019 16:15:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35309) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hdgv7-0004JW-W5 for qemu-devel@nongnu.org; Wed, 19 Jun 2019 16:11:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hdgv5-000184-Rv for qemu-devel@nongnu.org; Wed, 19 Jun 2019 16:11:01 -0400 Received: from mx1.redhat.com ([209.132.183.28]:52228) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hdgv5-000123-HW for qemu-devel@nongnu.org; Wed, 19 Jun 2019 16:10:59 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id CED26307D925; Wed, 19 Jun 2019 20:10:53 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-116-85.ams2.redhat.com [10.36.116.85]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9C0331001B3D; Wed, 19 Jun 2019 20:10:53 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id B8F041138536; Wed, 19 Jun 2019 22:10:50 +0200 (CEST) From: Markus Armbruster To: qemu-devel@nongnu.org Date: Wed, 19 Jun 2019 22:10:40 +0200 Message-Id: <20190619201050.19040-8-armbru@redhat.com> In-Reply-To: <20190619201050.19040-1-armbru@redhat.com> References: <20190619201050.19040-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); Wed, 19 Jun 2019 20:10:53 +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 07/17] MAINTAINERS: Merge sections CPU, NUMA into Machine core X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, Paolo Bonzini , Eduardo Habkost Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Suggested-by: Paolo Bonzini Cc: Eduardo Habkost Cc: Marcel Apfelbaum Signed-off-by: Markus Armbruster Reviewed-by: Daniel P. Berrangé --- MAINTAINERS | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/MAINTAINERS b/MAINTAINERS index 1aef0afaf7..f18fddbbbb 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1268,8 +1268,12 @@ S: Supported F: hw/core/machine.c F: hw/core/null-machine.c F: hw/cpu/cluster.c +F: numa.c +F: qom/cpu.c F: include/hw/boards.h F: include/hw/cpu/cluster.h +F: include/qom/cpu.h +F: include/sysemu/numa.h T: git https://github.com/ehabkost/qemu.git machine-next Xtensa Machines @@ -1833,11 +1837,6 @@ M: Markus Armbruster S: Supported F: scripts/coverity-model.c -CPU -S: Supported -F: qom/cpu.c -F: include/qom/cpu.h - Device Tree M: Alistair Francis R: David Gibson @@ -1945,13 +1944,6 @@ W: http://info.iet.unipi.it/~luigi/netmap/ S: Maintained F: net/netmap.c -NUMA -M: Eduardo Habkost -S: Maintained -F: numa.c -F: include/sysemu/numa.h -T: git https://github.com/ehabkost/qemu.git machine-next - Host Memory Backends M: Eduardo Habkost M: Igor Mammedov From patchwork Wed Jun 19 20:10:41 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Markus Armbruster X-Patchwork-Id: 1119000 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 45TbyZ6zNHz9sBp for ; Thu, 20 Jun 2019 06:24:22 +1000 (AEST) Received: from localhost ([::1]:41742 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hdh81-0007pF-0H for incoming@patchwork.ozlabs.org; Wed, 19 Jun 2019 16:24:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35430) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hdgvE-0004Lz-KQ for qemu-devel@nongnu.org; Wed, 19 Jun 2019 16:11:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hdgv5-00017E-Ia for qemu-devel@nongnu.org; Wed, 19 Jun 2019 16:11:07 -0400 Received: from mx1.redhat.com ([209.132.183.28]:40974) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hdgv3-00012n-QU for qemu-devel@nongnu.org; Wed, 19 Jun 2019 16:10:58 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 748AB3079B90; Wed, 19 Jun 2019 20:10:54 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-116-85.ams2.redhat.com [10.36.116.85]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9DB965C205; Wed, 19 Jun 2019 20:10:53 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id C26491138538; Wed, 19 Jun 2019 22:10:50 +0200 (CEST) From: Markus Armbruster To: qemu-devel@nongnu.org Date: Wed, 19 Jun 2019 22:10:41 +0200 Message-Id: <20190619201050.19040-9-armbru@redhat.com> In-Reply-To: <20190619201050.19040-1-armbru@redhat.com> References: <20190619201050.19040-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Wed, 19 Jun 2019 20:10:54 +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 08/17] qapi: Split machine.json off misc.json X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, Eduardo Habkost Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Move commands cpu-add, query-cpus, query-cpus-fast, query-current-machine, query-hotpluggable-cpus, query-machines, query-memdev, and set-numa-node with their types from misc.json to new machine.json. Also move types X86CPURegister32 and X86CPUFeatureWordInfo. Add machine.json to MAINTAINERS section "Machine core". Cc: Eduardo Habkost Cc: Marcel Apfelbaum Signed-off-by: Markus Armbruster Reviewed-by: Daniel P. Berrangé --- MAINTAINERS | 1 + cpus.c | 1 + include/hw/boards.h | 1 + include/sysemu/hostmem.h | 2 +- monitor/hmp-cmds.c | 1 + monitor/qmp-cmds.c | 1 + numa.c | 4 +- qapi/Makefile.objs | 2 +- qapi/machine.json | 697 +++++++++++++++++++++++++++++++++++++++ qapi/misc.json | 687 -------------------------------------- qapi/qapi-schema.json | 1 + target/i386/cpu.c | 2 +- target/s390x/cpu.c | 2 +- target/s390x/sigp.c | 2 +- vl.c | 2 +- 15 files changed, 711 insertions(+), 695 deletions(-) create mode 100644 qapi/machine.json diff --git a/MAINTAINERS b/MAINTAINERS index f18fddbbbb..9b488c5151 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1269,6 +1269,7 @@ F: hw/core/machine.c F: hw/core/null-machine.c F: hw/cpu/cluster.c F: numa.c +F: qapi/machine.json F: qom/cpu.c F: include/hw/boards.h F: include/hw/cpu/cluster.h diff --git a/cpus.c b/cpus.c index dde3b7b981..f5e677b2c4 100644 --- a/cpus.c +++ b/cpus.c @@ -28,6 +28,7 @@ #include "cpu.h" #include "monitor/monitor.h" #include "qapi/error.h" +#include "qapi/qapi-commands-machine.h" #include "qapi/qapi-commands-misc.h" #include "qapi/qapi-events-run-state.h" #include "qapi/qmp/qerror.h" diff --git a/include/hw/boards.h b/include/hw/boards.h index b7362af3f1..0c1cc510b5 100644 --- a/include/hw/boards.h +++ b/include/hw/boards.h @@ -6,6 +6,7 @@ #include "sysemu/blockdev.h" #include "sysemu/accel.h" #include "hw/qdev.h" +#include "qapi/qapi-types-machine.h" #include "qemu/module.h" #include "qom/object.h" #include "qom/cpu.h" diff --git a/include/sysemu/hostmem.h b/include/sysemu/hostmem.h index a023b372a4..92fa0e458c 100644 --- a/include/sysemu/hostmem.h +++ b/include/sysemu/hostmem.h @@ -14,7 +14,7 @@ #define SYSEMU_HOSTMEM_H #include "sysemu/sysemu.h" /* for MAX_NODES */ -#include "qapi/qapi-types-misc.h" +#include "qapi/qapi-types-machine.h" #include "qom/object.h" #include "exec/memory.h" #include "qemu/bitmap.h" diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c index 5641036dc3..789f763938 100644 --- a/monitor/hmp-cmds.c +++ b/monitor/hmp-cmds.c @@ -31,6 +31,7 @@ #include "qapi/qapi-builtin-visit.h" #include "qapi/qapi-commands-block.h" #include "qapi/qapi-commands-char.h" +#include "qapi/qapi-commands-machine.h" #include "qapi/qapi-commands-migration.h" #include "qapi/qapi-commands-misc.h" #include "qapi/qapi-commands-net.h" diff --git a/monitor/qmp-cmds.c b/monitor/qmp-cmds.c index 884eeaab80..58b54db033 100644 --- a/monitor/qmp-cmds.c +++ b/monitor/qmp-cmds.c @@ -31,6 +31,7 @@ #include "sysemu/block-backend.h" #include "qapi/error.h" #include "qapi/qapi-commands-block-core.h" +#include "qapi/qapi-commands-machine.h" #include "qapi/qapi-commands-misc.h" #include "qapi/qapi-commands-ui.h" #include "qapi/qmp/qerror.h" diff --git a/numa.c b/numa.c index 955ec0c830..6f85407c46 100644 --- a/numa.c +++ b/numa.c @@ -31,8 +31,8 @@ #include "qemu/error-report.h" #include "qapi/error.h" #include "qapi/opts-visitor.h" -#include "qapi/qapi-commands-misc.h" -#include "qapi/qapi-visit-misc.h" +#include "qapi/qapi-commands-machine.h" +#include "qapi/qapi-visit-machine.h" #include "hw/boards.h" #include "sysemu/hostmem.h" #include "hw/mem/pc-dimm.h" diff --git a/qapi/Makefile.objs b/qapi/Makefile.objs index 40b1dcffc4..01dced01aa 100644 --- a/qapi/Makefile.objs +++ b/qapi/Makefile.objs @@ -6,7 +6,7 @@ util-obj-y += qmp-event.o util-obj-y += qapi-util.o QAPI_COMMON_MODULES = audio authz block-core block char common crypto -QAPI_COMMON_MODULES += introspect job migration misc net +QAPI_COMMON_MODULES += introspect job machine migration misc net QAPI_COMMON_MODULES += qdev qom rdma rocker run-state sockets tpm QAPI_COMMON_MODULES += trace transaction ui QAPI_TARGET_MODULES = target diff --git a/qapi/machine.json b/qapi/machine.json new file mode 100644 index 0000000000..81849acb3a --- /dev/null +++ b/qapi/machine.json @@ -0,0 +1,697 @@ +# -*- Mode: Python -*- +# +# This work is licensed under the terms of the GNU GPL, version 2 or later. +# See the COPYING file in the top-level directory. + +## +# = Machines +## + +{ 'include': 'common.json' } + +## +# @CpuInfoArch: +# +# An enumeration of cpu types that enable additional information during +# @query-cpus and @query-cpus-fast. +# +# @s390: since 2.12 +# +# @riscv: since 2.12 +# +# Since: 2.6 +## +{ 'enum': 'CpuInfoArch', + 'data': ['x86', 'sparc', 'ppc', 'mips', 'tricore', 's390', 'riscv', 'other' ] } + +## +# @CpuInfo: +# +# Information about a virtual CPU +# +# @CPU: the index of the virtual CPU +# +# @current: this only exists for backwards compatibility and should be ignored +# +# @halted: true if the virtual CPU is in the halt state. Halt usually refers +# to a processor specific low power mode. +# +# @qom_path: path to the CPU object in the QOM tree (since 2.4) +# +# @thread_id: ID of the underlying host thread +# +# @props: properties describing to which node/socket/core/thread +# virtual CPU belongs to, provided if supported by board (since 2.10) +# +# @arch: architecture of the cpu, which determines which additional fields +# will be listed (since 2.6) +# +# Since: 0.14.0 +# +# Notes: @halted is a transient state that changes frequently. By the time the +# data is sent to the client, the guest may no longer be halted. +## +{ 'union': 'CpuInfo', + 'base': {'CPU': 'int', 'current': 'bool', 'halted': 'bool', + 'qom_path': 'str', 'thread_id': 'int', + '*props': 'CpuInstanceProperties', 'arch': 'CpuInfoArch' }, + 'discriminator': 'arch', + 'data': { 'x86': 'CpuInfoX86', + 'sparc': 'CpuInfoSPARC', + 'ppc': 'CpuInfoPPC', + 'mips': 'CpuInfoMIPS', + 'tricore': 'CpuInfoTricore', + 's390': 'CpuInfoS390', + 'riscv': 'CpuInfoRISCV' } } + +## +# @CpuInfoX86: +# +# Additional information about a virtual i386 or x86_64 CPU +# +# @pc: the 64-bit instruction pointer +# +# Since: 2.6 +## +{ 'struct': 'CpuInfoX86', 'data': { 'pc': 'int' } } + +## +# @CpuInfoSPARC: +# +# Additional information about a virtual SPARC CPU +# +# @pc: the PC component of the instruction pointer +# +# @npc: the NPC component of the instruction pointer +# +# Since: 2.6 +## +{ 'struct': 'CpuInfoSPARC', 'data': { 'pc': 'int', 'npc': 'int' } } + +## +# @CpuInfoPPC: +# +# Additional information about a virtual PPC CPU +# +# @nip: the instruction pointer +# +# Since: 2.6 +## +{ 'struct': 'CpuInfoPPC', 'data': { 'nip': 'int' } } + +## +# @CpuInfoMIPS: +# +# Additional information about a virtual MIPS CPU +# +# @PC: the instruction pointer +# +# Since: 2.6 +## +{ 'struct': 'CpuInfoMIPS', 'data': { 'PC': 'int' } } + +## +# @CpuInfoTricore: +# +# Additional information about a virtual Tricore CPU +# +# @PC: the instruction pointer +# +# Since: 2.6 +## +{ 'struct': 'CpuInfoTricore', 'data': { 'PC': 'int' } } + +## +# @CpuInfoRISCV: +# +# Additional information about a virtual RISCV CPU +# +# @pc: the instruction pointer +# +# Since 2.12 +## +{ 'struct': 'CpuInfoRISCV', 'data': { 'pc': 'int' } } + +## +# @CpuS390State: +# +# An enumeration of cpu states that can be assumed by a virtual +# S390 CPU +# +# Since: 2.12 +## +{ 'enum': 'CpuS390State', + 'prefix': 'S390_CPU_STATE', + 'data': [ 'uninitialized', 'stopped', 'check-stop', 'operating', 'load' ] } + +## +# @CpuInfoS390: +# +# Additional information about a virtual S390 CPU +# +# @cpu-state: the virtual CPU's state +# +# Since: 2.12 +## +{ 'struct': 'CpuInfoS390', 'data': { 'cpu-state': 'CpuS390State' } } + +## +# @query-cpus: +# +# Returns a list of information about each virtual CPU. +# +# This command causes vCPU threads to exit to userspace, which causes +# a small interruption to guest CPU execution. This will have a negative +# impact on realtime guests and other latency sensitive guest workloads. +# It is recommended to use @query-cpus-fast instead of this command to +# avoid the vCPU interruption. +# +# Returns: a list of @CpuInfo for each virtual CPU +# +# Since: 0.14.0 +# +# Example: +# +# -> { "execute": "query-cpus" } +# <- { "return": [ +# { +# "CPU":0, +# "current":true, +# "halted":false, +# "qom_path":"/machine/unattached/device[0]", +# "arch":"x86", +# "pc":3227107138, +# "thread_id":3134 +# }, +# { +# "CPU":1, +# "current":false, +# "halted":true, +# "qom_path":"/machine/unattached/device[2]", +# "arch":"x86", +# "pc":7108165, +# "thread_id":3135 +# } +# ] +# } +# +# Notes: This interface is deprecated (since 2.12.0), and it is strongly +# recommended that you avoid using it. Use @query-cpus-fast to +# obtain information about virtual CPUs. +# +## +{ 'command': 'query-cpus', 'returns': ['CpuInfo'] } + +## +# @CpuInfoFast: +# +# Information about a virtual CPU +# +# @cpu-index: index of the virtual CPU +# +# @qom-path: path to the CPU object in the QOM tree +# +# @thread-id: ID of the underlying host thread +# +# @props: properties describing to which node/socket/core/thread +# virtual CPU belongs to, provided if supported by board +# +# @arch: base architecture of the cpu; deprecated since 3.0.0 in favor +# of @target +# +# @target: the QEMU system emulation target, which determines which +# additional fields will be listed (since 3.0) +# +# Since: 2.12 +# +## +{ 'union' : 'CpuInfoFast', + 'base' : { 'cpu-index' : 'int', + 'qom-path' : 'str', + 'thread-id' : 'int', + '*props' : 'CpuInstanceProperties', + 'arch' : 'CpuInfoArch', + 'target' : 'SysEmuTarget' }, + 'discriminator' : 'target', + 'data' : { 's390x' : 'CpuInfoS390' } } + +## +# @query-cpus-fast: +# +# Returns information about all virtual CPUs. This command does not +# incur a performance penalty and should be used in production +# instead of query-cpus. +# +# Returns: list of @CpuInfoFast +# +# Since: 2.12 +# +# Example: +# +# -> { "execute": "query-cpus-fast" } +# <- { "return": [ +# { +# "thread-id": 25627, +# "props": { +# "core-id": 0, +# "thread-id": 0, +# "socket-id": 0 +# }, +# "qom-path": "/machine/unattached/device[0]", +# "arch":"x86", +# "target":"x86_64", +# "cpu-index": 0 +# }, +# { +# "thread-id": 25628, +# "props": { +# "core-id": 0, +# "thread-id": 0, +# "socket-id": 1 +# }, +# "qom-path": "/machine/unattached/device[2]", +# "arch":"x86", +# "target":"x86_64", +# "cpu-index": 1 +# } +# ] +# } +## +{ 'command': 'query-cpus-fast', 'returns': [ 'CpuInfoFast' ] } + +## +# @cpu-add: +# +# Adds CPU with specified ID. +# +# @id: ID of CPU to be created, valid values [0..max_cpus) +# +# Returns: Nothing on success +# +# Since: 1.5 +# +# Note: This command is deprecated. The `device_add` command should be +# used instead. See the `query-hotpluggable-cpus` command for +# details. +# +# Example: +# +# -> { "execute": "cpu-add", "arguments": { "id": 2 } } +# <- { "return": {} } +# +## +{ 'command': 'cpu-add', 'data': {'id': 'int'} } + +## +# @MachineInfo: +# +# Information describing a machine. +# +# @name: the name of the machine +# +# @alias: an alias for the machine name +# +# @is-default: whether the machine is default +# +# @cpu-max: maximum number of CPUs supported by the machine type +# (since 1.5.0) +# +# @hotpluggable-cpus: cpu hotplug via -device is supported (since 2.7.0) +# +# Since: 1.2.0 +## +{ 'struct': 'MachineInfo', + 'data': { 'name': 'str', '*alias': 'str', + '*is-default': 'bool', 'cpu-max': 'int', + 'hotpluggable-cpus': 'bool'} } + +## +# @query-machines: +# +# Return a list of supported machines +# +# Returns: a list of MachineInfo +# +# Since: 1.2.0 +## +{ 'command': 'query-machines', 'returns': ['MachineInfo'] } + +## +# @CurrentMachineParams: +# +# Information describing the running machine parameters. +# +# @wakeup-suspend-support: true if the machine supports wake up from +# suspend +# +# Since: 4.0 +## +{ 'struct': 'CurrentMachineParams', + 'data': { 'wakeup-suspend-support': 'bool'} } + +## +# @query-current-machine: +# +# Return information on the current virtual machine. +# +# Returns: CurrentMachineParams +# +# Since: 4.0 +## +{ 'command': 'query-current-machine', 'returns': 'CurrentMachineParams' } + +## +# @NumaOptionsType: +# +# @node: NUMA nodes configuration +# +# @dist: NUMA distance configuration (since 2.10) +# +# @cpu: property based CPU(s) to node mapping (Since: 2.10) +# +# Since: 2.1 +## +{ 'enum': 'NumaOptionsType', + 'data': [ 'node', 'dist', 'cpu' ] } + +## +# @NumaOptions: +# +# A discriminated record of NUMA options. (for OptsVisitor) +# +# Since: 2.1 +## +{ 'union': 'NumaOptions', + 'base': { 'type': 'NumaOptionsType' }, + 'discriminator': 'type', + 'data': { + 'node': 'NumaNodeOptions', + 'dist': 'NumaDistOptions', + 'cpu': 'NumaCpuOptions' }} + +## +# @NumaNodeOptions: +# +# Create a guest NUMA node. (for OptsVisitor) +# +# @nodeid: NUMA node ID (increase by 1 from 0 if omitted) +# +# @cpus: VCPUs belonging to this node (assign VCPUS round-robin +# if omitted) +# +# @mem: memory size of this node; mutually exclusive with @memdev. +# Equally divide total memory among nodes if both @mem and @memdev are +# omitted. +# +# @memdev: memory backend object. If specified for one node, +# it must be specified for all nodes. +# +# Since: 2.1 +## +{ 'struct': 'NumaNodeOptions', + 'data': { + '*nodeid': 'uint16', + '*cpus': ['uint16'], + '*mem': 'size', + '*memdev': 'str' }} + +## +# @NumaDistOptions: +# +# Set the distance between 2 NUMA nodes. +# +# @src: source NUMA node. +# +# @dst: destination NUMA node. +# +# @val: NUMA distance from source node to destination node. +# When a node is unreachable from another node, set the distance +# between them to 255. +# +# Since: 2.10 +## +{ 'struct': 'NumaDistOptions', + 'data': { + 'src': 'uint16', + 'dst': 'uint16', + 'val': 'uint8' }} + +## +# @X86CPURegister32: +# +# A X86 32-bit register +# +# Since: 1.5 +## +{ 'enum': 'X86CPURegister32', + 'data': [ 'EAX', 'EBX', 'ECX', 'EDX', 'ESP', 'EBP', 'ESI', 'EDI' ] } + +## +# @X86CPUFeatureWordInfo: +# +# Information about a X86 CPU feature word +# +# @cpuid-input-eax: Input EAX value for CPUID instruction for that feature word +# +# @cpuid-input-ecx: Input ECX value for CPUID instruction for that +# feature word +# +# @cpuid-register: Output register containing the feature bits +# +# @features: value of output register, containing the feature bits +# +# Since: 1.5 +## +{ 'struct': 'X86CPUFeatureWordInfo', + 'data': { 'cpuid-input-eax': 'int', + '*cpuid-input-ecx': 'int', + 'cpuid-register': 'X86CPURegister32', + 'features': 'int' } } + +## +# @DummyForceArrays: +# +# Not used by QMP; hack to let us use X86CPUFeatureWordInfoList internally +# +# Since: 2.5 +## +{ 'struct': 'DummyForceArrays', + 'data': { 'unused': ['X86CPUFeatureWordInfo'] } } + +## +# @NumaCpuOptions: +# +# Option "-numa cpu" overrides default cpu to node mapping. +# It accepts the same set of cpu properties as returned by +# query-hotpluggable-cpus[].props, where node-id could be used to +# override default node mapping. +# +# Since: 2.10 +## +{ 'struct': 'NumaCpuOptions', + 'base': 'CpuInstanceProperties', + 'data' : {} } + +## +# @HostMemPolicy: +# +# Host memory policy types +# +# @default: restore default policy, remove any nondefault policy +# +# @preferred: set the preferred host nodes for allocation +# +# @bind: a strict policy that restricts memory allocation to the +# host nodes specified +# +# @interleave: memory allocations are interleaved across the set +# of host nodes specified +# +# Since: 2.1 +## +{ 'enum': 'HostMemPolicy', + 'data': [ 'default', 'preferred', 'bind', 'interleave' ] } + +## +# @Memdev: +# +# Information about memory backend +# +# @id: backend's ID if backend has 'id' property (since 2.9) +# +# @size: memory backend size +# +# @merge: enables or disables memory merge support +# +# @dump: includes memory backend's memory in a core dump or not +# +# @prealloc: enables or disables memory preallocation +# +# @host-nodes: host nodes for its memory policy +# +# @policy: memory policy of memory backend +# +# Since: 2.1 +## +{ 'struct': 'Memdev', + 'data': { + '*id': 'str', + 'size': 'size', + 'merge': 'bool', + 'dump': 'bool', + 'prealloc': 'bool', + 'host-nodes': ['uint16'], + 'policy': 'HostMemPolicy' }} + +## +# @query-memdev: +# +# Returns information for all memory backends. +# +# Returns: a list of @Memdev. +# +# Since: 2.1 +# +# Example: +# +# -> { "execute": "query-memdev" } +# <- { "return": [ +# { +# "id": "mem1", +# "size": 536870912, +# "merge": false, +# "dump": true, +# "prealloc": false, +# "host-nodes": [0, 1], +# "policy": "bind" +# }, +# { +# "size": 536870912, +# "merge": false, +# "dump": true, +# "prealloc": true, +# "host-nodes": [2, 3], +# "policy": "preferred" +# } +# ] +# } +# +## +{ 'command': 'query-memdev', 'returns': ['Memdev'], 'allow-preconfig': true } + +## +# @CpuInstanceProperties: +# +# List of properties to be used for hotplugging a CPU instance, +# it should be passed by management with device_add command when +# a CPU is being hotplugged. +# +# @node-id: NUMA node ID the CPU belongs to +# @socket-id: socket number within node/board the CPU belongs to +# @core-id: core number within socket the CPU belongs to +# @thread-id: thread number within core the CPU belongs to +# +# Note: currently there are 4 properties that could be present +# but management should be prepared to pass through other +# properties with device_add command to allow for future +# interface extension. This also requires the filed names to be kept in +# sync with the properties passed to -device/device_add. +# +# Since: 2.7 +## +{ 'struct': 'CpuInstanceProperties', + 'data': { '*node-id': 'int', + '*socket-id': 'int', + '*core-id': 'int', + '*thread-id': 'int' + } +} + +## +# @HotpluggableCPU: +# +# @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 +# @qom-path: link to existing CPU object if CPU is present or +# omitted if CPU is not present. +# +# Since: 2.7 +## +{ 'struct': 'HotpluggableCPU', + 'data': { 'type': 'str', + 'vcpus-count': 'int', + 'props': 'CpuInstanceProperties', + '*qom-path': 'str' + } +} + +## +# @query-hotpluggable-cpus: +# +# TODO: Better documentation; currently there is none. +# +# Returns: a list of HotpluggableCPU objects. +# +# Since: 2.7 +# +# Example: +# +# For pseries machine type started with -smp 2,cores=2,maxcpus=4 -cpu POWER8: +# +# -> { "execute": "query-hotpluggable-cpus" } +# <- {"return": [ +# { "props": { "core": 8 }, "type": "POWER8-spapr-cpu-core", +# "vcpus-count": 1 }, +# { "props": { "core": 0 }, "type": "POWER8-spapr-cpu-core", +# "vcpus-count": 1, "qom-path": "/machine/unattached/device[0]"} +# ]}' +# +# For pc machine type started with -smp 1,maxcpus=2: +# +# -> { "execute": "query-hotpluggable-cpus" } +# <- {"return": [ +# { +# "type": "qemu64-x86_64-cpu", "vcpus-count": 1, +# "props": {"core-id": 0, "socket-id": 1, "thread-id": 0} +# }, +# { +# "qom-path": "/machine/unattached/device[0]", +# "type": "qemu64-x86_64-cpu", "vcpus-count": 1, +# "props": {"core-id": 0, "socket-id": 0, "thread-id": 0} +# } +# ]} +# +# For s390x-virtio-ccw machine type started with -smp 1,maxcpus=2 -cpu qemu +# (Since: 2.11): +# +# -> { "execute": "query-hotpluggable-cpus" } +# <- {"return": [ +# { +# "type": "qemu-s390x-cpu", "vcpus-count": 1, +# "props": { "core-id": 1 } +# }, +# { +# "qom-path": "/machine/unattached/device[0]", +# "type": "qemu-s390x-cpu", "vcpus-count": 1, +# "props": { "core-id": 0 } +# } +# ]} +# +## +{ 'command': 'query-hotpluggable-cpus', 'returns': ['HotpluggableCPU'], + 'allow-preconfig': true } + +## +# @set-numa-node: +# +# Runtime equivalent of '-numa' CLI option, available at +# preconfigure stage to configure numa mapping before initializing +# machine. +# +# Since 3.0 +## +{ 'command': 'set-numa-node', 'boxed': true, + 'data': 'NumaOptions', + 'allow-preconfig': true +} diff --git a/qapi/misc.json b/qapi/misc.json index 5fbda70ad8..b4f8c658b7 100644 --- a/qapi/misc.json +++ b/qapi/misc.json @@ -342,276 +342,6 @@ ## { 'command': 'query-events', 'returns': ['EventInfo'] } -## -# @CpuInfoArch: -# -# An enumeration of cpu types that enable additional information during -# @query-cpus and @query-cpus-fast. -# -# @s390: since 2.12 -# -# @riscv: since 2.12 -# -# Since: 2.6 -## -{ 'enum': 'CpuInfoArch', - 'data': ['x86', 'sparc', 'ppc', 'mips', 'tricore', 's390', 'riscv', 'other' ] } - -## -# @CpuInfo: -# -# Information about a virtual CPU -# -# @CPU: the index of the virtual CPU -# -# @current: this only exists for backwards compatibility and should be ignored -# -# @halted: true if the virtual CPU is in the halt state. Halt usually refers -# to a processor specific low power mode. -# -# @qom_path: path to the CPU object in the QOM tree (since 2.4) -# -# @thread_id: ID of the underlying host thread -# -# @props: properties describing to which node/socket/core/thread -# virtual CPU belongs to, provided if supported by board (since 2.10) -# -# @arch: architecture of the cpu, which determines which additional fields -# will be listed (since 2.6) -# -# Since: 0.14.0 -# -# Notes: @halted is a transient state that changes frequently. By the time the -# data is sent to the client, the guest may no longer be halted. -## -{ 'union': 'CpuInfo', - 'base': {'CPU': 'int', 'current': 'bool', 'halted': 'bool', - 'qom_path': 'str', 'thread_id': 'int', - '*props': 'CpuInstanceProperties', 'arch': 'CpuInfoArch' }, - 'discriminator': 'arch', - 'data': { 'x86': 'CpuInfoX86', - 'sparc': 'CpuInfoSPARC', - 'ppc': 'CpuInfoPPC', - 'mips': 'CpuInfoMIPS', - 'tricore': 'CpuInfoTricore', - 's390': 'CpuInfoS390', - 'riscv': 'CpuInfoRISCV' } } - -## -# @CpuInfoX86: -# -# Additional information about a virtual i386 or x86_64 CPU -# -# @pc: the 64-bit instruction pointer -# -# Since: 2.6 -## -{ 'struct': 'CpuInfoX86', 'data': { 'pc': 'int' } } - -## -# @CpuInfoSPARC: -# -# Additional information about a virtual SPARC CPU -# -# @pc: the PC component of the instruction pointer -# -# @npc: the NPC component of the instruction pointer -# -# Since: 2.6 -## -{ 'struct': 'CpuInfoSPARC', 'data': { 'pc': 'int', 'npc': 'int' } } - -## -# @CpuInfoPPC: -# -# Additional information about a virtual PPC CPU -# -# @nip: the instruction pointer -# -# Since: 2.6 -## -{ 'struct': 'CpuInfoPPC', 'data': { 'nip': 'int' } } - -## -# @CpuInfoMIPS: -# -# Additional information about a virtual MIPS CPU -# -# @PC: the instruction pointer -# -# Since: 2.6 -## -{ 'struct': 'CpuInfoMIPS', 'data': { 'PC': 'int' } } - -## -# @CpuInfoTricore: -# -# Additional information about a virtual Tricore CPU -# -# @PC: the instruction pointer -# -# Since: 2.6 -## -{ 'struct': 'CpuInfoTricore', 'data': { 'PC': 'int' } } - -## -# @CpuInfoRISCV: -# -# Additional information about a virtual RISCV CPU -# -# @pc: the instruction pointer -# -# Since 2.12 -## -{ 'struct': 'CpuInfoRISCV', 'data': { 'pc': 'int' } } - -## -# @CpuS390State: -# -# An enumeration of cpu states that can be assumed by a virtual -# S390 CPU -# -# Since: 2.12 -## -{ 'enum': 'CpuS390State', - 'prefix': 'S390_CPU_STATE', - 'data': [ 'uninitialized', 'stopped', 'check-stop', 'operating', 'load' ] } - -## -# @CpuInfoS390: -# -# Additional information about a virtual S390 CPU -# -# @cpu-state: the virtual CPU's state -# -# Since: 2.12 -## -{ 'struct': 'CpuInfoS390', 'data': { 'cpu-state': 'CpuS390State' } } - -## -# @query-cpus: -# -# Returns a list of information about each virtual CPU. -# -# This command causes vCPU threads to exit to userspace, which causes -# a small interruption to guest CPU execution. This will have a negative -# impact on realtime guests and other latency sensitive guest workloads. -# It is recommended to use @query-cpus-fast instead of this command to -# avoid the vCPU interruption. -# -# Returns: a list of @CpuInfo for each virtual CPU -# -# Since: 0.14.0 -# -# Example: -# -# -> { "execute": "query-cpus" } -# <- { "return": [ -# { -# "CPU":0, -# "current":true, -# "halted":false, -# "qom_path":"/machine/unattached/device[0]", -# "arch":"x86", -# "pc":3227107138, -# "thread_id":3134 -# }, -# { -# "CPU":1, -# "current":false, -# "halted":true, -# "qom_path":"/machine/unattached/device[2]", -# "arch":"x86", -# "pc":7108165, -# "thread_id":3135 -# } -# ] -# } -# -# Notes: This interface is deprecated (since 2.12.0), and it is strongly -# recommended that you avoid using it. Use @query-cpus-fast to -# obtain information about virtual CPUs. -# -## -{ 'command': 'query-cpus', 'returns': ['CpuInfo'] } - -## -# @CpuInfoFast: -# -# Information about a virtual CPU -# -# @cpu-index: index of the virtual CPU -# -# @qom-path: path to the CPU object in the QOM tree -# -# @thread-id: ID of the underlying host thread -# -# @props: properties describing to which node/socket/core/thread -# virtual CPU belongs to, provided if supported by board -# -# @arch: base architecture of the cpu; deprecated since 3.0.0 in favor -# of @target -# -# @target: the QEMU system emulation target, which determines which -# additional fields will be listed (since 3.0) -# -# Since: 2.12 -# -## -{ 'union' : 'CpuInfoFast', - 'base' : { 'cpu-index' : 'int', - 'qom-path' : 'str', - 'thread-id' : 'int', - '*props' : 'CpuInstanceProperties', - 'arch' : 'CpuInfoArch', - 'target' : 'SysEmuTarget' }, - 'discriminator' : 'target', - 'data' : { 's390x' : 'CpuInfoS390' } } - -## -# @query-cpus-fast: -# -# Returns information about all virtual CPUs. This command does not -# incur a performance penalty and should be used in production -# instead of query-cpus. -# -# Returns: list of @CpuInfoFast -# -# Since: 2.12 -# -# Example: -# -# -> { "execute": "query-cpus-fast" } -# <- { "return": [ -# { -# "thread-id": 25627, -# "props": { -# "core-id": 0, -# "thread-id": 0, -# "socket-id": 0 -# }, -# "qom-path": "/machine/unattached/device[0]", -# "arch":"x86", -# "target":"x86_64", -# "cpu-index": 0 -# }, -# { -# "thread-id": 25628, -# "props": { -# "core-id": 0, -# "thread-id": 0, -# "socket-id": 1 -# }, -# "qom-path": "/machine/unattached/device[2]", -# "arch":"x86", -# "target":"x86_64", -# "cpu-index": 1 -# } -# ] -# } -## -{ 'command': 'query-cpus-fast', 'returns': [ 'CpuInfoFast' ] } - ## # @IOThreadInfo: # @@ -1105,29 +835,6 @@ ## { 'command': 'system_powerdown' } -## -# @cpu-add: -# -# Adds CPU with specified ID. -# -# @id: ID of CPU to be created, valid values [0..max_cpus) -# -# Returns: Nothing on success -# -# Since: 1.5 -# -# Note: This command is deprecated. The `device_add` command should be -# used instead. See the `query-hotpluggable-cpus` command for -# details. -# -# Example: -# -# -> { "execute": "cpu-add", "arguments": { "id": 2 } } -# <- { "return": {} } -# -## -{ 'command': 'cpu-add', 'data': {'id': 'int'} } - ## # @memsave: # @@ -1647,64 +1354,6 @@ ## { 'command': 'closefd', 'data': {'fdname': 'str'} } -## -# @MachineInfo: -# -# Information describing a machine. -# -# @name: the name of the machine -# -# @alias: an alias for the machine name -# -# @is-default: whether the machine is default -# -# @cpu-max: maximum number of CPUs supported by the machine type -# (since 1.5.0) -# -# @hotpluggable-cpus: cpu hotplug via -device is supported (since 2.7.0) -# -# Since: 1.2.0 -## -{ 'struct': 'MachineInfo', - 'data': { 'name': 'str', '*alias': 'str', - '*is-default': 'bool', 'cpu-max': 'int', - 'hotpluggable-cpus': 'bool'} } - -## -# @query-machines: -# -# Return a list of supported machines -# -# Returns: a list of MachineInfo -# -# Since: 1.2.0 -## -{ 'command': 'query-machines', 'returns': ['MachineInfo'] } - -## -# @CurrentMachineParams: -# -# Information describing the running machine parameters. -# -# @wakeup-suspend-support: true if the machine supports wake up from -# suspend -# -# Since: 4.0 -## -{ 'struct': 'CurrentMachineParams', - 'data': { 'wakeup-suspend-support': 'bool'} } - -## -# @query-current-machine: -# -# Return information on the current virtual machine. -# -# Returns: CurrentMachineParams -# -# Since: 4.0 -## -{ 'command': 'query-current-machine', 'returns': 'CurrentMachineParams' } - ## # @MemoryInfo: # @@ -2132,226 +1781,6 @@ 'returns': ['CommandLineOptionInfo'], 'allow-preconfig': true } -## -# @X86CPURegister32: -# -# A X86 32-bit register -# -# Since: 1.5 -## -{ 'enum': 'X86CPURegister32', - 'data': [ 'EAX', 'EBX', 'ECX', 'EDX', 'ESP', 'EBP', 'ESI', 'EDI' ] } - -## -# @X86CPUFeatureWordInfo: -# -# Information about a X86 CPU feature word -# -# @cpuid-input-eax: Input EAX value for CPUID instruction for that feature word -# -# @cpuid-input-ecx: Input ECX value for CPUID instruction for that -# feature word -# -# @cpuid-register: Output register containing the feature bits -# -# @features: value of output register, containing the feature bits -# -# Since: 1.5 -## -{ 'struct': 'X86CPUFeatureWordInfo', - 'data': { 'cpuid-input-eax': 'int', - '*cpuid-input-ecx': 'int', - 'cpuid-register': 'X86CPURegister32', - 'features': 'int' } } - -## -# @DummyForceArrays: -# -# Not used by QMP; hack to let us use X86CPUFeatureWordInfoList internally -# -# Since: 2.5 -## -{ 'struct': 'DummyForceArrays', - 'data': { 'unused': ['X86CPUFeatureWordInfo'] } } - - -## -# @NumaOptionsType: -# -# @node: NUMA nodes configuration -# -# @dist: NUMA distance configuration (since 2.10) -# -# @cpu: property based CPU(s) to node mapping (Since: 2.10) -# -# Since: 2.1 -## -{ 'enum': 'NumaOptionsType', - 'data': [ 'node', 'dist', 'cpu' ] } - -## -# @NumaOptions: -# -# A discriminated record of NUMA options. (for OptsVisitor) -# -# Since: 2.1 -## -{ 'union': 'NumaOptions', - 'base': { 'type': 'NumaOptionsType' }, - 'discriminator': 'type', - 'data': { - 'node': 'NumaNodeOptions', - 'dist': 'NumaDistOptions', - 'cpu': 'NumaCpuOptions' }} - -## -# @NumaNodeOptions: -# -# Create a guest NUMA node. (for OptsVisitor) -# -# @nodeid: NUMA node ID (increase by 1 from 0 if omitted) -# -# @cpus: VCPUs belonging to this node (assign VCPUS round-robin -# if omitted) -# -# @mem: memory size of this node; mutually exclusive with @memdev. -# Equally divide total memory among nodes if both @mem and @memdev are -# omitted. -# -# @memdev: memory backend object. If specified for one node, -# it must be specified for all nodes. -# -# Since: 2.1 -## -{ 'struct': 'NumaNodeOptions', - 'data': { - '*nodeid': 'uint16', - '*cpus': ['uint16'], - '*mem': 'size', - '*memdev': 'str' }} - -## -# @NumaDistOptions: -# -# Set the distance between 2 NUMA nodes. -# -# @src: source NUMA node. -# -# @dst: destination NUMA node. -# -# @val: NUMA distance from source node to destination node. -# When a node is unreachable from another node, set the distance -# between them to 255. -# -# Since: 2.10 -## -{ 'struct': 'NumaDistOptions', - 'data': { - 'src': 'uint16', - 'dst': 'uint16', - 'val': 'uint8' }} - -## -# @NumaCpuOptions: -# -# Option "-numa cpu" overrides default cpu to node mapping. -# It accepts the same set of cpu properties as returned by -# query-hotpluggable-cpus[].props, where node-id could be used to -# override default node mapping. -# -# Since: 2.10 -## -{ 'struct': 'NumaCpuOptions', - 'base': 'CpuInstanceProperties', - 'data' : {} } - -## -# @HostMemPolicy: -# -# Host memory policy types -# -# @default: restore default policy, remove any nondefault policy -# -# @preferred: set the preferred host nodes for allocation -# -# @bind: a strict policy that restricts memory allocation to the -# host nodes specified -# -# @interleave: memory allocations are interleaved across the set -# of host nodes specified -# -# Since: 2.1 -## -{ 'enum': 'HostMemPolicy', - 'data': [ 'default', 'preferred', 'bind', 'interleave' ] } - -## -# @Memdev: -# -# Information about memory backend -# -# @id: backend's ID if backend has 'id' property (since 2.9) -# -# @size: memory backend size -# -# @merge: enables or disables memory merge support -# -# @dump: includes memory backend's memory in a core dump or not -# -# @prealloc: enables or disables memory preallocation -# -# @host-nodes: host nodes for its memory policy -# -# @policy: memory policy of memory backend -# -# Since: 2.1 -## -{ 'struct': 'Memdev', - 'data': { - '*id': 'str', - 'size': 'size', - 'merge': 'bool', - 'dump': 'bool', - 'prealloc': 'bool', - 'host-nodes': ['uint16'], - 'policy': 'HostMemPolicy' }} - -## -# @query-memdev: -# -# Returns information for all memory backends. -# -# Returns: a list of @Memdev. -# -# Since: 2.1 -# -# Example: -# -# -> { "execute": "query-memdev" } -# <- { "return": [ -# { -# "id": "mem1", -# "size": 536870912, -# "merge": false, -# "dump": true, -# "prealloc": false, -# "host-nodes": [0, 1], -# "policy": "bind" -# }, -# { -# "size": 536870912, -# "merge": false, -# "dump": true, -# "prealloc": true, -# "host-nodes": [2, 3], -# "policy": "preferred" -# } -# ] -# } -# -## -{ 'command': 'query-memdev', 'returns': ['Memdev'], 'allow-preconfig': true } - ## # @PCDIMMDeviceInfo: # @@ -2560,109 +1989,6 @@ ## { 'command': 'xen-load-devices-state', 'data': {'filename': 'str'} } -## -# @CpuInstanceProperties: -# -# List of properties to be used for hotplugging a CPU instance, -# it should be passed by management with device_add command when -# a CPU is being hotplugged. -# -# @node-id: NUMA node ID the CPU belongs to -# @socket-id: socket number within node/board the CPU belongs to -# @core-id: core number within socket the CPU belongs to -# @thread-id: thread number within core the CPU belongs to -# -# Note: currently there are 4 properties that could be present -# but management should be prepared to pass through other -# properties with device_add command to allow for future -# interface extension. This also requires the filed names to be kept in -# sync with the properties passed to -device/device_add. -# -# Since: 2.7 -## -{ 'struct': 'CpuInstanceProperties', - 'data': { '*node-id': 'int', - '*socket-id': 'int', - '*core-id': 'int', - '*thread-id': 'int' - } -} - -## -# @HotpluggableCPU: -# -# @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 -# @qom-path: link to existing CPU object if CPU is present or -# omitted if CPU is not present. -# -# Since: 2.7 -## -{ 'struct': 'HotpluggableCPU', - 'data': { 'type': 'str', - 'vcpus-count': 'int', - 'props': 'CpuInstanceProperties', - '*qom-path': 'str' - } -} - -## -# @query-hotpluggable-cpus: -# -# TODO: Better documentation; currently there is none. -# -# Returns: a list of HotpluggableCPU objects. -# -# Since: 2.7 -# -# Example: -# -# For pseries machine type started with -smp 2,cores=2,maxcpus=4 -cpu POWER8: -# -# -> { "execute": "query-hotpluggable-cpus" } -# <- {"return": [ -# { "props": { "core": 8 }, "type": "POWER8-spapr-cpu-core", -# "vcpus-count": 1 }, -# { "props": { "core": 0 }, "type": "POWER8-spapr-cpu-core", -# "vcpus-count": 1, "qom-path": "/machine/unattached/device[0]"} -# ]}' -# -# For pc machine type started with -smp 1,maxcpus=2: -# -# -> { "execute": "query-hotpluggable-cpus" } -# <- {"return": [ -# { -# "type": "qemu64-x86_64-cpu", "vcpus-count": 1, -# "props": {"core-id": 0, "socket-id": 1, "thread-id": 0} -# }, -# { -# "qom-path": "/machine/unattached/device[0]", -# "type": "qemu64-x86_64-cpu", "vcpus-count": 1, -# "props": {"core-id": 0, "socket-id": 0, "thread-id": 0} -# } -# ]} -# -# For s390x-virtio-ccw machine type started with -smp 1,maxcpus=2 -cpu qemu -# (Since: 2.11): -# -# -> { "execute": "query-hotpluggable-cpus" } -# <- {"return": [ -# { -# "type": "qemu-s390x-cpu", "vcpus-count": 1, -# "props": { "core-id": 1 } -# }, -# { -# "qom-path": "/machine/unattached/device[0]", -# "type": "qemu-s390x-cpu", "vcpus-count": 1, -# "props": { "core-id": 0 } -# } -# ]} -# -## -{ 'command': 'query-hotpluggable-cpus', 'returns': ['HotpluggableCPU'], - 'allow-preconfig': true } - ## # @GuidInfo: # @@ -2683,16 +2009,3 @@ ## { 'command': 'query-vm-generation-id', 'returns': 'GuidInfo' } -## -# @set-numa-node: -# -# Runtime equivalent of '-numa' CLI option, available at -# preconfigure stage to configure numa mapping before initializing -# machine. -# -# Since 3.0 -## -{ 'command': 'set-numa-node', 'boxed': true, - 'data': 'NumaOptions', - 'allow-preconfig': true -} diff --git a/qapi/qapi-schema.json b/qapi/qapi-schema.json index d6cf90a85a..31611191db 100644 --- a/qapi/qapi-schema.json +++ b/qapi/qapi-schema.json @@ -99,6 +99,7 @@ { 'include': 'introspect.json' } { 'include': 'qom.json' } { 'include': 'qdev.json' } +{ 'include': 'machine.json' } { 'include': 'misc.json' } { 'include': 'target.json' } { 'include': 'audio.json' } diff --git a/target/i386/cpu.c b/target/i386/cpu.c index fbed2eb804..cb50f05e7e 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -36,7 +36,7 @@ #include "qemu/option.h" #include "qemu/config-file.h" #include "qapi/error.h" -#include "qapi/qapi-visit-misc.h" +#include "qapi/qapi-visit-machine.h" #include "qapi/qapi-visit-run-state.h" #include "qapi/qmp/qdict.h" #include "qapi/qmp/qerror.h" diff --git a/target/s390x/cpu.c b/target/s390x/cpu.c index f2d93644d5..8540e7a2cb 100644 --- a/target/s390x/cpu.c +++ b/target/s390x/cpu.c @@ -31,7 +31,7 @@ #include "qemu/module.h" #include "trace.h" #include "qapi/visitor.h" -#include "qapi/qapi-visit-misc.h" +#include "qapi/qapi-types-machine.h" #include "qapi/qapi-visit-run-state.h" #include "sysemu/hw_accel.h" #include "hw/qdev-properties.h" diff --git a/target/s390x/sigp.c b/target/s390x/sigp.c index ce49a792fc..8348b7035e 100644 --- a/target/s390x/sigp.c +++ b/target/s390x/sigp.c @@ -17,7 +17,7 @@ #include "sysemu/sysemu.h" #include "sysemu/tcg.h" #include "trace.h" -#include "qapi/qapi-types-misc.h" +#include "qapi/qapi-types-machine.h" QemuMutex qemu_sigp_mutex; diff --git a/vl.c b/vl.c index 99a56b5556..0eb9b2c8bd 100644 --- a/vl.c +++ b/vl.c @@ -125,7 +125,7 @@ int main(int argc, char **argv) #include "qapi/qapi-visit-block-core.h" #include "qapi/qapi-visit-ui.h" #include "qapi/qapi-commands-block-core.h" -#include "qapi/qapi-commands-misc.h" +#include "qapi/qapi-commands-machine.h" #include "qapi/qapi-commands-run-state.h" #include "qapi/qapi-commands-ui.h" #include "qapi/qmp/qerror.h" From patchwork Wed Jun 19 20:10:42 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Markus Armbruster X-Patchwork-Id: 1118988 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 45Tbm75Zq8z9s4V for ; Thu, 20 Jun 2019 06:15:19 +1000 (AEST) Received: from localhost ([::1]:41680 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hdgzF-00087N-Qv for incoming@patchwork.ozlabs.org; Wed, 19 Jun 2019 16:15:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35345) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hdgv9-0004K5-RM for qemu-devel@nongnu.org; Wed, 19 Jun 2019 16:11:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hdgv7-0001AR-PH for qemu-devel@nongnu.org; Wed, 19 Jun 2019 16:11:03 -0400 Received: from mx1.redhat.com ([209.132.183.28]:33902) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hdgv7-00012D-2P for qemu-devel@nongnu.org; Wed, 19 Jun 2019 16:11:01 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id ECBC988318; Wed, 19 Jun 2019 20:10:53 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-116-85.ams2.redhat.com [10.36.116.85]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B6C936013D; Wed, 19 Jun 2019 20:10:53 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id CE3FF113853C; Wed, 19 Jun 2019 22:10:50 +0200 (CEST) From: Markus Armbruster To: qemu-devel@nongnu.org Date: Wed, 19 Jun 2019 22:10:42 +0200 Message-Id: <20190619201050.19040-10-armbru@redhat.com> In-Reply-To: <20190619201050.19040-1-armbru@redhat.com> References: <20190619201050.19040-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Wed, 19 Jun 2019 20:10:54 +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 09/17] hw/core: Move numa.c to hw/core/ X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, Eduardo Habkost Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Cc: Eduardo Habkost Cc: Marcel Apfelbaum Signed-off-by: Markus Armbruster Reviewed-by: Daniel P. Berrangé --- MAINTAINERS | 2 +- Makefile.target | 2 +- hw/core/Makefile.objs | 2 ++ numa.c => hw/core/numa.c | 0 4 files changed, 4 insertions(+), 2 deletions(-) rename numa.c => hw/core/numa.c (100%) diff --git a/MAINTAINERS b/MAINTAINERS index 9b488c5151..96a72a999a 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1267,8 +1267,8 @@ M: Marcel Apfelbaum S: Supported F: hw/core/machine.c F: hw/core/null-machine.c +F: hw/core/numa.c F: hw/cpu/cluster.c -F: numa.c F: qapi/machine.json F: qom/cpu.c F: include/hw/boards.h diff --git a/Makefile.target b/Makefile.target index 72c267f7dc..167ae2174e 100644 --- a/Makefile.target +++ b/Makefile.target @@ -148,7 +148,7 @@ endif #CONFIG_BSD_USER ######################################################### # System emulator target ifdef CONFIG_SOFTMMU -obj-y += arch_init.o cpus.o gdbstub.o balloon.o ioport.o numa.o +obj-y += arch_init.o cpus.o gdbstub.o balloon.o ioport.o obj-y += qtest.o obj-y += hw/ obj-y += monitor/ diff --git a/hw/core/Makefile.objs b/hw/core/Makefile.objs index a799c83815..e3a8307be6 100644 --- a/hw/core/Makefile.objs +++ b/hw/core/Makefile.objs @@ -22,3 +22,5 @@ common-obj-$(CONFIG_SOFTMMU) += split-irq.o common-obj-$(CONFIG_PLATFORM_BUS) += platform-bus.o common-obj-$(CONFIG_SOFTMMU) += generic-loader.o common-obj-$(CONFIG_SOFTMMU) += null-machine.o + +obj-$(CONFIG_SOFTMMU) += numa.o diff --git a/numa.c b/hw/core/numa.c similarity index 100% rename from numa.c rename to hw/core/numa.c From patchwork Wed Jun 19 20:10:43 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Markus Armbruster X-Patchwork-Id: 1119004 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 45Tc1s4L36z9s4V for ; Thu, 20 Jun 2019 06:27:13 +1000 (AEST) Received: from localhost ([::1]:41768 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hdhAl-0003JK-MT for incoming@patchwork.ozlabs.org; Wed, 19 Jun 2019 16:27:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35413) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hdgvD-0004Kw-79 for qemu-devel@nongnu.org; Wed, 19 Jun 2019 16:11:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hdgv5-00017k-Op for qemu-devel@nongnu.org; Wed, 19 Jun 2019 16:11:06 -0400 Received: from mx1.redhat.com ([209.132.183.28]:25418) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hdgv4-00012f-P7 for qemu-devel@nongnu.org; Wed, 19 Jun 2019 16:10:59 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4F16330C0DE2; Wed, 19 Jun 2019 20:10:54 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-116-85.ams2.redhat.com [10.36.116.85]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B8FB4601A5; Wed, 19 Jun 2019 20:10:53 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id D8078113853F; Wed, 19 Jun 2019 22:10:50 +0200 (CEST) From: Markus Armbruster To: qemu-devel@nongnu.org Date: Wed, 19 Jun 2019 22:10:43 +0200 Message-Id: <20190619201050.19040-11-armbru@redhat.com> In-Reply-To: <20190619201050.19040-1-armbru@redhat.com> References: <20190619201050.19040-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.45]); Wed, 19 Jun 2019 20:10:54 +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 10/17] hw/core: Collect QMP command handlers in hw/core/ X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, Eduardo Habkost Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" The handlers for qapi/machine.json's QMP commands are spread over cpus.c, hw/core/numa.c, monitor/misc.c, monitor/qmp-cmds.c, and vl.c. Move them all to new hw/core/machine-qmp-cmds.c, where they are covered by MAINTAINERS section "Machine core", just like qapi/machine.json. Cc: Eduardo Habkost Cc: Marcel Apfelbaum Signed-off-by: Markus Armbruster Reviewed-by: Daniel P. Berrangé --- MAINTAINERS | 1 + cpus.c | 188 --------------------- hw/core/Makefile.objs | 1 + hw/core/machine-qmp-cmds.c | 328 +++++++++++++++++++++++++++++++++++++ hw/core/numa.c | 62 ------- include/sysemu/numa.h | 2 + monitor/misc.c | 13 -- monitor/qmp-cmds.c | 12 -- vl.c | 45 ----- 9 files changed, 332 insertions(+), 320 deletions(-) create mode 100644 hw/core/machine-qmp-cmds.c diff --git a/MAINTAINERS b/MAINTAINERS index 96a72a999a..0e6d0861ab 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1265,6 +1265,7 @@ Machine core M: Eduardo Habkost M: Marcel Apfelbaum S: Supported +F: hw/core/machine-qmp-cmds.c F: hw/core/machine.c F: hw/core/null-machine.c F: hw/core/numa.c diff --git a/cpus.c b/cpus.c index f5e677b2c4..1c4bc06e4c 100644 --- a/cpus.c +++ b/cpus.c @@ -25,16 +25,13 @@ #include "qemu/osdep.h" #include "qemu-common.h" #include "qemu/config-file.h" -#include "cpu.h" #include "monitor/monitor.h" #include "qapi/error.h" -#include "qapi/qapi-commands-machine.h" #include "qapi/qapi-commands-misc.h" #include "qapi/qapi-events-run-state.h" #include "qapi/qmp/qerror.h" #include "qemu/error-report.h" #include "qemu/qemu-print.h" -#include "sysemu/sysemu.h" #include "sysemu/tcg.h" #include "sysemu/block-backend.h" #include "exec/gdbstub.h" @@ -57,7 +54,6 @@ #include "tcg.h" #include "hw/nmi.h" #include "sysemu/replay.h" -#include "hw/boards.h" #ifdef CONFIG_LINUX @@ -2202,190 +2198,6 @@ void list_cpus(const char *optarg) #endif } -CpuInfoList *qmp_query_cpus(Error **errp) -{ - MachineState *ms = MACHINE(qdev_get_machine()); - MachineClass *mc = MACHINE_GET_CLASS(ms); - CpuInfoList *head = NULL, *cur_item = NULL; - CPUState *cpu; - - CPU_FOREACH(cpu) { - CpuInfoList *info; -#if defined(TARGET_I386) - X86CPU *x86_cpu = X86_CPU(cpu); - CPUX86State *env = &x86_cpu->env; -#elif defined(TARGET_PPC) - PowerPCCPU *ppc_cpu = POWERPC_CPU(cpu); - CPUPPCState *env = &ppc_cpu->env; -#elif defined(TARGET_SPARC) - SPARCCPU *sparc_cpu = SPARC_CPU(cpu); - CPUSPARCState *env = &sparc_cpu->env; -#elif defined(TARGET_RISCV) - RISCVCPU *riscv_cpu = RISCV_CPU(cpu); - CPURISCVState *env = &riscv_cpu->env; -#elif defined(TARGET_MIPS) - MIPSCPU *mips_cpu = MIPS_CPU(cpu); - CPUMIPSState *env = &mips_cpu->env; -#elif defined(TARGET_TRICORE) - TriCoreCPU *tricore_cpu = TRICORE_CPU(cpu); - CPUTriCoreState *env = &tricore_cpu->env; -#elif defined(TARGET_S390X) - S390CPU *s390_cpu = S390_CPU(cpu); - CPUS390XState *env = &s390_cpu->env; -#endif - - cpu_synchronize_state(cpu); - - info = g_malloc0(sizeof(*info)); - info->value = g_malloc0(sizeof(*info->value)); - info->value->CPU = cpu->cpu_index; - info->value->current = (cpu == first_cpu); - info->value->halted = cpu->halted; - info->value->qom_path = object_get_canonical_path(OBJECT(cpu)); - info->value->thread_id = cpu->thread_id; -#if defined(TARGET_I386) - info->value->arch = CPU_INFO_ARCH_X86; - info->value->u.x86.pc = env->eip + env->segs[R_CS].base; -#elif defined(TARGET_PPC) - info->value->arch = CPU_INFO_ARCH_PPC; - info->value->u.ppc.nip = env->nip; -#elif defined(TARGET_SPARC) - info->value->arch = CPU_INFO_ARCH_SPARC; - info->value->u.q_sparc.pc = env->pc; - info->value->u.q_sparc.npc = env->npc; -#elif defined(TARGET_MIPS) - info->value->arch = CPU_INFO_ARCH_MIPS; - info->value->u.q_mips.PC = env->active_tc.PC; -#elif defined(TARGET_TRICORE) - info->value->arch = CPU_INFO_ARCH_TRICORE; - info->value->u.tricore.PC = env->PC; -#elif defined(TARGET_S390X) - info->value->arch = CPU_INFO_ARCH_S390; - info->value->u.s390.cpu_state = env->cpu_state; -#elif defined(TARGET_RISCV) - info->value->arch = CPU_INFO_ARCH_RISCV; - info->value->u.riscv.pc = env->pc; -#else - info->value->arch = CPU_INFO_ARCH_OTHER; -#endif - info->value->has_props = !!mc->cpu_index_to_instance_props; - if (info->value->has_props) { - CpuInstanceProperties *props; - props = g_malloc0(sizeof(*props)); - *props = mc->cpu_index_to_instance_props(ms, cpu->cpu_index); - info->value->props = props; - } - - /* XXX: waiting for the qapi to support GSList */ - if (!cur_item) { - head = cur_item = info; - } else { - cur_item->next = info; - cur_item = info; - } - } - - return head; -} - -static CpuInfoArch sysemu_target_to_cpuinfo_arch(SysEmuTarget target) -{ - /* - * The @SysEmuTarget -> @CpuInfoArch mapping below is based on the - * TARGET_ARCH -> TARGET_BASE_ARCH mapping in the "configure" script. - */ - switch (target) { - case SYS_EMU_TARGET_I386: - case SYS_EMU_TARGET_X86_64: - return CPU_INFO_ARCH_X86; - - case SYS_EMU_TARGET_PPC: - case SYS_EMU_TARGET_PPC64: - return CPU_INFO_ARCH_PPC; - - case SYS_EMU_TARGET_SPARC: - case SYS_EMU_TARGET_SPARC64: - return CPU_INFO_ARCH_SPARC; - - case SYS_EMU_TARGET_MIPS: - case SYS_EMU_TARGET_MIPSEL: - case SYS_EMU_TARGET_MIPS64: - case SYS_EMU_TARGET_MIPS64EL: - return CPU_INFO_ARCH_MIPS; - - case SYS_EMU_TARGET_TRICORE: - return CPU_INFO_ARCH_TRICORE; - - case SYS_EMU_TARGET_S390X: - return CPU_INFO_ARCH_S390; - - case SYS_EMU_TARGET_RISCV32: - case SYS_EMU_TARGET_RISCV64: - return CPU_INFO_ARCH_RISCV; - - default: - return CPU_INFO_ARCH_OTHER; - } -} - -static void cpustate_to_cpuinfo_s390(CpuInfoS390 *info, const CPUState *cpu) -{ -#ifdef TARGET_S390X - S390CPU *s390_cpu = S390_CPU(cpu); - CPUS390XState *env = &s390_cpu->env; - - info->cpu_state = env->cpu_state; -#else - abort(); -#endif -} - -/* - * fast means: we NEVER interrupt vCPU threads to retrieve - * information from KVM. - */ -CpuInfoFastList *qmp_query_cpus_fast(Error **errp) -{ - MachineState *ms = MACHINE(qdev_get_machine()); - MachineClass *mc = MACHINE_GET_CLASS(ms); - CpuInfoFastList *head = NULL, *cur_item = NULL; - SysEmuTarget target = qapi_enum_parse(&SysEmuTarget_lookup, TARGET_NAME, - -1, &error_abort); - CPUState *cpu; - - CPU_FOREACH(cpu) { - CpuInfoFastList *info = g_malloc0(sizeof(*info)); - info->value = g_malloc0(sizeof(*info->value)); - - info->value->cpu_index = cpu->cpu_index; - info->value->qom_path = object_get_canonical_path(OBJECT(cpu)); - info->value->thread_id = cpu->thread_id; - - info->value->has_props = !!mc->cpu_index_to_instance_props; - if (info->value->has_props) { - CpuInstanceProperties *props; - props = g_malloc0(sizeof(*props)); - *props = mc->cpu_index_to_instance_props(ms, cpu->cpu_index); - info->value->props = props; - } - - info->value->arch = sysemu_target_to_cpuinfo_arch(target); - info->value->target = target; - if (target == SYS_EMU_TARGET_S390X) { - cpustate_to_cpuinfo_s390(&info->value->u.s390x, cpu); - } - - if (!cur_item) { - head = cur_item = info; - } else { - cur_item->next = info; - cur_item = info; - } - } - - return head; -} - void qmp_memsave(int64_t addr, int64_t size, const char *filename, bool has_cpu, int64_t cpu_index, Error **errp) { diff --git a/hw/core/Makefile.objs b/hw/core/Makefile.objs index e3a8307be6..99e7abe982 100644 --- a/hw/core/Makefile.objs +++ b/hw/core/Makefile.objs @@ -23,4 +23,5 @@ common-obj-$(CONFIG_PLATFORM_BUS) += platform-bus.o common-obj-$(CONFIG_SOFTMMU) += generic-loader.o common-obj-$(CONFIG_SOFTMMU) += null-machine.o +obj-$(CONFIG_SOFTMMU) += machine-qmp-cmds.o obj-$(CONFIG_SOFTMMU) += numa.o diff --git a/hw/core/machine-qmp-cmds.c b/hw/core/machine-qmp-cmds.c new file mode 100644 index 0000000000..1e08252af7 --- /dev/null +++ b/hw/core/machine-qmp-cmds.c @@ -0,0 +1,328 @@ +/* + * QMP commands related to machines and CPUs + * + * Copyright (C) 2014 Red Hat Inc + * + * This work is licensed under the terms of the GNU GPL, version 2 or later. + * See the COPYING file in the top-level directory. + */ + +#include "qemu/osdep.h" +#include "cpu.h" +#include "hw/boards.h" +#include "qapi/error.h" +#include "qapi/qapi-commands-machine.h" +#include "qapi/qmp/qerror.h" +#include "sysemu/hostmem.h" +#include "sysemu/hw_accel.h" +#include "sysemu/numa.h" +#include "sysemu/sysemu.h" + +CpuInfoList *qmp_query_cpus(Error **errp) +{ + MachineState *ms = MACHINE(qdev_get_machine()); + MachineClass *mc = MACHINE_GET_CLASS(ms); + CpuInfoList *head = NULL, *cur_item = NULL; + CPUState *cpu; + + CPU_FOREACH(cpu) { + CpuInfoList *info; +#if defined(TARGET_I386) + X86CPU *x86_cpu = X86_CPU(cpu); + CPUX86State *env = &x86_cpu->env; +#elif defined(TARGET_PPC) + PowerPCCPU *ppc_cpu = POWERPC_CPU(cpu); + CPUPPCState *env = &ppc_cpu->env; +#elif defined(TARGET_SPARC) + SPARCCPU *sparc_cpu = SPARC_CPU(cpu); + CPUSPARCState *env = &sparc_cpu->env; +#elif defined(TARGET_RISCV) + RISCVCPU *riscv_cpu = RISCV_CPU(cpu); + CPURISCVState *env = &riscv_cpu->env; +#elif defined(TARGET_MIPS) + MIPSCPU *mips_cpu = MIPS_CPU(cpu); + CPUMIPSState *env = &mips_cpu->env; +#elif defined(TARGET_TRICORE) + TriCoreCPU *tricore_cpu = TRICORE_CPU(cpu); + CPUTriCoreState *env = &tricore_cpu->env; +#elif defined(TARGET_S390X) + S390CPU *s390_cpu = S390_CPU(cpu); + CPUS390XState *env = &s390_cpu->env; +#endif + + cpu_synchronize_state(cpu); + + info = g_malloc0(sizeof(*info)); + info->value = g_malloc0(sizeof(*info->value)); + info->value->CPU = cpu->cpu_index; + info->value->current = (cpu == first_cpu); + info->value->halted = cpu->halted; + info->value->qom_path = object_get_canonical_path(OBJECT(cpu)); + info->value->thread_id = cpu->thread_id; +#if defined(TARGET_I386) + info->value->arch = CPU_INFO_ARCH_X86; + info->value->u.x86.pc = env->eip + env->segs[R_CS].base; +#elif defined(TARGET_PPC) + info->value->arch = CPU_INFO_ARCH_PPC; + info->value->u.ppc.nip = env->nip; +#elif defined(TARGET_SPARC) + info->value->arch = CPU_INFO_ARCH_SPARC; + info->value->u.q_sparc.pc = env->pc; + info->value->u.q_sparc.npc = env->npc; +#elif defined(TARGET_MIPS) + info->value->arch = CPU_INFO_ARCH_MIPS; + info->value->u.q_mips.PC = env->active_tc.PC; +#elif defined(TARGET_TRICORE) + info->value->arch = CPU_INFO_ARCH_TRICORE; + info->value->u.tricore.PC = env->PC; +#elif defined(TARGET_S390X) + info->value->arch = CPU_INFO_ARCH_S390; + info->value->u.s390.cpu_state = env->cpu_state; +#elif defined(TARGET_RISCV) + info->value->arch = CPU_INFO_ARCH_RISCV; + info->value->u.riscv.pc = env->pc; +#else + info->value->arch = CPU_INFO_ARCH_OTHER; +#endif + info->value->has_props = !!mc->cpu_index_to_instance_props; + if (info->value->has_props) { + CpuInstanceProperties *props; + props = g_malloc0(sizeof(*props)); + *props = mc->cpu_index_to_instance_props(ms, cpu->cpu_index); + info->value->props = props; + } + + /* XXX: waiting for the qapi to support GSList */ + if (!cur_item) { + head = cur_item = info; + } else { + cur_item->next = info; + cur_item = info; + } + } + + return head; +} + +static CpuInfoArch sysemu_target_to_cpuinfo_arch(SysEmuTarget target) +{ + /* + * The @SysEmuTarget -> @CpuInfoArch mapping below is based on the + * TARGET_ARCH -> TARGET_BASE_ARCH mapping in the "configure" script. + */ + switch (target) { + case SYS_EMU_TARGET_I386: + case SYS_EMU_TARGET_X86_64: + return CPU_INFO_ARCH_X86; + + case SYS_EMU_TARGET_PPC: + case SYS_EMU_TARGET_PPC64: + return CPU_INFO_ARCH_PPC; + + case SYS_EMU_TARGET_SPARC: + case SYS_EMU_TARGET_SPARC64: + return CPU_INFO_ARCH_SPARC; + + case SYS_EMU_TARGET_MIPS: + case SYS_EMU_TARGET_MIPSEL: + case SYS_EMU_TARGET_MIPS64: + case SYS_EMU_TARGET_MIPS64EL: + return CPU_INFO_ARCH_MIPS; + + case SYS_EMU_TARGET_TRICORE: + return CPU_INFO_ARCH_TRICORE; + + case SYS_EMU_TARGET_S390X: + return CPU_INFO_ARCH_S390; + + case SYS_EMU_TARGET_RISCV32: + case SYS_EMU_TARGET_RISCV64: + return CPU_INFO_ARCH_RISCV; + + default: + return CPU_INFO_ARCH_OTHER; + } +} + +static void cpustate_to_cpuinfo_s390(CpuInfoS390 *info, const CPUState *cpu) +{ +#ifdef TARGET_S390X + S390CPU *s390_cpu = S390_CPU(cpu); + CPUS390XState *env = &s390_cpu->env; + + info->cpu_state = env->cpu_state; +#else + abort(); +#endif +} + +/* + * fast means: we NEVER interrupt vCPU threads to retrieve + * information from KVM. + */ +CpuInfoFastList *qmp_query_cpus_fast(Error **errp) +{ + MachineState *ms = MACHINE(qdev_get_machine()); + MachineClass *mc = MACHINE_GET_CLASS(ms); + CpuInfoFastList *head = NULL, *cur_item = NULL; + SysEmuTarget target = qapi_enum_parse(&SysEmuTarget_lookup, TARGET_NAME, + -1, &error_abort); + CPUState *cpu; + + CPU_FOREACH(cpu) { + CpuInfoFastList *info = g_malloc0(sizeof(*info)); + info->value = g_malloc0(sizeof(*info->value)); + + info->value->cpu_index = cpu->cpu_index; + info->value->qom_path = object_get_canonical_path(OBJECT(cpu)); + info->value->thread_id = cpu->thread_id; + + info->value->has_props = !!mc->cpu_index_to_instance_props; + if (info->value->has_props) { + CpuInstanceProperties *props; + props = g_malloc0(sizeof(*props)); + *props = mc->cpu_index_to_instance_props(ms, cpu->cpu_index); + info->value->props = props; + } + + info->value->arch = sysemu_target_to_cpuinfo_arch(target); + info->value->target = target; + if (target == SYS_EMU_TARGET_S390X) { + cpustate_to_cpuinfo_s390(&info->value->u.s390x, cpu); + } + + if (!cur_item) { + head = cur_item = info; + } else { + cur_item->next = info; + cur_item = info; + } + } + + return head; +} + +MachineInfoList *qmp_query_machines(Error **errp) +{ + GSList *el, *machines = object_class_get_list(TYPE_MACHINE, false); + MachineInfoList *mach_list = NULL; + + for (el = machines; el; el = el->next) { + MachineClass *mc = el->data; + MachineInfoList *entry; + MachineInfo *info; + + info = g_malloc0(sizeof(*info)); + if (mc->is_default) { + info->has_is_default = true; + info->is_default = true; + } + + if (mc->alias) { + info->has_alias = true; + info->alias = g_strdup(mc->alias); + } + + info->name = g_strdup(mc->name); + info->cpu_max = !mc->max_cpus ? 1 : mc->max_cpus; + info->hotpluggable_cpus = mc->has_hotpluggable_cpus; + + entry = g_malloc0(sizeof(*entry)); + entry->value = info; + entry->next = mach_list; + mach_list = entry; + } + + g_slist_free(machines); + return mach_list; +} + +CurrentMachineParams *qmp_query_current_machine(Error **errp) +{ + CurrentMachineParams *params = g_malloc0(sizeof(*params)); + params->wakeup_suspend_support = qemu_wakeup_suspend_enabled(); + + return params; +} + +HotpluggableCPUList *qmp_query_hotpluggable_cpus(Error **errp) +{ + MachineState *ms = MACHINE(qdev_get_machine()); + MachineClass *mc = MACHINE_GET_CLASS(ms); + + if (!mc->has_hotpluggable_cpus) { + error_setg(errp, QERR_FEATURE_DISABLED, "query-hotpluggable-cpus"); + return NULL; + } + + return machine_query_hotpluggable_cpus(ms); +} + +void qmp_cpu_add(int64_t id, Error **errp) +{ + MachineClass *mc; + + mc = MACHINE_GET_CLASS(current_machine); + if (mc->hot_add_cpu) { + mc->hot_add_cpu(id, errp); + } else { + error_setg(errp, "Not supported"); + } +} + +void qmp_set_numa_node(NumaOptions *cmd, Error **errp) +{ + if (!runstate_check(RUN_STATE_PRECONFIG)) { + error_setg(errp, "The command is permitted only in '%s' state", + RunState_str(RUN_STATE_PRECONFIG)); + return; + } + + set_numa_options(MACHINE(qdev_get_machine()), cmd, errp); +} + +static int query_memdev(Object *obj, void *opaque) +{ + MemdevList **list = opaque; + MemdevList *m = NULL; + + if (object_dynamic_cast(obj, TYPE_MEMORY_BACKEND)) { + m = g_malloc0(sizeof(*m)); + + m->value = g_malloc0(sizeof(*m->value)); + + m->value->id = object_get_canonical_path_component(obj); + m->value->has_id = !!m->value->id; + + m->value->size = object_property_get_uint(obj, "size", + &error_abort); + m->value->merge = object_property_get_bool(obj, "merge", + &error_abort); + m->value->dump = object_property_get_bool(obj, "dump", + &error_abort); + m->value->prealloc = object_property_get_bool(obj, + "prealloc", + &error_abort); + m->value->policy = object_property_get_enum(obj, + "policy", + "HostMemPolicy", + &error_abort); + object_property_get_uint16List(obj, "host-nodes", + &m->value->host_nodes, + &error_abort); + + m->next = *list; + *list = m; + } + + return 0; +} + +MemdevList *qmp_query_memdev(Error **errp) +{ + Object *obj = object_get_objects_root(); + MemdevList *list = NULL; + + object_child_foreach(obj, query_memdev, &list); + return list; +} diff --git a/hw/core/numa.c b/hw/core/numa.c index 6f85407c46..76c447f90a 100644 --- a/hw/core/numa.c +++ b/hw/core/numa.c @@ -27,14 +27,10 @@ #include "exec/cpu-common.h" #include "exec/ramlist.h" #include "qemu/bitmap.h" -#include "qom/cpu.h" #include "qemu/error-report.h" #include "qapi/error.h" #include "qapi/opts-visitor.h" -#include "qapi/qapi-commands-machine.h" #include "qapi/qapi-visit-machine.h" -#include "hw/boards.h" -#include "sysemu/hostmem.h" #include "hw/mem/pc-dimm.h" #include "hw/mem/memory-device.h" #include "qemu/option.h" @@ -174,7 +170,6 @@ static void parse_numa_distance(NumaDistOptions *dist, Error **errp) have_numa_distance = true; } -static void set_numa_options(MachineState *ms, NumaOptions *object, Error **errp) { Error *err = NULL; @@ -447,17 +442,6 @@ void parse_numa_opts(MachineState *ms) qemu_opts_foreach(qemu_find_opts("numa"), parse_numa, ms, &error_fatal); } -void qmp_set_numa_node(NumaOptions *cmd, Error **errp) -{ - if (!runstate_check(RUN_STATE_PRECONFIG)) { - error_setg(errp, "The command is permitted only in '%s' state", - RunState_str(RUN_STATE_PRECONFIG)); - return; - } - - set_numa_options(MACHINE(qdev_get_machine()), cmd, errp); -} - void numa_cpu_pre_plug(const CPUArchId *slot, DeviceState *dev, Error **errp) { int node_id = object_property_get_int(OBJECT(dev), "node-id", &error_abort); @@ -592,52 +576,6 @@ void query_numa_node_mem(NumaNodeMem node_mem[]) } } -static int query_memdev(Object *obj, void *opaque) -{ - MemdevList **list = opaque; - MemdevList *m = NULL; - - if (object_dynamic_cast(obj, TYPE_MEMORY_BACKEND)) { - m = g_malloc0(sizeof(*m)); - - m->value = g_malloc0(sizeof(*m->value)); - - m->value->id = object_get_canonical_path_component(obj); - m->value->has_id = !!m->value->id; - - m->value->size = object_property_get_uint(obj, "size", - &error_abort); - m->value->merge = object_property_get_bool(obj, "merge", - &error_abort); - m->value->dump = object_property_get_bool(obj, "dump", - &error_abort); - m->value->prealloc = object_property_get_bool(obj, - "prealloc", - &error_abort); - m->value->policy = object_property_get_enum(obj, - "policy", - "HostMemPolicy", - &error_abort); - object_property_get_uint16List(obj, "host-nodes", - &m->value->host_nodes, - &error_abort); - - m->next = *list; - *list = m; - } - - return 0; -} - -MemdevList *qmp_query_memdev(Error **errp) -{ - Object *obj = object_get_objects_root(); - MemdevList *list = NULL; - - object_child_foreach(obj, query_memdev, &list); - return list; -} - void ram_block_notifier_add(RAMBlockNotifier *n) { QLIST_INSERT_HEAD(&ram_list.ramblock_notifiers, n, next); diff --git a/include/sysemu/numa.h b/include/sysemu/numa.h index b6ac7de43e..01a263eba2 100644 --- a/include/sysemu/numa.h +++ b/include/sysemu/numa.h @@ -22,6 +22,8 @@ struct NumaNodeMem { }; extern NodeInfo numa_info[MAX_NODES]; + +void set_numa_options(MachineState *ms, NumaOptions *object, Error **errp); void parse_numa_opts(MachineState *ms); void numa_complete_configuration(MachineState *ms); void query_numa_node_mem(NumaNodeMem node_mem[]); diff --git a/monitor/misc.c b/monitor/misc.c index 2fb6896e84..45f3f55a4d 100644 --- a/monitor/misc.c +++ b/monitor/misc.c @@ -2338,16 +2338,3 @@ void monitor_init_globals(void) sortcmdlist(); qemu_mutex_init(&mon_fdsets_lock); } - -HotpluggableCPUList *qmp_query_hotpluggable_cpus(Error **errp) -{ - MachineState *ms = MACHINE(qdev_get_machine()); - MachineClass *mc = MACHINE_GET_CLASS(ms); - - if (!mc->has_hotpluggable_cpus) { - error_setg(errp, QERR_FEATURE_DISABLED, "query-hotpluggable-cpus"); - return NULL; - } - - return machine_query_hotpluggable_cpus(ms); -} diff --git a/monitor/qmp-cmds.c b/monitor/qmp-cmds.c index 58b54db033..8c55315839 100644 --- a/monitor/qmp-cmds.c +++ b/monitor/qmp-cmds.c @@ -114,18 +114,6 @@ void qmp_system_powerdown(Error **erp) qemu_system_powerdown_request(); } -void qmp_cpu_add(int64_t id, Error **errp) -{ - MachineClass *mc; - - mc = MACHINE_GET_CLASS(current_machine); - if (mc->hot_add_cpu) { - mc->hot_add_cpu(id, errp); - } else { - error_setg(errp, "Not supported"); - } -} - void qmp_x_exit_preconfig(Error **errp) { if (!runstate_check(RUN_STATE_PRECONFIG)) { diff --git a/vl.c b/vl.c index 0eb9b2c8bd..ddefa75c1d 100644 --- a/vl.c +++ b/vl.c @@ -55,7 +55,6 @@ int main(int argc, char **argv) #include "qemu/error-report.h" #include "qemu/sockets.h" #include "hw/hw.h" -#include "hw/boards.h" #include "sysemu/accel.h" #include "hw/usb.h" #include "hw/isa/isa.h" @@ -125,7 +124,6 @@ int main(int argc, char **argv) #include "qapi/qapi-visit-block-core.h" #include "qapi/qapi-visit-ui.h" #include "qapi/qapi-commands-block-core.h" -#include "qapi/qapi-commands-machine.h" #include "qapi/qapi-commands-run-state.h" #include "qapi/qapi-commands-ui.h" #include "qapi/qmp/qerror.h" @@ -1406,41 +1404,6 @@ static MachineClass *find_default_machine(GSList *machines) return NULL; } -MachineInfoList *qmp_query_machines(Error **errp) -{ - GSList *el, *machines = object_class_get_list(TYPE_MACHINE, false); - MachineInfoList *mach_list = NULL; - - for (el = machines; el; el = el->next) { - MachineClass *mc = el->data; - MachineInfoList *entry; - MachineInfo *info; - - info = g_malloc0(sizeof(*info)); - if (mc->is_default) { - info->has_is_default = true; - info->is_default = true; - } - - if (mc->alias) { - info->has_alias = true; - info->alias = g_strdup(mc->alias); - } - - info->name = g_strdup(mc->name); - info->cpu_max = !mc->max_cpus ? 1 : mc->max_cpus; - info->hotpluggable_cpus = mc->has_hotpluggable_cpus; - - entry = g_malloc0(sizeof(*entry)); - entry->value = info; - entry->next = mach_list; - mach_list = entry; - } - - g_slist_free(machines); - return mach_list; -} - static int machine_help_func(QemuOpts *opts, MachineState *machine) { ObjectProperty *prop; @@ -1739,14 +1702,6 @@ bool qemu_wakeup_suspend_enabled(void) return wakeup_suspend_enabled; } -CurrentMachineParams *qmp_query_current_machine(Error **errp) -{ - CurrentMachineParams *params = g_malloc0(sizeof(*params)); - params->wakeup_suspend_support = qemu_wakeup_suspend_enabled(); - - return params; -} - void qemu_system_killed(int signal, pid_t pid) { shutdown_signal = signal; From patchwork Wed Jun 19 20:10:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Markus Armbruster X-Patchwork-Id: 1118991 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 45TbmZ2PtXz9s4V for ; Thu, 20 Jun 2019 06:15:42 +1000 (AEST) Received: from localhost ([::1]:41686 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hdgzb-0008Dr-I4 for incoming@patchwork.ozlabs.org; Wed, 19 Jun 2019 16:15:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35344) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hdgv9-0004K4-RW for qemu-devel@nongnu.org; Wed, 19 Jun 2019 16:11:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hdgv5-00017g-Mz for qemu-devel@nongnu.org; Wed, 19 Jun 2019 16:11:03 -0400 Received: from mx1.redhat.com ([209.132.183.28]:46554) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hdgv4-00012k-5P for qemu-devel@nongnu.org; Wed, 19 Jun 2019 16:10:59 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 737B6C04BD4A; Wed, 19 Jun 2019 20:10:54 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-116-85.ams2.redhat.com [10.36.116.85]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C23181001DD1; Wed, 19 Jun 2019 20:10:53 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id DF45E11384D2; Wed, 19 Jun 2019 22:10:50 +0200 (CEST) From: Markus Armbruster To: qemu-devel@nongnu.org Date: Wed, 19 Jun 2019 22:10:44 +0200 Message-Id: <20190619201050.19040-12-armbru@redhat.com> In-Reply-To: <20190619201050.19040-1-armbru@redhat.com> References: <20190619201050.19040-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Wed, 19 Jun 2019 20:10:54 +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 11/17] hw/core: Collect HMP command handlers in hw/core/ X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, Eduardo Habkost , "Dr. David Alan Gilbert" Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Move the HMP handlers related to qapi/machine.json to hw/core/machine-hmp-cmds.c, where they are covered by MAINTAINERS section "Machine core", just like qapi/machine.json. Cc: Eduardo Habkost Cc: Marcel Apfelbaum Cc: "Dr. David Alan Gilbert" Signed-off-by: Markus Armbruster Reviewed-by: Daniel P. Berrangé Reviewed-by: Dr. David Alan Gilbert --- hw/core/Makefile.objs | 1 + hw/core/machine-hmp-cmds.c | 164 +++++++++++++++++++++++++++++++++++++ include/monitor/hmp.h | 1 + monitor/hmp-cmds.c | 111 ------------------------- monitor/misc.c | 32 +------- 5 files changed, 168 insertions(+), 141 deletions(-) create mode 100644 hw/core/machine-hmp-cmds.c diff --git a/hw/core/Makefile.objs b/hw/core/Makefile.objs index 99e7abe982..585b734358 100644 --- a/hw/core/Makefile.objs +++ b/hw/core/Makefile.objs @@ -25,3 +25,4 @@ common-obj-$(CONFIG_SOFTMMU) += null-machine.o obj-$(CONFIG_SOFTMMU) += machine-qmp-cmds.o obj-$(CONFIG_SOFTMMU) += numa.o +common-obj-$(CONFIG_SOFTMMU) += machine-hmp-cmds.o diff --git a/hw/core/machine-hmp-cmds.c b/hw/core/machine-hmp-cmds.c new file mode 100644 index 0000000000..7fa6075f1e --- /dev/null +++ b/hw/core/machine-hmp-cmds.c @@ -0,0 +1,164 @@ +/* + * HMP commands related to machines and CPUs + * + * Copyright IBM, Corp. 2011 + * + * Authors: + * Anthony Liguori + * + * This work is licensed under the terms of the GNU GPL, version 2. See + * the COPYING file in the top-level directory. + * + * Contributions after 2012-01-13 are licensed under the terms of the + * GNU GPL, version 2 or (at your option) any later version. + */ + +#include "qemu/osdep.h" +#include "monitor/hmp.h" +#include "monitor/monitor.h" +#include "qapi/error.h" +#include "qapi/qapi-builtin-visit.h" +#include "qapi/qapi-commands-machine.h" +#include "qapi/qmp/qdict.h" +#include "qapi/string-output-visitor.h" +#include "qemu/error-report.h" +#include "sysemu/numa.h" + +void hmp_info_cpus(Monitor *mon, const QDict *qdict) +{ + CpuInfoFastList *cpu_list, *cpu; + + cpu_list = qmp_query_cpus_fast(NULL); + + for (cpu = cpu_list; cpu; cpu = cpu->next) { + int active = ' '; + + if (cpu->value->cpu_index == monitor_get_cpu_index()) { + active = '*'; + } + + monitor_printf(mon, "%c CPU #%" PRId64 ":", active, + cpu->value->cpu_index); + monitor_printf(mon, " thread_id=%" PRId64 "\n", cpu->value->thread_id); + } + + qapi_free_CpuInfoFastList(cpu_list); +} + +void hmp_cpu_add(Monitor *mon, const QDict *qdict) +{ + int cpuid; + Error *err = NULL; + + error_report("cpu_add is deprecated, please use device_add instead"); + + cpuid = qdict_get_int(qdict, "id"); + qmp_cpu_add(cpuid, &err); + hmp_handle_error(mon, &err); +} + +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_id) { + monitor_printf(mon, " node-id: \"%" PRIu64 "\"\n", c->node_id); + } + if (c->has_socket_id) { + monitor_printf(mon, " socket-id: \"%" PRIu64 "\"\n", c->socket_id); + } + if (c->has_core_id) { + monitor_printf(mon, " core-id: \"%" PRIu64 "\"\n", c->core_id); + } + if (c->has_thread_id) { + monitor_printf(mon, " thread-id: \"%" PRIu64 "\"\n", c->thread_id); + } + + l = l->next; + } + + qapi_free_HotpluggableCPUList(saved); +} + +void hmp_info_memdev(Monitor *mon, const QDict *qdict) +{ + Error *err = NULL; + MemdevList *memdev_list = qmp_query_memdev(&err); + MemdevList *m = memdev_list; + Visitor *v; + char *str; + + while (m) { + v = string_output_visitor_new(false, &str); + visit_type_uint16List(v, NULL, &m->value->host_nodes, NULL); + monitor_printf(mon, "memory backend: %s\n", m->value->id); + monitor_printf(mon, " size: %" PRId64 "\n", m->value->size); + monitor_printf(mon, " merge: %s\n", + m->value->merge ? "true" : "false"); + monitor_printf(mon, " dump: %s\n", + m->value->dump ? "true" : "false"); + monitor_printf(mon, " prealloc: %s\n", + m->value->prealloc ? "true" : "false"); + monitor_printf(mon, " policy: %s\n", + HostMemPolicy_str(m->value->policy)); + visit_complete(v, &str); + monitor_printf(mon, " host nodes: %s\n", str); + + g_free(str); + visit_free(v); + m = m->next; + } + + monitor_printf(mon, "\n"); + + qapi_free_MemdevList(memdev_list); + hmp_handle_error(mon, &err); +} + +void hmp_info_numa(Monitor *mon, const QDict *qdict) +{ + int i; + NumaNodeMem *node_mem; + CpuInfoList *cpu_list, *cpu; + + cpu_list = qmp_query_cpus(&error_abort); + node_mem = g_new0(NumaNodeMem, nb_numa_nodes); + + query_numa_node_mem(node_mem); + monitor_printf(mon, "%d nodes\n", nb_numa_nodes); + for (i = 0; i < nb_numa_nodes; i++) { + monitor_printf(mon, "node %d cpus:", i); + for (cpu = cpu_list; cpu; cpu = cpu->next) { + if (cpu->value->has_props && cpu->value->props->has_node_id && + cpu->value->props->node_id == i) { + monitor_printf(mon, " %" PRIi64, cpu->value->CPU); + } + } + monitor_printf(mon, "\n"); + monitor_printf(mon, "node %d size: %" PRId64 " MB\n", i, + node_mem[i].node_mem >> 20); + monitor_printf(mon, "node %d plugged: %" PRId64 " MB\n", i, + node_mem[i].node_plugged_mem >> 20); + } + qapi_free_CpuInfoList(cpu_list); + g_free(node_mem); +} diff --git a/include/monitor/hmp.h b/include/monitor/hmp.h index f46ccdaa35..9d558e9d78 100644 --- a/include/monitor/hmp.h +++ b/include/monitor/hmp.h @@ -117,6 +117,7 @@ void hmp_cpu_add(Monitor *mon, const QDict *qdict); void hmp_object_add(Monitor *mon, const QDict *qdict); void hmp_object_del(Monitor *mon, const QDict *qdict); void hmp_info_memdev(Monitor *mon, const QDict *qdict); +void hmp_info_numa(Monitor *mon, const QDict *qdict); void hmp_info_memory_devices(Monitor *mon, const QDict *qdict); void hmp_qom_list(Monitor *mon, const QDict *qdict); void hmp_qom_set(Monitor *mon, const QDict *qdict); diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c index 789f763938..ea8ae2966e 100644 --- a/monitor/hmp-cmds.c +++ b/monitor/hmp-cmds.c @@ -31,7 +31,6 @@ #include "qapi/qapi-builtin-visit.h" #include "qapi/qapi-commands-block.h" #include "qapi/qapi-commands-char.h" -#include "qapi/qapi-commands-machine.h" #include "qapi/qapi-commands-migration.h" #include "qapi/qapi-commands-misc.h" #include "qapi/qapi-commands-net.h" @@ -457,27 +456,6 @@ void hmp_info_migrate_cache_size(Monitor *mon, const QDict *qdict) qmp_query_migrate_cache_size(NULL) >> 10); } -void hmp_info_cpus(Monitor *mon, const QDict *qdict) -{ - CpuInfoFastList *cpu_list, *cpu; - - cpu_list = qmp_query_cpus_fast(NULL); - - for (cpu = cpu_list; cpu; cpu = cpu->next) { - int active = ' '; - - if (cpu->value->cpu_index == monitor_get_cpu_index()) { - active = '*'; - } - - monitor_printf(mon, "%c CPU #%" PRId64 ":", active, - cpu->value->cpu_index); - monitor_printf(mon, " thread_id=%" PRId64 "\n", cpu->value->thread_id); - } - - qapi_free_CpuInfoFastList(cpu_list); -} - static void print_block_info(Monitor *mon, BlockInfo *info, BlockDeviceInfo *inserted, bool verbose) { @@ -2472,18 +2450,6 @@ void hmp_nbd_server_stop(Monitor *mon, const QDict *qdict) hmp_handle_error(mon, &err); } -void hmp_cpu_add(Monitor *mon, const QDict *qdict) -{ - int cpuid; - Error *err = NULL; - - error_report("cpu_add is deprecated, please use device_add instead"); - - cpuid = qdict_get_int(qdict, "id"); - qmp_cpu_add(cpuid, &err); - hmp_handle_error(mon, &err); -} - void hmp_chardev_add(Monitor *mon, const QDict *qdict) { const char *args = qdict_get_str(qdict, "args"); @@ -2615,41 +2581,6 @@ void hmp_object_del(Monitor *mon, const QDict *qdict) hmp_handle_error(mon, &err); } -void hmp_info_memdev(Monitor *mon, const QDict *qdict) -{ - Error *err = NULL; - MemdevList *memdev_list = qmp_query_memdev(&err); - MemdevList *m = memdev_list; - Visitor *v; - char *str; - - while (m) { - v = string_output_visitor_new(false, &str); - visit_type_uint16List(v, NULL, &m->value->host_nodes, NULL); - monitor_printf(mon, "memory backend: %s\n", m->value->id); - monitor_printf(mon, " size: %" PRId64 "\n", m->value->size); - monitor_printf(mon, " merge: %s\n", - m->value->merge ? "true" : "false"); - monitor_printf(mon, " dump: %s\n", - m->value->dump ? "true" : "false"); - monitor_printf(mon, " prealloc: %s\n", - m->value->prealloc ? "true" : "false"); - monitor_printf(mon, " policy: %s\n", - HostMemPolicy_str(m->value->policy)); - visit_complete(v, &str); - monitor_printf(mon, " host nodes: %s\n", str); - - g_free(str); - visit_free(v); - m = m->next; - } - - monitor_printf(mon, "\n"); - - qapi_free_MemdevList(memdev_list); - hmp_handle_error(mon, &err); -} - void hmp_info_memory_devices(Monitor *mon, const QDict *qdict) { Error *err = NULL; @@ -3039,48 +2970,6 @@ void hmp_info_ramblock(Monitor *mon, const QDict *qdict) ram_block_dump(mon); } -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_id) { - monitor_printf(mon, " node-id: \"%" PRIu64 "\"\n", c->node_id); - } - if (c->has_socket_id) { - monitor_printf(mon, " socket-id: \"%" PRIu64 "\"\n", c->socket_id); - } - if (c->has_core_id) { - monitor_printf(mon, " core-id: \"%" PRIu64 "\"\n", c->core_id); - } - if (c->has_thread_id) { - monitor_printf(mon, " thread-id: \"%" PRIu64 "\"\n", c->thread_id); - } - - l = l->next; - } - - qapi_free_HotpluggableCPUList(saved); -} - void hmp_info_vm_generation_id(Monitor *mon, const QDict *qdict) { Error *err = NULL; diff --git a/monitor/misc.c b/monitor/misc.c index 45f3f55a4d..00338c002a 100644 --- a/monitor/misc.c +++ b/monitor/misc.c @@ -36,7 +36,6 @@ #include "net/slirp.h" #include "chardev/char-mux.h" #include "ui/qemu-spice.h" -#include "sysemu/numa.h" #include "qemu/config-file.h" #include "qemu/ctype.h" #include "ui/console.h" @@ -48,6 +47,8 @@ #include "sysemu/hw_accel.h" #include "authz/list.h" #include "qapi/util.h" +#include "sysemu/blockdev.h" +#include "sysemu/sysemu.h" #include "sysemu/tcg.h" #include "sysemu/tpm.h" #include "qapi/qmp/qdict.h" @@ -1081,35 +1082,6 @@ static void hmp_info_mtree(Monitor *mon, const QDict *qdict) mtree_info(flatview, dispatch_tree, owner); } -static void hmp_info_numa(Monitor *mon, const QDict *qdict) -{ - int i; - NumaNodeMem *node_mem; - CpuInfoList *cpu_list, *cpu; - - cpu_list = qmp_query_cpus(&error_abort); - node_mem = g_new0(NumaNodeMem, nb_numa_nodes); - - query_numa_node_mem(node_mem); - monitor_printf(mon, "%d nodes\n", nb_numa_nodes); - for (i = 0; i < nb_numa_nodes; i++) { - monitor_printf(mon, "node %d cpus:", i); - for (cpu = cpu_list; cpu; cpu = cpu->next) { - if (cpu->value->has_props && cpu->value->props->has_node_id && - cpu->value->props->node_id == i) { - monitor_printf(mon, " %" PRIi64, cpu->value->CPU); - } - } - monitor_printf(mon, "\n"); - monitor_printf(mon, "node %d size: %" PRId64 " MB\n", i, - node_mem[i].node_mem >> 20); - monitor_printf(mon, "node %d plugged: %" PRId64 " MB\n", i, - node_mem[i].node_plugged_mem >> 20); - } - qapi_free_CpuInfoList(cpu_list); - g_free(node_mem); -} - #ifdef CONFIG_PROFILER int64_t dev_time; From patchwork Wed Jun 19 20:10:45 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Markus Armbruster X-Patchwork-Id: 1118998 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 45TbyX0xH6z9sBp for ; Thu, 20 Jun 2019 06:24:20 +1000 (AEST) Received: from localhost ([::1]:41738 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hdh7y-0007hZ-5i for incoming@patchwork.ozlabs.org; Wed, 19 Jun 2019 16:24:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35398) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hdgvC-0004Ks-BM for qemu-devel@nongnu.org; Wed, 19 Jun 2019 16:11:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hdgv4-000167-4i for qemu-devel@nongnu.org; Wed, 19 Jun 2019 16:11:04 -0400 Received: from mx1.redhat.com ([209.132.183.28]:51350) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hdgv3-00012x-5C for qemu-devel@nongnu.org; Wed, 19 Jun 2019 16:10:57 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9F65DC1EB1FE; Wed, 19 Jun 2019 20:10:54 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-116-85.ams2.redhat.com [10.36.116.85]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C4C2B5C21E; Wed, 19 Jun 2019 20:10:53 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id E75A01138407; Wed, 19 Jun 2019 22:10:50 +0200 (CEST) From: Markus Armbruster To: qemu-devel@nongnu.org Date: Wed, 19 Jun 2019 22:10:45 +0200 Message-Id: <20190619201050.19040-13-armbru@redhat.com> In-Reply-To: <20190619201050.19040-1-armbru@redhat.com> References: <20190619201050.19040-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Wed, 19 Jun 2019 20:10:54 +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 12/17] qapi: Split machine-target.json off target.json and misc.json X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, Eduardo Habkost Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Move commands query-cpu-definitions, query-cpu-model-baseline, query-cpu-model-comparison, and query-cpu-model-expansion with their types from target.json to machine-target.json. Also move typee CpuModelInfo, CpuModelExpansionType, and CpuModelCompareResult from misc.json there. Add machine-target.json to MAINTAINERS section "Machine core". Cc: Eduardo Habkost Cc: Marcel Apfelbaum Signed-off-by: Markus Armbruster Reviewed-by: Daniel P. Berrangé --- MAINTAINERS | 1 + qapi/Makefile.objs | 2 +- qapi/machine-target.json | 318 ++++++++++++++++++++++++++++++++ qapi/misc.json | 74 -------- qapi/qapi-schema.json | 1 + qapi/target.json | 242 ------------------------ target/arm/helper.c | 2 +- target/i386/cpu.c | 2 +- target/mips/helper.c | 2 +- target/ppc/translate_init.inc.c | 2 +- target/s390x/cpu_models.c | 2 +- 11 files changed, 326 insertions(+), 322 deletions(-) create mode 100644 qapi/machine-target.json diff --git a/MAINTAINERS b/MAINTAINERS index 0e6d0861ab..89e8c01cf3 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1271,6 +1271,7 @@ F: hw/core/null-machine.c F: hw/core/numa.c F: hw/cpu/cluster.c F: qapi/machine.json +F: qapi/machine-target.json F: qom/cpu.c F: include/hw/boards.h F: include/hw/cpu/cluster.h diff --git a/qapi/Makefile.objs b/qapi/Makefile.objs index 01dced01aa..4e87bef6e1 100644 --- a/qapi/Makefile.objs +++ b/qapi/Makefile.objs @@ -9,7 +9,7 @@ QAPI_COMMON_MODULES = audio authz block-core block char common crypto QAPI_COMMON_MODULES += introspect job machine migration misc net QAPI_COMMON_MODULES += qdev qom rdma rocker run-state sockets tpm QAPI_COMMON_MODULES += trace transaction ui -QAPI_TARGET_MODULES = target +QAPI_TARGET_MODULES = machine-target target QAPI_MODULES = $(QAPI_COMMON_MODULES) $(QAPI_TARGET_MODULES) util-obj-y += qapi-builtin-types.o diff --git a/qapi/machine-target.json b/qapi/machine-target.json new file mode 100644 index 0000000000..5d7480f6ab --- /dev/null +++ b/qapi/machine-target.json @@ -0,0 +1,318 @@ +# -*- Mode: Python -*- +# +# This work is licensed under the terms of the GNU GPL, version 2 or later. +# See the COPYING file in the top-level directory. + +## +# @CpuModelInfo: +# +# Virtual CPU model. +# +# A CPU model consists of the name of a CPU definition, to which +# delta changes are applied (e.g. features added/removed). Most magic values +# that an architecture might require should be hidden behind the name. +# However, if required, architectures can expose relevant properties. +# +# @name: the name of the CPU definition the model is based on +# @props: a dictionary of QOM properties to be applied +# +# Since: 2.8.0 +## +{ 'struct': 'CpuModelInfo', + 'data': { 'name': 'str', + '*props': 'any' } } + +## +# @CpuModelExpansionType: +# +# An enumeration of CPU model expansion types. +# +# @static: Expand to a static CPU model, a combination of a static base +# model name and property delta changes. As the static base model will +# never change, the expanded CPU model will be the same, independent of +# QEMU version, machine type, machine options, and accelerator options. +# Therefore, the resulting model can be used by tooling without having +# to specify a compatibility machine - e.g. when displaying the "host" +# model. The @static CPU models are migration-safe. + +# @full: Expand all properties. The produced model is not guaranteed to be +# migration-safe, but allows tooling to get an insight and work with +# model details. +# +# Note: When a non-migration-safe CPU model is expanded in static mode, some +# features enabled by the CPU model may be omitted, because they can't be +# implemented by a static CPU model definition (e.g. cache info passthrough and +# PMU passthrough in x86). If you need an accurate representation of the +# features enabled by a non-migration-safe CPU model, use @full. If you need a +# static representation that will keep ABI compatibility even when changing QEMU +# version or machine-type, use @static (but keep in mind that some features may +# be omitted). +# +# Since: 2.8.0 +## +{ 'enum': 'CpuModelExpansionType', + 'data': [ 'static', 'full' ] } + + +## +# @CpuModelCompareResult: +# +# An enumeration of CPU model comparison results. The result is usually +# calculated using e.g. CPU features or CPU generations. +# +# @incompatible: If model A is incompatible to model B, model A is not +# guaranteed to run where model B runs and the other way around. +# +# @identical: If model A is identical to model B, model A is guaranteed to run +# where model B runs and the other way around. +# +# @superset: If model A is a superset of model B, model B is guaranteed to run +# where model A runs. There are no guarantees about the other way. +# +# @subset: If model A is a subset of model B, model A is guaranteed to run +# where model B runs. There are no guarantees about the other way. +# +# Since: 2.8.0 +## +{ 'enum': 'CpuModelCompareResult', + 'data': [ 'incompatible', 'identical', 'superset', 'subset' ] } + +## +# @CpuModelBaselineInfo: +# +# The result of a CPU model baseline. +# +# @model: the baselined CpuModelInfo. +# +# Since: 2.8.0 +## +{ 'struct': 'CpuModelBaselineInfo', + 'data': { 'model': 'CpuModelInfo' }, + 'if': 'defined(TARGET_S390X)' } + +## +# @CpuModelCompareInfo: +# +# The result of a CPU model comparison. +# +# @result: The result of the compare operation. +# @responsible-properties: List of properties that led to the comparison result +# not being identical. +# +# @responsible-properties is a list of QOM property names that led to +# both CPUs not being detected as identical. For identical models, this +# list is empty. +# If a QOM property is read-only, that means there's no known way to make the +# CPU models identical. If the special property name "type" is included, the +# models are by definition not identical and cannot be made identical. +# +# Since: 2.8.0 +## +{ 'struct': 'CpuModelCompareInfo', + 'data': { 'result': 'CpuModelCompareResult', + 'responsible-properties': ['str'] }, + 'if': 'defined(TARGET_S390X)' } + +## +# @query-cpu-model-comparison: +# +# Compares two CPU models, returning how they compare in a specific +# configuration. The results indicates how both models compare regarding +# runnability. This result can be used by tooling to make decisions if a +# certain CPU model will run in a certain configuration or if a compatible +# CPU model has to be created by baselining. +# +# Usually, a CPU model is compared against the maximum possible CPU model +# of a certain configuration (e.g. the "host" model for KVM). If that CPU +# model is identical or a subset, it will run in that configuration. +# +# The result returned by this command may be affected by: +# +# * QEMU version: CPU models may look different depending on the QEMU version. +# (Except for CPU models reported as "static" in query-cpu-definitions.) +# * machine-type: CPU model may look different depending on the machine-type. +# (Except for CPU models reported as "static" in query-cpu-definitions.) +# * machine options (including accelerator): in some architectures, CPU models +# may look different depending on machine and accelerator options. (Except for +# CPU models reported as "static" in query-cpu-definitions.) +# * "-cpu" arguments and global properties: arguments to the -cpu option and +# global properties may affect expansion of CPU models. Using +# query-cpu-model-expansion while using these is not advised. +# +# Some architectures may not support comparing CPU models. s390x supports +# comparing CPU models. +# +# Returns: a CpuModelBaselineInfo. Returns an error if comparing CPU models is +# not supported, if a model cannot be used, if a model contains +# an unknown cpu definition name, unknown properties or properties +# with wrong types. +# +# Note: this command isn't specific to s390x, but is only implemented +# on this architecture currently. +# +# Since: 2.8.0 +## +{ 'command': 'query-cpu-model-comparison', + 'data': { 'modela': 'CpuModelInfo', 'modelb': 'CpuModelInfo' }, + 'returns': 'CpuModelCompareInfo', + 'if': 'defined(TARGET_S390X)' } + +## +# @query-cpu-model-baseline: +# +# Baseline two CPU models, creating a compatible third model. The created +# model will always be a static, migration-safe CPU model (see "static" +# CPU model expansion for details). +# +# This interface can be used by tooling to create a compatible CPU model out +# two CPU models. The created CPU model will be identical to or a subset of +# both CPU models when comparing them. Therefore, the created CPU model is +# guaranteed to run where the given CPU models run. +# +# The result returned by this command may be affected by: +# +# * QEMU version: CPU models may look different depending on the QEMU version. +# (Except for CPU models reported as "static" in query-cpu-definitions.) +# * machine-type: CPU model may look different depending on the machine-type. +# (Except for CPU models reported as "static" in query-cpu-definitions.) +# * machine options (including accelerator): in some architectures, CPU models +# may look different depending on machine and accelerator options. (Except for +# CPU models reported as "static" in query-cpu-definitions.) +# * "-cpu" arguments and global properties: arguments to the -cpu option and +# global properties may affect expansion of CPU models. Using +# query-cpu-model-expansion while using these is not advised. +# +# Some architectures may not support baselining CPU models. s390x supports +# baselining CPU models. +# +# Returns: a CpuModelBaselineInfo. Returns an error if baselining CPU models is +# not supported, if a model cannot be used, if a model contains +# an unknown cpu definition name, unknown properties or properties +# with wrong types. +# +# Note: this command isn't specific to s390x, but is only implemented +# on this architecture currently. +# +# Since: 2.8.0 +## +{ 'command': 'query-cpu-model-baseline', + 'data': { 'modela': 'CpuModelInfo', + 'modelb': 'CpuModelInfo' }, + 'returns': 'CpuModelBaselineInfo', + 'if': 'defined(TARGET_S390X)' } + +## +# @CpuModelExpansionInfo: +# +# The result of a cpu model expansion. +# +# @model: the expanded CpuModelInfo. +# +# Since: 2.8.0 +## +{ 'struct': 'CpuModelExpansionInfo', + 'data': { 'model': 'CpuModelInfo' }, + 'if': 'defined(TARGET_S390X) || defined(TARGET_I386)' } + +## +# @query-cpu-model-expansion: +# +# Expands a given CPU model (or a combination of CPU model + additional options) +# to different granularities, allowing tooling to get an understanding what a +# specific CPU model looks like in QEMU under a certain configuration. +# +# This interface can be used to query the "host" CPU model. +# +# The data returned by this command may be affected by: +# +# * QEMU version: CPU models may look different depending on the QEMU version. +# (Except for CPU models reported as "static" in query-cpu-definitions.) +# * machine-type: CPU model may look different depending on the machine-type. +# (Except for CPU models reported as "static" in query-cpu-definitions.) +# * machine options (including accelerator): in some architectures, CPU models +# may look different depending on machine and accelerator options. (Except for +# CPU models reported as "static" in query-cpu-definitions.) +# * "-cpu" arguments and global properties: arguments to the -cpu option and +# global properties may affect expansion of CPU models. Using +# query-cpu-model-expansion while using these is not advised. +# +# Some architectures may not support all expansion types. s390x supports +# "full" and "static". +# +# Returns: a CpuModelExpansionInfo. Returns an error if expanding CPU models is +# not supported, if the model cannot be expanded, if the model contains +# an unknown CPU definition name, unknown properties or properties +# with a wrong type. Also returns an error if an expansion type is +# not supported. +# +# Since: 2.8.0 +## +{ 'command': 'query-cpu-model-expansion', + 'data': { 'type': 'CpuModelExpansionType', + 'model': 'CpuModelInfo' }, + 'returns': 'CpuModelExpansionInfo', + 'if': 'defined(TARGET_S390X) || defined(TARGET_I386)' } + +## +# @CpuDefinitionInfo: +# +# Virtual CPU definition. +# +# @name: the name of the CPU definition +# +# @migration-safe: whether a CPU definition can be safely used for +# migration in combination with a QEMU compatibility machine +# when migrating between different QEMU versions and between +# hosts with different sets of (hardware or software) +# capabilities. If not provided, information is not available +# and callers should not assume the CPU definition to be +# migration-safe. (since 2.8) +# +# @static: whether a CPU definition is static and will not change depending on +# QEMU version, machine type, machine options and accelerator options. +# A static model is always migration-safe. (since 2.8) +# +# @unavailable-features: List of properties that prevent +# the CPU model from running in the current +# host. (since 2.8) +# @typename: Type name that can be used as argument to @device-list-properties, +# to introspect properties configurable using -cpu or -global. +# (since 2.9) +# +# @unavailable-features is a list of QOM property names that +# represent CPU model attributes that prevent the CPU from running. +# If the QOM property is read-only, that means there's no known +# way to make the CPU model run in the current host. Implementations +# that choose not to provide specific information return the +# property name "type". +# If the property is read-write, it means that it MAY be possible +# to run the CPU model in the current host if that property is +# changed. Management software can use it as hints to suggest or +# choose an alternative for the user, or just to generate meaningful +# error messages explaining why the CPU model can't be used. +# If @unavailable-features is an empty list, the CPU model is +# runnable using the current host and machine-type. +# If @unavailable-features is not present, runnability +# information for the CPU is not available. +# +# Since: 1.2.0 +## +{ 'struct': 'CpuDefinitionInfo', + 'data': { 'name': 'str', + '*migration-safe': 'bool', + 'static': 'bool', + '*unavailable-features': [ 'str' ], + 'typename': 'str' }, + 'if': 'defined(TARGET_PPC) || defined(TARGET_ARM) || defined(TARGET_I386) || defined(TARGET_S390X) || defined(TARGET_MIPS)' } + +## +# @query-cpu-definitions: +# +# Return a list of supported virtual CPU definitions +# +# Returns: a list of CpuDefInfo +# +# Since: 1.2.0 +## +{ 'command': 'query-cpu-definitions', 'returns': ['CpuDefinitionInfo'], + 'if': 'defined(TARGET_PPC) || defined(TARGET_ARM) || defined(TARGET_I386) || defined(TARGET_S390X) || defined(TARGET_MIPS)' } diff --git a/qapi/misc.json b/qapi/misc.json index b4f8c658b7..d7db863c81 100644 --- a/qapi/misc.json +++ b/qapi/misc.json @@ -1387,80 +1387,6 @@ { 'command': 'query-memory-size-summary', 'returns': 'MemoryInfo' } -## -# @CpuModelInfo: -# -# Virtual CPU model. -# -# A CPU model consists of the name of a CPU definition, to which -# delta changes are applied (e.g. features added/removed). Most magic values -# that an architecture might require should be hidden behind the name. -# However, if required, architectures can expose relevant properties. -# -# @name: the name of the CPU definition the model is based on -# @props: a dictionary of QOM properties to be applied -# -# Since: 2.8.0 -## -{ 'struct': 'CpuModelInfo', - 'data': { 'name': 'str', - '*props': 'any' } } - -## -# @CpuModelExpansionType: -# -# An enumeration of CPU model expansion types. -# -# @static: Expand to a static CPU model, a combination of a static base -# model name and property delta changes. As the static base model will -# never change, the expanded CPU model will be the same, independent of -# QEMU version, machine type, machine options, and accelerator options. -# Therefore, the resulting model can be used by tooling without having -# to specify a compatibility machine - e.g. when displaying the "host" -# model. The @static CPU models are migration-safe. - -# @full: Expand all properties. The produced model is not guaranteed to be -# migration-safe, but allows tooling to get an insight and work with -# model details. -# -# Note: When a non-migration-safe CPU model is expanded in static mode, some -# features enabled by the CPU model may be omitted, because they can't be -# implemented by a static CPU model definition (e.g. cache info passthrough and -# PMU passthrough in x86). If you need an accurate representation of the -# features enabled by a non-migration-safe CPU model, use @full. If you need a -# static representation that will keep ABI compatibility even when changing QEMU -# version or machine-type, use @static (but keep in mind that some features may -# be omitted). -# -# Since: 2.8.0 -## -{ 'enum': 'CpuModelExpansionType', - 'data': [ 'static', 'full' ] } - - -## -# @CpuModelCompareResult: -# -# An enumeration of CPU model comparison results. The result is usually -# calculated using e.g. CPU features or CPU generations. -# -# @incompatible: If model A is incompatible to model B, model A is not -# guaranteed to run where model B runs and the other way around. -# -# @identical: If model A is identical to model B, model A is guaranteed to run -# where model B runs and the other way around. -# -# @superset: If model A is a superset of model B, model B is guaranteed to run -# where model A runs. There are no guarantees about the other way. -# -# @subset: If model A is a subset of model B, model A is guaranteed to run -# where model B runs. There are no guarantees about the other way. -# -# Since: 2.8.0 -## -{ 'enum': 'CpuModelCompareResult', - 'data': [ 'incompatible', 'identical', 'superset', 'subset' ] } - ## # @AddfdInfo: # diff --git a/qapi/qapi-schema.json b/qapi/qapi-schema.json index 31611191db..8dc82fde31 100644 --- a/qapi/qapi-schema.json +++ b/qapi/qapi-schema.json @@ -100,6 +100,7 @@ { 'include': 'qom.json' } { 'include': 'qdev.json' } { 'include': 'machine.json' } +{ 'include': 'machine-target.json' } { 'include': 'misc.json' } { 'include': 'target.json' } { 'include': 'audio.json' } diff --git a/qapi/target.json b/qapi/target.json index 1d4d54b600..e0a73581d8 100644 --- a/qapi/target.json +++ b/qapi/target.json @@ -5,8 +5,6 @@ # = Target-specific commands & events ## -{ 'include': 'misc.json' } - ## # @RTC_CHANGE: # @@ -228,130 +226,6 @@ 'data': { 'filename': 'str' }, 'if': 'defined(TARGET_S390X)' } -## -# @CpuModelBaselineInfo: -# -# The result of a CPU model baseline. -# -# @model: the baselined CpuModelInfo. -# -# Since: 2.8.0 -## -{ 'struct': 'CpuModelBaselineInfo', - 'data': { 'model': 'CpuModelInfo' }, - 'if': 'defined(TARGET_S390X)' } - -## -# @CpuModelCompareInfo: -# -# The result of a CPU model comparison. -# -# @result: The result of the compare operation. -# @responsible-properties: List of properties that led to the comparison result -# not being identical. -# -# @responsible-properties is a list of QOM property names that led to -# both CPUs not being detected as identical. For identical models, this -# list is empty. -# If a QOM property is read-only, that means there's no known way to make the -# CPU models identical. If the special property name "type" is included, the -# models are by definition not identical and cannot be made identical. -# -# Since: 2.8.0 -## -{ 'struct': 'CpuModelCompareInfo', - 'data': { 'result': 'CpuModelCompareResult', - 'responsible-properties': ['str'] }, - 'if': 'defined(TARGET_S390X)' } - -## -# @query-cpu-model-comparison: -# -# Compares two CPU models, returning how they compare in a specific -# configuration. The results indicates how both models compare regarding -# runnability. This result can be used by tooling to make decisions if a -# certain CPU model will run in a certain configuration or if a compatible -# CPU model has to be created by baselining. -# -# Usually, a CPU model is compared against the maximum possible CPU model -# of a certain configuration (e.g. the "host" model for KVM). If that CPU -# model is identical or a subset, it will run in that configuration. -# -# The result returned by this command may be affected by: -# -# * QEMU version: CPU models may look different depending on the QEMU version. -# (Except for CPU models reported as "static" in query-cpu-definitions.) -# * machine-type: CPU model may look different depending on the machine-type. -# (Except for CPU models reported as "static" in query-cpu-definitions.) -# * machine options (including accelerator): in some architectures, CPU models -# may look different depending on machine and accelerator options. (Except for -# CPU models reported as "static" in query-cpu-definitions.) -# * "-cpu" arguments and global properties: arguments to the -cpu option and -# global properties may affect expansion of CPU models. Using -# query-cpu-model-expansion while using these is not advised. -# -# Some architectures may not support comparing CPU models. s390x supports -# comparing CPU models. -# -# Returns: a CpuModelBaselineInfo. Returns an error if comparing CPU models is -# not supported, if a model cannot be used, if a model contains -# an unknown cpu definition name, unknown properties or properties -# with wrong types. -# -# Note: this command isn't specific to s390x, but is only implemented -# on this architecture currently. -# -# Since: 2.8.0 -## -{ 'command': 'query-cpu-model-comparison', - 'data': { 'modela': 'CpuModelInfo', 'modelb': 'CpuModelInfo' }, - 'returns': 'CpuModelCompareInfo', - 'if': 'defined(TARGET_S390X)' } - -## -# @query-cpu-model-baseline: -# -# Baseline two CPU models, creating a compatible third model. The created -# model will always be a static, migration-safe CPU model (see "static" -# CPU model expansion for details). -# -# This interface can be used by tooling to create a compatible CPU model out -# two CPU models. The created CPU model will be identical to or a subset of -# both CPU models when comparing them. Therefore, the created CPU model is -# guaranteed to run where the given CPU models run. -# -# The result returned by this command may be affected by: -# -# * QEMU version: CPU models may look different depending on the QEMU version. -# (Except for CPU models reported as "static" in query-cpu-definitions.) -# * machine-type: CPU model may look different depending on the machine-type. -# (Except for CPU models reported as "static" in query-cpu-definitions.) -# * machine options (including accelerator): in some architectures, CPU models -# may look different depending on machine and accelerator options. (Except for -# CPU models reported as "static" in query-cpu-definitions.) -# * "-cpu" arguments and global properties: arguments to the -cpu option and -# global properties may affect expansion of CPU models. Using -# query-cpu-model-expansion while using these is not advised. -# -# Some architectures may not support baselining CPU models. s390x supports -# baselining CPU models. -# -# Returns: a CpuModelBaselineInfo. Returns an error if baselining CPU models is -# not supported, if a model cannot be used, if a model contains -# an unknown cpu definition name, unknown properties or properties -# with wrong types. -# -# Note: this command isn't specific to s390x, but is only implemented -# on this architecture currently. -# -# Since: 2.8.0 -## -{ 'command': 'query-cpu-model-baseline', - 'data': { 'modela': 'CpuModelInfo', - 'modelb': 'CpuModelInfo' }, - 'returns': 'CpuModelBaselineInfo', - 'if': 'defined(TARGET_S390X)' } - ## # @GICCapability: # @@ -396,119 +270,3 @@ ## { 'command': 'query-gic-capabilities', 'returns': ['GICCapability'], 'if': 'defined(TARGET_ARM)' } - -## -# @CpuModelExpansionInfo: -# -# The result of a cpu model expansion. -# -# @model: the expanded CpuModelInfo. -# -# Since: 2.8.0 -## -{ 'struct': 'CpuModelExpansionInfo', - 'data': { 'model': 'CpuModelInfo' }, - 'if': 'defined(TARGET_S390X) || defined(TARGET_I386)' } - -## -# @query-cpu-model-expansion: -# -# Expands a given CPU model (or a combination of CPU model + additional options) -# to different granularities, allowing tooling to get an understanding what a -# specific CPU model looks like in QEMU under a certain configuration. -# -# This interface can be used to query the "host" CPU model. -# -# The data returned by this command may be affected by: -# -# * QEMU version: CPU models may look different depending on the QEMU version. -# (Except for CPU models reported as "static" in query-cpu-definitions.) -# * machine-type: CPU model may look different depending on the machine-type. -# (Except for CPU models reported as "static" in query-cpu-definitions.) -# * machine options (including accelerator): in some architectures, CPU models -# may look different depending on machine and accelerator options. (Except for -# CPU models reported as "static" in query-cpu-definitions.) -# * "-cpu" arguments and global properties: arguments to the -cpu option and -# global properties may affect expansion of CPU models. Using -# query-cpu-model-expansion while using these is not advised. -# -# Some architectures may not support all expansion types. s390x supports -# "full" and "static". -# -# Returns: a CpuModelExpansionInfo. Returns an error if expanding CPU models is -# not supported, if the model cannot be expanded, if the model contains -# an unknown CPU definition name, unknown properties or properties -# with a wrong type. Also returns an error if an expansion type is -# not supported. -# -# Since: 2.8.0 -## -{ 'command': 'query-cpu-model-expansion', - 'data': { 'type': 'CpuModelExpansionType', - 'model': 'CpuModelInfo' }, - 'returns': 'CpuModelExpansionInfo', - 'if': 'defined(TARGET_S390X) || defined(TARGET_I386)' } - -## -# @CpuDefinitionInfo: -# -# Virtual CPU definition. -# -# @name: the name of the CPU definition -# -# @migration-safe: whether a CPU definition can be safely used for -# migration in combination with a QEMU compatibility machine -# when migrating between different QEMU versions and between -# hosts with different sets of (hardware or software) -# capabilities. If not provided, information is not available -# and callers should not assume the CPU definition to be -# migration-safe. (since 2.8) -# -# @static: whether a CPU definition is static and will not change depending on -# QEMU version, machine type, machine options and accelerator options. -# A static model is always migration-safe. (since 2.8) -# -# @unavailable-features: List of properties that prevent -# the CPU model from running in the current -# host. (since 2.8) -# @typename: Type name that can be used as argument to @device-list-properties, -# to introspect properties configurable using -cpu or -global. -# (since 2.9) -# -# @unavailable-features is a list of QOM property names that -# represent CPU model attributes that prevent the CPU from running. -# If the QOM property is read-only, that means there's no known -# way to make the CPU model run in the current host. Implementations -# that choose not to provide specific information return the -# property name "type". -# If the property is read-write, it means that it MAY be possible -# to run the CPU model in the current host if that property is -# changed. Management software can use it as hints to suggest or -# choose an alternative for the user, or just to generate meaningful -# error messages explaining why the CPU model can't be used. -# If @unavailable-features is an empty list, the CPU model is -# runnable using the current host and machine-type. -# If @unavailable-features is not present, runnability -# information for the CPU is not available. -# -# Since: 1.2.0 -## -{ 'struct': 'CpuDefinitionInfo', - 'data': { 'name': 'str', - '*migration-safe': 'bool', - 'static': 'bool', - '*unavailable-features': [ 'str' ], - 'typename': 'str' }, - 'if': 'defined(TARGET_PPC) || defined(TARGET_ARM) || defined(TARGET_I386) || defined(TARGET_S390X) || defined(TARGET_MIPS)' } - -## -# @query-cpu-definitions: -# -# Return a list of supported virtual CPU definitions -# -# Returns: a list of CpuDefInfo -# -# Since: 1.2.0 -## -{ 'command': 'query-cpu-definitions', 'returns': ['CpuDefinitionInfo'], - 'if': 'defined(TARGET_PPC) || defined(TARGET_ARM) || defined(TARGET_I386) || defined(TARGET_S390X) || defined(TARGET_MIPS)' } diff --git a/target/arm/helper.c b/target/arm/helper.c index df4276f5f6..7caea52561 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -21,7 +21,7 @@ #include "sysemu/kvm.h" #include "fpu/softfloat.h" #include "qemu/range.h" -#include "qapi/qapi-commands-target.h" +#include "qapi/qapi-commands-machine-target.h" #include "qapi/error.h" #include "qemu/guest-random.h" diff --git a/target/i386/cpu.c b/target/i386/cpu.c index cb50f05e7e..4051066079 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -43,7 +43,7 @@ #include "qapi/visitor.h" #include "qom/qom-qobject.h" #include "sysemu/arch_init.h" -#include "qapi/qapi-commands-target.h" +#include "qapi/qapi-commands-machine-target.h" #include "standard-headers/asm-x86/kvm_para.h" diff --git a/target/mips/helper.c b/target/mips/helper.c index 6e6a44292f..a2b6459b05 100644 --- a/target/mips/helper.c +++ b/target/mips/helper.c @@ -24,7 +24,7 @@ #include "exec/cpu_ldst.h" #include "exec/log.h" #include "hw/mips/cpudevs.h" -#include "qapi/qapi-commands-target.h" +#include "qapi/qapi-commands-machine-target.h" enum { TLBRET_XI = -6, diff --git a/target/ppc/translate_init.inc.c b/target/ppc/translate_init.inc.c index 03cb6d0521..86fc8f2e31 100644 --- a/target/ppc/translate_init.inc.c +++ b/target/ppc/translate_init.inc.c @@ -41,7 +41,7 @@ #include "qemu/cutils.h" #include "disas/capstone.h" #include "fpu/softfloat.h" -#include "qapi/qapi-commands-target.h" +#include "qapi/qapi-commands-machine-target.h" /* #define PPC_DUMP_CPU */ /* #define PPC_DEBUG_SPR */ diff --git a/target/s390x/cpu_models.c b/target/s390x/cpu_models.c index 19ebde14db..2cb09c0780 100644 --- a/target/s390x/cpu_models.c +++ b/target/s390x/cpu_models.c @@ -28,7 +28,7 @@ #include "sysemu/arch_init.h" #include "hw/pci/pci.h" #endif -#include "qapi/qapi-commands-target.h" +#include "qapi/qapi-commands-machine-target.h" #define CPUDEF_INIT(_type, _gen, _ec_ga, _mha_pow, _hmfai, _name, _desc) \ { \ From patchwork Wed Jun 19 20:10:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Markus Armbruster X-Patchwork-Id: 1118997 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 45TbvP6Ym1z9s7h for ; Thu, 20 Jun 2019 06:21:32 +1000 (AEST) Received: from localhost ([::1]:41714 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hdh5D-00044D-Nd for incoming@patchwork.ozlabs.org; Wed, 19 Jun 2019 16:21:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35300) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hdgv7-0004JK-7f for qemu-devel@nongnu.org; Wed, 19 Jun 2019 16:11:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hdgv4-00016X-J8 for qemu-devel@nongnu.org; Wed, 19 Jun 2019 16:11:00 -0400 Received: from mx1.redhat.com ([209.132.183.28]:44506) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hdgv3-00012d-OO for qemu-devel@nongnu.org; Wed, 19 Jun 2019 16:10:58 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4C0623091DC1 for ; Wed, 19 Jun 2019 20:10:54 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-116-85.ams2.redhat.com [10.36.116.85]) by smtp.corp.redhat.com (Postfix) with ESMTPS id EA21319936; Wed, 19 Jun 2019 20:10:53 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id EE1251136434; Wed, 19 Jun 2019 22:10:50 +0200 (CEST) From: Markus Armbruster To: qemu-devel@nongnu.org Date: Wed, 19 Jun 2019 22:10:46 +0200 Message-Id: <20190619201050.19040-14-armbru@redhat.com> In-Reply-To: <20190619201050.19040-1-armbru@redhat.com> References: <20190619201050.19040-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Wed, 19 Jun 2019 20:10:54 +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 13/17] qapi: Rename target.json to misc-target.json X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Markus Armbruster Reviewed-by: Daniel P. Berrangé --- hw/ppc/spapr_rtc.c | 2 +- hw/s390x/s390-skeys.c | 2 +- hw/timer/mc146818rtc.c | 4 ++-- qapi/Makefile.objs | 2 +- qapi/{target.json => misc-target.json} | 4 ---- qapi/qapi-schema.json | 2 +- target/arm/monitor.c | 2 +- target/i386/sev_i386.h | 2 +- 8 files changed, 8 insertions(+), 12 deletions(-) rename qapi/{target.json => misc-target.json} (99%) diff --git a/hw/ppc/spapr_rtc.c b/hw/ppc/spapr_rtc.c index af1ef30a53..6cf0113b34 100644 --- a/hw/ppc/spapr_rtc.c +++ b/hw/ppc/spapr_rtc.c @@ -32,7 +32,7 @@ #include "sysemu/sysemu.h" #include "hw/ppc/spapr.h" #include "qapi/error.h" -#include "qapi/qapi-events-target.h" +#include "qapi/qapi-events-misc-target.h" #include "qemu/cutils.h" #include "qemu/module.h" diff --git a/hw/s390x/s390-skeys.c b/hw/s390x/s390-skeys.c index daac936698..e5bd92c0c7 100644 --- a/hw/s390x/s390-skeys.c +++ b/hw/s390x/s390-skeys.c @@ -14,7 +14,7 @@ #include "hw/boards.h" #include "hw/s390x/storage-keys.h" #include "qapi/error.h" -#include "qapi/qapi-commands-target.h" +#include "qapi/qapi-commands-misc-target.h" #include "qapi/qmp/qdict.h" #include "qemu/error-report.h" #include "sysemu/kvm.h" diff --git a/hw/timer/mc146818rtc.c b/hw/timer/mc146818rtc.c index 0d79e000d2..ce4550b6f2 100644 --- a/hw/timer/mc146818rtc.c +++ b/hw/timer/mc146818rtc.c @@ -33,8 +33,8 @@ #include "sysemu/replay.h" #include "hw/timer/mc146818rtc.h" #include "qapi/error.h" -#include "qapi/qapi-commands-target.h" -#include "qapi/qapi-events-target.h" +#include "qapi/qapi-commands-misc-target.h" +#include "qapi/qapi-events-misc-target.h" #include "qapi/visitor.h" #include "exec/address-spaces.h" diff --git a/qapi/Makefile.objs b/qapi/Makefile.objs index 4e87bef6e1..c0be6fcd3e 100644 --- a/qapi/Makefile.objs +++ b/qapi/Makefile.objs @@ -9,7 +9,7 @@ QAPI_COMMON_MODULES = audio authz block-core block char common crypto QAPI_COMMON_MODULES += introspect job machine migration misc net QAPI_COMMON_MODULES += qdev qom rdma rocker run-state sockets tpm QAPI_COMMON_MODULES += trace transaction ui -QAPI_TARGET_MODULES = machine-target target +QAPI_TARGET_MODULES = machine-target misc-target QAPI_MODULES = $(QAPI_COMMON_MODULES) $(QAPI_TARGET_MODULES) util-obj-y += qapi-builtin-types.o diff --git a/qapi/target.json b/qapi/misc-target.json similarity index 99% rename from qapi/target.json rename to qapi/misc-target.json index e0a73581d8..a00fd821eb 100644 --- a/qapi/target.json +++ b/qapi/misc-target.json @@ -1,10 +1,6 @@ # -*- Mode: Python -*- # -## -# = Target-specific commands & events -## - ## # @RTC_CHANGE: # diff --git a/qapi/qapi-schema.json b/qapi/qapi-schema.json index 8dc82fde31..bcfac85074 100644 --- a/qapi/qapi-schema.json +++ b/qapi/qapi-schema.json @@ -102,5 +102,5 @@ { 'include': 'machine.json' } { 'include': 'machine-target.json' } { 'include': 'misc.json' } -{ 'include': 'target.json' } +{ 'include': 'misc-target.json' } { 'include': 'audio.json' } diff --git a/target/arm/monitor.c b/target/arm/monitor.c index 41b32b94b2..6ec6dd04ac 100644 --- a/target/arm/monitor.c +++ b/target/arm/monitor.c @@ -23,7 +23,7 @@ #include "qemu/osdep.h" #include "hw/boards.h" #include "kvm_arm.h" -#include "qapi/qapi-commands-target.h" +#include "qapi/qapi-commands-misc-target.h" static GICCapability *gic_cap_new(int version) { diff --git a/target/i386/sev_i386.h b/target/i386/sev_i386.h index c0f9373beb..55313441ae 100644 --- a/target/i386/sev_i386.h +++ b/target/i386/sev_i386.h @@ -19,7 +19,7 @@ #include "sysemu/kvm.h" #include "sysemu/sev.h" #include "qemu/error-report.h" -#include "qapi/qapi-commands-target.h" +#include "qapi/qapi-commands-misc-target.h" #define SEV_POLICY_NODBG 0x1 #define SEV_POLICY_NOKS 0x2 From patchwork Wed Jun 19 20:10:47 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Markus Armbruster X-Patchwork-Id: 1119001 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 45Tbyc53FKz9s4V for ; Thu, 20 Jun 2019 06:24:24 +1000 (AEST) Received: from localhost ([::1]:41746 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hdh82-0007uo-Of for incoming@patchwork.ozlabs.org; Wed, 19 Jun 2019 16:24:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35422) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hdgvD-0004LP-JL for qemu-devel@nongnu.org; Wed, 19 Jun 2019 16:11:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hdgv7-0001Ab-Uq for qemu-devel@nongnu.org; Wed, 19 Jun 2019 16:11:06 -0400 Received: from mx1.redhat.com ([209.132.183.28]:33926) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hdgv7-00014Y-3E for qemu-devel@nongnu.org; Wed, 19 Jun 2019 16:11:01 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C61578112E for ; Wed, 19 Jun 2019 20:10:56 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-116-85.ams2.redhat.com [10.36.116.85]) by smtp.corp.redhat.com (Postfix) with ESMTPS id F38DF604CC; Wed, 19 Jun 2019 20:10:53 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 014AF1136435; Wed, 19 Jun 2019 22:10:50 +0200 (CEST) From: Markus Armbruster To: qemu-devel@nongnu.org Date: Wed, 19 Jun 2019 22:10:47 +0200 Message-Id: <20190619201050.19040-15-armbru@redhat.com> In-Reply-To: <20190619201050.19040-1-armbru@redhat.com> References: <20190619201050.19040-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Wed, 19 Jun 2019 20:10:56 +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 14/17] qapi: Split dump.json off misc.json X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Move commands dump-guest-memory, query-dump, query-dump-guest-memory-capability with their types from misc.json to new dump.json. Add dump.json to MAINTAINERS section "Dump". Cc: Marc-André Lureau Signed-off-by: Markus Armbruster Reviewed-by: Marc-André Lureau Reviewed-by: Daniel P. Berrangé --- MAINTAINERS | 1 + dump.c | 4 +- include/sysemu/dump.h | 2 +- monitor/hmp-cmds.c | 1 + qapi/Makefile.objs | 2 +- qapi/dump.json | 200 ++++++++++++++++++++++++++++++++++++++++++ qapi/misc.json | 192 ---------------------------------------- qapi/qapi-schema.json | 1 + 8 files changed, 207 insertions(+), 196 deletions(-) create mode 100644 qapi/dump.json diff --git a/MAINTAINERS b/MAINTAINERS index 89e8c01cf3..ea110e99ca 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1855,6 +1855,7 @@ F: hw/misc/vmcoreinfo.c F: include/hw/misc/vmcoreinfo.h F: include/sysemu/dump-arch.h F: include/sysemu/dump.h +F: qapi/dump.json F: scripts/dump-guest-memory.py F: stubs/dump.c diff --git a/dump.c b/dump.c index e99554628c..c7b2301652 100644 --- a/dump.c +++ b/dump.c @@ -24,8 +24,8 @@ #include "sysemu/memory_mapping.h" #include "sysemu/cpus.h" #include "qapi/error.h" -#include "qapi/qapi-commands-misc.h" -#include "qapi/qapi-events-misc.h" +#include "qapi/qapi-commands-dump.h" +#include "qapi/qapi-events-dump.h" #include "qapi/qmp/qerror.h" #include "qemu/error-report.h" #include "hw/misc/vmcoreinfo.h" diff --git a/include/sysemu/dump.h b/include/sysemu/dump.h index d824bc0941..250143cb5a 100644 --- a/include/sysemu/dump.h +++ b/include/sysemu/dump.h @@ -14,7 +14,7 @@ #ifndef DUMP_H #define DUMP_H -#include "qapi/qapi-types-misc.h" +#include "qapi/qapi-types-dump.h" #define MAKEDUMPFILE_SIGNATURE "makedumpfile" #define MAX_SIZE_MDF_HEADER (4096) /* max size of makedumpfile_header */ diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c index ea8ae2966e..18ffeb7017 100644 --- a/monitor/hmp-cmds.c +++ b/monitor/hmp-cmds.c @@ -31,6 +31,7 @@ #include "qapi/qapi-builtin-visit.h" #include "qapi/qapi-commands-block.h" #include "qapi/qapi-commands-char.h" +#include "qapi/qapi-commands-dump.h" #include "qapi/qapi-commands-migration.h" #include "qapi/qapi-commands-misc.h" #include "qapi/qapi-commands-net.h" diff --git a/qapi/Makefile.objs b/qapi/Makefile.objs index c0be6fcd3e..c5a29e86e2 100644 --- a/qapi/Makefile.objs +++ b/qapi/Makefile.objs @@ -6,7 +6,7 @@ util-obj-y += qmp-event.o util-obj-y += qapi-util.o QAPI_COMMON_MODULES = audio authz block-core block char common crypto -QAPI_COMMON_MODULES += introspect job machine migration misc net +QAPI_COMMON_MODULES += dump introspect job machine migration misc net QAPI_COMMON_MODULES += qdev qom rdma rocker run-state sockets tpm QAPI_COMMON_MODULES += trace transaction ui QAPI_TARGET_MODULES = machine-target misc-target diff --git a/qapi/dump.json b/qapi/dump.json new file mode 100644 index 0000000000..2b35409a7b --- /dev/null +++ b/qapi/dump.json @@ -0,0 +1,200 @@ +# -*- Mode: Python -*- +# +# This work is licensed under the terms of the GNU GPL, version 2 or later. +# See the COPYING file in the top-level directory. + +## +# = Dump guest memory +## + +## +# @DumpGuestMemoryFormat: +# +# An enumeration of guest-memory-dump's format. +# +# @elf: elf format +# +# @kdump-zlib: kdump-compressed format with zlib-compressed +# +# @kdump-lzo: kdump-compressed format with lzo-compressed +# +# @kdump-snappy: kdump-compressed format with snappy-compressed +# +# @win-dmp: Windows full crashdump format, +# can be used instead of ELF converting (since 2.13) +# +# Since: 2.0 +## +{ 'enum': 'DumpGuestMemoryFormat', + 'data': [ 'elf', 'kdump-zlib', 'kdump-lzo', 'kdump-snappy', 'win-dmp' ] } + +## +# @dump-guest-memory: +# +# Dump guest's memory to vmcore. It is a synchronous operation that can take +# very long depending on the amount of guest memory. +# +# @paging: if true, do paging to get guest's memory mapping. This allows +# using gdb to process the core file. +# +# IMPORTANT: this option can make QEMU allocate several gigabytes +# of RAM. This can happen for a large guest, or a +# malicious guest pretending to be large. +# +# Also, paging=true has the following limitations: +# +# 1. The guest may be in a catastrophic state or can have corrupted +# memory, which cannot be trusted +# 2. The guest can be in real-mode even if paging is enabled. For +# example, the guest uses ACPI to sleep, and ACPI sleep state +# goes in real-mode +# 3. Currently only supported on i386 and x86_64. +# +# @protocol: the filename or file descriptor of the vmcore. The supported +# protocols are: +# +# 1. file: the protocol starts with "file:", and the following +# string is the file's path. +# 2. fd: the protocol starts with "fd:", and the following string +# is the fd's name. +# +# @detach: if true, QMP will return immediately rather than +# waiting for the dump to finish. The user can track progress +# using "query-dump". (since 2.6). +# +# @begin: if specified, the starting physical address. +# +# @length: if specified, the memory size, in bytes. If you don't +# want to dump all guest's memory, please specify the start @begin +# and @length +# +# @format: if specified, the format of guest memory dump. But non-elf +# format is conflict with paging and filter, ie. @paging, @begin and +# @length is not allowed to be specified with non-elf @format at the +# same time (since 2.0) +# +# Note: All boolean arguments default to false +# +# Returns: nothing on success +# +# Since: 1.2 +# +# Example: +# +# -> { "execute": "dump-guest-memory", +# "arguments": { "protocol": "fd:dump" } } +# <- { "return": {} } +# +## +{ 'command': 'dump-guest-memory', + 'data': { 'paging': 'bool', 'protocol': 'str', '*detach': 'bool', + '*begin': 'int', '*length': 'int', + '*format': 'DumpGuestMemoryFormat'} } + +## +# @DumpStatus: +# +# Describe the status of a long-running background guest memory dump. +# +# @none: no dump-guest-memory has started yet. +# +# @active: there is one dump running in background. +# +# @completed: the last dump has finished successfully. +# +# @failed: the last dump has failed. +# +# Since: 2.6 +## +{ 'enum': 'DumpStatus', + 'data': [ 'none', 'active', 'completed', 'failed' ] } + +## +# @DumpQueryResult: +# +# The result format for 'query-dump'. +# +# @status: enum of @DumpStatus, which shows current dump status +# +# @completed: bytes written in latest dump (uncompressed) +# +# @total: total bytes to be written in latest dump (uncompressed) +# +# Since: 2.6 +## +{ 'struct': 'DumpQueryResult', + 'data': { 'status': 'DumpStatus', + 'completed': 'int', + 'total': 'int' } } + +## +# @query-dump: +# +# Query latest dump status. +# +# Returns: A @DumpStatus object showing the dump status. +# +# Since: 2.6 +# +# Example: +# +# -> { "execute": "query-dump" } +# <- { "return": { "status": "active", "completed": 1024000, +# "total": 2048000 } } +# +## +{ 'command': 'query-dump', 'returns': 'DumpQueryResult' } + +## +# @DUMP_COMPLETED: +# +# Emitted when background dump has completed +# +# @result: final dump status +# +# @error: human-readable error string that provides +# hint on why dump failed. Only presents on failure. The +# user should not try to interpret the error string. +# +# Since: 2.6 +# +# Example: +# +# { "event": "DUMP_COMPLETED", +# "data": {"result": {"total": 1090650112, "status": "completed", +# "completed": 1090650112} } } +# +## +{ 'event': 'DUMP_COMPLETED' , + 'data': { 'result': 'DumpQueryResult', '*error': 'str' } } + +## +# @DumpGuestMemoryCapability: +# +# A list of the available formats for dump-guest-memory +# +# Since: 2.0 +## +{ 'struct': 'DumpGuestMemoryCapability', + 'data': { + 'formats': ['DumpGuestMemoryFormat'] } } + +## +# @query-dump-guest-memory-capability: +# +# Returns the available formats for dump-guest-memory +# +# Returns: A @DumpGuestMemoryCapability object listing available formats for +# dump-guest-memory +# +# Since: 2.0 +# +# Example: +# +# -> { "execute": "query-dump-guest-memory-capability" } +# <- { "return": { "formats": +# ["elf", "kdump-zlib", "kdump-lzo", "kdump-snappy"] } +# +## +{ 'command': 'query-dump-guest-memory-capability', + 'returns': 'DumpGuestMemoryCapability' } diff --git a/qapi/misc.json b/qapi/misc.json index d7db863c81..31427d45a6 100644 --- a/qapi/misc.json +++ b/qapi/misc.json @@ -1117,198 +1117,6 @@ ## { 'command': 'xen-set-global-dirty-log', 'data': { 'enable': 'bool' } } -## -# @DumpGuestMemoryFormat: -# -# An enumeration of guest-memory-dump's format. -# -# @elf: elf format -# -# @kdump-zlib: kdump-compressed format with zlib-compressed -# -# @kdump-lzo: kdump-compressed format with lzo-compressed -# -# @kdump-snappy: kdump-compressed format with snappy-compressed -# -# @win-dmp: Windows full crashdump format, -# can be used instead of ELF converting (since 2.13) -# -# Since: 2.0 -## -{ 'enum': 'DumpGuestMemoryFormat', - 'data': [ 'elf', 'kdump-zlib', 'kdump-lzo', 'kdump-snappy', 'win-dmp' ] } - -## -# @dump-guest-memory: -# -# Dump guest's memory to vmcore. It is a synchronous operation that can take -# very long depending on the amount of guest memory. -# -# @paging: if true, do paging to get guest's memory mapping. This allows -# using gdb to process the core file. -# -# IMPORTANT: this option can make QEMU allocate several gigabytes -# of RAM. This can happen for a large guest, or a -# malicious guest pretending to be large. -# -# Also, paging=true has the following limitations: -# -# 1. The guest may be in a catastrophic state or can have corrupted -# memory, which cannot be trusted -# 2. The guest can be in real-mode even if paging is enabled. For -# example, the guest uses ACPI to sleep, and ACPI sleep state -# goes in real-mode -# 3. Currently only supported on i386 and x86_64. -# -# @protocol: the filename or file descriptor of the vmcore. The supported -# protocols are: -# -# 1. file: the protocol starts with "file:", and the following -# string is the file's path. -# 2. fd: the protocol starts with "fd:", and the following string -# is the fd's name. -# -# @detach: if true, QMP will return immediately rather than -# waiting for the dump to finish. The user can track progress -# using "query-dump". (since 2.6). -# -# @begin: if specified, the starting physical address. -# -# @length: if specified, the memory size, in bytes. If you don't -# want to dump all guest's memory, please specify the start @begin -# and @length -# -# @format: if specified, the format of guest memory dump. But non-elf -# format is conflict with paging and filter, ie. @paging, @begin and -# @length is not allowed to be specified with non-elf @format at the -# same time (since 2.0) -# -# Note: All boolean arguments default to false -# -# Returns: nothing on success -# -# Since: 1.2 -# -# Example: -# -# -> { "execute": "dump-guest-memory", -# "arguments": { "protocol": "fd:dump" } } -# <- { "return": {} } -# -## -{ 'command': 'dump-guest-memory', - 'data': { 'paging': 'bool', 'protocol': 'str', '*detach': 'bool', - '*begin': 'int', '*length': 'int', - '*format': 'DumpGuestMemoryFormat'} } - -## -# @DumpStatus: -# -# Describe the status of a long-running background guest memory dump. -# -# @none: no dump-guest-memory has started yet. -# -# @active: there is one dump running in background. -# -# @completed: the last dump has finished successfully. -# -# @failed: the last dump has failed. -# -# Since: 2.6 -## -{ 'enum': 'DumpStatus', - 'data': [ 'none', 'active', 'completed', 'failed' ] } - -## -# @DumpQueryResult: -# -# The result format for 'query-dump'. -# -# @status: enum of @DumpStatus, which shows current dump status -# -# @completed: bytes written in latest dump (uncompressed) -# -# @total: total bytes to be written in latest dump (uncompressed) -# -# Since: 2.6 -## -{ 'struct': 'DumpQueryResult', - 'data': { 'status': 'DumpStatus', - 'completed': 'int', - 'total': 'int' } } - -## -# @query-dump: -# -# Query latest dump status. -# -# Returns: A @DumpStatus object showing the dump status. -# -# Since: 2.6 -# -# Example: -# -# -> { "execute": "query-dump" } -# <- { "return": { "status": "active", "completed": 1024000, -# "total": 2048000 } } -# -## -{ 'command': 'query-dump', 'returns': 'DumpQueryResult' } - -## -# @DUMP_COMPLETED: -# -# Emitted when background dump has completed -# -# @result: final dump status -# -# @error: human-readable error string that provides -# hint on why dump failed. Only presents on failure. The -# user should not try to interpret the error string. -# -# Since: 2.6 -# -# Example: -# -# { "event": "DUMP_COMPLETED", -# "data": {"result": {"total": 1090650112, "status": "completed", -# "completed": 1090650112} } } -# -## -{ 'event': 'DUMP_COMPLETED' , - 'data': { 'result': 'DumpQueryResult', '*error': 'str' } } - -## -# @DumpGuestMemoryCapability: -# -# A list of the available formats for dump-guest-memory -# -# Since: 2.0 -## -{ 'struct': 'DumpGuestMemoryCapability', - 'data': { - 'formats': ['DumpGuestMemoryFormat'] } } - -## -# @query-dump-guest-memory-capability: -# -# Returns the available formats for dump-guest-memory -# -# Returns: A @DumpGuestMemoryCapability object listing available formats for -# dump-guest-memory -# -# Since: 2.0 -# -# Example: -# -# -> { "execute": "query-dump-guest-memory-capability" } -# <- { "return": { "formats": -# ["elf", "kdump-zlib", "kdump-lzo", "kdump-snappy"] } -# -## -{ 'command': 'query-dump-guest-memory-capability', - 'returns': 'DumpGuestMemoryCapability' } - ## # @getfd: # diff --git a/qapi/qapi-schema.json b/qapi/qapi-schema.json index bcfac85074..38af54d6b3 100644 --- a/qapi/qapi-schema.json +++ b/qapi/qapi-schema.json @@ -86,6 +86,7 @@ { 'include': 'crypto.json' } { 'include': 'block.json' } { 'include': 'char.json' } +{ 'include': 'dump.json' } { 'include': 'job.json' } { 'include': 'net.json' } { 'include': 'rdma.json' } From patchwork Wed Jun 19 20:10:48 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Markus Armbruster X-Patchwork-Id: 1118987 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 45Tbhq0Dmzz9s5c for ; Thu, 20 Jun 2019 06:12:27 +1000 (AEST) Received: from localhost ([::1]:41662 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hdgwR-0004Na-8S for incoming@patchwork.ozlabs.org; Wed, 19 Jun 2019 16:12:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35296) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hdgv7-0004JI-6Z for qemu-devel@nongnu.org; Wed, 19 Jun 2019 16:11:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hdgv5-00017X-Mt for qemu-devel@nongnu.org; Wed, 19 Jun 2019 16:11:01 -0400 Received: from mx1.redhat.com ([209.132.183.28]:33922) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hdgv4-00014M-2u for qemu-devel@nongnu.org; Wed, 19 Jun 2019 16:10:59 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7B0B18112C for ; Wed, 19 Jun 2019 20:10:56 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-116-85.ams2.redhat.com [10.36.116.85]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 195C060142; Wed, 19 Jun 2019 20:10:55 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 082CC1136436; Wed, 19 Jun 2019 22:10:51 +0200 (CEST) From: Markus Armbruster To: qemu-devel@nongnu.org Date: Wed, 19 Jun 2019 22:10:48 +0200 Message-Id: <20190619201050.19040-16-armbru@redhat.com> In-Reply-To: <20190619201050.19040-1-armbru@redhat.com> References: <20190619201050.19040-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Wed, 19 Jun 2019 20:10:56 +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 15/17] dump: Move the code to dump/ X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Cc: Marc-André Lureau Signed-off-by: Markus Armbruster Reviewed-by: Marc-André Lureau Reviewed-by: Daniel P. Berrangé --- MAINTAINERS | 2 +- Makefile.target | 3 +-- dump/Makefile.objs | 2 ++ dump.c => dump/dump.c | 0 win_dump.c => dump/win_dump.c | 0 win_dump.h => dump/win_dump.h | 0 6 files changed, 4 insertions(+), 3 deletions(-) create mode 100644 dump/Makefile.objs rename dump.c => dump/dump.c (100%) rename win_dump.c => dump/win_dump.c (100%) rename win_dump.h => dump/win_dump.h (100%) diff --git a/MAINTAINERS b/MAINTAINERS index ea110e99ca..a3fdda015f 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1850,7 +1850,7 @@ F: include/sysemu/device_tree.h Dump S: Supported M: Marc-André Lureau -F: dump.c +F: dump/dump.c F: hw/misc/vmcoreinfo.c F: include/hw/misc/vmcoreinfo.h F: include/sysemu/dump-arch.h diff --git a/Makefile.target b/Makefile.target index 167ae2174e..a6919e0caf 100644 --- a/Makefile.target +++ b/Makefile.target @@ -150,13 +150,12 @@ endif #CONFIG_BSD_USER ifdef CONFIG_SOFTMMU obj-y += arch_init.o cpus.o gdbstub.o balloon.o ioport.o obj-y += qtest.o +obj-y += dump/ obj-y += hw/ obj-y += monitor/ obj-y += qapi/ obj-y += memory.o obj-y += memory_mapping.o -obj-y += dump.o -obj-$(TARGET_X86_64) += win_dump.o obj-y += migration/ram.o LIBS := $(libs_softmmu) $(LIBS) diff --git a/dump/Makefile.objs b/dump/Makefile.objs new file mode 100644 index 0000000000..ea6b074967 --- /dev/null +++ b/dump/Makefile.objs @@ -0,0 +1,2 @@ +obj-y += dump.o +obj-$(TARGET_X86_64) += win_dump.o diff --git a/dump.c b/dump/dump.c similarity index 100% rename from dump.c rename to dump/dump.c diff --git a/win_dump.c b/dump/win_dump.c similarity index 100% rename from win_dump.c rename to dump/win_dump.c diff --git a/win_dump.h b/dump/win_dump.h similarity index 100% rename from win_dump.h rename to dump/win_dump.h From patchwork Wed Jun 19 20:10:49 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Markus Armbruster X-Patchwork-Id: 1118985 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 45Tbhk2jQ4z9s7h for ; Thu, 20 Jun 2019 06:12:19 +1000 (AEST) Received: from localhost ([::1]:41658 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hdgwK-0004Ko-6r for incoming@patchwork.ozlabs.org; Wed, 19 Jun 2019 16:12:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35262) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hdgv5-0004JG-OC for qemu-devel@nongnu.org; Wed, 19 Jun 2019 16:11:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hdgv3-00015X-QN for qemu-devel@nongnu.org; Wed, 19 Jun 2019 16:10:59 -0400 Received: from mx1.redhat.com ([209.132.183.28]:34236) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hdgv3-00014O-6B for qemu-devel@nongnu.org; Wed, 19 Jun 2019 16:10:57 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7B17E81E09 for ; Wed, 19 Jun 2019 20:10:56 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-116-85.ams2.redhat.com [10.36.116.85]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 190FD6013D; Wed, 19 Jun 2019 20:10:55 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 0F48D113643E; Wed, 19 Jun 2019 22:10:51 +0200 (CEST) From: Markus Armbruster To: qemu-devel@nongnu.org Date: Wed, 19 Jun 2019 22:10:49 +0200 Message-Id: <20190619201050.19040-17-armbru@redhat.com> In-Reply-To: <20190619201050.19040-1-armbru@redhat.com> References: <20190619201050.19040-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Wed, 19 Jun 2019 20:10:56 +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 16/17] MAINTAINERS: Add Windows dump to section "Dump" X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Commit 2da91b54fe9 "dump: add Windows dump format to dump-guest-memory" neglected to update MAINTAINERS. Do it now. Cc: Marc-André Lureau Signed-off-by: Markus Armbruster Reviewed-by: Marc-André Lureau Reviewed-by: Daniel P. Berrangé --- MAINTAINERS | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/MAINTAINERS b/MAINTAINERS index a3fdda015f..327ad80ae4 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1850,9 +1850,10 @@ F: include/sysemu/device_tree.h Dump S: Supported M: Marc-André Lureau -F: dump/dump.c +F: dump/ F: hw/misc/vmcoreinfo.c F: include/hw/misc/vmcoreinfo.h +F: include/qemu/win_dump_defs F: include/sysemu/dump-arch.h F: include/sysemu/dump.h F: qapi/dump.json From patchwork Wed Jun 19 20:10:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Markus Armbruster X-Patchwork-Id: 1118999 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 45TbyZ6yC8z9s4V for ; Thu, 20 Jun 2019 06:24:22 +1000 (AEST) Received: from localhost ([::1]:41744 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hdh81-0007rt-0y for incoming@patchwork.ozlabs.org; Wed, 19 Jun 2019 16:24:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35404) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hdgvC-0004Ku-Iu for qemu-devel@nongnu.org; Wed, 19 Jun 2019 16:11:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hdgv7-00019R-5R for qemu-devel@nongnu.org; Wed, 19 Jun 2019 16:11:05 -0400 Received: from mx1.redhat.com ([209.132.183.28]:33818) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hdgv5-00015d-NN for qemu-devel@nongnu.org; Wed, 19 Jun 2019 16:11:00 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B12AE30C132E for ; Wed, 19 Jun 2019 20:10:57 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-116-85.ams2.redhat.com [10.36.116.85]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 340961001B3D; Wed, 19 Jun 2019 20:10:55 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 15E5E1136444; Wed, 19 Jun 2019 22:10:51 +0200 (CEST) From: Markus Armbruster To: qemu-devel@nongnu.org Date: Wed, 19 Jun 2019 22:10:50 +0200 Message-Id: <20190619201050.19040-18-armbru@redhat.com> In-Reply-To: <20190619201050.19040-1-armbru@redhat.com> References: <20190619201050.19040-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.45]); Wed, 19 Jun 2019 20:10:57 +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 17/17] dump: Move HMP command handlers to dump/ X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , "Dr. David Alan Gilbert" Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Move the HMP handlers related to qapi/dump.json to dimp/dump-hmp-cmds.c, where they are covered by MAINTAINERS section "Dump", just like qapi/dump.json. Cc: Marc-André Lureau Cc: "Dr. David Alan Gilbert" Signed-off-by: Markus Armbruster Reviewed-by: Daniel P. Berrangé Reviewed-by: Dr. David Alan Gilbert --- Makefile.objs | 1 + dump/Makefile.objs | 1 + dump/dump-hmp-cmds.c | 88 ++++++++++++++++++++++++++++++++++++++++++++ monitor/hmp-cmds.c | 76 -------------------------------------- 4 files changed, 90 insertions(+), 76 deletions(-) create mode 100644 dump/dump-hmp-cmds.c diff --git a/Makefile.objs b/Makefile.objs index 7494d6143b..c93d731047 100644 --- a/Makefile.objs +++ b/Makefile.objs @@ -45,6 +45,7 @@ io-obj-y = io/ ifeq ($(CONFIG_SOFTMMU),y) common-obj-y = blockdev.o blockdev-nbd.o block/ common-obj-y += bootdevice.o iothread.o +common-obj-y += dump/ common-obj-y += job-qmp.o common-obj-y += monitor/ common-obj-y += net/ diff --git a/dump/Makefile.objs b/dump/Makefile.objs index ea6b074967..d2a5db3b81 100644 --- a/dump/Makefile.objs +++ b/dump/Makefile.objs @@ -1,2 +1,3 @@ obj-y += dump.o +common-obj-y += dump-hmp-cmds.o obj-$(TARGET_X86_64) += win_dump.o diff --git a/dump/dump-hmp-cmds.c b/dump/dump-hmp-cmds.c new file mode 100644 index 0000000000..3dbf44372c --- /dev/null +++ b/dump/dump-hmp-cmds.c @@ -0,0 +1,88 @@ +/* + * Human Monitor Interface commands + * + * This work is licensed under the terms of the GNU GPL, version 2 or later. + * See the COPYING file in the top-level directory. + */ + +#include "qemu/osdep.h" +#include "monitor/hmp.h" +#include "monitor/monitor.h" +#include "qapi/error.h" +#include "qapi/qapi-commands-dump.h" +#include "qapi/qmp/qdict.h" + +void hmp_dump_guest_memory(Monitor *mon, const QDict *qdict) +{ + Error *err = NULL; + bool win_dmp = qdict_get_try_bool(qdict, "windmp", false); + bool paging = qdict_get_try_bool(qdict, "paging", false); + bool zlib = qdict_get_try_bool(qdict, "zlib", false); + bool lzo = qdict_get_try_bool(qdict, "lzo", false); + bool snappy = qdict_get_try_bool(qdict, "snappy", false); + const char *file = qdict_get_str(qdict, "filename"); + bool has_begin = qdict_haskey(qdict, "begin"); + bool has_length = qdict_haskey(qdict, "length"); + bool has_detach = qdict_haskey(qdict, "detach"); + int64_t begin = 0; + int64_t length = 0; + bool detach = false; + enum DumpGuestMemoryFormat dump_format = DUMP_GUEST_MEMORY_FORMAT_ELF; + char *prot; + + if (zlib + lzo + snappy + win_dmp > 1) { + error_setg(&err, "only one of '-z|-l|-s|-w' can be set"); + hmp_handle_error(mon, &err); + return; + } + + if (win_dmp) { + dump_format = DUMP_GUEST_MEMORY_FORMAT_WIN_DMP; + } + + if (zlib) { + dump_format = DUMP_GUEST_MEMORY_FORMAT_KDUMP_ZLIB; + } + + if (lzo) { + dump_format = DUMP_GUEST_MEMORY_FORMAT_KDUMP_LZO; + } + + if (snappy) { + dump_format = DUMP_GUEST_MEMORY_FORMAT_KDUMP_SNAPPY; + } + + if (has_begin) { + begin = qdict_get_int(qdict, "begin"); + } + if (has_length) { + length = qdict_get_int(qdict, "length"); + } + if (has_detach) { + detach = qdict_get_bool(qdict, "detach"); + } + + prot = g_strconcat("file:", file, NULL); + + qmp_dump_guest_memory(paging, prot, true, detach, has_begin, begin, + has_length, length, true, dump_format, &err); + hmp_handle_error(mon, &err); + g_free(prot); +} + +void hmp_info_dump(Monitor *mon, const QDict *qdict) +{ + DumpQueryResult *result = qmp_query_dump(NULL); + + assert(result && result->status < DUMP_STATUS__MAX); + monitor_printf(mon, "Status: %s\n", DumpStatus_str(result->status)); + + if (result->status == DUMP_STATUS_ACTIVE) { + float percent = 0; + assert(result->total != 0); + percent = 100.0 * result->completed / result->total; + monitor_printf(mon, "Finished: %.2f %%\n", percent); + } + + qapi_free_DumpQueryResult(result); +} diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c index 18ffeb7017..dc12ae6129 100644 --- a/monitor/hmp-cmds.c +++ b/monitor/hmp-cmds.c @@ -31,7 +31,6 @@ #include "qapi/qapi-builtin-visit.h" #include "qapi/qapi-commands-block.h" #include "qapi/qapi-commands-char.h" -#include "qapi/qapi-commands-dump.h" #include "qapi/qapi-commands-migration.h" #include "qapi/qapi-commands-misc.h" #include "qapi/qapi-commands-net.h" @@ -2160,64 +2159,6 @@ void hmp_device_del(Monitor *mon, const QDict *qdict) hmp_handle_error(mon, &err); } -void hmp_dump_guest_memory(Monitor *mon, const QDict *qdict) -{ - Error *err = NULL; - bool win_dmp = qdict_get_try_bool(qdict, "windmp", false); - bool paging = qdict_get_try_bool(qdict, "paging", false); - bool zlib = qdict_get_try_bool(qdict, "zlib", false); - bool lzo = qdict_get_try_bool(qdict, "lzo", false); - bool snappy = qdict_get_try_bool(qdict, "snappy", false); - const char *file = qdict_get_str(qdict, "filename"); - bool has_begin = qdict_haskey(qdict, "begin"); - bool has_length = qdict_haskey(qdict, "length"); - bool has_detach = qdict_haskey(qdict, "detach"); - int64_t begin = 0; - int64_t length = 0; - bool detach = false; - enum DumpGuestMemoryFormat dump_format = DUMP_GUEST_MEMORY_FORMAT_ELF; - char *prot; - - if (zlib + lzo + snappy + win_dmp > 1) { - error_setg(&err, "only one of '-z|-l|-s|-w' can be set"); - hmp_handle_error(mon, &err); - return; - } - - if (win_dmp) { - dump_format = DUMP_GUEST_MEMORY_FORMAT_WIN_DMP; - } - - if (zlib) { - dump_format = DUMP_GUEST_MEMORY_FORMAT_KDUMP_ZLIB; - } - - if (lzo) { - dump_format = DUMP_GUEST_MEMORY_FORMAT_KDUMP_LZO; - } - - if (snappy) { - dump_format = DUMP_GUEST_MEMORY_FORMAT_KDUMP_SNAPPY; - } - - if (has_begin) { - begin = qdict_get_int(qdict, "begin"); - } - if (has_length) { - length = qdict_get_int(qdict, "length"); - } - if (has_detach) { - detach = qdict_get_bool(qdict, "detach"); - } - - prot = g_strconcat("file:", file, NULL); - - qmp_dump_guest_memory(paging, prot, true, detach, has_begin, begin, - has_length, length, true, dump_format, &err); - hmp_handle_error(mon, &err); - g_free(prot); -} - void hmp_netdev_add(Monitor *mon, const QDict *qdict) { Error *err = NULL; @@ -2949,23 +2890,6 @@ void hmp_rocker_of_dpa_groups(Monitor *mon, const QDict *qdict) qapi_free_RockerOfDpaGroupList(list); } -void hmp_info_dump(Monitor *mon, const QDict *qdict) -{ - DumpQueryResult *result = qmp_query_dump(NULL); - - assert(result && result->status < DUMP_STATUS__MAX); - monitor_printf(mon, "Status: %s\n", DumpStatus_str(result->status)); - - if (result->status == DUMP_STATUS_ACTIVE) { - float percent = 0; - assert(result->total != 0); - percent = 100.0 * result->completed / result->total; - monitor_printf(mon, "Finished: %.2f %%\n", percent); - } - - qapi_free_DumpQueryResult(result); -} - void hmp_info_ramblock(Monitor *mon, const QDict *qdict) { ram_block_dump(mon);