qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v3 44/50] build-sys: add a target schema


From: Markus Armbruster
Subject: Re: [Qemu-devel] [PATCH v3 44/50] build-sys: add a target schema
Date: Thu, 14 Dec 2017 17:34:07 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux)

Marc-André Lureau <address@hidden> writes:

> This schema is going to contain target-specific commands/events &
> types, that can be conditionnally guarded with poisoned defines. To
> filter it out by default, set the unit name to 'target'.
>
> And new rules to compile this unit generated files per-target.
>
> Use the "-u all" options for the introspection schema, since it is
> generated as a single file and must contain all definitions.
>
> Signed-off-by: Marc-André Lureau <address@hidden>
> ---
>  qapi-schema.json |  1 +
>  qapi/target.json |  3 +++
>  monitor.c        |  2 ++
>  Makefile         | 29 ++++++++++++++++++++++++++++-
>  Makefile.target  |  2 ++
>  5 files changed, 36 insertions(+), 1 deletion(-)
>  create mode 100644 qapi/target.json
>
> diff --git a/qapi-schema.json b/qapi-schema.json
> index f3af2cb851..42b6aebddb 100644
> --- a/qapi-schema.json
> +++ b/qapi-schema.json
> @@ -92,6 +92,7 @@
>  { 'include': 'qapi/transaction.json' }
>  { 'include': 'qapi/trace.json' }
>  { 'include': 'qapi/introspect.json' }
> +{ 'include': 'qapi/target.json' }
>  
>  ##
>  # = Miscellanea
> diff --git a/qapi/target.json b/qapi/target.json
> new file mode 100644
> index 0000000000..e9644f52c2
> --- /dev/null
> +++ b/qapi/target.json
> @@ -0,0 +1,3 @@
> +# -*- Mode: Python -*-
> +
> +{ 'pragma': { 'unit': 'target' } }
> diff --git a/monitor.c b/monitor.c
> index bf8a7685bf..af4eaeca5e 100644
> --- a/monitor.c
> +++ b/monitor.c
> @@ -68,6 +68,7 @@
>  #include "exec/exec-all.h"
>  #include "qemu/log.h"
>  #include "qmp-commands.h"
> +#include "target-qmp-commands.h"
>  #include "hmp.h"
>  #include "qemu/thread.h"
>  #include "block/qapi.h"
> @@ -1003,6 +1004,7 @@ void monitor_init_qmp_commands(void)
>  
>      QTAILQ_INIT(&qmp_commands);
>      qmp_init_marshal(&qmp_commands);
> +    target_qmp_init_marshal(&qmp_commands);
>  
>      qmp_register_command(&qmp_commands, "query-qmp-schema",
>                           qmp_query_qmp_schema,
> diff --git a/Makefile b/Makefile
> index 337a1f6f9b..7356b4e7b7 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -54,6 +54,8 @@ include $(SRC_PATH)/rules.mak
>  GENERATED_FILES = qemu-version.h config-host.h qemu-options.def
>  GENERATED_FILES += qmp-commands.h qapi-types.h qapi-visit.h qapi-event.h
>  GENERATED_FILES += qmp-marshal.c qapi-types.c qapi-visit.c qapi-event.c
> +GENERATED_FILES += target-qmp-commands.h target-qapi-types.h 
> target-qapi-visit.h target-qapi-event.h
> +GENERATED_FILES += target-qmp-marshal.c target-qapi-types.c 
> target-qapi-visit.c target-qapi-event.c
>  GENERATED_FILES += qmp-introspect.h
>  GENERATED_FILES += qmp-introspect.c
>  
> @@ -418,6 +420,7 @@ qapi-modules = $(SRC_PATH)/qapi-schema.json 
> $(SRC_PATH)/qapi/common.json \
>                 $(SRC_PATH)/qapi/rocker.json \
>                 $(SRC_PATH)/qapi/run-state.json \
>                 $(SRC_PATH)/qapi/sockets.json \
> +               $(SRC_PATH)/qapi/target.json \
>                 $(SRC_PATH)/qapi/tpm.json \
>                 $(SRC_PATH)/qapi/trace.json \
>                 $(SRC_PATH)/qapi/transaction.json \
> @@ -443,10 +446,34 @@ $(qapi-modules) $(SRC_PATH)/scripts/qapi-commands.py 
> $(qapi-py)
>       $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-commands.py \
>               $(gen-out-type) -o "." $<, \
>               "GEN","$@")
> +
> +target-qapi-types.c target-qapi-types.h :\
> +$(qapi-modules) $(SRC_PATH)/scripts/qapi-types.py $(qapi-py)
> +     $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-types.py \
> +             -i qapi-types.h \
> +             $(gen-out-type) -p target- -u target $<, \
> +             "GEN","$@")
> +target-qapi-visit.c target-qapi-visit.h :\
> +$(qapi-modules) $(SRC_PATH)/scripts/qapi-visit.py $(qapi-py)
> +     $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-visit.py \
> +             -i qapi-visit.h \
> +             $(gen-out-type) -p target- -u target $<, \
> +             "GEN","$@")
> +target-qapi-event.c target-qapi-event.h :\
> +$(qapi-modules) $(SRC_PATH)/scripts/qapi-event.py $(qapi-py)
> +     $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-event.py \
> +             $(gen-out-type) -p target- -u target  $<, \
> +             "GEN","$@")
> +target-qmp-commands.h target-qmp-marshal.c :\
> +$(qapi-modules) $(SRC_PATH)/scripts/qapi-commands.py $(qapi-py)
> +     $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-commands.py \
> +             $(gen-out-type) -p target- -u target $<, \
> +             "GEN","$@")
> +
>  qmp-introspect.h qmp-introspect.c :\
>  $(qapi-modules) $(SRC_PATH)/scripts/qapi-introspect.py $(qapi-py)
>       $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-introspect.py \
> -             $(gen-out-type) -o "." $<, \
> +             $(gen-out-type) -o "." -u all $<, \
>               "GEN","$@")
>  

Let's see whether I understand how this works.  Without -u (not fully
visible in the diff), we get everything but the target-specific stuff.
With -u target, we get just the target-specific stuff.  With -u all, we
get everything.  Correct?

>  QGALIB_GEN=$(addprefix qga/qapi-generated/, qga-qapi-types.h 
> qga-qapi-visit.h qga-qmp-commands.h)
> diff --git a/Makefile.target b/Makefile.target
> index 0d28ed1df0..e44a3847d3 100644
> --- a/Makefile.target
> +++ b/Makefile.target
> @@ -157,6 +157,8 @@ endif
>  
>  GENERATED_FILES += hmp-commands.h hmp-commands-info.h
>  
> +obj-y += target-qapi-types.o target-qapi-visit.o
> +obj-y += target-qapi-event.o target-qmp-marshal.o
>  obj-y += qmp-introspect.o
>  
>  endif # CONFIG_SOFTMMU



reply via email to

[Prev in Thread] Current Thread [Next in Thread]