Skip to contentSkip to conversation

docs/interop/firmware.json: scripts/qapi-gen.py compatibility

PATCH Superseded Thomas Weißschuh 3 participants 9 messages Mar 11, 2024 – Mar 28, 2024 Arm/Amlogic Meson SoC support

v3 of 7 Superseded Latest is v7 →

lore
Share & tools
lore
#0 lore raw

v3 cover docs/interop/firmware.json: scripts/qapi-gen.py compatibility

docs/interop/firmware.json is currently not usable with qapi-gen.py due to various non-functional issues.
Fix those issue to provide compatibility.

---
Changes in v3:
- Drop already picked up patches
- Drop include of pragma.json
- Introduce new enums FirmwareFormat and FirmwareArchitecture
- Link to v2: https://lore.kernel.org/r/[email protected]

Changes in v2:
- Add review tag from Philippe
- Add Fixes tag (Philippe)
- Add testcase (Philippe)
- Link to v1: https://lore.kernel.org/r/[email protected]

---
Thomas Weißschuh (3):
docs/interop/firmware.json: add new enum FirmwareFormat docs/interop/firmware.json: add new enum FirmwareArchitecture
docs: add test for firmware.json QAPI

 docs/interop/firmware.json | 36 ++++++++++++++++++++++++++++++++----
 docs/meson.build           |  5 +++++
 2 files changed, 37 insertions(+), 4 deletions(-)

---
base-commit: 7489f7f3f81dcb776df8c1b9a9db281fc21bf05f
change-id: 20240306-qapi-firmware-json-6fb1213936dd

Best regards,

Signature · 1 line
Thomas Weißschuh <[email protected]>
#1 lore raw

PATCH v3 1/3 docs/interop/firmware.json: add new enum FirmwareFormat

Only a small subset of all blockdev drivers make sense for firmware images. Introduce and use a new enum to represent this.

This also reduces the dependency of firmware.json on the global qapi definitions.

---
 docs/interop/firmware.json | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)
docs/interop/firmware.json +16 -2
index 54a1fc6c1041..0e619e8780e7 100644
@@ -15,7 +15,11 @@
 ##
 
 { 'include' : 'machine.json' }
-{ 'include' : 'block-core.json' }
+
+{ 'pragma': {
+    'documentation-exceptions': [
+        'FirmwareFormat'
+    ] } }
 
 ##
 # @FirmwareOSInterface:
@@ -200,6 +204,16 @@
              'enrolled-keys', 'requires-smm', 'secure-boot',
              'verbose-dynamic', 'verbose-static' ] }
 
+##
+# @FirmwareFormat:
+#
+# Formats that are supported for firmware images.
+#
+# Since: 8.3
+##
+{ 'enum': 'FirmwareFormat',
+  'data': [ 'raw', 'qcow2' ] }
+
 ##
 # @FirmwareFlashFile:
 #
@@ -219,7 +233,7 @@
 ##
 { 'struct' : 'FirmwareFlashFile',
   'data'   : { 'filename' : 'str',
-               'format'   : 'BlockdevDriver' } }
+               'format'   : 'FirmwareFormat' } }
 
 
 ##
Signature · 1 line
2.44.0
#2 lore raw

Re: [PATCH v3 1/3] docs/interop/firmware.json: add new enum FirmwareFormat

Quoted 13 lines · Thomas Weißschuh

Only a small subset of all blockdev drivers make sense for firmware images. Introduce and use a new enum to represent this.

This also reduces the dependency of firmware.json on the global qapi definitions.

---
  docs/interop/firmware.json | 18 ++++++++++++++++--
  1 file changed, 16 insertions(+), 2 deletions(-)

docs/interop/firmware.json line 212

Quoted 6 lines
docs/interop/firmware.json +6 -0
+##
+# @FirmwareFormat:
+#
+# Formats that are supported for firmware images.
+#
+# Since: 8.3

That will be 9.0 :/

Quoted 3 lines
docs/interop/firmware.json +3 -0
+##
+{ 'enum': 'FirmwareFormat',
+  'data': [ 'raw', 'qcow2' ] }
#3 lore raw

Re: [PATCH v3 1/3] docs/interop/firmware.json: add new enum FirmwareFormat

Quoted 14 lines · Philippe Mathieu-Daudé
Quoted 11 lines · Thomas Weißschuh

Only a small subset of all blockdev drivers make sense for firmware images. Introduce and use a new enum to represent this.

This also reduces the dependency of firmware.json on the global qapi definitions.

---
  docs/interop/firmware.json | 18 ++++++++++++++++--
  1 file changed, 16 insertions(+), 2 deletions(-)
Quoted 8 lines

docs/interop/firmware.json line 212

Quoted 6 lines
docs/interop/firmware.json +6 -0
+##
+# @FirmwareFormat:
+#
+# Formats that are supported for firmware images.
+#
+# Since: 8.3

That will be 9.0 :/

Thanks.

IMO it doesn't warrant a new revision, the maintainer can change it when applying.

