All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Daniel P. Berrange" <berrange@redhat.com>
To: Anthony Liguori <aliguori@us.ibm.com>
Cc: Eric Blake <eblake@redhat.com>,
	qemu-devel@nongnu.org, Luiz Capitulino <lcapitulino@redhat.com>
Subject: Re: [Qemu-devel] [PATCH] qapi: add 'query-target' command to return target arch/bit size (v2)
Date: Wed, 22 Aug 2012 16:15:04 +0100	[thread overview]
Message-ID: <20120822151504.GI22908@redhat.com> (raw)
In-Reply-To: <1345648178-19823-1-git-send-email-aliguori@us.ibm.com>

You can remove '/bit size' in the commit message 1st line.

On Wed, Aug 22, 2012 at 10:09:38AM -0500, Anthony Liguori wrote:
> From: "Daniel P. Berrange" <berrange@redhat.com>
> 
> 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' }}
> 
> Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
> ---
> v1 -> v2 (aliguori)
>  - remove 'bits' field
>  - switch command to return an enum
> ---
>  arch_init.c      |   11 +++++++++++
>  configure        |    7 ++++++-
>  qapi-schema.json |   39 +++++++++++++++++++++++++++++++++++++++
>  qmp-commands.hx  |    5 +++++
>  4 files changed, 61 insertions(+), 1 deletions(-)
> 
> diff --git a/arch_init.c b/arch_init.c
> index 9b46bfc..5a1173e 100644
> --- a/arch_init.c
> +++ b/arch_init.c
> @@ -44,6 +44,7 @@
>  #include "exec-memory.h"
>  #include "hw/pcspk.h"
>  #include "qemu/page_cache.h"
> +#include "qmp-commands.h"
>  
>  #ifdef DEBUG_ARCH_INIT
>  #define DPRINTF(fmt, ...) \
> @@ -1080,3 +1081,13 @@ int xen_available(void)
>      return 0;
>  #endif
>  }
> +
> +
> +TargetInfo *qmp_query_target(Error **errp)
> +{
> +    TargetInfo *info = g_malloc0(sizeof(*info));
> +
> +    info->arch = TARGET_TYPE;
> +
> +    return info;
> +}
> diff --git a/configure b/configure
> index 60d266f..d97fd81 100755
> --- a/configure
> +++ b/configure
> @@ -3834,14 +3834,19 @@ case "$target_arch2" in
>    ;;
>  esac
>  
> +upper() {
> +    echo "$@"| LC_ALL=C tr '[a-z]' '[A-Z]'
> +}
> +
>  echo "TARGET_SHORT_ALIGNMENT=$target_short_alignment" >> $config_target_mak
>  echo "TARGET_INT_ALIGNMENT=$target_int_alignment" >> $config_target_mak
>  echo "TARGET_LONG_ALIGNMENT=$target_long_alignment" >> $config_target_mak
>  echo "TARGET_LLONG_ALIGNMENT=$target_llong_alignment" >> $config_target_mak
>  echo "TARGET_ARCH=$TARGET_ARCH" >> $config_target_mak
> -target_arch_name="`echo $TARGET_ARCH | LC_ALL=C tr '[a-z]' '[A-Z]'`"
> +target_arch_name="`upper $TARGET_ARCH`"
>  echo "TARGET_$target_arch_name=y" >> $config_target_mak
>  echo "TARGET_ARCH2=$target_arch2" >> $config_target_mak
> +echo "TARGET_TYPE=TARGET_TYPE_`upper $target_arch2`" >> $config_target_mak
>  echo "TARGET_BASE_ARCH=$TARGET_BASE_ARCH" >> $config_target_mak
>  if [ "$TARGET_ABI_DIR" = "" ]; then
>    TARGET_ABI_DIR=$TARGET_ARCH
> diff --git a/qapi-schema.json b/qapi-schema.json
> index 3d2b2d1..72b3c4d 100644
> --- a/qapi-schema.json
> +++ b/qapi-schema.json
> @@ -2454,3 +2454,42 @@
>  #
>  ##
>  { 'command': 'query-fdsets', 'returns': ['FdsetInfo'] }
> +
> +##
> +# @TargetType
> +#
> +# Target CPU emulation type
> +#
> +# These parameters correspond to the softmmu binary CPU name that is currently
> +# running.
> +#
> +# Since: 1.2.0
> +##
> +{ 'enum': 'TargetType',
> +  'data': [ 'alpha', 'arm', 'cris', 'i386', 'lm32', 'm68k', 'microblazeel',
> +            'microblaze', 'mips64el', 'mips64', 'mipsel', 'mips', 'or32',
> +            'ppc64', 'ppcemb', 'ppc', 's390x', 'sh4eb', 'sh4', 'sparc64',
> +            'sparc', 'unicore32', 'x86_64', 'xtensaeb', 'xtensa' ] }
> +
> +##
> +# @TargetInfo:
> +#
> +# Information describing the QEMU target.
> +#
> +# @arch: the target architecture (eg "x86_64", "i386", etc)
> +#
> +# Since: 1.2.0
> +##
> +{ 'type': 'TargetInfo',
> +  'data': { 'arch': 'TargetType' } }
> +
> +##
> +# @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,
> +    },

The changes look fine to me.


Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|

  reply	other threads:[~2012-08-22 15:15 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-22 15:09 [Qemu-devel] [PATCH] qapi: add 'query-target' command to return target arch/bit size (v2) Anthony Liguori
2012-08-22 15:15 ` Daniel P. Berrange [this message]
2012-08-22 15:44 ` Eric Blake
2012-08-22 15:50 ` Luiz Capitulino

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120822151504.GI22908@redhat.com \
    --to=berrange@redhat.com \
    --cc=aliguori@us.ibm.com \
    --cc=eblake@redhat.com \
    --cc=lcapitulino@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.