[Qemu-devel] [PATCH v3 07/17] qapi: New module target.json

Markus Armbruster posted 17 patches 6 years, 9 months ago
Maintainers: Markus Armbruster <armbru@redhat.com>, David Hildenbrand <david@redhat.com>, Christian Borntraeger <borntraeger@de.ibm.com>, Halil Pasic <pasic@linux.ibm.com>, Eduardo Habkost <ehabkost@redhat.com>, Richard Henderson <rth@twiddle.net>, David Gibson <david@gibson.dropbear.id.au>, Gerd Hoffmann <kraxel@redhat.com>, Cornelia Huck <cohuck@redhat.com>, Peter Maydell <peter.maydell@linaro.org>, "Dr. David Alan Gilbert" <dgilbert@redhat.com>, Michael Roth <mdroth@linux.vnet.ibm.com>, Eric Blake <eblake@redhat.com>, Paolo Bonzini <pbonzini@redhat.com>, "Michael S. Tsirkin" <mst@redhat.com>
There is a newer version of this series
[Qemu-devel] [PATCH v3 07/17] qapi: New module target.json
Posted by Markus Armbruster 6 years, 9 months ago
We can't add appropriate target-specific conditionals to misc.json,
because that would make all of misc.json unusable in
target-independent code.  To keep misc.json target-independent, we
need to split off target-dependent target.json.

This commit doesn't actually split off anything, it merely creates the
empty module.  The next few patches will move stuff from misc.json
there.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
 Makefile.objs         | 20 +++++++++-----------
 Makefile.target       | 10 ++++++++++
 qapi/qapi-schema.json |  1 +
 qapi/target.json      | 13 +++++++++++++
 4 files changed, 33 insertions(+), 11 deletions(-)
 create mode 100644 qapi/target.json

diff --git a/Makefile.objs b/Makefile.objs
index 70ee51742f..5f0a7a8ca5 100644
--- a/Makefile.objs
+++ b/Makefile.objs
@@ -1,20 +1,19 @@
-QAPI_MODULES = block-core block char common crypto introspect job migration
-QAPI_MODULES += misc net rdma rocker run-state sockets tpm trace transaction
-QAPI_MODULES += ui
+QAPI_COMMON_MODULES = block-core block char common crypto introspect
+QAPI_COMMON_MODULES += job migration misc net rdma rocker run-state
+QAPI_COMMON_MODULES += sockets tpm trace transaction ui
+QAPI_TARGET_MODULES = target
+QAPI_MODULES = $(QAPI_COMMON_MODULES) $(QAPI_TARGET_MODULES)
 
 #######################################################################
 # Common libraries for tools and emulators
 stub-obj-y = stubs/ crypto/
 util-obj-y = util/ qobject/ qapi/
 util-obj-y += qapi/qapi-builtin-types.o
-util-obj-y += qapi/qapi-types.o
-util-obj-y += $(QAPI_MODULES:%=qapi/qapi-types-%.o)
+util-obj-y += $(QAPI_COMMON_MODULES:%=qapi/qapi-types-%.o)
 util-obj-y += qapi/qapi-builtin-visit.o
-util-obj-y += qapi/qapi-visit.o
-util-obj-y += $(QAPI_MODULES:%=qapi/qapi-visit-%.o)
+util-obj-y += $(QAPI_COMMON_MODULES:%=qapi/qapi-visit-%.o)
 util-obj-y += qapi/qapi-emit-events.o
-util-obj-y += qapi/qapi-events.o
-util-obj-y += $(QAPI_MODULES:%=qapi/qapi-events-%.o)
+util-obj-y += $(QAPI_COMMON_MODULES:%=qapi/qapi-events-%.o)
 
 chardev-obj-y = chardev/
 slirp-obj-$(CONFIG_SLIRP) = slirp/
@@ -92,8 +91,7 @@ common-obj-$(CONFIG_FDT) += device_tree.o
 ######################################################################
 # qapi
 
