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 From: Eduardo Habkost Date: Wed, 5 Oct 2016 16:49:01 -0300 Message-Id: <1475696941-8056-1-git-send-email-ehabkost@redhat.com> Subject: [Qemu-devel] [PATCH v2] qmp: Disable query-cpu-* commands when they're unavailable List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org, armbru@redhat.com 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, david@gibson.dropbear.id.au, eblake@redhat.com, rth@twiddle.net 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 --- 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) -- 2.7.4