All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Marc-André Lureau" <marcandre.lureau@gmail.com>
To: Markus Armbruster <armbru@redhat.com>
Cc: Peter Maydell <peter.maydell@linaro.org>,
	Eduardo Habkost <ehabkost@redhat.com>,
	Alexander Graf <agraf@suse.de>,
	qemu-devel@nongnu.org, "open list:ARM" <qemu-arm@nongnu.org>,
	"open list:PowerPC" <qemu-ppc@nongnu.org>,
	Paolo Bonzini <pbonzini@redhat.com>,
	Richard Henderson <rth@twiddle.net>,
	"Dr. David Alan Gilbert" <dgilbert@redhat.com>,
	David Gibson <david@gibson.dropbear.id.au>
Subject: Re: [Qemu-devel] [PATCH 26/26] qapi: make query-cpu-definitions depend on specific targets
Date: Thu, 17 Aug 2017 12:43:23 +0000	[thread overview]
Message-ID: <CAJ+F1CL2z10V=xwJOKDHG=dCT01q7mOzNdLY7Y9io6goUZK61g@mail.gmail.com> (raw)
In-Reply-To: <87shgqcr7a.fsf@dusky.pond.sub.org>

Hi

On Thu, Aug 17, 2017 at 2:30 PM Markus Armbruster <armbru@redhat.com> wrote:

> Marc-André Lureau <marcandre.lureau@redhat.com> writes:
>
> > It depends on TARGET_PPC || TARGET_ARM || TARGET_I386 || TARGET_S390X.
> >
> > Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> > ---
> >  qapi-schema.json            |  4 +++-
> >  include/sysemu/arch_init.h  |  2 --
> >  monitor.c                   | 22 ----------------------
> >  qmp.c                       |  5 -----
> >  stubs/arch-query-cpu-def.c  | 10 ----------
> >  target/arm/helper.c         |  3 ++-
> >  target/i386/cpu.c           |  3 ++-
> >  target/ppc/translate_init.c |  3 ++-
> >  target/s390x/cpu_models.c   |  2 +-
> >  stubs/Makefile.objs         |  1 -
> >  10 files changed, 10 insertions(+), 45 deletions(-)
> >  delete mode 100644 stubs/arch-query-cpu-def.c
> >
> > diff --git a/qapi-schema.json b/qapi-schema.json
> > index f5e1acff83..8e3949bca8 100644
> > --- a/qapi-schema.json
> > +++ b/qapi-schema.json
> > @@ -4433,7 +4433,9 @@
> >  #
> >  # Since: 1.2.0
> >  ##
> > -{ 'command': 'query-cpu-definitions', 'returns': ['CpuDefinitionInfo'] }
> > +{ 'command': 'query-cpu-definitions', 'returns': ['CpuDefinitionInfo'],
> > +  'if': ['defined(NEED_CPU_H)',
> > +         'defined(TARGET_PPC) || defined(TARGET_ARM) ||
> defined(TARGET_I386) || defined(TARGET_S390X)'] }
> >
> >  ##
> >  # @CpuModelInfo:
> > diff --git a/include/sysemu/arch_init.h b/include/sysemu/arch_init.h
> > index fb3d20a1b8..e9721b9ce8 100644
> > --- a/include/sysemu/arch_init.h
> > +++ b/include/sysemu/arch_init.h
> > @@ -31,6 +31,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 b134c39144..6600819599 100644
> > --- a/monitor.c
> > +++ b/monitor.c
> > @@ -956,26 +956,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
> > -}
> > -
>
> Very nice to see this gone.  Its removal could be made a separate commit
> to highlight the achievement :)
>
> There are a few more candidates:
>
> * QERR_FEATURE_DISABLED leads me to
>   - query-hotpluggable-cpus via monitor.c
>   - x-colo-lost-heartbeat via colo-failover.c
>   - query-rocker, query-rocker-ports, query-rocker-of-dpa-flows,
>     query-rocker-of-dpa-groups via qmp-norocker.c
>
> * QERR_UNSUPPORTED leads me to
>   - dump-guest-memory via dump_init() and stubs/dump.c
>   - query-vm-generation-id via stubs/vmgenid.c
>   - inject-nmi via nmi_monitor_handle() and s390_nmi()
>   - query-pci via pci-stub.c
>
> * grep error_set stubs/* doesn't find more
>

I have started to look at other opportunities in
https://github.com/elmarco/qemu/commits/qapi-if-more, but I have to revisit
that once we have that series ready. I guess this could be done case by
case later, and collaboratively.

Thanks for the review so far, I'll get back to it soon.


> >  void monitor_init_qmp_commands(void)
> >  {
> >      /*
> > @@ -995,8 +975,6 @@ 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_NO_OPTIONS);
> > diff --git a/qmp.c b/qmp.c
> > index afa266ec1e..d57ccf1251 100644
> > --- a/qmp.c
> > +++ b/qmp.c
> > @@ -541,11 +541,6 @@ DevicePropertyInfoList
> *qmp_device_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 cefe4beb82..0000000000
> > --- a/stubs/arch-query-cpu-def.c
> > +++ /dev/null
> > @@ -1,10 +0,0 @@
> > -#include "qemu/osdep.h"
> > -#include "qemu-common.h"
> > -#include "sysemu/arch_init.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 4ed32c56b8..ec644f3930 100644
> > --- a/target/arm/helper.c
> > +++ b/target/arm/helper.c
> > @@ -15,6 +15,7 @@
> >  #include <zlib.h> /* For crc32 */
> >  #include "exec/semihost.h"
> >  #include "sysemu/kvm.h"
> > +#include "qmp-commands.h"
> >
> >  #define ARM_CPU_FREQ 1000000000 /* FIXME: 1 GHz, should be configurable
> */
> >
> > @@ -5336,7 +5337,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 d683e70a13..e5f61f6bff 100644
> > --- a/target/i386/cpu.c
> > +++ b/target/i386/cpu.c
> > @@ -36,6 +36,7 @@
> >  #include "qapi/visitor.h"
> >  #include "qom/qom-qobject.h"
> >  #include "sysemu/arch_init.h"
> > +#include "qmp-commands.h"
> >
> >  #if defined(CONFIG_KVM)
> >  #include <linux/kvm_para.h>
> > @@ -2318,7 +2319,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.c b/target/ppc/translate_init.c
> > index 01723bdfec..2a2d62e5bb 100644
> > --- a/target/ppc/translate_init.c
> > +++ b/target/ppc/translate_init.c
> > @@ -34,6 +34,7 @@
> >  #include "hw/ppc/ppc.h"
> >  #include "mmu-book3s-v3.h"
> >  #include "sysemu/qtest.h"
> > +#include "qmp-commands.h"
> >
> >  //#define PPC_DUMP_CPU
> >  //#define PPC_DEBUG_SPR
> > @@ -10391,7 +10392,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 863dce064f..8021dda341 100644
> > --- a/target/s390x/cpu_models.c
> > +++ b/target/s390x/cpu_models.c
> > @@ -387,7 +387,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 dcfe6f49f9..71af433f6b 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
>
> --
Marc-André Lureau

  reply	other threads:[~2017-08-17 12:43 UTC|newest]