Locally I changed it, so if a new revision is necessary for other reasons it will have the change.

Quoted 4 lines
Quoted 3 lines
docs/interop/firmware.json +3 -0
+##
+{ 'enum': 'FirmwareFormat',
+  'data': [ 'raw', 'qcow2' ] }
#4 lore raw

Re: [PATCH v3 1/3] docs/interop/firmware.json: add new enum FirmwareFormat

In reply to Thomas Weißschuh
Quoted 17 lines · Thomas Weißschuh

Only a small subset of all blockdev drivers make sense for firmware images. Introduce and use a new enum to represent this.

This also reduces the dependency of firmware.json on the global qapi definitions.

---
 docs/interop/firmware.json | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)
docs/interop/firmware.json +0 -0
index 54a1fc6c1041..0e619e8780e7 100644

docs/interop/firmware.json line 22

Quoted 9 lines
docs/interop/firmware.json +5 -1
@@ -15,7 +15,11 @@
 ##
 
 { 'include' : 'machine.json' }
-{ 'include' : 'block-core.json' }
+
+{ 'pragma': {
+    'documentation-exceptions': [
+        'FirmwareFormat'
+    ] } }

Necessary because ...

docs/interop/firmware.json line 211

Quoted 12 lines
docs/interop/firmware.json +5 -0
 ##
 # @FirmwareOSInterface:
@@ -200,6 +204,16 @@
              'enrolled-keys', 'requires-smm', 'secure-boot',
              'verbose-dynamic', 'verbose-static' ] }
 
+##
+# @FirmwareFormat:
+#
+# Formats that are supported for firmware images.
+#

... we don't document the members here. Documenting them would be nicer. We'd do that if we could steal it from BlockdevDriver, but there's nothing to steal there.

Mere observation; I'm not asking you to come up with documentation BlockdevDriver doesn't have.

docs/interop/firmware.json line 215

Quoted 4 lines
docs/interop/firmware.json +4 -0
+# Since: 8.3
+##
+{ 'enum': 'FirmwareFormat',
+  'data': [ 'raw', 'qcow2' ] }

@raw or @file? Kevin or Hanna, thoughts?

Quoted 13 lines
docs/interop/firmware.json +2 -1
+
 ##
 # @FirmwareFlashFile:
 #
@@ -219,7 +233,7 @@
 ##
 { 'struct' : 'FirmwareFlashFile',
   'data'   : { 'filename' : 'str',
-               'format'   : 'BlockdevDriver' } }
+               'format'   : 'FirmwareFormat' } }
 
 
 ##
#5 lore raw

Re: [PATCH v3 1/3] docs/interop/firmware.json: add new enum FirmwareFormat

Hi Hanna and Kevin,

any updates?

Quoted 50 lines · Markus Armbruster
Quoted 17 lines · Thomas Weißschuh

Only a small subset of all blockdev drivers make sense for firmware images. Introduce and use a new enum to represent this.

This also reduces the dependency of firmware.json on the global qapi definitions.

---
 docs/interop/firmware.json | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)
docs/interop/firmware.json +0 -0
index 54a1fc6c1041..0e619e8780e7 100644

docs/interop/firmware.json line 22

Quoted 9 lines
docs/interop/firmware.json +5 -1
@@ -15,7 +15,11 @@
 ##
 
 { 'include' : 'machine.json' }
-{ 'include' : 'block-core.json' }
+
+{ 'pragma': {
+    'documentation-exceptions': [
+        'FirmwareFormat'
+    ] } }

Necessary because ...

docs/interop/firmware.json line 211

Quoted 12 lines
docs/interop/firmware.json +5 -0
 ##
 # @FirmwareOSInterface:
@@ -200,6 +204,16 @@
              'enrolled-keys', 'requires-smm', 'secure-boot',
              'verbose-dynamic', 'verbose-static' ] }
 
+##
+# @FirmwareFormat:
+#
+# Formats that are supported for firmware images.
+#

... we don't document the members here. Documenting them would be nicer. We'd do that if we could steal it from BlockdevDriver, but there's nothing to steal there.

Mere observation; I'm not asking you to come up with documentation BlockdevDriver doesn't have.

Quoted 6 lines

docs/interop/firmware.json line 215

Quoted 4 lines
docs/interop/firmware.json +4 -0
+# Since: 8.3
+##
+{ 'enum': 'FirmwareFormat',
+  'data': [ 'raw', 'qcow2' ] }

@raw or @file? Kevin or Hanna, thoughts?

The existing descriptors in pc-bios/descriptors/ are using @raw.

Quoted 12 lines
Quoted 12 lines
docs/interop/firmware.json +2 -1
+
 ##
 # @FirmwareFlashFile:
 #
@@ -219,7 +233,7 @@
 ##
 { 'struct' : 'FirmwareFlashFile',
   'data'   : { 'filename' : 'str',
-               'format'   : 'BlockdevDriver' } }
+               'format'   : 'FirmwareFormat' } }
 
 
Quoted 1 line

