From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:55042) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T3Zps-0006nl-3o for qemu-devel@nongnu.org; Mon, 20 Aug 2012 17:48:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T3Zpr-0003GW-1f for qemu-devel@nongnu.org; Mon, 20 Aug 2012 17:48:36 -0400 Received: from e3.ny.us.ibm.com ([32.97.182.143]:41845) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T3Zpq-0003GP-Tc for qemu-devel@nongnu.org; Mon, 20 Aug 2012 17:48:34 -0400 Received: from /spool/local by e3.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 20 Aug 2012 17:48:32 -0400 Received: from d01relay04.pok.ibm.com (d01relay04.pok.ibm.com [9.56.227.236]) by d01dlp03.pok.ibm.com (Postfix) with ESMTP id BBB49C90041 for ; Mon, 20 Aug 2012 17:48:29 -0400 (EDT) Received: from d03av06.boulder.ibm.com (d03av06.boulder.ibm.com [9.17.195.245]) by d01relay04.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q7KLmTlJ180882 for ; Mon, 20 Aug 2012 17:48:29 -0400 Received: from d03av06.boulder.ibm.com (loopback [127.0.0.1]) by d03av06.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q7KLnnEZ009898 for ; Mon, 20 Aug 2012 15:49:49 -0600 From: Anthony Liguori In-Reply-To: <1345473098-26299-1-git-send-email-berrange@redhat.com> References: <1345473098-26299-1-git-send-email-berrange@redhat.com> Date: Mon, 20 Aug 2012 16:48:24 -0500 Message-ID: <87ehn1mdzr.fsf@codemonkey.ws> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Subject: Re: [Qemu-devel] [PATCH] qapi: add 'query-target' command to return target arch/bit size List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Daniel P. Berrange" , qemu-devel@nongnu.org Cc: Luiz Capitulino "Daniel P. Berrange" writes: > From: "Daniel P. Berrange" > > Add a 'query-target' QAPI command to allow management applications > to determine what target architecture a QEMU binary is emulating > without having to parse the binary name or -help output > > $ qmp-shell -p /tmp/qemu > (QEMU) query-target > { u'return': { u'arch': u'x86_64', u'bits': 64}} "bits" is really ambiguous. What it means in QEMU (specifically the value you are returning) is probably not what you expect it to mean. We're going to most likely fix TARGET_PHYS_ADDR_BITS to 64 real soon. Why did you include this field? What information are you looking to get from QEMU and what decisions do you plan to make with it? Regards, Anthony Liguori > > Signed-off-by: Daniel P. Berrange > --- > arch_init.c | 11 +++++++++++ > qapi-schema.json | 25 +++++++++++++++++++++++++ > qmp-commands.hx | 5 +++++ > 3 files changed, 41 insertions(+) > > diff --git a/arch_init.c b/arch_init.c > index 9b46bfc..095672d 100644 > --- a/arch_init.c > +++ b/arch_init.c > @@ -1080,3 +1080,14 @@ int xen_available(void) > return 0; > #endif > } > + > + > +TargetInfo *qmp_query_target(Error **errp) > +{ > + TargetInfo *info = g_malloc0(sizeof(*info)); > + > + info->arch = g_strdup(TARGET_ARCH); > + info->bits = TARGET_PHYS_ADDR_BITS; > + > + return info; > +} > diff --git a/qapi-schema.json b/qapi-schema.json > index 3d2b2d1..f0e3fe0 100644 > --- a/qapi-schema.json > +++ b/qapi-schema.json > @@ -2454,3 +2454,28 @@ > # > ## > { 'command': 'query-fdsets', 'returns': ['FdsetInfo'] } > + > +## > +# @TargetInfo: > +# > +# Information describing the QEMU target. > +# > +# @arch: the name of the target architecture (eg "x86_64", "i686", etc) > +# > +# @bits: number of bits in physical address (eg 32 or 64) > +# > +# Since: 1.2.0 > +## > +{ 'type': 'TargetInfo', > + 'data': { 'arch': 'str', 'bits': 'int' } } > + > +## > +# @query-target: > +# > +# Return information about the target for this QEMU > +# > +# Returns: TargetInfo > +# > +# Since: 1.2.0 > +## > +{ 'command': 'query-target', 'returns': 'TargetInfo' } > diff --git a/qmp-commands.hx b/qmp-commands.hx > index 2ce4ce6..00d798f 100644 > --- a/qmp-commands.hx > +++ b/qmp-commands.hx > @@ -2509,3 +2509,8 @@ EQMP > .mhandler.cmd_new = qmp_marshal_input_query_cpu_definitions, > }, > > + { > + .name = "query-target", > + .args_type = "", > + .mhandler.cmd_new = qmp_marshal_input_query_target, > + }, > -- > 1.7.11.2