Thread overview: 69+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-27 15:41 [Qemu-devel] [PATCH 00/26] qapi: add #if pre-processor conditions to generated code Marc-André Lureau
2017-07-27 15:41 ` [Qemu-devel] [PATCH 01/26] qapi: fix type_seen key error Marc-André Lureau
2017-08-15 14:40   ` Markus Armbruster
2017-08-17 23:17     ` Marc-André Lureau
2017-07-27 15:41 ` [Qemu-devel] [PATCH 02/26] qobject: replace dump_qobject() by qobject_to_string() Marc-André Lureau
2017-08-16  9:02   ` Markus Armbruster
2017-07-27 15:41 ` [Qemu-devel] [PATCH 03/26] qboject: add literal qobject type Marc-André Lureau
2017-08-16  8:59   ` Markus Armbruster
2017-08-22 11:16     ` Marc-André Lureau
2017-07-27 15:41 ` [Qemu-devel] [PATCH 04/26] qapi: generate a literal qobject for introspection Marc-André Lureau
2017-08-16 10:21   ` Markus Armbruster
2017-08-22 11:17     ` Marc-André Lureau
2017-08-17 11:48   ` Markus Armbruster
2017-07-27 15:41 ` [Qemu-devel] [PATCH 05/26] visitor: pass size of strings array to enum visitor Marc-André Lureau
2017-08-16 12:54   ` Markus Armbruster
2017-08-22 11:17     ` Marc-André Lureau
2017-07-27 15:41 ` [Qemu-devel] [PATCH 06/26] qapi2texi: minor python code simplification Marc-André Lureau
2017-08-16 12:55   ` Markus Armbruster
2017-07-27 15:41 ` [Qemu-devel] [PATCH 07/26] qapi: add 'if' condition on top-level schema elements Marc-André Lureau
2017-08-16 15:43   ` Markus Armbruster
2017-08-17  5:50     ` Markus Armbruster
2017-08-22 11:17     ` Marc-André Lureau
2017-08-22 16:52       ` Markus Armbruster
2017-08-23 12:45         ` Eduardo Habkost
2017-08-17 11:51   ` Markus Armbruster
2017-07-27 15:41 ` [Qemu-devel] [PATCH 08/26] qapi: add 'if' condition on enum member values Marc-André Lureau
2017-07-27 15:41 ` [Qemu-devel] [PATCH 09/26] qapi: add 'if' condition on struct member Marc-André Lureau
2017-07-27 15:41 ` [Qemu-devel] [PATCH 10/26] qapi: add 'if' condition on union variant Marc-André Lureau
2017-07-27 15:41 ` [Qemu-devel] [PATCH 11/26] qapi: add 'if' condition on alternate variant Marc-André Lureau
2017-07-27 15:41 ` [Qemu-devel] [PATCH 12/26] qapi2texi: add 'If:' section to generated documentation Marc-André Lureau
2017-07-27 15:41 ` [Qemu-devel] [PATCH 13/26] qapi2texi: add 'If:' condition to enum values Marc-André Lureau
2017-07-27 15:41 ` [Qemu-devel] [PATCH 14/26] qapi2texi: add 'If:' condition to struct members Marc-André Lureau
2017-07-27 15:41 ` [Qemu-devel] [PATCH 15/26] qapi2texi: add condition to variants Marc-André Lureau
2017-07-27 15:41 ` [Qemu-devel] [PATCH 16/26] qapi: add conditions to VNC type/commands/events on the schema Marc-André Lureau
2017-07-28 19:00   ` Dr. David Alan Gilbert
2017-08-17  6:32     ` Markus Armbruster
2017-08-17  9:33       ` Dr. David Alan Gilbert
2017-08-17  7:04   ` Markus Armbruster
2017-08-17  8:56     ` Markus Armbruster
2017-08-23 15:07       ` Gerd Hoffmann
2017-08-23 17:35         ` Eduardo Habkost
2017-08-23 15:09     ` Gerd Hoffmann
2017-08-29 10:42     ` Daniel P. Berrange
2017-08-29 10:46       ` Marc-André Lureau
2017-07-27 15:41 ` [Qemu-devel] [PATCH 17/26] qapi: add conditions to SPICE " Marc-André Lureau
2017-08-17  8:10   ` Markus Armbruster
2017-08-17  8:43     ` Markus Armbruster
2017-07-27 15:41 ` [Qemu-devel] [PATCH 18/26] qapi: add conditions to REPLICATION type/commands " Marc-André Lureau
2017-08-17  9:16   ` Markus Armbruster
2017-08-22 11:18     ` Marc-André Lureau
2017-07-27 15:41 ` [Qemu-devel] [PATCH 19/26] build-sys: move qapi variables in qapi.mak Marc-André Lureau
2017-08-17  9:19   ` Markus Armbruster
2017-07-27 15:41 ` [Qemu-devel] [PATCH 20/26] tests/qmp-test: add query-qmp-schema test Marc-André Lureau
2017-07-27 15:41 ` [Qemu-devel] [PATCH 21/26] build-sys: make qemu qapi objects per-target Marc-André Lureau
2017-08-17 11:44   ` Markus Armbruster
2017-08-22 11:18     ` Marc-André Lureau
2017-07-27 15:41 ` [Qemu-devel] [PATCH 22/26] qapi: make rtc-reset-reinjection depend on TARGET_I386 Marc-André Lureau
2017-08-17 11:57   ` Markus Armbruster
2017-08-22 11:18     ` Marc-André Lureau
2017-07-27 15:41 ` [Qemu-devel] [PATCH 23/26] qapi: make s390 commands depend on TARGET_S390X Marc-André Lureau
2017-08-17 12:13   ` Markus Armbruster
2017-07-27 15:41 ` [Qemu-devel] [PATCH 24/26] qapi: make query-gic-capabilities depend on TARGET_ARM Marc-André Lureau
2017-07-27 15:41 ` [Qemu-devel] [PATCH 25/26] qapi: make query-cpu-model-expansion depend on s390 or x86 Marc-André Lureau
2017-07-27 15:41 ` [Qemu-devel] [PATCH 26/26] qapi: make query-cpu-definitions depend on specific targets Marc-André Lureau
2017-08-17 12:30   ` Markus Armbruster
2017-08-17 12:43     ` Marc-André Lureau [this message]
2017-08-17 13:55 ` [Qemu-devel] [PATCH 00/26] qapi: add #if pre-processor conditions to generated code Markus Armbruster
2017-08-22 11:22   ` Marc-André Lureau
2017-08-22 16:58     ` Markus Armbruster

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='CAJ+F1CL2z10V=xwJOKDHG=dCT01q7mOzNdLY7Y9io6goUZK61g@mail.gmail.com' \
    --to=marcandre.lureau@gmail.com \
    --cc=agraf@suse.de \
    --cc=armbru@redhat.com \
    --cc=david@gibson.dropbear.id.au \
    --cc=dgilbert@redhat.com \
    --cc=ehabkost@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    --cc=rth@twiddle.net \
    /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.