-common-obj-y += qapi/qapi-commands.o
-common-obj-y += $(QAPI_MODULES:%=qapi/qapi-commands-%.o)
+common-obj-y += $(QAPI_COMMON_MODULES:%=qapi/qapi-commands-%.o)
 common-obj-y += qmp.o hmp.o
 endif
 
diff --git a/Makefile.target b/Makefile.target
index d8af835890..f908477040 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -164,6 +164,16 @@ endif
 
 GENERATED_FILES += hmp-commands.h hmp-commands-info.h
 
+# FIXME duplicates Makefile.obj's
+QAPI_TARGET_MODULES = target
+obj-y += $(QAPI_TARGET_MODULES:%=qapi/qapi-types-%.o)
+obj-y += qapi/qapi-types.o
+obj-y += $(QAPI_TARGET_MODULES:%=qapi/qapi-visit-%.o)
+obj-y += qapi/qapi-visit.o
+obj-y += $(QAPI_TARGET_MODULES:%=qapi/qapi-events-%.o)
+obj-y += qapi/qapi-events.o
+obj-y += $(QAPI_TARGET_MODULES:%=qapi/qapi-commands-%.o)
+obj-y += qapi/qapi-commands.o
 obj-y += qapi/qapi-introspect.o
 
 endif # CONFIG_SOFTMMU
diff --git a/qapi/qapi-schema.json b/qapi/qapi-schema.json
index 1845aa78ff..db61bfd688 100644
--- a/qapi/qapi-schema.json
+++ b/qapi/qapi-schema.json
@@ -97,3 +97,4 @@
 { 'include': 'trace.json' }
 { 'include': 'introspect.json' }
 { 'include': 'misc.json' }
+{ 'include': 'target.json' }
diff --git a/qapi/target.json b/qapi/target.json
new file mode 100644
index 0000000000..8054926293
--- /dev/null
+++ b/qapi/target.json
@@ -0,0 +1,13 @@
+# -*- Mode: Python -*-
+#
+
+##
+# = Target-specific commands & events
+##
+
+##
+# @TARGET-TEMPORARY-DUMMY:
+# Will go away in the next commit.  Needed in this one because empty
+# modules don't generate anything, defeating this commit's purpose.
+##
+{ 'event': 'TARGET-TEMPORARY-DUMMY' }
-- 
2.17.2


Re: [Qemu-devel] [PATCH v3 07/17] qapi: New module target.json
Posted by Marc-André Lureau 6 years, 9 months ago
On Wed, Feb 6, 2019 at 7:17 PM Markus Armbruster <armbru@redhat.com> wrote:
>
> We can't add appropriate target-specific conditionals to misc.json,
> because that would make all of misc.json unusable in
> target-independent code.  To keep misc.json target-independent, we
> need to split off target-dependent target.json.
>
> This commit doesn't actually split off anything, it merely creates the
> empty module.  The next few patches will move stuff from misc.json
> there.
>
> Signed-off-by: Markus Armbruster <armbru@redhat.com>

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>