docs/interop/firmware.json line 239

Quoted 1 line
docs/interop/firmware.json +0 -0
 ##

Thanks,
Thomas

#6 lore raw

PATCH v3 2/3 docs/interop/firmware.json: add new enum FirmwareArchitecture

In reply to Thomas Weißschuh

Only a small subset of all architectures supported by qemu make use of firmware files. Introduce and use a new enum to represent this.

This also removes the dependency of firmware.json on the global qapi definitions.

---
 docs/interop/firmware.json | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)
docs/interop/firmware.json +17 -3
index 0e619e8780e7..54cae6a51b43 100644
@@ -14,11 +14,13 @@
 # = Firmware
 ##
 
-{ 'include' : 'machine.json' }
-
 { 'pragma': {
     'documentation-exceptions': [
+        'FirmwareArchitecture',
         'FirmwareFormat'
+    ],
+    'member-name-exceptions': [
+        'FirmwareArchitecture'
     ] } }
 
 ##
@@ -64,6 +66,18 @@
 { 'enum' : 'FirmwareDevice',
   'data' : [ 'flash', 'kernel', 'memory' ] }
 
+##
+# @FirmwareArchitecture:
+#
+# Enumerations of architectures for which Qemu uses additional firmware files.
+# The values are a subset of the enum SysEmuTarget.
+#
+# Since: 8.3
+##
+{ 'enum' : 'FirmwareArchitecture',
+  'data' : [ 'aarch64', 'arm', 'i386', 'loongarch64', 'x86_64' ] }
+
+
 ##
 # @FirmwareTarget:
 #
@@ -85,7 +99,7 @@
 # Since: 3.0
 ##
 { 'struct' : 'FirmwareTarget',
-  'data'   : { 'architecture' : 'SysEmuTarget',
+  'data'   : { 'architecture' : 'FirmwareArchitecture',
                'machines'     : [ 'str' ] } }
 
 ##
Signature · 1 line
2.44.0
#7 lore raw

Re: [PATCH v3 2/3] docs/interop/firmware.json: add new enum FirmwareArchitecture

Quoted 17 lines · Thomas Weißschuh

Only a small subset of all architectures supported by qemu make use of firmware files. Introduce and use a new enum to represent this.

This also removes the dependency of firmware.json on the global qapi definitions.

---
 docs/interop/firmware.json | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)
docs/interop/firmware.json +0 -0
index 0e619e8780e7..54cae6a51b43 100644

docs/interop/firmware.json line 19

Quoted 8 lines
docs/interop/firmware.json +1 -2
@@ -14,11 +14,13 @@
 # = Firmware
 ##
 
-{ 'include' : 'machine.json' }
-
 { 'pragma': {
     'documentation-exceptions': [
+        'FirmwareArchitecture',

Comment on the previous patch applies.

docs/interop/firmware.json line 23

Quoted 4 lines
docs/interop/firmware.json +3 -0
         'FirmwareFormat'
+    ],
+    'member-name-exceptions': [
+        'FirmwareArchitecture'

Needed for x86_64. Fine.

Quoted 31 lines
docs/interop/firmware.json +13 -1
     ] } }
 
 ##
@@ -64,6 +66,18 @@
 { 'enum' : 'FirmwareDevice',
   'data' : [ 'flash', 'kernel', 'memory' ] }
 
+##
+# @FirmwareArchitecture:
+#
+# Enumerations of architectures for which Qemu uses additional firmware files.
+# The values are a subset of the enum SysEmuTarget.
+#
+# Since: 8.3
+##
+{ 'enum' : 'FirmwareArchitecture',
+  'data' : [ 'aarch64', 'arm', 'i386', 'loongarch64', 'x86_64' ] }
+
+
 ##
 # @FirmwareTarget:
 #
@@ -85,7 +99,7 @@
 # Since: 3.0
 ##
 { 'struct' : 'FirmwareTarget',
-  'data'   : { 'architecture' : 'SysEmuTarget',
+  'data'   : { 'architecture' : 'FirmwareArchitecture',
                'machines'     : [ 'str' ] } }
 
 ##
#8 lore raw

PATCH v3 3/3 docs: add test for firmware.json QAPI

In reply to Thomas Weißschuh

To make sure that the QAPI description stays valid add a testcase.

---
 docs/meson.build | 5 +++++
 1 file changed, 5 insertions(+)
docs/meson.build +5 -0
index 9040f860ae1a..bcca45a342a3 100644
@@ -99,3 +99,8 @@ if build_docs
   alias_target('html', sphinxdocs)
   alias_target('man', sphinxmans)
 endif
+
+test('QAPI firmware.json regression tests', python,
+     args: [qapi_gen.full_path(), '-o', meson.current_build_dir() / 'qapi',
+            meson.current_source_dir() / 'interop/firmware.json'],
+     env: test_env, suite: ['qapi-schema', 'qapi-interop'])
Signature · 1 line
2.44.0