From patchwork Sun Dec 16 14:08:50 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= X-Patchwork-Id: 1014135 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=2001:4830:134:3::11; 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 [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43HmTD2WN8z9s3C for ; Mon, 17 Dec 2018 01:12:48 +1100 (AEDT) Received: from localhost ([::1]:42600 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gYX9x-0003HA-Vn for incoming@patchwork.ozlabs.org; Sun, 16 Dec 2018 09:12:46 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60995) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gYX6X-00012k-1y for qemu-devel@nongnu.org; Sun, 16 Dec 2018 09:09:13 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gYX6V-0004jy-TP for qemu-devel@nongnu.org; Sun, 16 Dec 2018 09:09:13 -0500 Received: from mx1.redhat.com ([209.132.183.28]:49750) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gYX6V-0004jb-Mc for qemu-devel@nongnu.org; Sun, 16 Dec 2018 09:09:11 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 06DF35D61D for ; Sun, 16 Dec 2018 14:09:11 +0000 (UTC) Received: from localhost (ovpn-112-19.ams2.redhat.com [10.36.112.19]) by smtp.corp.redhat.com (Postfix) with ESMTP id 24A7B5DA2A; Sun, 16 Dec 2018 14:09:09 +0000 (UTC) From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= To: qemu-devel@nongnu.org Date: Sun, 16 Dec 2018 18:08:50 +0400 Message-Id: <20181216140902.23986-2-marcandre.lureau@redhat.com> In-Reply-To: <20181216140902.23986-1-marcandre.lureau@redhat.com> References: <20181216140902.23986-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Sun, 16 Dec 2018 14:09:11 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 01/13] build-sys: move qmp-introspect per target X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: armbru@redhat.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" The following patches are going to introduce per-target #ifdef in the schemas. The introspection data is statically generated once, and must thus be built per-target to reflect target-specific configuration. Drop "do_test_visitor_in_qmp_introspect(&qmp_schema_qlit)" since the schema is no longer in a common object. It is covered by the per-target query-qmp-schema test instead. Signed-off-by: Marc-André Lureau Reviewed-by: Markus Armbruster --- tests/test-qobject-input-visitor.c | 1 - Makefile.objs | 2 -- Makefile.target | 2 ++ 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/tests/test-qobject-input-visitor.c b/tests/test-qobject-input-visitor.c index caa90b3d7e..609334adf6 100644 --- a/tests/test-qobject-input-visitor.c +++ b/tests/test-qobject-input-visitor.c @@ -1271,7 +1271,6 @@ static void test_visitor_in_qmp_introspect(TestInputVisitorData *data, const void *unused) { do_test_visitor_in_qmp_introspect(data, &test_qmp_schema_qlit); - do_test_visitor_in_qmp_introspect(data, &qmp_schema_qlit); } int main(int argc, char **argv) diff --git a/Makefile.objs b/Makefile.objs index 56af0347d3..0388d5157d 100644 --- a/Makefile.objs +++ b/Makefile.objs @@ -13,7 +13,6 @@ util-obj-y += qapi/qapi-visit.o util-obj-y += $(QAPI_MODULES:%=qapi/qapi-visit-%.o) util-obj-y += qapi/qapi-events.o util-obj-y += $(QAPI_MODULES:%=qapi/qapi-events-%.o) -util-obj-y += qapi/qapi-introspect.o chardev-obj-y = chardev/ @@ -94,7 +93,6 @@ common-obj-$(CONFIG_FDT) += device_tree.o common-obj-y += qapi/qapi-commands.o common-obj-y += $(QAPI_MODULES:%=qapi/qapi-commands-%.o) -common-obj-y += qapi/qapi-introspect.o common-obj-y += qmp.o hmp.o endif diff --git a/Makefile.target b/Makefile.target index 44ec4b630c..c882292ae1 100644 --- a/Makefile.target +++ b/Makefile.target @@ -156,6 +156,8 @@ endif GENERATED_FILES += hmp-commands.h hmp-commands-info.h +obj-y += qapi/qapi-introspect.o + endif # CONFIG_SOFTMMU dummy := $(call unnest-vars,,obj-y) From patchwork Sun Dec 16 14:08:51 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= X-Patchwork-Id: 1014138 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=2001:4830:134:3::11; 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 [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43HmX96bX3z9s3C for ; Mon, 17 Dec 2018 01:15:21 +1100 (AEDT) Received: from localhost ([::1]:42611 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gYXCR-0005NK-4M for incoming@patchwork.ozlabs.org; Sun, 16 Dec 2018 09:15:19 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:32801) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gYX6b-00014a-BK for qemu-devel@nongnu.org; Sun, 16 Dec 2018 09:09:18 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gYX6a-0004nG-Ey for qemu-devel@nongnu.org; Sun, 16 Dec 2018 09:09:17 -0500 Received: from mx1.redhat.com ([209.132.183.28]:57848) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gYX6a-0004mU-9J for qemu-devel@nongnu.org; Sun, 16 Dec 2018 09:09:16 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A2A85C0270B0 for ; Sun, 16 Dec 2018 14:09:15 +0000 (UTC) Received: from localhost (ovpn-112-19.ams2.redhat.com [10.36.112.19]) by smtp.corp.redhat.com (Postfix) with ESMTP id B956218BAA; Sun, 16 Dec 2018 14:09:14 +0000 (UTC) From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= To: qemu-devel@nongnu.org Date: Sun, 16 Dec 2018 18:08:51 +0400 Message-Id: <20181216140902.23986-3-marcandre.lureau@redhat.com> In-Reply-To: <20181216140902.23986-1-marcandre.lureau@redhat.com> References: <20181216140902.23986-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Sun, 16 Dec 2018 14:09:15 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 02/13] qapi-commands: don't initialize command list in qmp_init_marshall() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: armbru@redhat.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" This will let the caller add several list of commands coming from different schemas (the following patches split the schemas for common and arch-specific parts). Signed-off-by: Marc-André Lureau --- scripts/qapi/commands.py | 2 -- monitor.c | 1 + qga/main.c | 1 + tests/test-qmp-cmds.c | 1 + docs/devel/qapi-code-gen.txt | 2 -- 5 files changed, 3 insertions(+), 4 deletions(-) diff --git a/scripts/qapi/commands.py b/scripts/qapi/commands.py index 0f3c991918..a9b2ecb304 100644 --- a/scripts/qapi/commands.py +++ b/scripts/qapi/commands.py @@ -222,8 +222,6 @@ def gen_registry(registry, prefix): void %(c_prefix)sqmp_init_marshal(QmpCommandList *cmds) { - QTAILQ_INIT(cmds); - ''', c_prefix=c_name(prefix, protect=False)) ret += registry diff --git a/monitor.c b/monitor.c index 7848a3cb0d..30e8926002 100644 --- a/monitor.c +++ b/monitor.c @@ -1181,6 +1181,7 @@ static void monitor_init_qmp_commands(void) * "qmp_capabilities", to enforce capability negotiation */ + QTAILQ_INIT(&qmp_commands); qmp_init_marshal(&qmp_commands); qmp_register_command(&qmp_commands, "query-qmp-schema", diff --git a/qga/main.c b/qga/main.c index 87a0711c14..1d6c1024c9 100644 --- a/qga/main.c +++ b/qga/main.c @@ -1486,6 +1486,7 @@ int main(int argc, char **argv) config->log_level = G_LOG_LEVEL_ERROR | G_LOG_LEVEL_CRITICAL; + QTAILQ_INIT(&ga_commands); qga_qmp_init_marshal(&ga_commands); init_dfl_pathnames(); diff --git a/tests/test-qmp-cmds.c b/tests/test-qmp-cmds.c index 481cb069ca..bbd52cfb69 100644 --- a/tests/test-qmp-cmds.c +++ b/tests/test-qmp-cmds.c @@ -325,6 +325,7 @@ int main(int argc, char **argv) g_test_add_func("/qmp/dealloc_types", test_dealloc_types); g_test_add_func("/qmp/dealloc_partial", test_dealloc_partial); + QTAILQ_INIT(&qmp_commands); test_qmp_init_marshal(&qmp_commands); g_test_run(); diff --git a/docs/devel/qapi-code-gen.txt b/docs/devel/qapi-code-gen.txt index 43bd853e69..681177dec1 100644 --- a/docs/devel/qapi-code-gen.txt +++ b/docs/devel/qapi-code-gen.txt @@ -1334,8 +1334,6 @@ Example: void example_qmp_init_marshal(QmpCommandList *cmds) { - QTAILQ_INIT(cmds); - qmp_register_command(cmds, "my-command", qmp_marshal_my_command, QCO_NO_OPTIONS); } From patchwork Sun Dec 16 14:08:52 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= X-Patchwork-Id: 1014133 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=2001:4830:134:3::11; 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 [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43HmQG1ynkz9s3C for ; Mon, 17 Dec 2018 01:10:14 +1100 (AEDT) Received: from localhost ([::1]:42586 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gYX7T-0001Cu-O9 for incoming@patchwork.ozlabs.org; Sun, 16 Dec 2018 09:10:11 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:32874) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gYX6k-0001B4-1s for qemu-devel@nongnu.org; Sun, 16 Dec 2018 09:09:27 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gYX6f-0004tF-3H for qemu-devel@nongnu.org; Sun, 16 Dec 2018 09:09:26 -0500 Received: from mx1.redhat.com ([209.132.183.28]:49770) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gYX6e-0004st-Qy for qemu-devel@nongnu.org; Sun, 16 Dec 2018 09:09:21 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 37DE75F72C for ; Sun, 16 Dec 2018 14:09:20 +0000 (UTC) Received: from localhost (ovpn-112-19.ams2.redhat.com [10.36.112.19]) by smtp.corp.redhat.com (Postfix) with ESMTP id 59A675DA2A; Sun, 16 Dec 2018 14:09:19 +0000 (UTC) From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= To: qemu-devel@nongnu.org Date: Sun, 16 Dec 2018 18:08:52 +0400 Message-Id: <20181216140902.23986-4-marcandre.lureau@redhat.com> In-Reply-To: <20181216140902.23986-1-marcandre.lureau@redhat.com> References: <20181216140902.23986-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Sun, 16 Dec 2018 14:09:20 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 03/13] qapi-commands: rename init_marshal() to register_commands() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: armbru@redhat.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" The function only calls various register_command() now, use a more descriptive name. Signed-off-by: Marc-André Lureau --- scripts/qapi/commands.py | 4 ++-- monitor.c | 2 +- qga/main.c | 2 +- tests/test-qmp-cmds.c | 2 +- docs/devel/qapi-code-gen.txt | 4 ++-- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/scripts/qapi/commands.py b/scripts/qapi/commands.py index a9b2ecb304..94313b8aef 100644 --- a/scripts/qapi/commands.py +++ b/scripts/qapi/commands.py @@ -220,7 +220,7 @@ def gen_register_command(name, success_response, allow_oob, allow_preconfig): def gen_registry(registry, prefix): ret = mcgen(''' -void %(c_prefix)sqmp_init_marshal(QmpCommandList *cmds) +void %(c_prefix)sqmp_register_commands(QmpCommandList *cmds) { ''', c_prefix=c_name(prefix, protect=False)) @@ -270,7 +270,7 @@ class QAPISchemaGenCommandVisitor(QAPISchemaModularCVisitor): def visit_end(self): (genc, genh) = self._module[self._main_module] genh.add(mcgen(''' -void %(c_prefix)sqmp_init_marshal(QmpCommandList *cmds); +void %(c_prefix)sqmp_register_commands(QmpCommandList *cmds); ''', c_prefix=c_name(self._prefix, protect=False))) genc.add(gen_registry(self._regy.get_content(), self._prefix)) diff --git a/monitor.c b/monitor.c index 30e8926002..720d8d98a7 100644 --- a/monitor.c +++ b/monitor.c @@ -1182,7 +1182,7 @@ static void monitor_init_qmp_commands(void) */ QTAILQ_INIT(&qmp_commands); - qmp_init_marshal(&qmp_commands); + qmp_register_commands(&qmp_commands); qmp_register_command(&qmp_commands, "query-qmp-schema", qmp_query_qmp_schema, QCO_ALLOW_PRECONFIG); diff --git a/qga/main.c b/qga/main.c index 1d6c1024c9..75496fa793 100644 --- a/qga/main.c +++ b/qga/main.c @@ -1487,7 +1487,7 @@ int main(int argc, char **argv) config->log_level = G_LOG_LEVEL_ERROR | G_LOG_LEVEL_CRITICAL; QTAILQ_INIT(&ga_commands); - qga_qmp_init_marshal(&ga_commands); + qga_qmp_register_commands(&ga_commands); init_dfl_pathnames(); config_load(config); diff --git a/tests/test-qmp-cmds.c b/tests/test-qmp-cmds.c index bbd52cfb69..039ffcc6a9 100644 --- a/tests/test-qmp-cmds.c +++ b/tests/test-qmp-cmds.c @@ -326,7 +326,7 @@ int main(int argc, char **argv) g_test_add_func("/qmp/dealloc_partial", test_dealloc_partial); QTAILQ_INIT(&qmp_commands); - test_qmp_init_marshal(&qmp_commands); + test_qmp_register_commands(&qmp_commands); g_test_run(); return 0; diff --git a/docs/devel/qapi-code-gen.txt b/docs/devel/qapi-code-gen.txt index 681177dec1..79a38c21e6 100644 --- a/docs/devel/qapi-code-gen.txt +++ b/docs/devel/qapi-code-gen.txt @@ -1271,7 +1271,7 @@ Example: UserDefOne *qmp_my_command(UserDefOneList *arg1, Error **errp); void qmp_marshal_my_command(QDict *args, QObject **ret, Error **errp); - void example_qmp_init_marshal(QmpCommandList *cmds); + void example_qmp_register_commands(QmpCommandList *cmds); #endif /* EXAMPLE_QAPI_COMMANDS_H */ $ cat qapi-generated/example-qapi-commands.c @@ -1332,7 +1332,7 @@ Example: visit_free(v); } - void example_qmp_init_marshal(QmpCommandList *cmds) + void example_qmp_register_commands(QmpCommandList *cmds) { qmp_register_command(cmds, "my-command", qmp_marshal_my_command, QCO_NO_OPTIONS); From patchwork Sun Dec 16 14:08:53 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= X-Patchwork-Id: 1014134 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=2001:4830:134:3::11; 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 [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43HmRj4FJTz9s3C for ; Mon, 17 Dec 2018 01:11:29 +1100 (AEDT) Received: from localhost ([::1]:42596 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gYX8h-0002Eg-4k for incoming@patchwork.ozlabs.org; Sun, 16 Dec 2018 09:11:27 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:32920) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gYX6m-0001DP-Rm for qemu-devel@nongnu.org; Sun, 16 Dec 2018 09:09:30 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gYX6k-0004xH-QL for qemu-devel@nongnu.org; Sun, 16 Dec 2018 09:09:28 -0500 Received: from mx1.redhat.com ([209.132.183.28]:57886) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gYX6k-0004wO-F2 for qemu-devel@nongnu.org; Sun, 16 Dec 2018 09:09:26 -0500 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 CB68EC05D410 for ; Sun, 16 Dec 2018 14:09:25 +0000 (UTC) Received: from localhost (ovpn-112-19.ams2.redhat.com [10.36.112.19]) by smtp.corp.redhat.com (Postfix) with ESMTP id 14F831057069; Sun, 16 Dec 2018 14:09:23 +0000 (UTC) From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= To: qemu-devel@nongnu.org Date: Sun, 16 Dec 2018 18:08:53 +0400 Message-Id: <20181216140902.23986-5-marcandre.lureau@redhat.com> In-Reply-To: <20181216140902.23986-1-marcandre.lureau@redhat.com> References: <20181216140902.23986-1-marcandre.lureau@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.32]); Sun, 16 Dec 2018 14:09:25 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 04/13] RFC: qapi: learn to split the schema by 'top-unit' X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: armbru@redhat.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" A module can declare belonging to a 'top-unit', with the corresponding pragma value (the default 'top-unit' is None). The generators have a chance to break the generated output by units (top-units are visited first). Generated types, visitors, events and commands are split by 'top-unit'. Generated introspection and documentation remain monolithic. In the following commits, a 'target' unit is introduced. The generated 'target' files will be allowed to used poisoned defines for conditional compilation, since they will be built with the target objects. TODO: if this approach is acceptable, split the patch, write tests & doc. Note: I don't really have better ideas, but open for suggestions... Signed-off-by: Marc-André Lureau --- scripts/qapi/commands.py | 22 +++++--- scripts/qapi/common.py | 105 +++++++++++++++++++++++++++++++-------- scripts/qapi/events.py | 37 ++++++++------ scripts/qapi/types.py | 8 +-- scripts/qapi/visit.py | 8 +-- 5 files changed, 130 insertions(+), 50 deletions(-) diff --git a/scripts/qapi/commands.py b/scripts/qapi/commands.py index 94313b8aef..e4dc92e70b 100644 --- a/scripts/qapi/commands.py +++ b/scripts/qapi/commands.py @@ -237,14 +237,20 @@ class QAPISchemaGenCommandVisitor(QAPISchemaModularCVisitor): QAPISchemaModularCVisitor.__init__( self, prefix, 'qapi-commands', ' * Schema-defined QAPI/QMP commands', __doc__) + + def visit_unit_begin(self, unit): + super(self.__class__, self).visit_unit_begin(unit) self._regy = QAPIGenCCode() self._visited_ret_types = {} - def _begin_module(self, name): + def _begin_module(self, name, main_module): self._visited_ret_types[self._genc] = set() - commands = self._module_basename('qapi-commands', name) - types = self._module_basename('qapi-types', name) - visit = self._module_basename('qapi-visit', name) + commands = self._module_basename('qapi-commands', name, + self._unit, main_module) + types = self._module_basename('qapi-types', name, + self._unit, main_module) + visit = self._module_basename('qapi-visit', name, + self._unit, main_module) self._genc.add(mcgen(''' #include "qemu/osdep.h" #include "qemu-common.h" @@ -267,13 +273,13 @@ class QAPISchemaGenCommandVisitor(QAPISchemaModularCVisitor): ''', types=types)) - def visit_end(self): - (genc, genh) = self._module[self._main_module] + def visit_unit_end(self): + (genc, genh) = self.get_module_gen(self._main_module) genh.add(mcgen(''' void %(c_prefix)sqmp_register_commands(QmpCommandList *cmds); ''', - c_prefix=c_name(self._prefix, protect=False))) - genc.add(gen_registry(self._regy.get_content(), self._prefix)) + c_prefix=c_name(self._prefix_unit(), protect=False))) + genc.add(gen_registry(self._regy.get_content(), self._prefix_unit())) def visit_command(self, name, info, ifcond, arg_type, ret_type, gen, success_response, boxed, allow_oob, allow_preconfig): diff --git a/scripts/qapi/common.py b/scripts/qapi/common.py index 8c2d97369e..1ef3a4f70b 100644 --- a/scripts/qapi/common.py +++ b/scripts/qapi/common.py @@ -269,11 +269,12 @@ class QAPISchemaParser(object): self.exprs = [] self.docs = [] self.accept() + self._top_unit = None cur_doc = None while self.tok is not None: info = {'file': self.fname, 'line': self.line, - 'parent': self.incl_info} + 'parent': self.incl_info, 'top-unit': self._top_unit} if self.tok == '#': self.reject_expr_doc(cur_doc) cur_doc = self.get_doc(info) @@ -296,6 +297,9 @@ class QAPISchemaParser(object): exprs_include = self._include(include, info, incl_fname, previously_included) if exprs_include: + incl_info = self.exprs[-1]['info'] + if exprs_include._top_unit: + incl_info['has-pragma-top-unit'] = exprs_include._top_unit self.exprs.extend(exprs_include.exprs) self.docs.extend(exprs_include.docs) elif "pragma" in expr: @@ -357,6 +361,11 @@ class QAPISchemaParser(object): raise QAPISemError(info, "Pragma 'doc-required' must be boolean") doc_required = value + elif name == 'top-unit': + if not isinstance(value, str): + raise QAPISemError(info, + "Pragma 'top-unit' must be a string") + self._top_unit = value elif name == 'returns-whitelist': if (not isinstance(value, list) or any([not isinstance(elt, str) for elt in value])): @@ -1081,6 +1090,11 @@ class QAPISchemaEntity(object): def c_name(self): return c_name(self.name) + def get_top_unit(self): + if self.info: + return self.info['top-unit'] + return None + def check(self, schema): if isinstance(self._ifcond, QAPISchemaType): # inherit the condition from a type @@ -1101,6 +1115,12 @@ class QAPISchemaVisitor(object): def visit_begin(self, schema): pass + def visit_unit_begin(self, unit): + pass + + def visit_unit_end(self): + pass + def visit_end(self): pass @@ -1610,7 +1630,7 @@ class QAPISchema(object): parser = QAPISchemaParser(f) exprs = check_exprs(parser.exprs) self.docs = parser.docs - self._entity_list = [] + self._entity_list = {} # dict of unit name -> list of entity self._entity_dict = {} self._predefining = True self._def_predefineds() @@ -1622,7 +1642,8 @@ class QAPISchema(object): # Only the predefined types are allowed to not have info assert ent.info or self._predefining assert ent.name is None or ent.name not in self._entity_dict - self._entity_list.append(ent) + entity_list = self._entity_list.setdefault(ent.get_top_unit(), []) + entity_list.append(ent) if ent.name is not None: self._entity_dict[ent.name] = ent if ent.info: @@ -1861,18 +1882,23 @@ class QAPISchema(object): assert False def check(self): - for ent in self._entity_list: - ent.check(self) + for unit in self._entity_list: + for ent in self._entity_list[unit]: + ent.check(self) def visit(self, visitor): visitor.visit_begin(self) - module = None - for entity in self._entity_list: - if visitor.visit_needed(entity): + for unit in self._entity_list: + module = None + visitor.visit_unit_begin(unit) + for entity in self._entity_list[unit]: + if not visitor.visit_needed(entity): + continue if entity.module != module: module = entity.module visitor.visit_module(module) entity.visit(visitor) + visitor.visit_unit_end() visitor.visit_end() @@ -2313,6 +2339,19 @@ class QAPISchemaMonolithicCVisitor(QAPISchemaVisitor): self._genh.write(output_dir, self._prefix + self._what + '.h') +class QAPIGenCModule(object): + + def __init__(self, blurb, pydoc, unit, main_module=False): + self.genc = QAPIGenC(blurb, pydoc) + self.genh = QAPIGenH(blurb, pydoc) + self.unit = unit + self.main_module = main_module + + def write(self, output_dir, basename): + self.genc.write(output_dir, basename + '.c') + self.genh.write(output_dir, basename + '.h') + + class QAPISchemaModularCVisitor(QAPISchemaVisitor): def __init__(self, prefix, what, blurb, pydoc): @@ -2321,48 +2360,70 @@ class QAPISchemaModularCVisitor(QAPISchemaVisitor): self._blurb = blurb self._pydoc = pydoc self._module = {} + self._unit = None self._main_module = None - def _module_basename(self, what, name): + def _module_basename(self, what, name, unit=None, main_module=False): if name is None: return re.sub(r'-', '-builtin-', what) basename = os.path.join(os.path.dirname(name), self._prefix + what) - if name == self._main_module: + if unit: + basename = unit + '-' + basename + if main_module: return basename return basename + '-' + os.path.splitext(os.path.basename(name))[0] + def _prefix_unit(self): + if self._unit: + return self._prefix + self._unit + '-' + return self._prefix + + def visit_unit_begin(self, unit): + self._unit = unit + self._main_module = None + def _add_module(self, name, blurb): - if self._main_module is None and name is not None: + main_module = False + if (name is not None and + ((self._unit is None and self._main_module is None) or + (self._unit == os.path.splitext(os.path.basename(name))[0]))): self._main_module = name - genc = QAPIGenC(blurb, self._pydoc) - genh = QAPIGenH(blurb, self._pydoc) - self._module[name] = (genc, genh) + main_module = True + self._module[name] = QAPIGenCModule(blurb, self._pydoc, + self._unit, main_module) self._set_module(name) + return main_module + + def get_module_gen(self, name): + mod = self._module[name] + return mod.genc, mod.genh def _set_module(self, name): - self._genc, self._genh = self._module[name] + self._genc, self._genh = self.get_module_gen(name) def write(self, output_dir, opt_builtins=False): for name in self._module: if name is None and not opt_builtins: continue - basename = self._module_basename(self._what, name) - (genc, genh) = self._module[name] - genc.write(output_dir, basename + '.c') - genh.write(output_dir, basename + '.h') + module = self._module[name] + basename = self._module_basename(self._what, name, + module.unit, module.main_module) + module.write(output_dir, basename) - def _begin_module(self, name): + def _begin_module(self, name, main_module): pass def visit_module(self, name): if name in self._module: self._set_module(name) return - self._add_module(name, self._blurb) - self._begin_module(name) + main_module = self._add_module(name, self._blurb) + self._begin_module(name, main_module) def visit_include(self, name, info): + if 'has-pragma-top-unit' in info: + return basename = self._module_basename(self._what, name) self._genh.preamble_add(mcgen(''' #include "%(basename)s.h" diff --git a/scripts/qapi/events.py b/scripts/qapi/events.py index 37ee5de682..b73e10e16d 100644 --- a/scripts/qapi/events.py +++ b/scripts/qapi/events.py @@ -58,7 +58,12 @@ def gen_param_var(typ): return ret -def gen_event_send(name, arg_type, boxed, event_enum_name): +def gen_event_send(unit, name, arg_type, boxed, event_enum_name): + if not unit: + unit = '' + else: + unit += '_' + # FIXME: Our declaration of local variables (and of 'errp' in the # parameter list) can collide with exploded members of the event's # data type passed in as parameters. If this collision ever hits in @@ -86,7 +91,7 @@ def gen_event_send(name, arg_type, boxed, event_enum_name): ret += mcgen(''' - emit = qmp_event_get_func_emit(); + emit = %(unit)sqmp_event_get_func_emit(); if (!emit) { return; } @@ -94,7 +99,7 @@ def gen_event_send(name, arg_type, boxed, event_enum_name): qmp = qmp_event_build_dict("%(name)s"); ''', - name=name) + name=name, unit=unit) if arg_type and not arg_type.is_empty(): ret += mcgen(''' @@ -143,12 +148,17 @@ class QAPISchemaGenEventVisitor(QAPISchemaModularCVisitor): QAPISchemaModularCVisitor.__init__( self, prefix, 'qapi-events', ' * Schema-defined QAPI/QMP events', __doc__) - self._event_enum_name = c_name(prefix + 'QAPIEvent', protect=False) + + def visit_unit_begin(self, unit): + super(self.__class__, self).visit_unit_begin(unit) + self._event_enum_name = c_name(self._prefix_unit() + 'QAPIEvent', protect=False) self._event_enum_members = [] - def _begin_module(self, name): - types = self._module_basename('qapi-types', name) - visit = self._module_basename('qapi-visit', name) + def _begin_module(self, name, main_module): + types = self._module_basename('qapi-types', name, + self._unit, main_module) + visit = self._module_basename('qapi-visit', name, + self._unit, main_module) self._genc.add(mcgen(''' #include "qemu/osdep.h" #include "qemu-common.h" @@ -160,7 +170,7 @@ class QAPISchemaGenEventVisitor(QAPISchemaModularCVisitor): #include "qapi/qmp-event.h" ''', - visit=visit, prefix=self._prefix)) + visit=visit, prefix=self._prefix_unit())) self._genh.add(mcgen(''' #include "qapi/util.h" #include "%(types)s.h" @@ -168,17 +178,16 @@ class QAPISchemaGenEventVisitor(QAPISchemaModularCVisitor): ''', types=types)) - def visit_end(self): - (genc, genh) = self._module[self._main_module] + def visit_unit_end(self): + (genc, genh) = self.get_module_gen(self._main_module) genh.add(gen_enum(self._event_enum_name, self._event_enum_members)) - genc.add(gen_enum_lookup(self._event_enum_name, - self._event_enum_members)) + genc.add(gen_enum_lookup(self._event_enum_name, self._event_enum_members)) def visit_event(self, name, info, ifcond, arg_type, boxed): with ifcontext(ifcond, self._genh, self._genc): self._genh.add(gen_event_send_decl(name, arg_type, boxed)) - self._genc.add(gen_event_send(name, arg_type, boxed, - self._event_enum_name)) + self._genc.add(gen_event_send(self._unit, name, + arg_type, boxed, self._event_enum_name)) self._event_enum_members.append(QAPISchemaMember(name, ifcond)) diff --git a/scripts/qapi/types.py b/scripts/qapi/types.py index 62d4cf9f95..db85cf9b9b 100644 --- a/scripts/qapi/types.py +++ b/scripts/qapi/types.py @@ -194,9 +194,11 @@ class QAPISchemaGenTypeVisitor(QAPISchemaModularCVisitor): #include "qapi/util.h" ''')) - def _begin_module(self, name): - types = self._module_basename('qapi-types', name) - visit = self._module_basename('qapi-visit', name) + def _begin_module(self, name, main_module): + types = self._module_basename('qapi-types', name, + self._unit, main_module) + visit = self._module_basename('qapi-visit', name, + self._unit, main_module) self._genc.preamble_add(mcgen(''' #include "qemu/osdep.h" #include "qapi/dealloc-visitor.h" diff --git a/scripts/qapi/visit.py b/scripts/qapi/visit.py index 82eab72b21..258ebdb690 100644 --- a/scripts/qapi/visit.py +++ b/scripts/qapi/visit.py @@ -298,9 +298,11 @@ class QAPISchemaGenVisitVisitor(QAPISchemaModularCVisitor): ''', prefix=prefix)) - def _begin_module(self, name): - types = self._module_basename('qapi-types', name) - visit = self._module_basename('qapi-visit', name) + def _begin_module(self, name, main_module): + types = self._module_basename('qapi-types', name, + self._unit, main_module) + visit = self._module_basename('qapi-visit', name, + self._unit, main_module) self._genc.preamble_add(mcgen(''' #include "qemu/osdep.h" #include "qemu-common.h" From patchwork Sun Dec 16 14:08:54 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= X-Patchwork-Id: 1014136 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=2001:4830:134:3::11; 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 [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43HmTn5MdVz9s3C for ; Mon, 17 Dec 2018 01:13:17 +1100 (AEDT) Received: from localhost ([::1]:42603 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gYXAR-0003iv-9A for incoming@patchwork.ozlabs.org; Sun, 16 Dec 2018 09:13:15 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33000) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gYX6v-0001JX-Gl for qemu-devel@nongnu.org; Sun, 16 Dec 2018 09:09:39 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gYX6q-00052H-Fj for qemu-devel@nongnu.org; Sun, 16 Dec 2018 09:09:37 -0500 Received: from mx1.redhat.com ([209.132.183.28]:45610) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gYX6q-00051T-4w for qemu-devel@nongnu.org; Sun, 16 Dec 2018 09:09:32 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5ABB781F0C for ; Sun, 16 Dec 2018 14:09:31 +0000 (UTC) Received: from localhost (ovpn-112-19.ams2.redhat.com [10.36.112.19]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3EC2F608F3; Sun, 16 Dec 2018 14:09:28 +0000 (UTC) From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= To: qemu-devel@nongnu.org Date: Sun, 16 Dec 2018 18:08:54 +0400 Message-Id: <20181216140902.23986-6-marcandre.lureau@redhat.com> In-Reply-To: <20181216140902.23986-1-marcandre.lureau@redhat.com> References: <20181216140902.23986-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Sun, 16 Dec 2018 14:09:31 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 05/13] qapi: add a top-unit 'target' schema X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: armbru@redhat.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Add a 'target' top-unit to be compiled seperately from the common qapi modules. This will allow poisoned target #ifdef usage. The generated commands must be registered seperately. The events have a different enum, and must thus use a different emitter/limiter. The DUMMY event is there to force the visit of target, ensuring files are built. It is removed in next commit. Signed-off-by: Marc-André Lureau --- qapi/qapi-schema.json | 1 + qapi/target.json | 13 +++ include/qapi/qmp-event.h | 4 + monitor.c | 216 ++++++++++++++++++++++++++------------- qapi/qmp-event.c | 11 ++ Makefile | 7 +- Makefile.target | 2 + 7 files changed, 181 insertions(+), 73 deletions(-) create mode 100644 qapi/target.json diff --git a/qapi/qapi-schema.json b/qapi/qapi-schema.json index 65b6dc2f6f..4a836d6c9f 100644 --- a/qapi/qapi-schema.json +++ b/qapi/qapi-schema.json @@ -94,3 +94,4 @@ { 'include': 'trace.json' } { 'include': 'introspect.json' } { 'include': 'misc.json' } +{ 'include': 'target.json' } diff --git a/qapi/target.json b/qapi/target.json new file mode 100644 index 0000000000..be2360ca34 --- /dev/null +++ b/qapi/target.json @@ -0,0 +1,13 @@ +# -*- Mode: Python -*- +# + +## +# = Target-specific commands & events +## + +{ 'pragma': { 'top-unit': 'target' } } + +## +# @DUMMY: +## +{ 'event': 'DUMMY' } diff --git a/include/qapi/qmp-event.h b/include/qapi/qmp-event.h index 23e588ccf8..da752f8371 100644 --- a/include/qapi/qmp-event.h +++ b/include/qapi/qmp-event.h @@ -20,5 +20,9 @@ void qmp_event_set_func_emit(QMPEventFuncEmit emit); QMPEventFuncEmit qmp_event_get_func_emit(void); +void target_qmp_event_set_func_emit(QMPEventFuncEmit emit); + +QMPEventFuncEmit target_qmp_event_get_func_emit(void); + QDict *qmp_event_build_dict(const char *event_name); #endif diff --git a/monitor.c b/monitor.c index 720d8d98a7..86f3193158 100644 --- a/monitor.c +++ b/monitor.c @@ -76,6 +76,8 @@ #include "block/qapi.h" #include "qapi/qapi-commands.h" #include "qapi/qapi-events.h" +#include "qapi/target-qapi-commands.h" +#include "qapi/target-qapi-events.h" #include "qapi/error.h" #include "qapi/qmp-event.h" #include "qapi/qapi-introspect.h" @@ -185,22 +187,25 @@ typedef struct { GQueue *qmp_requests; } MonitorQMP; +typedef struct { + GHashTable *state; + const size_t size; /* size of array == number of events */ + const int64_t rate[]; /* Minimum time (in ns) between two events */ +} MonitorEventRateLimit; + /* * To prevent flooding clients, events can be throttled. The * throttling is calculated globally, rather than per-Monitor * instance. */ typedef struct MonitorQAPIEventState { - QAPIEvent event; /* Throttling state for this event type and... */ + const MonitorEventRateLimit *limiter; + unsigned event; /* Throttling state for this event type and... */ QDict *data; /* ... data, see qapi_event_throttle_equal() */ QEMUTimer *timer; /* Timer for handling delayed events */ QDict *qdict; /* Delayed event (if any) */ } MonitorQAPIEventState; -typedef struct { - int64_t rate; /* Minimum time (in ns) between two events */ -} MonitorQAPIEventConf; - struct Monitor { CharBackend chr; int reset_seen; @@ -263,9 +268,8 @@ typedef struct QMPRequest QMPRequest; /* QMP checker flags */ #define QMP_ACCEPT_UNKNOWNS 1 -/* Protects mon_list, monitor_qapi_event_state, monitor_destroyed. */ +/* Protects mon_list, limiter, monitor_qapi_event_state, monitor_destroyed. */ static QemuMutex monitor_lock; -static GHashTable *monitor_qapi_event_state; static QTAILQ_HEAD(mon_list, Monitor) mon_list; static bool monitor_destroyed; @@ -500,22 +504,12 @@ static void qmp_send_response(Monitor *mon, const QDict *rsp) qobject_unref(json); } -static MonitorQAPIEventConf monitor_qapi_event_conf[QAPI_EVENT__MAX] = { - /* Limit guest-triggerable events to 1 per second */ - [QAPI_EVENT_RTC_CHANGE] = { 1000 * SCALE_MS }, - [QAPI_EVENT_WATCHDOG] = { 1000 * SCALE_MS }, - [QAPI_EVENT_BALLOON_CHANGE] = { 1000 * SCALE_MS }, - [QAPI_EVENT_QUORUM_REPORT_BAD] = { 1000 * SCALE_MS }, - [QAPI_EVENT_QUORUM_FAILURE] = { 1000 * SCALE_MS }, - [QAPI_EVENT_VSERPORT_CHANGE] = { 1000 * SCALE_MS }, -}; - /* * Broadcast an event to all monitors. * @qdict is the event object. Its member "event" must match @event. * Caller must hold monitor_lock. */ -static void monitor_qapi_event_emit(QAPIEvent event, QDict *qdict) +static void monitor_qapi_event_emit(unsigned event, QDict *qdict) { Monitor *mon; @@ -535,30 +529,31 @@ static void monitor_qapi_event_handler(void *opaque); * applying any rate limiting if required. */ static void -monitor_qapi_event_queue_no_reenter(QAPIEvent event, QDict *qdict) +monitor_qapi_event_queue_no_reenter(const MonitorEventRateLimit *limiter, + unsigned event, QDict *qdict) { - MonitorQAPIEventConf *evconf; + int64_t rate; MonitorQAPIEventState *evstate; - assert(event < QAPI_EVENT__MAX); - evconf = &monitor_qapi_event_conf[event]; - trace_monitor_protocol_event_queue(event, qdict, evconf->rate); + assert(event < limiter->size); + rate = limiter->rate[event]; + trace_monitor_protocol_event_queue(event, qdict, rate); qemu_mutex_lock(&monitor_lock); - if (!evconf->rate) { + if (!rate) { /* Unthrottled event */ monitor_qapi_event_emit(event, qdict); } else { QDict *data = qobject_to(QDict, qdict_get(qdict, "data")); MonitorQAPIEventState key = { .event = event, .data = data }; - evstate = g_hash_table_lookup(monitor_qapi_event_state, &key); + evstate = g_hash_table_lookup(limiter->state, &key); assert(!evstate || timer_pending(evstate->timer)); if (evstate) { /* - * Timer is pending for (at least) evconf->rate ns after + * Timer is pending for (at least) rate ns after * last send. Store event for sending when timer fires, * replacing a prior stored event if any. */ @@ -566,9 +561,9 @@ monitor_qapi_event_queue_no_reenter(QAPIEvent event, QDict *qdict) evstate->qdict = qobject_ref(qdict); } else { /* - * Last send was (at least) evconf->rate ns ago. + * Last send was (at least) rate ns ago. * Send immediately, and arm the timer to call - * monitor_qapi_event_handler() in evconf->rate ns. Any + * monitor_qapi_event_handler() in rate ns. Any * events arriving before then will be delayed until then. */ int64_t now = qemu_clock_get_ns(monitor_get_event_clock()); @@ -576,14 +571,15 @@ monitor_qapi_event_queue_no_reenter(QAPIEvent event, QDict *qdict) monitor_qapi_event_emit(event, qdict); evstate = g_new(MonitorQAPIEventState, 1); + evstate->limiter = limiter; evstate->event = event; evstate->data = qobject_ref(data); evstate->qdict = NULL; evstate->timer = timer_new_ns(monitor_get_event_clock(), monitor_qapi_event_handler, evstate); - g_hash_table_add(monitor_qapi_event_state, evstate); - timer_mod_ns(evstate->timer, now + evconf->rate); + g_hash_table_add(limiter->state, evstate); + timer_mod_ns(evstate->timer, now + rate); } } @@ -591,7 +587,8 @@ monitor_qapi_event_queue_no_reenter(QAPIEvent event, QDict *qdict) } static void -monitor_qapi_event_queue(QAPIEvent event, QDict *qdict) +monitor_qapi_event_queue_limit(const MonitorEventRateLimit *limiter, + QAPIEvent event, QDict *qdict) { /* * monitor_qapi_event_queue_no_reenter() is not reentrant: it @@ -624,7 +621,7 @@ monitor_qapi_event_queue(QAPIEvent event, QDict *qdict) while ((ev = QSIMPLEQ_FIRST(&event_queue)) != NULL) { QSIMPLEQ_REMOVE_HEAD(&event_queue, entry); - monitor_qapi_event_queue_no_reenter(ev->event, ev->qdict); + monitor_qapi_event_queue_no_reenter(limiter, ev->event, ev->qdict); qobject_unref(ev->qdict); g_free(ev); } @@ -632,36 +629,6 @@ monitor_qapi_event_queue(QAPIEvent event, QDict *qdict) reentered = false; } -/* - * This function runs evconf->rate ns after sending a throttled - * event. - * If another event has since been stored, send it. - */ -static void monitor_qapi_event_handler(void *opaque) -{ - MonitorQAPIEventState *evstate = opaque; - MonitorQAPIEventConf *evconf = &monitor_qapi_event_conf[evstate->event]; - - trace_monitor_protocol_event_handler(evstate->event, evstate->qdict); - qemu_mutex_lock(&monitor_lock); - - if (evstate->qdict) { - int64_t now = qemu_clock_get_ns(monitor_get_event_clock()); - - monitor_qapi_event_emit(evstate->event, evstate->qdict); - qobject_unref(evstate->qdict); - evstate->qdict = NULL; - timer_mod_ns(evstate->timer, now + evconf->rate); - } else { - g_hash_table_remove(monitor_qapi_event_state, evstate); - qobject_unref(evstate->data); - timer_free(evstate->timer); - g_free(evstate); - } - - qemu_mutex_unlock(&monitor_lock); -} - static unsigned int qapi_event_throttle_hash(const void *key) { const MonitorQAPIEventState *evstate = key; @@ -700,11 +667,103 @@ static gboolean qapi_event_throttle_equal(const void *a, const void *b) return TRUE; } +static void +monitor_qapi_event_queue(unsigned event, QDict *qdict) +{ + static MonitorEventRateLimit limiter = { + .size = QAPI_EVENT__MAX, + .rate = { + /* Limit guest-triggerable events to 1 per second */ + [QAPI_EVENT_RTC_CHANGE] = 1000 * SCALE_MS, + [QAPI_EVENT_WATCHDOG] = 1000 * SCALE_MS, + [QAPI_EVENT_BALLOON_CHANGE] = 1000 * SCALE_MS, + [QAPI_EVENT_QUORUM_REPORT_BAD] = 1000 * SCALE_MS, + [QAPI_EVENT_QUORUM_FAILURE] = 1000 * SCALE_MS, + [QAPI_EVENT_VSERPORT_CHANGE] = 1000 * SCALE_MS, + [QAPI_EVENT__MAX] = 0, + }, + }; + + if (!limiter.state) { + limiter.state = g_hash_table_new(qapi_event_throttle_hash, + qapi_event_throttle_equal); + } + + monitor_qapi_event_queue_limit(&limiter, event, qdict); +} + +static unsigned int target_qapi_event_throttle_hash(const void *key) +{ + const MonitorQAPIEventState *evstate = key; + unsigned int hash = evstate->event * 255; + + return hash; +} + +static gboolean target_qapi_event_throttle_equal(const void *a, const void *b) +{ + const MonitorQAPIEventState *eva = a; + const MonitorQAPIEventState *evb = b; + + if (eva->event != evb->event) { + return FALSE; + } + + return TRUE; +} + +static void +target_monitor_qapi_event_queue(unsigned event, QDict *qdict) +{ + static MonitorEventRateLimit limiter = { + .size = TARGET_QAPI_EVENT__MAX, + .rate = { + [TARGET_QAPI_EVENT__MAX] = 0, + }, + }; + + if (!limiter.state) { + limiter.state = g_hash_table_new(target_qapi_event_throttle_hash, + target_qapi_event_throttle_equal); + } + monitor_qapi_event_queue_limit(&limiter, event, qdict); +} + +/* + * This function runs evconf->rate ns after sending a throttled + * event. + * If another event has since been stored, send it. + */ +static void monitor_qapi_event_handler(void *opaque) +{ + MonitorQAPIEventState *evstate = opaque; + const MonitorEventRateLimit *limiter = evstate->limiter; + int64_t rate = limiter->rate[evstate->event]; + + trace_monitor_protocol_event_handler(evstate->event, evstate->qdict); + qemu_mutex_lock(&monitor_lock); + + if (evstate->qdict) { + int64_t now = qemu_clock_get_ns(monitor_get_event_clock()); + + monitor_qapi_event_emit(evstate->event, evstate->qdict); + qobject_unref(evstate->qdict); + evstate->qdict = NULL; + timer_mod_ns(evstate->timer, now + rate); + } else { + g_hash_table_remove(limiter->state, evstate); + qobject_unref(evstate->data); + timer_free(evstate->timer); + g_free(evstate); + } + + qemu_mutex_unlock(&monitor_lock); +} + static void monitor_qapi_event_init(void) { - monitor_qapi_event_state = g_hash_table_new(qapi_event_throttle_hash, - qapi_event_throttle_equal); qmp_event_set_func_emit(monitor_qapi_event_queue); + target_qmp_event_set_func_emit(target_monitor_qapi_event_queue); } static void handle_hmp_command(Monitor *mon, const char *cmdline); @@ -1099,9 +1158,10 @@ CommandInfoList *qmp_query_commands(Error **errp) return list; } -EventInfoList *qmp_query_events(Error **errp) +static void qmp_query_events_list(EventInfoList **list, + const QEnumLookup *qenum, int max) { - EventInfoList *info, *ev_list = NULL; + EventInfoList *info; QAPIEvent e; for (e = 0 ; e < QAPI_EVENT__MAX ; e++) { @@ -1111,11 +1171,22 @@ EventInfoList *qmp_query_events(Error **errp) info->value = g_malloc0(sizeof(*info->value)); info->value->name = g_strdup(event_name); - info->next = ev_list; - ev_list = info; + info->next = *list; + *list = info; } - return ev_list; +} + +EventInfoList *qmp_query_events(Error **errp) +{ + EventInfoList *list = NULL; + + qmp_query_events_list(&list, &QAPIEvent_lookup, + QAPI_EVENT__MAX); + qmp_query_events_list(&list, &target_QAPIEvent_lookup, + TARGET_QAPI_EVENT__MAX); + + return list; } /* @@ -1183,6 +1254,7 @@ static void monitor_init_qmp_commands(void) QTAILQ_INIT(&qmp_commands); qmp_register_commands(&qmp_commands); + target_qmp_register_commands(&qmp_commands); qmp_register_command(&qmp_commands, "query-qmp-schema", qmp_query_qmp_schema, QCO_ALLOW_PRECONFIG); @@ -2941,11 +3013,11 @@ static int default_fmt_size = 4; static int is_valid_option(const char *c, const char *typestr) { char option[3]; - + option[0] = '-'; option[1] = *c; option[2] = '\0'; - + typestr = strstr(typestr, option); return (typestr != NULL); } @@ -3318,7 +3390,7 @@ static QDict *monitor_parse_arguments(Monitor *mon, p++; if(c != *p) { if(!is_valid_option(p, typestr)) { - + monitor_printf(mon, "%s: unsupported option -%c\n", cmd->name, *p); goto fail; diff --git a/qapi/qmp-event.c b/qapi/qmp-event.c index 5b8854043e..a0f7dd8ac2 100644 --- a/qapi/qmp-event.c +++ b/qapi/qmp-event.c @@ -20,6 +20,7 @@ #include "qapi/qmp/qjson.h" static QMPEventFuncEmit qmp_emit; +static QMPEventFuncEmit target_qmp_emit; void qmp_event_set_func_emit(QMPEventFuncEmit emit) { @@ -31,6 +32,16 @@ QMPEventFuncEmit qmp_event_get_func_emit(void) return qmp_emit; } +void target_qmp_event_set_func_emit(QMPEventFuncEmit emit) +{ + target_qmp_emit = emit; +} + +QMPEventFuncEmit target_qmp_event_get_func_emit(void) +{ + return target_qmp_emit; +} + static void timestamp_put(QDict *qdict) { int err; diff --git a/Makefile b/Makefile index c8b9efdad4..01a31e2ea5 100644 --- a/Makefile +++ b/Makefile @@ -92,16 +92,20 @@ GENERATED_FILES = qemu-version.h config-host.h qemu-options.def #see Makefile.objs for the definition of QAPI_MODULES GENERATED_QAPI_FILES = qapi/qapi-builtin-types.h qapi/qapi-builtin-types.c GENERATED_QAPI_FILES += qapi/qapi-types.h qapi/qapi-types.c +GENERATED_QAPI_FILES += qapi/target-qapi-types.h qapi/target-qapi-types.c GENERATED_QAPI_FILES += $(QAPI_MODULES:%=qapi/qapi-types-%.h) GENERATED_QAPI_FILES += $(QAPI_MODULES:%=qapi/qapi-types-%.c) GENERATED_QAPI_FILES += qapi/qapi-builtin-visit.h qapi/qapi-builtin-visit.c GENERATED_QAPI_FILES += qapi/qapi-visit.h qapi/qapi-visit.c +GENERATED_QAPI_FILES += qapi/target-qapi-visit.h qapi/target-qapi-visit.c GENERATED_QAPI_FILES += $(QAPI_MODULES:%=qapi/qapi-visit-%.h) GENERATED_QAPI_FILES += $(QAPI_MODULES:%=qapi/qapi-visit-%.c) GENERATED_QAPI_FILES += qapi/qapi-commands.h qapi/qapi-commands.c +GENERATED_QAPI_FILES += qapi/target-qapi-commands.h qapi/target-qapi-commands.c GENERATED_QAPI_FILES += $(QAPI_MODULES:%=qapi/qapi-commands-%.h) GENERATED_QAPI_FILES += $(QAPI_MODULES:%=qapi/qapi-commands-%.c) GENERATED_QAPI_FILES += qapi/qapi-events.h qapi/qapi-events.c +GENERATED_QAPI_FILES += qapi/target-qapi-events.h qapi/target-qapi-events.c GENERATED_QAPI_FILES += $(QAPI_MODULES:%=qapi/qapi-events-%.h) GENERATED_QAPI_FILES += $(QAPI_MODULES:%=qapi/qapi-events-%.c) GENERATED_QAPI_FILES += qapi/qapi-introspect.c qapi/qapi-introspect.h @@ -528,7 +532,8 @@ qga/qapi-generated/qapi-gen-timestamp: $(SRC_PATH)/qga/qapi-schema.json $(qapi-p @>$@ qapi-modules = $(SRC_PATH)/qapi/qapi-schema.json \ - $(QAPI_MODULES:%=$(SRC_PATH)/qapi/%.json) + $(QAPI_MODULES:%=$(SRC_PATH)/qapi/%.json) \ + $(SRC_PATH)/qapi/target.json $(GENERATED_QAPI_FILES): qapi-gen-timestamp ; qapi-gen-timestamp: $(qapi-modules) $(qapi-py) diff --git a/Makefile.target b/Makefile.target index c882292ae1..95ebaf1fa7 100644 --- a/Makefile.target +++ b/Makefile.target @@ -156,6 +156,8 @@ endif GENERATED_FILES += hmp-commands.h hmp-commands-info.h +obj-y += qapi/target-qapi-types.o qapi/target-qapi-visit.o +obj-y += qapi/target-qapi-events.o qapi/target-qapi-commands.o obj-y += qapi/qapi-introspect.o endif # CONFIG_SOFTMMU From patchwork Sun Dec 16 14:08:55 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= X-Patchwork-Id: 1014140 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=2001:4830:134:3::11; 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 [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43HmZy2vcBz9s3Z for ; Mon, 17 Dec 2018 01:17:46 +1100 (AEDT) Received: from localhost ([::1]:42626 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gYXEl-000768-Vv for incoming@patchwork.ozlabs.org; Sun, 16 Dec 2018 09:17:44 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33034) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gYX6x-0001Mh-PS for qemu-devel@nongnu.org; Sun, 16 Dec 2018 09:09:41 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gYX6v-000565-OA for qemu-devel@nongnu.org; Sun, 16 Dec 2018 09:09:39 -0500 Received: from mx1.redhat.com ([209.132.183.28]:38936) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gYX6v-00055P-DV for qemu-devel@nongnu.org; Sun, 16 Dec 2018 09:09:37 -0500 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 C16B389AD1 for ; Sun, 16 Dec 2018 14:09:36 +0000 (UTC) Received: from localhost (ovpn-112-19.ams2.redhat.com [10.36.112.19]) by smtp.corp.redhat.com (Postfix) with ESMTP id 17138600C8; Sun, 16 Dec 2018 14:09:34 +0000 (UTC) From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= To: qemu-devel@nongnu.org Date: Sun, 16 Dec 2018 18:08:55 +0400 Message-Id: <20181216140902.23986-7-marcandre.lureau@redhat.com> In-Reply-To: <20181216140902.23986-1-marcandre.lureau@redhat.com> References: <20181216140902.23986-1-marcandre.lureau@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.26]); Sun, 16 Dec 2018 14:09:36 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 06/13] qapi: make rtc-reset-reinjection and SEV depend on TARGET_I386 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: armbru@redhat.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Move rtc-reset-reinjection and SEV in target.json and make them conditional on TARGET_I386. Signed-off-by: Marc-André Lureau --- qapi/misc.json | 166 -------------------------------------- qapi/target.json | 175 ++++++++++++++++++++++++++++++++++++++++- target/i386/sev_i386.h | 2 +- hw/timer/mc146818rtc.c | 2 +- monitor.c | 31 -------- 5 files changed, 175 insertions(+), 201 deletions(-) diff --git a/qapi/misc.json b/qapi/misc.json index 8325e0dc9c..688e874fb8 100644 --- a/qapi/misc.json +++ b/qapi/misc.json @@ -3053,24 +3053,6 @@ { 'event': 'ACPI_DEVICE_OST', 'data': { 'info': 'ACPIOSTInfo' } } -## -# @rtc-reset-reinjection: -# -# This command will reset the RTC interrupt reinjection backlog. -# Can be used if another mechanism to synchronize guest time -# is in effect, for example QEMU guest agent's guest-set-time -# command. -# -# Since: 2.1 -# -# Example: -# -# -> { "execute": "rtc-reset-reinjection" } -# <- { "return": {} } -# -## -{ 'command': 'rtc-reset-reinjection' } - ## # @RTC_CHANGE: # @@ -3299,154 +3281,6 @@ ## { 'command': 'query-vm-generation-id', 'returns': 'GuidInfo' } - -## -# @SevState: -# -# An enumeration of SEV state information used during @query-sev. -# -# @uninit: The guest is uninitialized. -# -# @launch-update: The guest is currently being launched; plaintext data and -# register state is being imported. -# -# @launch-secret: The guest is currently being launched; ciphertext data -# is being imported. -# -# @running: The guest is fully launched or migrated in. -# -# @send-update: The guest is currently being migrated out to another machine. -# -# @receive-update: The guest is currently being migrated from another machine. -# -# Since: 2.12 -## -{ 'enum': 'SevState', - 'data': ['uninit', 'launch-update', 'launch-secret', 'running', - 'send-update', 'receive-update' ] } - -## -# @SevInfo: -# -# Information about Secure Encrypted Virtualization (SEV) support -# -# @enabled: true if SEV is active -# -# @api-major: SEV API major version -# -# @api-minor: SEV API minor version -# -# @build-id: SEV FW build id -# -# @policy: SEV policy value -# -# @state: SEV guest state -# -# @handle: SEV firmware handle -# -# Since: 2.12 -## -{ 'struct': 'SevInfo', - 'data': { 'enabled': 'bool', - 'api-major': 'uint8', - 'api-minor' : 'uint8', - 'build-id' : 'uint8', - 'policy' : 'uint32', - 'state' : 'SevState', - 'handle' : 'uint32' - } -} - -## -# @query-sev: -# -# Returns information about SEV -# -# Returns: @SevInfo -# -# Since: 2.12 -# -# Example: -# -# -> { "execute": "query-sev" } -# <- { "return": { "enabled": true, "api-major" : 0, "api-minor" : 0, -# "build-id" : 0, "policy" : 0, "state" : "running", -# "handle" : 1 } } -# -## -{ 'command': 'query-sev', 'returns': 'SevInfo' } - -## -# @SevLaunchMeasureInfo: -# -# SEV Guest Launch measurement information -# -# @data: the measurement value encoded in base64 -# -# Since: 2.12 -# -## -{ 'struct': 'SevLaunchMeasureInfo', 'data': {'data': 'str'} } - -## -# @query-sev-launch-measure: -# -# Query the SEV guest launch information. -# -# Returns: The @SevLaunchMeasureInfo for the guest -# -# Since: 2.12 -# -# Example: -# -# -> { "execute": "query-sev-launch-measure" } -# <- { "return": { "data": "4l8LXeNlSPUDlXPJG5966/8%YZ" } } -# -## -{ 'command': 'query-sev-launch-measure', 'returns': 'SevLaunchMeasureInfo' } - -## -# @SevCapability: -# -# The struct describes capability for a Secure Encrypted Virtualization -# feature. -# -# @pdh: Platform Diffie-Hellman key (base64 encoded) -# -# @cert-chain: PDH certificate chain (base64 encoded) -# -# @cbitpos: C-bit location in page table entry -# -# @reduced-phys-bits: Number of physical Address bit reduction when SEV is -# enabled -# -# Since: 2.12 -## -{ 'struct': 'SevCapability', - 'data': { 'pdh': 'str', - 'cert-chain': 'str', - 'cbitpos': 'int', - 'reduced-phys-bits': 'int'} } - -## -# @query-sev-capabilities: -# -# This command is used to get the SEV capabilities, and is supported on AMD -# X86 platforms only. -# -# Returns: SevCapability objects. -# -# Since: 2.12 -# -# Example: -# -# -> { "execute": "query-sev-capabilities" } -# <- { "return": { "pdh": "8CCDD8DDD", "cert-chain": "888CCCDDDEE", -# "cbitpos": 47, "reduced-phys-bits": 5}} -# -## -{ 'command': 'query-sev-capabilities', 'returns': 'SevCapability' } - ## # @set-numa-node: # diff --git a/qapi/target.json b/qapi/target.json index be2360ca34..f277b69a2a 100644 --- a/qapi/target.json +++ b/qapi/target.json @@ -8,6 +8,177 @@ { 'pragma': { 'top-unit': 'target' } } ## -# @DUMMY: +# @rtc-reset-reinjection: +# +# This command will reset the RTC interrupt reinjection backlog. +# Can be used if another mechanism to synchronize guest time +# is in effect, for example QEMU guest agent's guest-set-time +# command. +# +# Since: 2.1 +# +# Example: +# +# -> { "execute": "rtc-reset-reinjection" } +# <- { "return": {} } +# +## +{ 'command': 'rtc-reset-reinjection', + 'if': 'defined(TARGET_I386)' } + + +## +# @SevState: +# +# An enumeration of SEV state information used during @query-sev. +# +# @uninit: The guest is uninitialized. +# +# @launch-update: The guest is currently being launched; plaintext data and +# register state is being imported. +# +# @launch-secret: The guest is currently being launched; ciphertext data +# is being imported. +# +# @running: The guest is fully launched or migrated in. +# +# @send-update: The guest is currently being migrated out to another machine. +# +# @receive-update: The guest is currently being migrated from another machine. +# +# Since: 2.12 +## +{ 'enum': 'SevState', + 'data': ['uninit', 'launch-update', 'launch-secret', 'running', + 'send-update', 'receive-update' ], + 'if': 'defined(TARGET_I386)' } + +## +# @SevInfo: +# +# Information about Secure Encrypted Virtualization (SEV) support +# +# @enabled: true if SEV is active +# +# @api-major: SEV API major version +# +# @api-minor: SEV API minor version +# +# @build-id: SEV FW build id +# +# @policy: SEV policy value +# +# @state: SEV guest state +# +# @handle: SEV firmware handle +# +# Since: 2.12 +## +{ 'struct': 'SevInfo', + 'data': { 'enabled': 'bool', + 'api-major': 'uint8', + 'api-minor' : 'uint8', + 'build-id' : 'uint8', + 'policy' : 'uint32', + 'state' : 'SevState', + 'handle' : 'uint32' + }, + 'if': 'defined(TARGET_I386)' +} + +## +# @query-sev: +# +# Returns information about SEV +# +# Returns: @SevInfo +# +# Since: 2.12 +# +# Example: +# +# -> { "execute": "query-sev" } +# <- { "return": { "enabled": true, "api-major" : 0, "api-minor" : 0, +# "build-id" : 0, "policy" : 0, "state" : "running", +# "handle" : 1 } } +# +## +{ 'command': 'query-sev', 'returns': 'SevInfo', + 'if': 'defined(TARGET_I386)' } + + +## +# @SevLaunchMeasureInfo: +# +# SEV Guest Launch measurement information +# +# @data: the measurement value encoded in base64 +# +# Since: 2.12 +# +## +{ 'struct': 'SevLaunchMeasureInfo', 'data': {'data': 'str'}, + 'if': 'defined(TARGET_I386)' } + +## +# @query-sev-launch-measure: +# +# Query the SEV guest launch information. +# +# Returns: The @SevLaunchMeasureInfo for the guest +# +# Since: 2.12 +# +# Example: +# +# -> { "execute": "query-sev-launch-measure" } +# <- { "return": { "data": "4l8LXeNlSPUDlXPJG5966/8%YZ" } } +# +## +{ 'command': 'query-sev-launch-measure', 'returns': 'SevLaunchMeasureInfo', + 'if': 'defined(TARGET_I386)' } + + +## +# @SevCapability: +# +# The struct describes capability for a Secure Encrypted Virtualization +# feature. +# +# @pdh: Platform Diffie-Hellman key (base64 encoded) +# +# @cert-chain: PDH certificate chain (base64 encoded) +# +# @cbitpos: C-bit location in page table entry +# +# @reduced-phys-bits: Number of physical Address bit reduction when SEV is +# enabled +# +# Since: 2.12 +## +{ 'struct': 'SevCapability', + 'data': { 'pdh': 'str', + 'cert-chain': 'str', + 'cbitpos': 'int', + 'reduced-phys-bits': 'int'}, + 'if': 'defined(TARGET_I386)' } + +## +# @query-sev-capabilities: +# +# This command is used to get the SEV capabilities, and is supported on AMD +# X86 platforms only. +# +# Returns: SevCapability objects. +# +# Since: 2.12 +# +# Example: +# +# -> { "execute": "query-sev-capabilities" } +# <- { "return": { "pdh": "8CCDD8DDD", "cert-chain": "888CCCDDDEE", +# "cbitpos": 47, "reduced-phys-bits": 5}} +# ## -{ 'event': 'DUMMY' } +{ 'command': 'query-sev-capabilities', 'returns': 'SevCapability', + 'if': 'defined(TARGET_I386)' } diff --git a/target/i386/sev_i386.h b/target/i386/sev_i386.h index b8622dfb1e..8f88f86952 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-misc.h" +#include "qapi/target-qapi-commands.h" #define SEV_POLICY_NODBG 0x1 #define SEV_POLICY_NOKS 0x2 diff --git a/hw/timer/mc146818rtc.c b/hw/timer/mc146818rtc.c index e4e4de8b8a..a27b389f8e 100644 --- a/hw/timer/mc146818rtc.c +++ b/hw/timer/mc146818rtc.c @@ -31,7 +31,7 @@ #include "sysemu/replay.h" #include "hw/timer/mc146818rtc.h" #include "qapi/error.h" -#include "qapi/qapi-commands-misc.h" +#include "qapi/target-qapi-commands.h" #include "qapi/qapi-events-misc.h" #include "qapi/visitor.h" #include "exec/address-spaces.h" diff --git a/monitor.c b/monitor.c index 86f3193158..4b3059614f 100644 --- a/monitor.c +++ b/monitor.c @@ -1218,12 +1218,6 @@ static void qmp_query_qmp_schema(QDict *qdict, QObject **ret_data, */ static void qmp_unregister_commands_hack(void) { -#ifndef TARGET_I386 - qmp_unregister_command(&qmp_commands, "rtc-reset-reinjection"); - qmp_unregister_command(&qmp_commands, "query-sev"); - qmp_unregister_command(&qmp_commands, "query-sev-launch-measure"); - qmp_unregister_command(&qmp_commands, "query-sev-capabilities"); -#endif #ifndef TARGET_S390X qmp_unregister_command(&qmp_commands, "dump-skeys"); #endif @@ -4740,31 +4734,6 @@ QemuOptsList qemu_mon_opts = { }, }; -#ifndef TARGET_I386 -void qmp_rtc_reset_reinjection(Error **errp) -{ - error_setg(errp, QERR_FEATURE_DISABLED, "rtc-reset-reinjection"); -} - -SevInfo *qmp_query_sev(Error **errp) -{ - error_setg(errp, QERR_FEATURE_DISABLED, "query-sev"); - return NULL; -} - -SevLaunchMeasureInfo *qmp_query_sev_launch_measure(Error **errp) -{ - error_setg(errp, QERR_FEATURE_DISABLED, "query-sev-launch-measure"); - return NULL; -} - -SevCapability *qmp_query_sev_capabilities(Error **errp) -{ - error_setg(errp, QERR_FEATURE_DISABLED, "query-sev-capabilities"); - return NULL; -} -#endif - #ifndef TARGET_S390X void qmp_dump_skeys(const char *filename, Error **errp) { From patchwork Sun Dec 16 14:08:56 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= X-Patchwork-Id: 1014139 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=2001:4830:134:3::11; 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 [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43HmXl5dllz9s3C for ; Mon, 17 Dec 2018 01:15:51 +1100 (AEDT) Received: from localhost ([::1]:42619 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gYXCv-0005qm-By for incoming@patchwork.ozlabs.org; Sun, 16 Dec 2018 09:15:49 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33077) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gYX76-0001T6-EY for qemu-devel@nongnu.org; Sun, 16 Dec 2018 09:09:52 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gYX71-00059n-Cg for qemu-devel@nongnu.org; Sun, 16 Dec 2018 09:09:48 -0500 Received: from mx1.redhat.com ([209.132.183.28]:53004) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gYX71-00059R-3c for qemu-devel@nongnu.org; Sun, 16 Dec 2018 09:09:43 -0500 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 794FEC05CDFA for ; Sun, 16 Dec 2018 14:09:42 +0000 (UTC) Received: from localhost (ovpn-112-19.ams2.redhat.com [10.36.112.19]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9F3415C1B5; Sun, 16 Dec 2018 14:09:40 +0000 (UTC) From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= To: qemu-devel@nongnu.org Date: Sun, 16 Dec 2018 18:08:56 +0400 Message-Id: <20181216140902.23986-8-marcandre.lureau@redhat.com> In-Reply-To: <20181216140902.23986-1-marcandre.lureau@redhat.com> References: <20181216140902.23986-1-marcandre.lureau@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.31]); Sun, 16 Dec 2018 14:09:42 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 07/13] qapi: make s390 commands depend on TARGET_S390X X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: armbru@redhat.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Marc-André Lureau Acked-by: Cornelia Huck --- qapi/misc.json | 137 ----------------------- qapi/target.json | 142 ++++++++++++++++++++++++ include/sysemu/arch_init.h | 7 -- hw/s390x/s390-skeys.c | 2 +- monitor.c | 14 --- qmp.c | 14 --- stubs/arch-query-cpu-model-baseline.c | 13 --- stubs/arch-query-cpu-model-comparison.c | 13 --- target/s390x/cpu_models.c | 5 +- stubs/Makefile.objs | 2 - 10 files changed, 146 insertions(+), 203 deletions(-) delete mode 100644 stubs/arch-query-cpu-model-baseline.c delete mode 100644 stubs/arch-query-cpu-model-comparison.c diff --git a/qapi/misc.json b/qapi/misc.json index 688e874fb8..a962e4096e 100644 --- a/qapi/misc.json +++ b/qapi/misc.json @@ -1865,27 +1865,6 @@ { 'command': 'query-dump-guest-memory-capability', 'returns': 'DumpGuestMemoryCapability' } -## -# @dump-skeys: -# -# Dump guest's storage keys -# -# @filename: the path to the file to dump to -# -# This command is only supported on s390 architecture. -# -# Since: 2.5 -# -# Example: -# -# -> { "execute": "dump-skeys", -# "arguments": { "filename": "/tmp/skeys" } } -# <- { "return": {} } -# -## -{ 'command': 'dump-skeys', - 'data': { 'filename': 'str' } } - ## # @object-add: # @@ -2228,122 +2207,6 @@ { 'enum': 'CpuModelCompareResult', 'data': [ 'incompatible', 'identical', 'superset', 'subset' ] } -## -# @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'] - } -} - -## -# @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. -# -# Since: 2.8.0 -## -{ 'command': 'query-cpu-model-comparison', - 'data': { 'modela': 'CpuModelInfo', 'modelb': 'CpuModelInfo' }, - 'returns': 'CpuModelCompareInfo' } - -## -# @CpuModelBaselineInfo: -# -# The result of a CPU model baseline. -# -# @model: the baselined CpuModelInfo. -# -# Since: 2.8.0 -## -{ 'struct': 'CpuModelBaselineInfo', - 'data': { 'model': 'CpuModelInfo' } } - -## -# @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. -# -# Since: 2.8.0 -## -{ 'command': 'query-cpu-model-baseline', - 'data': { 'modela': 'CpuModelInfo', - 'modelb': 'CpuModelInfo' }, - 'returns': 'CpuModelBaselineInfo' } - ## # @AddfdInfo: # diff --git a/qapi/target.json b/qapi/target.json index f277b69a2a..d751e1623a 100644 --- a/qapi/target.json +++ b/qapi/target.json @@ -7,6 +7,8 @@ { 'pragma': { 'top-unit': 'target' } } +{ 'include': 'misc.json' } + ## # @rtc-reset-reinjection: # @@ -182,3 +184,143 @@ ## { 'command': 'query-sev-capabilities', 'returns': 'SevCapability', 'if': 'defined(TARGET_I386)' } + +## +# @dump-skeys: +# +# Dump guest's storage keys +# +# @filename: the path to the file to dump to +# +# This command is only supported on s390 architecture. +# +# Since: 2.5 +# +# Example: +# +# -> { "execute": "dump-skeys", +# "arguments": { "filename": "/tmp/skeys" } } +# <- { "return": {} } +# +## +{ 'command': 'dump-skeys', + '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. +# +# 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. +# +# Since: 2.8.0 +## +{ 'command': 'query-cpu-model-baseline', + 'data': { 'modela': 'CpuModelInfo', + 'modelb': 'CpuModelInfo' }, + 'returns': 'CpuModelBaselineInfo', + 'if': 'defined(TARGET_S390X)' } diff --git a/include/sysemu/arch_init.h b/include/sysemu/arch_init.h index 32abdfe6a1..f0ef652b2a 100644 --- a/include/sysemu/arch_init.h +++ b/include/sysemu/arch_init.h @@ -36,11 +36,4 @@ CpuDefinitionInfoList *arch_query_cpu_definitions(Error **errp); CpuModelExpansionInfo *arch_query_cpu_model_expansion(CpuModelExpansionType type, CpuModelInfo *mode, Error **errp); -CpuModelCompareInfo *arch_query_cpu_model_comparison(CpuModelInfo *modela, - CpuModelInfo *modelb, - Error **errp); -CpuModelBaselineInfo *arch_query_cpu_model_baseline(CpuModelInfo *modela, - CpuModelInfo *modelb, - Error **errp); - #endif diff --git a/hw/s390x/s390-skeys.c b/hw/s390x/s390-skeys.c index 15f7ab0e53..ad6b4793c6 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-misc.h" +#include "qapi/target-qapi-commands.h" #include "qapi/qmp/qdict.h" #include "qemu/error-report.h" #include "sysemu/kvm.h" diff --git a/monitor.c b/monitor.c index 4b3059614f..141eb8f8c9 100644 --- a/monitor.c +++ b/monitor.c @@ -1218,19 +1218,12 @@ static void qmp_query_qmp_schema(QDict *qdict, QObject **ret_data, */ static void qmp_unregister_commands_hack(void) { -#ifndef TARGET_S390X - qmp_unregister_command(&qmp_commands, "dump-skeys"); -#endif #ifndef TARGET_ARM qmp_unregister_command(&qmp_commands, "query-gic-capabilities"); #endif #if !defined(TARGET_S390X) && !defined(TARGET_I386) qmp_unregister_command(&qmp_commands, "query-cpu-model-expansion"); #endif -#if !defined(TARGET_S390X) - qmp_unregister_command(&qmp_commands, "query-cpu-model-baseline"); - qmp_unregister_command(&qmp_commands, "query-cpu-model-comparison"); -#endif #if !defined(TARGET_PPC) && !defined(TARGET_ARM) && !defined(TARGET_I386) \ && !defined(TARGET_S390X) qmp_unregister_command(&qmp_commands, "query-cpu-definitions"); @@ -4734,13 +4727,6 @@ QemuOptsList qemu_mon_opts = { }, }; -#ifndef TARGET_S390X -void qmp_dump_skeys(const char *filename, Error **errp) -{ - error_setg(errp, QERR_FEATURE_DISABLED, "dump-skeys"); -} -#endif - #ifndef TARGET_ARM GICCapabilityList *qmp_query_gic_capabilities(Error **errp) { diff --git a/qmp.c b/qmp.c index e7c0a2fd60..a480f96f57 100644 --- a/qmp.c +++ b/qmp.c @@ -611,20 +611,6 @@ CpuModelExpansionInfo *qmp_query_cpu_model_expansion(CpuModelExpansionType type, return arch_query_cpu_model_expansion(type, model, errp); } -CpuModelCompareInfo *qmp_query_cpu_model_comparison(CpuModelInfo *modela, - CpuModelInfo *modelb, - Error **errp) -{ - return arch_query_cpu_model_comparison(modela, modelb, errp); -} - -CpuModelBaselineInfo *qmp_query_cpu_model_baseline(CpuModelInfo *modela, - CpuModelInfo *modelb, - Error **errp) -{ - return arch_query_cpu_model_baseline(modela, modelb, errp); -} - void qmp_add_client(const char *protocol, const char *fdname, bool has_skipauth, bool skipauth, bool has_tls, bool tls, Error **errp) diff --git a/stubs/arch-query-cpu-model-baseline.c b/stubs/arch-query-cpu-model-baseline.c deleted file mode 100644 index 0d066da328..0000000000 --- a/stubs/arch-query-cpu-model-baseline.c +++ /dev/null @@ -1,13 +0,0 @@ -#include "qemu/osdep.h" -#include "qemu-common.h" -#include "sysemu/arch_init.h" -#include "qapi/error.h" -#include "qapi/qmp/qerror.h" - -CpuModelBaselineInfo *arch_query_cpu_model_baseline(CpuModelInfo *modela, - CpuModelInfo *modelb, - Error **errp) -{ - error_setg(errp, QERR_UNSUPPORTED); - return NULL; -} diff --git a/stubs/arch-query-cpu-model-comparison.c b/stubs/arch-query-cpu-model-comparison.c deleted file mode 100644 index 8eb311a26c..0000000000 --- a/stubs/arch-query-cpu-model-comparison.c +++ /dev/null @@ -1,13 +0,0 @@ -#include "qemu/osdep.h" -#include "qemu-common.h" -#include "sysemu/arch_init.h" -#include "qapi/error.h" -#include "qapi/qmp/qerror.h" - -CpuModelCompareInfo *arch_query_cpu_model_comparison(CpuModelInfo *modela, - CpuModelInfo *modelb, - Error **errp) -{ - error_setg(errp, QERR_UNSUPPORTED); - return NULL; -} diff --git a/target/s390x/cpu_models.c b/target/s390x/cpu_models.c index 7c253ff308..106c5fd008 100644 --- a/target/s390x/cpu_models.c +++ b/target/s390x/cpu_models.c @@ -25,6 +25,7 @@ #include "sysemu/arch_init.h" #include "hw/pci/pci.h" #endif +#include "qapi/target-qapi-commands.h" #define CPUDEF_INIT(_type, _gen, _ec_ga, _mha_pow, _hmfai, _name, _desc) \ { \ @@ -605,7 +606,7 @@ static void list_add_feat(const char *name, void *opaque) *last = entry; } -CpuModelCompareInfo *arch_query_cpu_model_comparison(CpuModelInfo *infoa, +CpuModelCompareInfo *qmp_query_cpu_model_comparison(CpuModelInfo *infoa, CpuModelInfo *infob, Error **errp) { @@ -678,7 +679,7 @@ CpuModelCompareInfo *arch_query_cpu_model_comparison(CpuModelInfo *infoa, return compare_info; } -CpuModelBaselineInfo *arch_query_cpu_model_baseline(CpuModelInfo *infoa, +CpuModelBaselineInfo *qmp_query_cpu_model_baseline(CpuModelInfo *infoa, CpuModelInfo *infob, Error **errp) { diff --git a/stubs/Makefile.objs b/stubs/Makefile.objs index 5dd0aeeec6..48eb080bfb 100644 --- a/stubs/Makefile.objs +++ b/stubs/Makefile.objs @@ -1,7 +1,5 @@ stub-obj-y += arch-query-cpu-def.o stub-obj-y += arch-query-cpu-model-expansion.o -stub-obj-y += arch-query-cpu-model-comparison.o -stub-obj-y += arch-query-cpu-model-baseline.o stub-obj-y += bdrv-next-monitor-owned.o stub-obj-y += blk-commit-all.o stub-obj-y += blockdev-close-all-bdrv-states.o From patchwork Sun Dec 16 14:08:57 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= X-Patchwork-Id: 1014143 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=2001:4830:134:3::11; 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 [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43HmdM6tCbz9s3C for ; Mon, 17 Dec 2018 01:19:51 +1100 (AEDT) Received: from localhost ([::1]:42633 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gYXGn-00005D-Gl for incoming@patchwork.ozlabs.org; Sun, 16 Dec 2018 09:19:49 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33082) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gYX76-0001TK-Oc for qemu-devel@nongnu.org; Sun, 16 Dec 2018 09:09:52 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gYX76-0005Ce-17 for qemu-devel@nongnu.org; Sun, 16 Dec 2018 09:09:48 -0500 Received: from mx1.redhat.com ([209.132.183.28]:57970) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gYX75-0005C6-Rg for qemu-devel@nongnu.org; Sun, 16 Dec 2018 09:09:47 -0500 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 37777C058CBC for ; Sun, 16 Dec 2018 14:09:47 +0000 (UTC) Received: from localhost (ovpn-112-19.ams2.redhat.com [10.36.112.19]) by smtp.corp.redhat.com (Postfix) with ESMTP id 316E15C1B5; Sun, 16 Dec 2018 14:09:45 +0000 (UTC) From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= To: qemu-devel@nongnu.org Date: Sun, 16 Dec 2018 18:08:57 +0400 Message-Id: <20181216140902.23986-9-marcandre.lureau@redhat.com> In-Reply-To: <20181216140902.23986-1-marcandre.lureau@redhat.com> References: <20181216140902.23986-1-marcandre.lureau@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]); Sun, 16 Dec 2018 14:09:47 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 08/13] target.json: add a note about query-cpu* not being s390x-specific X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: armbru@redhat.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Marc-André Lureau Acked-by: Cornelia Huck --- qapi/target.json | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/qapi/target.json b/qapi/target.json index d751e1623a..dcfb6bc525 100644 --- a/qapi/target.json +++ b/qapi/target.json @@ -277,6 +277,9 @@ # 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', @@ -317,6 +320,9 @@ # 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', From patchwork Sun Dec 16 14:08:58 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= X-Patchwork-Id: 1014142 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=2001:4830:134:3::11; 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 [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43HmbP6gJrz9s3C for ; Mon, 17 Dec 2018 01:18:09 +1100 (AEDT) Received: from localhost ([::1]:42629 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gYXF9-0007MH-Ic for incoming@patchwork.ozlabs.org; Sun, 16 Dec 2018 09:18:07 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33130) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gYX7C-0001WO-FS for qemu-devel@nongnu.org; Sun, 16 Dec 2018 09:09:59 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gYX7B-0005GY-HY for qemu-devel@nongnu.org; Sun, 16 Dec 2018 09:09:54 -0500 Received: from mx1.redhat.com ([209.132.183.28]:34218) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gYX7B-0005Fx-96 for qemu-devel@nongnu.org; Sun, 16 Dec 2018 09:09:53 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A00F53DEEB for ; Sun, 16 Dec 2018 14:09:52 +0000 (UTC) Received: from localhost (ovpn-112-19.ams2.redhat.com [10.36.112.19]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1B32D608F3; Sun, 16 Dec 2018 14:09:50 +0000 (UTC) From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= To: qemu-devel@nongnu.org Date: Sun, 16 Dec 2018 18:08:58 +0400 Message-Id: <20181216140902.23986-10-marcandre.lureau@redhat.com> In-Reply-To: <20181216140902.23986-1-marcandre.lureau@redhat.com> References: <20181216140902.23986-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Sun, 16 Dec 2018 14:09:52 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 09/13] qapi: make query-gic-capabilities depend on TARGET_ARM X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: armbru@redhat.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Marc-André Lureau --- qapi/misc.json | 43 ------------------------------------------ qapi/target.json | 45 ++++++++++++++++++++++++++++++++++++++++++++ monitor.c | 11 ----------- target/arm/monitor.c | 2 +- 4 files changed, 46 insertions(+), 55 deletions(-) diff --git a/qapi/misc.json b/qapi/misc.json index a962e4096e..951518ee46 100644 --- a/qapi/misc.json +++ b/qapi/misc.json @@ -2978,49 +2978,6 @@ ## { 'command': 'xen-load-devices-state', 'data': {'filename': 'str'} } -## -# @GICCapability: -# -# The struct describes capability for a specific GIC (Generic -# Interrupt Controller) version. These bits are not only decided by -# QEMU/KVM software version, but also decided by the hardware that -# the program is running upon. -# -# @version: version of GIC to be described. Currently, only 2 and 3 -# are supported. -# -# @emulated: whether current QEMU/hardware supports emulated GIC -# device in user space. -# -# @kernel: whether current QEMU/hardware supports hardware -# accelerated GIC device in kernel. -# -# Since: 2.6 -## -{ 'struct': 'GICCapability', - 'data': { 'version': 'int', - 'emulated': 'bool', - 'kernel': 'bool' } } - -## -# @query-gic-capabilities: -# -# This command is ARM-only. It will return a list of GICCapability -# objects that describe its capability bits. -# -# Returns: a list of GICCapability objects. -# -# Since: 2.6 -# -# Example: -# -# -> { "execute": "query-gic-capabilities" } -# <- { "return": [{ "version": 2, "emulated": true, "kernel": false }, -# { "version": 3, "emulated": false, "kernel": true } ] } -# -## -{ 'command': 'query-gic-capabilities', 'returns': ['GICCapability'] } - ## # @CpuInstanceProperties: # diff --git a/qapi/target.json b/qapi/target.json index dcfb6bc525..14bc02d90c 100644 --- a/qapi/target.json +++ b/qapi/target.json @@ -330,3 +330,48 @@ 'modelb': 'CpuModelInfo' }, 'returns': 'CpuModelBaselineInfo', 'if': 'defined(TARGET_S390X)' } + +## +# @GICCapability: +# +# The struct describes capability for a specific GIC (Generic +# Interrupt Controller) version. These bits are not only decided by +# QEMU/KVM software version, but also decided by the hardware that +# the program is running upon. +# +# @version: version of GIC to be described. Currently, only 2 and 3 +# are supported. +# +# @emulated: whether current QEMU/hardware supports emulated GIC +# device in user space. +# +# @kernel: whether current QEMU/hardware supports hardware +# accelerated GIC device in kernel. +# +# Since: 2.6 +## +{ 'struct': 'GICCapability', + 'data': { 'version': 'int', + 'emulated': 'bool', + 'kernel': 'bool' }, + 'if': 'defined(TARGET_ARM)' } + +## +# @query-gic-capabilities: +# +# This command is ARM-only. It will return a list of GICCapability +# objects that describe its capability bits. +# +# Returns: a list of GICCapability objects. +# +# Since: 2.6 +# +# Example: +# +# -> { "execute": "query-gic-capabilities" } +# <- { "return": [{ "version": 2, "emulated": true, "kernel": false }, +# { "version": 3, "emulated": false, "kernel": true } ] } +# +## +{ 'command': 'query-gic-capabilities', 'returns': ['GICCapability'], + 'if': 'defined(TARGET_ARM)' } diff --git a/monitor.c b/monitor.c index 141eb8f8c9..15da71607e 100644 --- a/monitor.c +++ b/monitor.c @@ -1218,9 +1218,6 @@ static void qmp_query_qmp_schema(QDict *qdict, QObject **ret_data, */ static void qmp_unregister_commands_hack(void) { -#ifndef TARGET_ARM - qmp_unregister_command(&qmp_commands, "query-gic-capabilities"); -#endif #if !defined(TARGET_S390X) && !defined(TARGET_I386) qmp_unregister_command(&qmp_commands, "query-cpu-model-expansion"); #endif @@ -4727,14 +4724,6 @@ QemuOptsList qemu_mon_opts = { }, }; -#ifndef TARGET_ARM -GICCapabilityList *qmp_query_gic_capabilities(Error **errp) -{ - error_setg(errp, QERR_FEATURE_DISABLED, "query-gic-capabilities"); - return NULL; -} -#endif - HotpluggableCPUList *qmp_query_hotpluggable_cpus(Error **errp) { MachineState *ms = MACHINE(qdev_get_machine()); diff --git a/target/arm/monitor.c b/target/arm/monitor.c index 4cdd2676dd..250405bf4d 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-misc.h" +#include "qapi/target-qapi-commands.h" static GICCapability *gic_cap_new(int version) { From patchwork Sun Dec 16 14:08:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= X-Patchwork-Id: 1014145 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=2001:4830:134:3::11; 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 [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43Hmgq08xTz9s3C for ; Mon, 17 Dec 2018 01:21:59 +1100 (AEDT) Received: from localhost ([::1]:42648 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gYXIq-0001P2-Jv for incoming@patchwork.ozlabs.org; Sun, 16 Dec 2018 09:21:56 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33156) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gYX7I-0001d4-Cp for qemu-devel@nongnu.org; Sun, 16 Dec 2018 09:10:01 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gYX7G-0005Jk-V3 for qemu-devel@nongnu.org; Sun, 16 Dec 2018 09:10:00 -0500 Received: from mx1.redhat.com ([209.132.183.28]:60608) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gYX7G-0005JJ-ML for qemu-devel@nongnu.org; Sun, 16 Dec 2018 09:09:58 -0500 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 13F8D3695F for ; Sun, 16 Dec 2018 14:09:58 +0000 (UTC) Received: from localhost (ovpn-112-19.ams2.redhat.com [10.36.112.19]) by smtp.corp.redhat.com (Postfix) with ESMTP id 82F7860BEC; Sun, 16 Dec 2018 14:09:56 +0000 (UTC) From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= To: qemu-devel@nongnu.org Date: Sun, 16 Dec 2018 18:08:59 +0400 Message-Id: <20181216140902.23986-11-marcandre.lureau@redhat.com> In-Reply-To: <20181216140902.23986-1-marcandre.lureau@redhat.com> References: <20181216140902.23986-1-marcandre.lureau@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.30]); Sun, 16 Dec 2018 14:09:58 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 10/13] qapi: make query-cpu-model-expansion depend on s390 or x86 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: armbru@redhat.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Marc-André Lureau Reviewed-by: Eduardo Habkost Acked-by: Cornelia Huck --- qapi/misc.json | 51 ------------------------- qapi/target.json | 52 ++++++++++++++++++++++++++ include/sysemu/arch_init.h | 3 -- monitor.c | 3 -- qmp.c | 7 ---- stubs/arch-query-cpu-model-expansion.c | 13 ------- target/i386/cpu.c | 3 +- target/s390x/cpu_models.c | 2 +- stubs/Makefile.objs | 1 - 9 files changed, 55 insertions(+), 80 deletions(-) delete mode 100644 stubs/arch-query-cpu-model-expansion.c diff --git a/qapi/misc.json b/qapi/misc.json index 951518ee46..8f4ebd5a46 100644 --- a/qapi/misc.json +++ b/qapi/misc.json @@ -2133,57 +2133,6 @@ 'data': [ 'static', 'full' ] } -## -# @CpuModelExpansionInfo: -# -# The result of a cpu model expansion. -# -# @model: the expanded CpuModelInfo. -# -# Since: 2.8.0 -## -{ 'struct': 'CpuModelExpansionInfo', - 'data': { 'model': 'CpuModelInfo' } } - - -## -# @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' } - ## # @CpuModelCompareResult: # diff --git a/qapi/target.json b/qapi/target.json index 14bc02d90c..dd37c459c1 100644 --- a/qapi/target.json +++ b/qapi/target.json @@ -375,3 +375,55 @@ ## { '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)' } diff --git a/include/sysemu/arch_init.h b/include/sysemu/arch_init.h index f0ef652b2a..2497fd3351 100644 --- a/include/sysemu/arch_init.h +++ b/include/sysemu/arch_init.h @@ -33,7 +33,4 @@ int kvm_available(void); int xen_available(void); CpuDefinitionInfoList *arch_query_cpu_definitions(Error **errp); -CpuModelExpansionInfo *arch_query_cpu_model_expansion(CpuModelExpansionType type, - CpuModelInfo *mode, - Error **errp); #endif diff --git a/monitor.c b/monitor.c index 15da71607e..6a041c11b9 100644 --- a/monitor.c +++ b/monitor.c @@ -1218,9 +1218,6 @@ static void qmp_query_qmp_schema(QDict *qdict, QObject **ret_data, */ static void qmp_unregister_commands_hack(void) { -#if !defined(TARGET_S390X) && !defined(TARGET_I386) - qmp_unregister_command(&qmp_commands, "query-cpu-model-expansion"); -#endif #if !defined(TARGET_PPC) && !defined(TARGET_ARM) && !defined(TARGET_I386) \ && !defined(TARGET_S390X) qmp_unregister_command(&qmp_commands, "query-cpu-definitions"); diff --git a/qmp.c b/qmp.c index a480f96f57..0f930014fa 100644 --- a/qmp.c +++ b/qmp.c @@ -604,13 +604,6 @@ CpuDefinitionInfoList *qmp_query_cpu_definitions(Error **errp) return arch_query_cpu_definitions(errp); } -CpuModelExpansionInfo *qmp_query_cpu_model_expansion(CpuModelExpansionType type, - CpuModelInfo *model, - Error **errp) -{ - return arch_query_cpu_model_expansion(type, model, errp); -} - void qmp_add_client(const char *protocol, const char *fdname, bool has_skipauth, bool skipauth, bool has_tls, bool tls, Error **errp) diff --git a/stubs/arch-query-cpu-model-expansion.c b/stubs/arch-query-cpu-model-expansion.c deleted file mode 100644 index 26273a8b10..0000000000 --- a/stubs/arch-query-cpu-model-expansion.c +++ /dev/null @@ -1,13 +0,0 @@ -#include "qemu/osdep.h" -#include "qemu-common.h" -#include "sysemu/arch_init.h" -#include "qapi/error.h" -#include "qapi/qmp/qerror.h" - -CpuModelExpansionInfo *arch_query_cpu_model_expansion(CpuModelExpansionType type, - CpuModelInfo *mode, - Error **errp) -{ - error_setg(errp, QERR_UNSUPPORTED); - return NULL; -} diff --git a/target/i386/cpu.c b/target/i386/cpu.c index 677a3bd5fb..18579bc5e8 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -41,6 +41,7 @@ #include "qapi/visitor.h" #include "qom/qom-qobject.h" #include "sysemu/arch_init.h" +#include "qapi/target-qapi-commands.h" #include "standard-headers/asm-x86/kvm_para.h" @@ -4027,7 +4028,7 @@ out: } CpuModelExpansionInfo * -arch_query_cpu_model_expansion(CpuModelExpansionType type, +qmp_query_cpu_model_expansion(CpuModelExpansionType type, CpuModelInfo *model, Error **errp) { diff --git a/target/s390x/cpu_models.c b/target/s390x/cpu_models.c index 106c5fd008..a1e745855b 100644 --- a/target/s390x/cpu_models.c +++ b/target/s390x/cpu_models.c @@ -567,7 +567,7 @@ static void cpu_info_from_model(CpuModelInfo *info, const S390CPUModel *model, } } -CpuModelExpansionInfo *arch_query_cpu_model_expansion(CpuModelExpansionType type, +CpuModelExpansionInfo *qmp_query_cpu_model_expansion(CpuModelExpansionType type, CpuModelInfo *model, Error **errp) { diff --git a/stubs/Makefile.objs b/stubs/Makefile.objs index 48eb080bfb..e28f443b7b 100644 --- a/stubs/Makefile.objs +++ b/stubs/Makefile.objs @@ -1,5 +1,4 @@ stub-obj-y += arch-query-cpu-def.o -stub-obj-y += arch-query-cpu-model-expansion.o stub-obj-y += bdrv-next-monitor-owned.o stub-obj-y += blk-commit-all.o stub-obj-y += blockdev-close-all-bdrv-states.o From patchwork Sun Dec 16 14:09:00 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= X-Patchwork-Id: 1014146 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=2001:4830:134:3::11; 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 [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43HmjR6L6Gz9s3C for ; Mon, 17 Dec 2018 01:23:23 +1100 (AEDT) Received: from localhost ([::1]:42656 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gYXKD-0002OD-G9 for incoming@patchwork.ozlabs.org; Sun, 16 Dec 2018 09:23:21 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33203) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gYX7O-0001jK-LY for qemu-devel@nongnu.org; Sun, 16 Dec 2018 09:10:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gYX7M-0005NV-Qh for qemu-devel@nongnu.org; Sun, 16 Dec 2018 09:10:06 -0500 Received: from mx1.redhat.com ([209.132.183.28]:34246) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gYX7M-0005Mw-IY for qemu-devel@nongnu.org; Sun, 16 Dec 2018 09:10:04 -0500 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 E566946233 for ; Sun, 16 Dec 2018 14:10:03 +0000 (UTC) Received: from localhost (ovpn-112-19.ams2.redhat.com [10.36.112.19]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1603B60BEC; Sun, 16 Dec 2018 14:10:01 +0000 (UTC) From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= To: qemu-devel@nongnu.org Date: Sun, 16 Dec 2018 18:09:00 +0400 Message-Id: <20181216140902.23986-12-marcandre.lureau@redhat.com> In-Reply-To: <20181216140902.23986-1-marcandre.lureau@redhat.com> References: <20181216140902.23986-1-marcandre.lureau@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.29]); Sun, 16 Dec 2018 14:10:03 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 11/13] qapi: make query-cpu-definitions depend on specific targets X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: armbru@redhat.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" It depends on TARGET_PPC || TARGET_ARM || TARGET_I386 || TARGET_S390X. Signed-off-by: Marc-André Lureau Reviewed-by: Eduardo Habkost Acked-by: Cornelia Huck --- qapi/misc.json | 58 ------------------------------ qapi/target.json | 64 +++++++++++++++++++++++++++++++++ include/sysemu/arch_init.h | 1 - monitor.c | 22 ------------ qmp.c | 5 --- stubs/arch-query-cpu-def.c | 11 ------ target/arm/helper.c | 3 +- target/i386/cpu.c | 3 +- target/ppc/translate_init.inc.c | 3 +- target/s390x/cpu_models.c | 2 +- stubs/Makefile.objs | 1 - 11 files changed, 71 insertions(+), 102 deletions(-) delete mode 100644 stubs/arch-query-cpu-def.c diff --git a/qapi/misc.json b/qapi/misc.json index 8f4ebd5a46..7d620b2d7b 100644 --- a/qapi/misc.json +++ b/qapi/misc.json @@ -1991,54 +1991,6 @@ ## { 'command': 'query-machines', 'returns': ['MachineInfo'] } -## -# @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' } } - ## # @MemoryInfo: # @@ -2071,16 +2023,6 @@ ## { 'command': 'query-memory-size-summary', 'returns': 'MemoryInfo' } -## -# @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'] } ## # @CpuModelInfo: diff --git a/qapi/target.json b/qapi/target.json index dd37c459c1..c75af005c9 100644 --- a/qapi/target.json +++ b/qapi/target.json @@ -427,3 +427,67 @@ '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)' } + +## +# @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)' } diff --git a/include/sysemu/arch_init.h b/include/sysemu/arch_init.h index 2497fd3351..10cbafe970 100644 --- a/include/sysemu/arch_init.h +++ b/include/sysemu/arch_init.h @@ -32,5 +32,4 @@ extern const uint32_t arch_type; int kvm_available(void); int xen_available(void); -CpuDefinitionInfoList *arch_query_cpu_definitions(Error **errp); #endif diff --git a/monitor.c b/monitor.c index 6a041c11b9..780247ab64 100644 --- a/monitor.c +++ b/monitor.c @@ -1204,26 +1204,6 @@ static void qmp_query_qmp_schema(QDict *qdict, QObject **ret_data, *ret_data = qobject_from_qlit(&qmp_schema_qlit); } -/* - * We used to define commands in qmp-commands.hx in addition to the - * QAPI schema. This permitted defining some of them only in certain - * configurations. query-commands has always reflected that (good, - * because it lets QMP clients figure out what's actually available), - * while query-qmp-schema never did (not so good). This function is a - * hack to keep the configuration-specific commands defined exactly as - * before, even though qmp-commands.hx is gone. - * - * FIXME Educate the QAPI schema on configuration-specific commands, - * and drop this hack. - */ -static void qmp_unregister_commands_hack(void) -{ -#if !defined(TARGET_PPC) && !defined(TARGET_ARM) && !defined(TARGET_I386) \ - && !defined(TARGET_S390X) - qmp_unregister_command(&qmp_commands, "query-cpu-definitions"); -#endif -} - static void monitor_init_qmp_commands(void) { /* @@ -1244,8 +1224,6 @@ static void monitor_init_qmp_commands(void) qmp_register_command(&qmp_commands, "netdev_add", qmp_netdev_add, QCO_NO_OPTIONS); - qmp_unregister_commands_hack(); - QTAILQ_INIT(&qmp_cap_negotiation_commands); qmp_register_command(&qmp_cap_negotiation_commands, "qmp_capabilities", qmp_marshal_qmp_capabilities, QCO_ALLOW_PRECONFIG); diff --git a/qmp.c b/qmp.c index 0f930014fa..8d5fb1a000 100644 --- a/qmp.c +++ b/qmp.c @@ -599,11 +599,6 @@ ObjectPropertyInfoList *qmp_qom_list_properties(const char *typename, return prop_list; } -CpuDefinitionInfoList *qmp_query_cpu_definitions(Error **errp) -{ - return arch_query_cpu_definitions(errp); -} - void qmp_add_client(const char *protocol, const char *fdname, bool has_skipauth, bool skipauth, bool has_tls, bool tls, Error **errp) diff --git a/stubs/arch-query-cpu-def.c b/stubs/arch-query-cpu-def.c deleted file mode 100644 index d436f95314..0000000000 --- a/stubs/arch-query-cpu-def.c +++ /dev/null @@ -1,11 +0,0 @@ -#include "qemu/osdep.h" -#include "qemu-common.h" -#include "sysemu/arch_init.h" -#include "qapi/error.h" -#include "qapi/qmp/qerror.h" - -CpuDefinitionInfoList *arch_query_cpu_definitions(Error **errp) -{ - error_setg(errp, QERR_UNSUPPORTED); - return NULL; -} diff --git a/target/arm/helper.c b/target/arm/helper.c index 644599b29d..13a266965e 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -18,6 +18,7 @@ #include "sysemu/kvm.h" #include "fpu/softfloat.h" #include "qemu/range.h" +#include "qapi/target-qapi-commands.h" #define ARM_CPU_FREQ 1000000000 /* FIXME: 1 GHz, should be configurable */ @@ -5938,7 +5939,7 @@ static void arm_cpu_add_definition(gpointer data, gpointer user_data) *cpu_list = entry; } -CpuDefinitionInfoList *arch_query_cpu_definitions(Error **errp) +CpuDefinitionInfoList *qmp_query_cpu_definitions(Error **errp) { CpuDefinitionInfoList *cpu_list = NULL; GSList *list; diff --git a/target/i386/cpu.c b/target/i386/cpu.c index 18579bc5e8..dc0a7413a4 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -36,6 +36,7 @@ #include "qapi/error.h" #include "qapi/qapi-visit-misc.h" #include "qapi/qapi-visit-run-state.h" +#include "qapi/target-qapi-commands.h" #include "qapi/qmp/qdict.h" #include "qapi/qmp/qerror.h" #include "qapi/visitor.h" @@ -3753,7 +3754,7 @@ static void x86_cpu_definition_entry(gpointer data, gpointer user_data) *cpu_list = entry; } -CpuDefinitionInfoList *arch_query_cpu_definitions(Error **errp) +CpuDefinitionInfoList *qmp_query_cpu_definitions(Error **errp) { CpuDefinitionInfoList *cpu_list = NULL; GSList *list = get_sorted_cpu_model_list(); diff --git a/target/ppc/translate_init.inc.c b/target/ppc/translate_init.inc.c index 168d0cec28..fe7ada079c 100644 --- a/target/ppc/translate_init.inc.c +++ b/target/ppc/translate_init.inc.c @@ -38,6 +38,7 @@ #include "qemu/cutils.h" #include "disas/capstone.h" #include "fpu/softfloat.h" +#include "qapi/target-qapi-commands.h" //#define PPC_DUMP_CPU //#define PPC_DEBUG_SPR @@ -10207,7 +10208,7 @@ static void ppc_cpu_defs_entry(gpointer data, gpointer user_data) *first = entry; } -CpuDefinitionInfoList *arch_query_cpu_definitions(Error **errp) +CpuDefinitionInfoList *qmp_query_cpu_definitions(Error **errp) { CpuDefinitionInfoList *cpu_list = NULL; GSList *list; diff --git a/target/s390x/cpu_models.c b/target/s390x/cpu_models.c index a1e745855b..2c2207fb1d 100644 --- a/target/s390x/cpu_models.c +++ b/target/s390x/cpu_models.c @@ -433,7 +433,7 @@ static void create_cpu_model_list(ObjectClass *klass, void *opaque) *cpu_list = entry; } -CpuDefinitionInfoList *arch_query_cpu_definitions(Error **errp) +CpuDefinitionInfoList *qmp_query_cpu_definitions(Error **errp) { struct CpuDefinitionInfoListData list_data = { .list = NULL, diff --git a/stubs/Makefile.objs b/stubs/Makefile.objs index e28f443b7b..4eb2947371 100644 --- a/stubs/Makefile.objs +++ b/stubs/Makefile.objs @@ -1,4 +1,3 @@ -stub-obj-y += arch-query-cpu-def.o stub-obj-y += bdrv-next-monitor-owned.o stub-obj-y += blk-commit-all.o stub-obj-y += blockdev-close-all-bdrv-states.o From patchwork Sun Dec 16 14:09:01 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= X-Patchwork-Id: 1014144 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=2001:4830:134:3::11; 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 [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43Hmdt4x7mz9s3C for ; Mon, 17 Dec 2018 01:20:17 +1100 (AEDT) Received: from localhost ([::1]:42637 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gYXHC-0000LW-3f for incoming@patchwork.ozlabs.org; Sun, 16 Dec 2018 09:20:14 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33241) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gYX7U-0001sw-IO for qemu-devel@nongnu.org; Sun, 16 Dec 2018 09:10:13 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gYX7S-0005VD-VH for qemu-devel@nongnu.org; Sun, 16 Dec 2018 09:10:12 -0500 Received: from mx1.redhat.com ([209.132.183.28]:33630) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gYX7S-0005Qz-MI for qemu-devel@nongnu.org; Sun, 16 Dec 2018 09:10:10 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6B0CA81DEA for ; Sun, 16 Dec 2018 14:10:08 +0000 (UTC) Received: from localhost (ovpn-112-19.ams2.redhat.com [10.36.112.19]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8E4F95D9C6; Sun, 16 Dec 2018 14:10:07 +0000 (UTC) From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= To: qemu-devel@nongnu.org Date: Sun, 16 Dec 2018 18:09:01 +0400 Message-Id: <20181216140902.23986-13-marcandre.lureau@redhat.com> In-Reply-To: <20181216140902.23986-1-marcandre.lureau@redhat.com> References: <20181216140902.23986-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Sun, 16 Dec 2018 14:10:08 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 12/13] qapi: remove qmp_unregister_command() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: armbru@redhat.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" This command is no longer needed, the schema has compile-time configuration conditions. Signed-off-by: Marc-André Lureau --- include/qapi/qmp/dispatch.h | 1 - qapi/qmp-registry.c | 8 -------- 2 files changed, 9 deletions(-) diff --git a/include/qapi/qmp/dispatch.h b/include/qapi/qmp/dispatch.h index 68a528a9aa..9aa426a398 100644 --- a/include/qapi/qmp/dispatch.h +++ b/include/qapi/qmp/dispatch.h @@ -39,7 +39,6 @@ typedef QTAILQ_HEAD(QmpCommandList, QmpCommand) QmpCommandList; void qmp_register_command(QmpCommandList *cmds, const char *name, QmpCommandFunc *fn, QmpCommandOptions options); -void qmp_unregister_command(QmpCommandList *cmds, const char *name); QmpCommand *qmp_find_command(QmpCommandList *cmds, const char *name); void qmp_disable_command(QmpCommandList *cmds, const char *name); void qmp_enable_command(QmpCommandList *cmds, const char *name); diff --git a/qapi/qmp-registry.c b/qapi/qmp-registry.c index 5af484cd9a..ca00f74795 100644 --- a/qapi/qmp-registry.c +++ b/qapi/qmp-registry.c @@ -27,14 +27,6 @@ void qmp_register_command(QmpCommandList *cmds, const char *name, QTAILQ_INSERT_TAIL(cmds, cmd, node); } -void qmp_unregister_command(QmpCommandList *cmds, const char *name) -{ - QmpCommand *cmd = qmp_find_command(cmds, name); - - QTAILQ_REMOVE(cmds, cmd, node); - g_free(cmd); -} - QmpCommand *qmp_find_command(QmpCommandList *cmds, const char *name) { QmpCommand *cmd; From patchwork Sun Dec 16 14:09:02 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= X-Patchwork-Id: 1014137 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=2001:4830:134:3::11; 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 [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43HmVw491zz9s3Z for ; Mon, 17 Dec 2018 01:14:16 +1100 (AEDT) Received: from localhost ([::1]:42607 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gYXBN-0004Za-PP for incoming@patchwork.ozlabs.org; Sun, 16 Dec 2018 09:14:13 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33300) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gYX7c-0001wn-3o for qemu-devel@nongnu.org; Sun, 16 Dec 2018 09:10:25 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gYX7Y-0005ZB-Ci for qemu-devel@nongnu.org; Sun, 16 Dec 2018 09:10:18 -0500 Received: from mx1.redhat.com ([209.132.183.28]:58054) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gYX7W-0005XY-L4 for qemu-devel@nongnu.org; Sun, 16 Dec 2018 09:10:16 -0500 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 A22A9C05D3ED for ; Sun, 16 Dec 2018 14:10:13 +0000 (UTC) Received: from localhost (ovpn-112-19.ams2.redhat.com [10.36.112.19]) by smtp.corp.redhat.com (Postfix) with ESMTP id 22BFA5C22B; Sun, 16 Dec 2018 14:10:11 +0000 (UTC) From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= To: qemu-devel@nongnu.org Date: Sun, 16 Dec 2018 18:09:02 +0400 Message-Id: <20181216140902.23986-14-marcandre.lureau@redhat.com> In-Reply-To: <20181216140902.23986-1-marcandre.lureau@redhat.com> References: <20181216140902.23986-1-marcandre.lureau@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]); Sun, 16 Dec 2018 14:10:13 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 13/13] qapi: move RTC_CHANGE to the target schema X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: armbru@redhat.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" A few targets don't emit RTC_CHANGE, we could restrict the event to the tagets that do emit it. Note: There is a lot more of events & commands that we could restrict to capable targets, with the cost of some additional complexity, but the benefit of added correctness and better introspection. Note2: The rate limite could perhaps be part of the schema, and the common event emitter code, to simplify the need of custom and #ifdef code in the monitor. Signed-off-by: Marc-André Lureau --- qapi/misc.json | 23 ----------------------- qapi/target.json | 23 +++++++++++++++++++++++ hw/ppc/spapr_rtc.c | 2 +- hw/timer/mc146818rtc.c | 2 +- monitor.c | 8 +++++++- 5 files changed, 32 insertions(+), 26 deletions(-) diff --git a/qapi/misc.json b/qapi/misc.json index 7d620b2d7b..aa97344c20 100644 --- a/qapi/misc.json +++ b/qapi/misc.json @@ -2807,29 +2807,6 @@ { 'event': 'ACPI_DEVICE_OST', 'data': { 'info': 'ACPIOSTInfo' } } -## -# @RTC_CHANGE: -# -# Emitted when the guest changes the RTC time. -# -# @offset: offset between base RTC clock (as specified by -rtc base), and -# new RTC clock value. Note that value will be different depending -# on clock chosen to drive RTC (specified by -rtc clock). -# -# Note: This event is rate-limited. -# -# Since: 0.13.0 -# -# Example: -# -# <- { "event": "RTC_CHANGE", -# "data": { "offset": 78 }, -# "timestamp": { "seconds": 1267020223, "microseconds": 435656 } } -# -## -{ 'event': 'RTC_CHANGE', - 'data': { 'offset': 'int' } } - ## # @ReplayMode: # diff --git a/qapi/target.json b/qapi/target.json index c75af005c9..039f539fcf 100644 --- a/qapi/target.json +++ b/qapi/target.json @@ -9,6 +9,29 @@ { 'include': 'misc.json' } +## +# @RTC_CHANGE: +# +# Emitted when the guest changes the RTC time. +# +# @offset: offset between base RTC clock (as specified by -rtc base), and +# new RTC clock value +# +# Note: This event is rate-limited. +# +# Since: 0.13.0 +# +# Example: +# +# <- { "event": "RTC_CHANGE", +# "data": { "offset": 78 }, +# "timestamp": { "seconds": 1267020223, "microseconds": 435656 } } +# +## +{ 'event': 'RTC_CHANGE', + 'data': { 'offset': 'int' }, + 'if': 'defined(TARGET_ALPHA) || defined(TARGET_ARM) || defined(TARGET_HPPA) || defined(TARGET_I386) || defined(TARGET_MIPS) || defined(TARGET_MIPS64) || defined(TARGET_MOXIE) || defined(TARGET_PPC) || defined(TARGET_PPC64) || defined(TARGET_S390X) || defined(TARGET_SH4) || defined(TARGET_SPARC)' } + ## # @rtc-reset-reinjection: # diff --git a/hw/ppc/spapr_rtc.c b/hw/ppc/spapr_rtc.c index cd049f389d..ce00d96865 100644 --- a/hw/ppc/spapr_rtc.c +++ b/hw/ppc/spapr_rtc.c @@ -31,7 +31,7 @@ #include "sysemu/sysemu.h" #include "hw/ppc/spapr.h" #include "qapi/error.h" -#include "qapi/qapi-events-misc.h" +#include "qapi/target-qapi-events.h" #include "qemu/cutils.h" void spapr_rtc_read(sPAPRRTCState *rtc, struct tm *tm, uint32_t *ns) diff --git a/hw/timer/mc146818rtc.c b/hw/timer/mc146818rtc.c index a27b389f8e..8e7ac3034e 100644 --- a/hw/timer/mc146818rtc.c +++ b/hw/timer/mc146818rtc.c @@ -32,7 +32,7 @@ #include "hw/timer/mc146818rtc.h" #include "qapi/error.h" #include "qapi/target-qapi-commands.h" -#include "qapi/qapi-events-misc.h" +#include "qapi/target-qapi-events.h" #include "qapi/visitor.h" #include "exec/address-spaces.h" diff --git a/monitor.c b/monitor.c index 780247ab64..f7abb18084 100644 --- a/monitor.c +++ b/monitor.c @@ -674,7 +674,6 @@ monitor_qapi_event_queue(unsigned event, QDict *qdict) .size = QAPI_EVENT__MAX, .rate = { /* Limit guest-triggerable events to 1 per second */ - [QAPI_EVENT_RTC_CHANGE] = 1000 * SCALE_MS, [QAPI_EVENT_WATCHDOG] = 1000 * SCALE_MS, [QAPI_EVENT_BALLOON_CHANGE] = 1000 * SCALE_MS, [QAPI_EVENT_QUORUM_REPORT_BAD] = 1000 * SCALE_MS, @@ -718,6 +717,13 @@ target_monitor_qapi_event_queue(unsigned event, QDict *qdict) static MonitorEventRateLimit limiter = { .size = TARGET_QAPI_EVENT__MAX, .rate = { + /* Limit guest-triggerable events to 1 per second */ +#if defined(TARGET_ALPHA) || defined(TARGET_ARM) || defined(TARGET_HPPA) || \ + defined(TARGET_I386) || defined(TARGET_MIPS) | defined(TARGET_MIPS64) || \ + defined(TARGET_MOXIE) || defined(TARGET_PPC) || defined(TARGET_PPC64) || \ + defined(TARGET_S390X) || defined(TARGET_SH4) || defined(TARGET_SPARC) + [TARGET_QAPI_EVENT_RTC_CHANGE] = 1000 * SCALE_MS, +#endif [TARGET_QAPI_EVENT__MAX] = 0, }, };