> ---
>  Makefile.objs         | 20 +++++++++-----------
>  Makefile.target       | 10 ++++++++++
>  qapi/qapi-schema.json |  1 +
>  qapi/target.json      | 13 +++++++++++++
>  4 files changed, 33 insertions(+), 11 deletions(-)
>  create mode 100644 qapi/target.json
>
> diff --git a/Makefile.objs b/Makefile.objs
> index 70ee51742f..5f0a7a8ca5 100644
> --- a/Makefile.objs
> +++ b/Makefile.objs
> @@ -1,20 +1,19 @@
> -QAPI_MODULES = block-core block char common crypto introspect job migration
> -QAPI_MODULES += misc net rdma rocker run-state sockets tpm trace transaction
> -QAPI_MODULES += ui
> +QAPI_COMMON_MODULES = block-core block char common crypto introspect
> +QAPI_COMMON_MODULES += job migration misc net rdma rocker run-state
> +QAPI_COMMON_MODULES += sockets tpm trace transaction ui
> +QAPI_TARGET_MODULES = target
> +QAPI_MODULES = $(QAPI_COMMON_MODULES) $(QAPI_TARGET_MODULES)
>
>  #######################################################################
>  # Common libraries for tools and emulators
>  stub-obj-y = stubs/ crypto/
>  util-obj-y = util/ qobject/ qapi/
>  util-obj-y += qapi/qapi-builtin-types.o
> -util-obj-y += qapi/qapi-types.o
> -util-obj-y += $(QAPI_MODULES:%=qapi/qapi-types-%.o)
> +util-obj-y += $(QAPI_COMMON_MODULES:%=qapi/qapi-types-%.o)
>  util-obj-y += qapi/qapi-builtin-visit.o
> -util-obj-y += qapi/qapi-visit.o
> -util-obj-y += $(QAPI_MODULES:%=qapi/qapi-visit-%.o)
> +util-obj-y += $(QAPI_COMMON_MODULES:%=qapi/qapi-visit-%.o)
>  util-obj-y += qapi/qapi-emit-events.o
> -util-obj-y += qapi/qapi-events.o
> -util-obj-y += $(QAPI_MODULES:%=qapi/qapi-events-%.o)
> +util-obj-y += $(QAPI_COMMON_MODULES:%=qapi/qapi-events-%.o)
>
>  chardev-obj-y = chardev/
>  slirp-obj-$(CONFIG_SLIRP) = slirp/
> @@ -92,8 +91,7 @@ common-obj-$(CONFIG_FDT) += device_tree.o
>  ######################################################################
>  # qapi
>
> -common-obj-y += qapi/qapi-commands.o
> -common-obj-y += $(QAPI_MODULES:%=qapi/qapi-commands-%.o)
> +common-obj-y += $(QAPI_COMMON_MODULES:%=qapi/qapi-commands-%.o)
>  common-obj-y += qmp.o hmp.o
>  endif
>
> diff --git a/Makefile.target b/Makefile.target
> index d8af835890..f908477040 100644
> --- a/Makefile.target
> +++ b/Makefile.target
> @@ -164,6 +164,16 @@ endif
>
>  GENERATED_FILES += hmp-commands.h hmp-commands-info.h
>
> +# FIXME duplicates Makefile.obj's
> +QAPI_TARGET_MODULES = target
> +obj-y += $(QAPI_TARGET_MODULES:%=qapi/qapi-types-%.o)
> +obj-y += qapi/qapi-types.o
> +obj-y += $(QAPI_TARGET_MODULES:%=qapi/qapi-visit-%.o)
> +obj-y += qapi/qapi-visit.o
> +obj-y += $(QAPI_TARGET_MODULES:%=qapi/qapi-events-%.o)
> +obj-y += qapi/qapi-events.o
> +obj-y += $(QAPI_TARGET_MODULES:%=qapi/qapi-commands-%.o)
> +obj-y += qapi/qapi-commands.o
>  obj-y += qapi/qapi-introspect.o
>
>  endif # CONFIG_SOFTMMU
> diff --git a/qapi/qapi-schema.json b/qapi/qapi-schema.json
> index 1845aa78ff..db61bfd688 100644
> --- a/qapi/qapi-schema.json
> +++ b/qapi/qapi-schema.json
> @@ -97,3 +97,4 @@
>  { 'include': 'trace.json' }
>  { 'include': 'introspect.json' }
>  { 'include': 'misc.json' }
> +{ 'include': 'target.json' }
> diff --git a/qapi/target.json b/qapi/target.json
> new file mode 100644
> index 0000000000..8054926293
> --- /dev/null
> +++ b/qapi/target.json
> @@ -0,0 +1,13 @@
> +# -*- Mode: Python -*-
> +#
> +
> +##
> +# = Target-specific commands & events
> +##
> +
> +##
> +# @TARGET-TEMPORARY-DUMMY:
> +# Will go away in the next commit.  Needed in this one because empty
> +# modules don't generate anything, defeating this commit's purpose.
> +##
> +{ 'event': 'TARGET-TEMPORARY-DUMMY' }
> --
> 2.17.2
>

