Skip to contentSkip to conversation

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

PATCH Superseded Thomas Weißschuh 2 participants 7 messages Jul 18, 2024 Arm/Amlogic Meson SoC support

v4 of 7 Superseded Latest is v7 →

lore
Share & tools
lore
#0 lore raw

v4 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.

In v3 there was an open question about @file vs. @raw, but given that the existing descriptors in pc-bios/descriptors/ are already using @raw it seems clear the we have to keep it.

---
Changes in v4:
- Update "since" to 9.1
- Add comment to 'member-name-exceptions'
- Document enum members and drop 'documentation-exceptions'
- Link to v3: https://lore.kernel.org/r/[email protected]

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 | 46 ++++++++++++++++++++++++++++++++++++++++++----
 docs/meson.build           |  5 +++++
 2 files changed, 47 insertions(+), 4 deletions(-)

---
base-commit: 58ee924b97d1c0898555647a31820c5a20d55a73
change-id: 20240306-qapi-firmware-json-6fb1213936dd

Best regards,

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

PATCH v4 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 on firmware.json from the global qapi definitions.

---
 docs/interop/firmware.json | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)
docs/interop/firmware.json +15 -2
index 54a1fc6c1041..a26fe81bf2fe 100644
@@ -15,7 +15,6 @@
 ##
 
 { 'include' : 'machine.json' }
-{ 'include' : 'block-core.json' }
 
 ##
 # @FirmwareOSInterface:
@@ -200,6 +199,20 @@
              'enrolled-keys', 'requires-smm', 'secure-boot',
              'verbose-dynamic', 'verbose-static' ] }
 
+##
+# @FirmwareFormat:
+#
+# Formats that are supported for firmware images.
+#
+# @raw: Raw disk image format.
+#
+# @qcow2: QEMU image format.
+#
+# Since: 9.1
+##
+{ 'enum': 'FirmwareFormat',
+  'data': [ 'raw', 'qcow2' ] }
+
 ##
 # @FirmwareFlashFile:
 #
@@ -219,7 +232,7 @@
 ##
 { 'struct' : 'FirmwareFlashFile',
   'data'   : { 'filename' : 'str',
-               'format'   : 'BlockdevDriver' } }
+               'format'   : 'FirmwareFormat' } }
 
 
 ##
Signature · 1 line
2.45.2
Reviewed-by on v4 1/3
#2 lore raw

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

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 on firmware.json from the global qapi definitions.

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

With regards,
Daniel

Signature · 3 lines
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
#3 lore raw

PATCH v4 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 to machine.json from the global qapi definitions.

---
 docs/interop/firmware.json | 29 +++++++++++++++++++++++++++--
 1 file changed, 27 insertions(+), 2 deletions(-)
docs/interop/firmware.json +27 -2
index a26fe81bf2fe..2eb0be11d595 100644
@@ -14,7 +14,10 @@
 # = Firmware
 ##
 
-{ 'include' : 'machine.json' }
+{ 'pragma': {
+    'member-name-exceptions': [
+        'FirmwareArchitecture' # x86_64
+    ] } }
 
 ##
 # @FirmwareOSInterface:
@@ -59,6 +62,28 @@
 { '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.
+#
+# @aarch64: 64-bit Arm.
+#
+# @arm: 32-bit Arm.
+#
+# @i386: 32-bit x86.
+#
+# @loongarch64: 64-bit LoongArch.
+#
+# @x86_64: 64-bit x86.
+#
+# Since: 9.1
+##
+{ 'enum' : 'FirmwareArchitecture',
+  'data' : [ 'aarch64', 'arm', 'i386', 'loongarch64', 'x86_64' ] }
+
+
 ##
 # @FirmwareTarget:
 #
@@ -80,7 +105,7 @@
 # Since: 3.0
 ##
 { 'struct' : 'FirmwareTarget',
-  'data'   : { 'architecture' : 'SysEmuTarget',
+  'data'   : { 'architecture' : 'FirmwareArchitecture',
                'machines'     : [ 'str' ] } }
 
 ##
Signature · 1 line
2.45.2
Reviewed-by on v4 2/3
#4 lore raw

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

Quoted 11 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 to machine.json from the global qapi definitions.

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

With regards,
Daniel

Signature · 3 lines
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
#5 lore raw

PATCH v4 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.45.2
Reviewed-by on v4 3/3
#6 lore raw

Re: [PATCH v4 3/3] docs: add test for firmware.json QAPI

Quoted 8 lines · Thomas Weißschuh

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

---
 docs/meson.build | 5 +++++
 1 file changed, 5 insertions(+)

With regards,
Daniel

Signature · 3 lines
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|