From patchwork Wed Oct 5 19:49:01 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eduardo Habkost X-Patchwork-Id: 9363337 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 17402607D6 for ; Wed, 5 Oct 2016 20:05:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 093E628619 for ; Wed, 5 Oct 2016 20:05:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EEC4A286B4; Wed, 5 Oct 2016 20:05:18 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 9831E28619 for ; Wed, 5 Oct 2016 20:05:18 +0000 (UTC) Received: from localhost ([::1]:51117 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1brsRJ-0005E6-OY for patchwork-qemu-devel@patchwork.kernel.org; Wed, 05 Oct 2016 16:05:17 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48107) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1brsBp-0001ch-F1 for qemu-devel@nongnu.org; Wed, 05 Oct 2016 15:49:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1brsBl-00039Z-8h for qemu-devel@nongnu.org; Wed, 05 Oct 2016 15:49:16 -0400 Received: from mx1.redhat.com ([209.132.183.28]:37818) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1brsBl-000383-2Z for qemu-devel@nongnu.org; Wed, 05 Oct 2016 15:49:13 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 814FD7CDEA; Wed, 5 Oct 2016 19:49:09 +0000 (UTC) Received: from localhost (ovpn-116-132.phx2.redhat.com [10.3.116.132]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u95Jn8X1019503; Wed, 5 Oct 2016 15:49:08 -0400 From: Eduardo Habkost To: qemu-devel@nongnu.org, armbru@redhat.com Date: Wed, 5 Oct 2016 16:49:01 -0300 Message-Id: <1475696941-8056-1-git-send-email-ehabkost@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Wed, 05 Oct 2016 19:49:09 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v2] qmp: Disable query-cpu-* commands when they're unavailable 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: peter.maydell@linaro.org, dahi@linux.vnet.ibm.com, agraf@suse.de, borntraeger@de.ibm.com, jjherne@linux.vnet.ibm.com, cornelia.huck@de.ibm.com, pbonzini@redhat.com, jdenemar@redhat.com, rth@twiddle.net, david@gibson.dropbear.id.au Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Instead of requiring clients to actually call the query-cpu-* commands to find out if they are implemented, remove them from the output of "query-commands", so clients know they are not available. This is implemented by extending the existing hack at qmp_unregister_commands_hack(). I wish I could avoid adding even more #ifdefs to that code, but that's the solution we have today. Signed-off-by: Eduardo Habkost Reviewed-by: Markus Armbruster --- Changes v1 -> v2: * Instead of adding new qmp_commands_init() and arch_qmp_commands_init() functions, simply extend the hack at qmp_unregister_commands_hack() --- monitor.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/monitor.c b/monitor.c index 83c4edf..4ff74b7 100644 --- a/monitor.c +++ b/monitor.c @@ -992,6 +992,15 @@ static void qmp_unregister_commands_hack(void) #ifndef TARGET_ARM qmp_unregister_command("query-gic-capabilities"); #endif +#if !defined(TARGET_S390X) + qmp_unregister_command("query-cpu-model-expansion"); + qmp_unregister_command("query-cpu-model-baseline"); + qmp_unregister_command("query-cpu-model-comparison"); +#endif +#if !defined(TARGET_PPC) && !defined(TARGET_ARM) && !defined(TARGET_I386) \ + && !defined(TARGET_S390X) + qmp_unregister_command("query-cpu-definitions"); +#endif } static void qmp_init_marshal(void)