Re: [Qemu-devel] [PATCH v3 07/17] qapi: New module target.json
Posted by Eric Blake 6 years, 9 months ago
On 2/6/19 12:17 PM, Markus Armbruster wrote:
> We can't add appropriate target-specific conditionals to misc.json,
> because that would make all of misc.json unusable in
> target-independent code.  To keep misc.json target-independent, we
> need to split off target-dependent target.json.
> 
> This commit doesn't actually split off anything, it merely creates the
> empty module.  The next few patches will move stuff from misc.json
> there.
> 
> Signed-off-by: Markus Armbruster <armbru@redhat.com>
> ---
>  Makefile.objs         | 20 +++++++++-----------
>  Makefile.target       | 10 ++++++++++
>  qapi/qapi-schema.json |  1 +
>  qapi/target.json      | 13 +++++++++++++
>  4 files changed, 33 insertions(+), 11 deletions(-)
>  create mode 100644 qapi/target.json

> +++ b/Makefile.target
> @@ -164,6 +164,16 @@ endif
>  
>  GENERATED_FILES += hmp-commands.h hmp-commands-info.h
>  
> +# FIXME duplicates Makefile.obj's

Is this addressed later in the series, or should the commit message call
it out?

> +QAPI_TARGET_MODULES = target
> +obj-y += $(QAPI_TARGET_MODULES:%=qapi/qapi-types-%.o)
> +obj-y += qapi/qapi-types.o
> +obj-y += $(QAPI_TARGET_MODULES:%=qapi/qapi-visit-%.o)
> +obj-y += qapi/qapi-visit.o
> +obj-y += $(QAPI_TARGET_MODULES:%=qapi/qapi-events-%.o)
> +obj-y += qapi/qapi-events.o
> +obj-y += $(QAPI_TARGET_MODULES:%=qapi/qapi-commands-%.o)
> +obj-y += qapi/qapi-commands.o
>  obj-y += qapi/qapi-introspect.o
>  
-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org

Re: [Qemu-devel] [PATCH v3 07/17] qapi: New module target.json
Posted by Markus Armbruster 6 years, 9 months ago
Eric Blake <eblake@redhat.com> writes:

> On 2/6/19 12:17 PM, Markus Armbruster wrote:
>> We can't add appropriate target-specific conditionals to misc.json,
>> because that would make all of misc.json unusable in
>> target-independent code.  To keep misc.json target-independent, we
>> need to split off target-dependent target.json.
>> 
>> This commit doesn't actually split off anything, it merely creates the
>> empty module.  The next few patches will move stuff from misc.json
>> there.
>> 
>> Signed-off-by: Markus Armbruster <armbru@redhat.com>
>> ---
>>  Makefile.objs         | 20 +++++++++-----------
>>  Makefile.target       | 10 ++++++++++
>>  qapi/qapi-schema.json |  1 +
>>  qapi/target.json      | 13 +++++++++++++
>>  4 files changed, 33 insertions(+), 11 deletions(-)
>>  create mode 100644 qapi/target.json
>
>> +++ b/Makefile.target
>> @@ -164,6 +164,16 @@ endif
>>  
>>  GENERATED_FILES += hmp-commands.h hmp-commands-info.h
>>  
>> +# FIXME duplicates Makefile.obj's
>
> Is this addressed later in the series, or should the commit message call
> it out?

It's not addressed.

I added the FIXME for my RFC v2, which went out in a bit of a hurry
right before my Christmas break.  I promptly forgot it exists.

Either I find a way to avoid the duplication, or I mention the FIXME in
my commit message.

Thanks!

>> +QAPI_TARGET_MODULES = target
>> +obj-y += $(QAPI_TARGET_MODULES:%=qapi/qapi-types-%.o)
>> +obj-y += qapi/qapi-types.o
>> +obj-y += $(QAPI_TARGET_MODULES:%=qapi/qapi-visit-%.o)
>> +obj-y += qapi/qapi-visit.o
>> +obj-y += $(QAPI_TARGET_MODULES:%=qapi/qapi-events-%.o)
>> +obj-y += qapi/qapi-events.o
>> +obj-y += $(QAPI_TARGET_MODULES:%=qapi/qapi-commands-%.o)
>> +obj-y += qapi/qapi-commands.o
>>  obj-y += qapi/qapi-introspect.o
>>