Skip to contentSkip to conversation

qapi: static typing conversion, "pt0"

PATCH Superseded John Snow 1 participant 5 messages Apr 16, 2021

Subsystems (2)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

John Snow

author
#0 lore raw

v2 cover qapi: static typing conversion, "pt0"

This is a manual testing pre-requisite for other QAPI cleanup patches. It isn't polished, and I am not ready to polish it, so it's included here as an informative basis for ongoing work only.

It changes the default role for Sphinx markup involving single-backticks from "default", which merely renders text as if it was a ``literal``, to "any", which behaves like a cross-reference target.

To do this, existing uses of the single-backtick markup are converted (whenever they do not resolve to something meaningful), to double-backticks.

Then, sphinx-autodoc is enabled for the scripts/qapi package so that docstring formatting can be validated and inspected to make sure the output looks "nice". It is not necessarily how we'd want to expose this information, ultimately, but serves as a good smoke test for base-line docstring consistency.

Lastly, some scripts/tools for running linters with "canonical" configurations are provided as a means to verify the linting base-line. I use these to validate my own work.

John Snow (4):
[DO-NOT-MERGE] docs: replace single backtick (`) with double-backtick

    (``)

[DO-NOT-MERGE] docs/sphinx: change default role to "any" [DO-NOT-MERGE] docs: enable sphinx-autodoc for scripts/qapi [DO-NOT-MERGE]: Add some ad-hoc linting helpers.

 docs/conf.py                               |   6 +-
 docs/devel/build-system.rst                | 146 ++++++++++-----------
 docs/devel/fuzzing.rst                     |   9 +-
 docs/devel/index.rst                       |   1 +
 docs/devel/migration.rst                   |  59 +++++----
 docs/devel/python/index.rst                |   7 +
 docs/devel/python/qapi.commands.rst        |   7 +
 docs/devel/python/qapi.common.rst          |   7 +
 docs/devel/python/qapi.error.rst           |   7 +
 docs/devel/python/qapi.events.rst          |   7 +
 docs/devel/python/qapi.expr.rst            |   7 +
 docs/devel/python/qapi.gen.rst             |   7 +
 docs/devel/python/qapi.introspect.rst      |   7 +
 docs/devel/python/qapi.main.rst            |   7 +
 docs/devel/python/qapi.parser.rst          |   8 ++
 docs/devel/python/qapi.rst                 |  26 ++++
 docs/devel/python/qapi.schema.rst          |   7 +
 docs/devel/python/qapi.source.rst          |   7 +
 docs/devel/python/qapi.types.rst           |   7 +
 docs/devel/python/qapi.visit.rst           |   7 +
 docs/devel/qgraph.rst                      |   8 +-
 docs/devel/tcg-plugins.rst                 |  14 +-
 docs/devel/testing.rst                     |   8 +-
 docs/interop/live-block-operations.rst     |   4 +-
 docs/system/arm/cpu-features.rst           | 116 ++++++++--------
 docs/system/arm/nuvoton.rst                |   2 +-
 docs/system/arm/sbsa.rst                   |   4 +-
 docs/system/cpu-hotplug.rst                |   2 +-
 docs/system/guest-loader.rst               |   6 +-
 docs/system/ppc/powernv.rst                |   8 +-
 docs/system/removed-features.rst           |   2 +-
 docs/system/riscv/microchip-icicle-kit.rst |   2 +-
 docs/system/s390x/protvirt.rst             |  12 +-
 qapi/block-core.json                       |   4 +-
 scripts/qapi-lint.sh                       |  29 ++++
 scripts/qapi/Makefile                      |   5 +
 36 files changed, 370 insertions(+), 202 deletions(-)
 create mode 100644 docs/devel/python/index.rst
 create mode 100644 docs/devel/python/qapi.commands.rst
 create mode 100644 docs/devel/python/qapi.common.rst
 create mode 100644 docs/devel/python/qapi.error.rst
 create mode 100644 docs/devel/python/qapi.events.rst
 create mode 100644 docs/devel/python/qapi.expr.rst
 create mode 100644 docs/devel/python/qapi.gen.rst
 create mode 100644 docs/devel/python/qapi.introspect.rst
 create mode 100644 docs/devel/python/qapi.main.rst
 create mode 100644 docs/devel/python/qapi.parser.rst
 create mode 100644 docs/devel/python/qapi.rst
 create mode 100644 docs/devel/python/qapi.schema.rst
 create mode 100644 docs/devel/python/qapi.source.rst
 create mode 100644 docs/devel/python/qapi.types.rst
 create mode 100644 docs/devel/python/qapi.visit.rst
 create mode 100755 scripts/qapi-lint.sh
 create mode 100644 scripts/qapi/Makefile
Signature · 1 line
2.30.2
author
#1 lore raw

PATCH v2 1/4 docs: replace single backtick (`) with double-backtick (``)

The single backtick in ReST is the "default role". Currently, Sphinx's default role is called "content". Sphinx suggests you can use the "Any" role instead to turn any single-backtick enclosed item into a cross-reference.

Before we do that, though, we'll need to turn all existing usages of the "content" role to inline verbatim markup by using double backticks instead.

---
 docs/devel/build-system.rst                | 146 ++++++++++-----------
 docs/devel/fuzzing.rst                     |   9 +-
 docs/devel/migration.rst                   |  59 +++++----
 docs/devel/qgraph.rst                      |   8 +-
 docs/devel/tcg-plugins.rst                 |  14 +-
 docs/devel/testing.rst                     |   8 +-
 docs/interop/live-block-operations.rst     |   4 +-
 docs/system/arm/cpu-features.rst           | 116 ++++++++--------
 docs/system/arm/nuvoton.rst                |   2 +-
 docs/system/arm/sbsa.rst                   |   4 +-
 docs/system/cpu-hotplug.rst                |   2 +-
 docs/system/guest-loader.rst               |   6 +-
 docs/system/ppc/powernv.rst                |   8 +-
 docs/system/removed-features.rst           |   2 +-
 docs/system/riscv/microchip-icicle-kit.rst |   2 +-
 docs/system/s390x/protvirt.rst             |  12 +-
 qapi/block-core.json                       |   4 +-
 17 files changed, 205 insertions(+), 201 deletions(-)
docs/devel/build-system.rst +73 -73
index 7ef36f42d0f..4746646a406 100644
@@ -53,14 +53,14 @@ following tasks:
  - Add a Meson build option to meson_options.txt.
 
  - Add support to the command line arg parser to handle any new
-   `--enable-XXX`/`--disable-XXX` flags required by the feature.
+   ``--enable-XXX``/``--disable-XXX`` flags required by the feature.
 
  - Add information to the help output message to report on the new
    feature flag.
 
  - Add code to perform the actual feature check.
 
- - Add code to include the feature status in `config-host.h`
+ - Add code to include the feature status in ``config-host.h``
 
  - Add code to print out the feature status in the configure summary
    upon completion.
@@ -116,51 +116,51 @@ Helper functions
 The configure script provides a variety of helper functions to assist
 developers in checking for system features:
 
-`do_cc $ARGS...`
+``do_cc $ARGS...``
    Attempt to run the system C compiler passing it $ARGS...
 
-`do_cxx $ARGS...`
+``do_cxx $ARGS...``
    Attempt to run the system C++ compiler passing it $ARGS...
 
-`compile_object $CFLAGS`
+``compile_object $CFLAGS``
    Attempt to compile a test program with the system C compiler using
    $CFLAGS. The test program must have been previously written to a file
-   called $TMPC.  The replacement in Meson is the compiler object `cc`,
-   which has methods such as `cc.compiles()`,
-   `cc.check_header()`, `cc.has_function()`.
+   called $TMPC.  The replacement in Meson is the compiler object ``cc``,
+   which has methods such as ``cc.compiles()``,
+   ``cc.check_header()``, ``cc.has_function()``.
 
-`compile_prog $CFLAGS $LDFLAGS`
+``compile_prog $CFLAGS $LDFLAGS``
    Attempt to compile a test program with the system C compiler using
    $CFLAGS and link it with the system linker using $LDFLAGS. The test
    program must have been previously written to a file called $TMPC.
-   The replacement in Meson is `cc.find_library()` and `cc.links()`.
+   The replacement in Meson is ``cc.find_library()`` and ``cc.links()``.
 
-`has $COMMAND`
+``has $COMMAND``
    Determine if $COMMAND exists in the current environment, either as a
    shell builtin, or executable binary, returning 0 on success.  The
-   replacement in Meson is `find_program()`.
+   replacement in Meson is ``find_program()``.
 
-`check_define $NAME`
+``check_define $NAME``
    Determine if the macro $NAME is defined by the system C compiler
 
-`check_include $NAME`
+``check_include $NAME``
    Determine if the include $NAME file is available to the system C
-   compiler.  The replacement in Meson is `cc.has_header()`.
+   compiler.  The replacement in Meson is ``cc.has_header()``.
 
-`write_c_skeleton`
+``write_c_skeleton``
    Write a minimal C program main() function to the temporary file
    indicated by $TMPC
 
-`feature_not_found $NAME $REMEDY`
+``feature_not_found $NAME $REMEDY``
    Print a message to stderr that the feature $NAME was not available
    on the system, suggesting the user try $REMEDY to address the
    problem.
 
-`error_exit $MESSAGE $MORE...`
+``error_exit $MESSAGE $MORE...``
    Print $MESSAGE to stderr, followed by $MORE... and then exit from the
    configure script with non-zero status
 
-`query_pkg_config $ARGS...`
+``query_pkg_config $ARGS...``
    Run pkg-config passing it $ARGS. If QEMU is doing a static build,
    then --static will be automatically added to $ARGS
 
@@ -187,7 +187,7 @@ process for:
 
 4) other data files, such as icons or desktop files
 
-All executables are built by default, except for some `contrib/`
+All executables are built by default, except for some ``contrib/``
 binaries that are known to fail to build on some platforms (for example
 32-bit or big-endian platforms).  Tests are also built by default,
 though that might change in the future.
@@ -195,14 +195,14 @@ though that might change in the future.
 The source code is highly modularized, split across many files to
 facilitate building of all of these components with as little duplicated
 compilation as possible. Using the Meson "sourceset" functionality,
-`meson.build` files group the source files in rules that are
+``meson.build`` files group the source files in rules that are
 enabled according to the available system libraries and to various
 configuration symbols.  Sourcesets belong to one of four groups:
 
 Subsystem sourcesets:
   Various subsystems that are common to both tools and emulators have
-  their own sourceset, for example `block_ss` for the block device subsystem,
-  `chardev_ss` for the character device subsystem, etc.  These sourcesets
+  their own sourceset, for example ``block_ss`` for the block device subsystem,
+  ``chardev_ss`` for the character device subsystem, etc.  These sourcesets
   are then turned into static libraries as follows::
 
     libchardev = static_library('chardev', chardev_ss.sources(),
@@ -211,8 +211,8 @@ Subsystem sourcesets:
 
     chardev = declare_dependency(link_whole: libchardev)
 
-  As of Meson 0.55.1, the special `.fa` suffix should be used for everything
-  that is used with `link_whole`, to ensure that the link flags are placed
+  As of Meson 0.55.1, the special ``.fa`` suffix should be used for everything
+  that is used with ``link_whole``, to ensure that the link flags are placed
   correctly in the command line.
 
 Target-independent emulator sourcesets:
@@ -221,16 +221,16 @@ Target-independent emulator sourcesets:
   This includes error handling infrastructure, standard data structures,
   platform portability wrapper functions, etc.
 
-  Target-independent code lives in the `common_ss`, `softmmu_ss` and
-  `user_ss` sourcesets.  `common_ss` is linked into all emulators,
-  `softmmu_ss` only in system emulators, `user_ss` only in user-mode
+  Target-independent code lives in the ``common_ss``, ``softmmu_ss`` and
+  ``user_ss`` sourcesets.  ``common_ss`` is linked into all emulators,
+  ``softmmu_ss`` only in system emulators, ``user_ss`` only in user-mode
   emulators.
 
   Target-independent sourcesets must exercise particular care when using
-  `if_false` rules.  The `if_false` rule will be used correctly when linking
+  ``if_false`` rules.  The ``if_false`` rule will be used correctly when linking
   emulator binaries; however, when *compiling* target-independent files
-  into .o files, Meson may need to pick *both* the `if_true` and
-  `if_false` sides to cater for targets that want either side.  To
+  into .o files, Meson may need to pick *both* the ``if_true`` and
+  ``if_false`` sides to cater for targets that want either side.  To
   achieve that, you can add a special rule using the ``CONFIG_ALL``
   symbol::
 
@@ -245,14 +245,14 @@ Target-dependent emulator sourcesets:
   In the target-dependent set lives CPU emulation, some device emulation and
   much glue code. This sometimes also has to be compiled multiple times,
   once for each target being built.  Target-dependent files are included
-  in the `specific_ss` sourceset.
+  in the ``specific_ss`` sourceset.
 
-  Each emulator also includes sources for files in the `hw/` and `target/`
+  Each emulator also includes sources for files in the ``hw/`` and ``target/``
   subdirectories.  The subdirectory used for each emulator comes
   from the target's definition of ``TARGET_BASE_ARCH`` or (if missing)
-  ``TARGET_ARCH``, as found in `default-configs/targets/*.mak`.
+  ``TARGET_ARCH``, as found in ``default-configs/targets/*.mak``.
 
-  Each subdirectory in `hw/` adds one sourceset to the `hw_arch` dictionary,
+  Each subdirectory in ``hw/`` adds one sourceset to the ``hw_arch`` dictionary,
   for example::
 
     arm_ss = ss.source_set()
@@ -262,8 +262,8 @@ Target-dependent emulator sourcesets:
 
   The sourceset is only used for system emulators.
 
-  Each subdirectory in `target/` instead should add one sourceset to each
-  of the `target_arch` and `target_softmmu_arch`, which are used respectively
+  Each subdirectory in ``target/`` instead should add one sourceset to each
+  of the ``target_arch`` and ``target_softmmu_arch``, which are used respectively
   for all emulators and for system emulators only.  For example::
 
     arm_ss = ss.source_set()
@@ -273,15 +273,15 @@ Target-dependent emulator sourcesets:
     target_softmmu_arch += {'arm': arm_softmmu_ss}
 
 Utility sourcesets:
-  All binaries link with a static library `libqemuutil.a`.  This library
+  All binaries link with a static library ``libqemuutil.a``.  This library
   is built from several sourcesets; most of them however host generated
-  code, and the only two of general interest are `util_ss` and `stub_ss`.
+  code, and the only two of general interest are ``util_ss`` and ``stub_ss``.
 
   The separation between these two is purely for documentation purposes.
-  `util_ss` contains generic utility files.  Even though this code is only
+  ``util_ss`` contains generic utility files.  Even though this code is only
   linked in some binaries, sometimes it requires hooks only in some of
   these and depend on other functions that are not fully implemented by
-  all QEMU binaries.  `stub_ss` links dummy stubs that will only be linked
+  all QEMU binaries.  ``stub_ss`` links dummy stubs that will only be linked
   into the binary if the real implementation is not present.  In a way,
   the stubs can be thought of as a portable implementation of the weak
   symbols concept.
@@ -290,8 +290,8 @@ Utility sourcesets:
 The following files concur in the definition of which files are linked
 into each emulator:
 
-`default-configs/devices/*.mak`
-  The files under `default-configs/devices/` control the boards and devices
+``default-configs/devices/*.mak``
+  The files under ``default-configs/devices/`` control the boards and devices
   that are built into each QEMU system emulation targets. They merely contain
   a list of config variable definitions such as::
 
@@ -299,18 +299,18 @@ into each emulator:
     CONFIG_XLNX_ZYNQMP_ARM=y
     CONFIG_XLNX_VERSAL=y
 
-`*/Kconfig`
-  These files are processed together with `default-configs/devices/*.mak` and
+``*/Kconfig``
+  These files are processed together with ``default-configs/devices/*.mak`` and
   describe the dependencies between various features, subsystems and
   device models.  They are described in :ref:`kconfig`
 
-`default-configs/targets/*.mak`
-  These files mostly define symbols that appear in the `*-config-target.h`
+``default-configs/targets/*.mak``
+  These files mostly define symbols that appear in the ``*-config-target.h``
   file for each emulator [#cfgtarget]_.  However, the ``TARGET_ARCH``
-  and ``TARGET_BASE_ARCH`` will also be used to select the `hw/` and
-  `target/` subdirectories that are compiled into each target.
+  and ``TARGET_BASE_ARCH`` will also be used to select the ``hw/`` and
+  ``target/`` subdirectories that are compiled into each target.
 
-.. [#cfgtarget] This header is included by `qemu/osdep.h` when
+.. [#cfgtarget] This header is included by ``qemu/osdep.h`` when
                 compiling files from the target-specific sourcesets.
 
 These files rarely need changing unless you are adding a completely
@@ -322,19 +322,19 @@ Support scripts
 ---------------
 
 Meson has a special convention for invoking Python scripts: if their
-first line is `#! /usr/bin/env python3` and the file is *not* executable,
+first line is ``#! /usr/bin/env python3`` and the file is *not* executable,
 find_program() arranges to invoke the script under the same Python
 interpreter that was used to invoke Meson.  This is the most common
 and preferred way to invoke support scripts from Meson build files,
 because it automatically uses the value of configure's --python= option.
 
-In case the script is not written in Python, use a `#! /usr/bin/env ...`
+In case the script is not written in Python, use a ``#! /usr/bin/env ...``
 line and make the script executable.
 
 Scripts written in Python, where it is desirable to make the script
 executable (for example for test scripts that developers may want to
 invoke from the command line, such as tests/qapi-schema/test-qapi.py),
-should be invoked through the `python` variable in meson.build. For
+should be invoked through the ``python`` variable in meson.build. For
 example::
 
   test('QAPI schema regression tests', python,
@@ -358,10 +358,10 @@ rules and wraps them so that e.g. submodules are built before QEMU.
 The resulting build system is largely non-recursive in nature, in
 contrast to common practices seen with automake.
 
-Tests are also ran by the Makefile with the traditional `make check`
-phony target, while benchmarks are run with `make bench`.  Meson test
-suites such as `unit` can be ran with `make check-unit` too.  It is also
-possible to run tests defined in meson.build with `meson test`.
+Tests are also ran by the Makefile with the traditional ``make check``
+phony target, while benchmarks are run with ``make bench``.  Meson test
+suites such as ``unit`` can be ran with ``make check-unit`` too.  It is also
+possible to run tests defined in meson.build with ``meson test``.
 
 Important files for the build system
 ====================================
@@ -373,28 +373,28 @@ The following key files are statically defined in the source tree, with
 the rules needed to build QEMU. Their behaviour is influenced by a
 number of dynamically created files listed later.
 
-`Makefile`
+``Makefile``
   The main entry point used when invoking make to build all the components
   of QEMU. The default 'all' target will naturally result in the build of
   every component. Makefile takes care of recursively building submodules
   directly via a non-recursive set of rules.
 
-`*/meson.build`
+``*/meson.build``
   The meson.build file in the root directory is the main entry point for the
   Meson build system, and it coordinates the configuration and build of all
   executables.  Build rules for various subdirectories are included in
   other meson.build files spread throughout the QEMU source tree.
 
-`tests/Makefile.include`
+``tests/Makefile.include``
   Rules for external test harnesses. These include the TCG tests,
-  `qemu-iotests` and the Avocado-based acceptance tests.
+  ``qemu-iotests`` and the Avocado-based acceptance tests.
 
-`tests/docker/Makefile.include`
+``tests/docker/Makefile.include``
   Rules for Docker tests. Like tests/Makefile, this file is included
   directly by the top level Makefile, anything defined in this file will
   influence the entire build system.
 
-`tests/vm/Makefile.include`
+``tests/vm/Makefile.include``
   Rules for VM-based tests. Like tests/Makefile, this file is included
   directly by the top level Makefile, anything defined in this file will
   influence the entire build system.
@@ -410,11 +410,11 @@ Makefile.
 
 Built by configure:
 
-`config-host.mak`
+``config-host.mak``
   When configure has determined the characteristics of the build host it
   will write a long list of variables to config-host.mak file. This
   provides the various install directories, compiler / linker flags and a
-  variety of `CONFIG_*` variables related to optionally enabled features.
+  variety of ``CONFIG_*`` variables related to optionally enabled features.
   This is imported by the top level Makefile and meson.build in order to
   tailor the build output.
 
@@ -429,29 +429,29 @@ Built by configure:
 
 Built by Meson:
 
-`${TARGET-NAME}-config-devices.mak`
+``${TARGET-NAME}-config-devices.mak``
   TARGET-NAME is again the name of a system or userspace emulator. The
   config-devices.mak file is automatically generated by make using the
   scripts/make_device_config.sh program, feeding it the
   default-configs/$TARGET-NAME file as input.
 
-`config-host.h`, `$TARGET-NAME/config-target.h`, `$TARGET-NAME/config-devices.h`
+``config-host.h``, ``$TARGET-NAME/config-target.h``, ``$TARGET-NAME/config-devices.h``
   These files are used by source code to determine what features
   are enabled.  They are generated from the contents of the corresponding
-  `*.h` files using the scripts/create_config program. This extracts
+  ``*.h`` files using the scripts/create_config program. This extracts
   relevant variables and formats them as C preprocessor macros.
 
-`build.ninja`
+``build.ninja``
   The build rules.
 
 
 Built by Makefile:
 
-`Makefile.ninja`
+``Makefile.ninja``
   A Makefile include that bridges to ninja for the actual build.  The
   Makefile is mostly a list of targets that Meson included in build.ninja.
 
-`Makefile.mtest`
+``Makefile.mtest``
   The Makefile definitions that let "make check" run tests defined in
   meson.build.  The rules are produced from Meson's JSON description of
   tests (obtained with "meson introspect --tests") through the script
@@ -461,9 +461,9 @@ Built by Makefile:
 Useful make targets
 -------------------
 
-`help`
+``help``
   Print a help message for the most common build targets.
 
-`print-VAR`
+``print-VAR``
   Print the value of the variable VAR. Useful for debugging the build
   system.
docs/devel/fuzzing.rst +5 -4
index 2749bb9bed3..d5fe9314c65 100644
@@ -182,10 +182,11 @@ The output should contain a complete list of matched MemoryRegions.
 
 OSS-Fuzz
 --------
-QEMU is continuously fuzzed on `OSS-Fuzz` __(https://github.com/google/oss-fuzz).
-By default, the OSS-Fuzz build will try to fuzz every fuzz-target. Since the
-generic-fuzz target requires additional information provided in environment
-variables, we pre-define some generic-fuzz configs in
+QEMU is continuously fuzzed on ``OSS-Fuzz``
+__(https://github.com/google/oss-fuzz).  By default, the OSS-Fuzz build
+will try to fuzz every fuzz-target. Since the generic-fuzz target
+requires additional information provided in environment variables, we
+pre-define some generic-fuzz configs in
 ``tests/qtest/fuzz/generic_fuzz_configs.h``. Each config must specify:
 
 - ``.name``: To identify the fuzzer config
docs/devel/migration.rst +31 -28

119 lines not on this page · raw message

docs/devel/qgraph.rst +4 -4
index a9aff167ada..0eabd01a3e5 100644
@@ -66,11 +66,11 @@ Notes for the nodes:
 Edges
 ^^^^^^
 
-An edge relation between two nodes (drivers or machines) `X` and `Y` can be:
+An edge relation between two nodes (drivers or machines) ``X`` and ``Y`` can be:
 
-- ``X CONSUMES Y``: `Y` can be plugged into `X`
-- ``X PRODUCES Y``: `X` provides the interface `Y`
-- ``X CONTAINS Y``: `Y` is part of `X` component
+- ``X CONSUMES Y``: ``Y`` can be plugged into ``X``
+- ``X PRODUCES Y``: ``X`` provides the interface ``Y``
+- ``X CONTAINS Y``: ``Y`` is part of ``X`` component
 
 Execution steps
 ^^^^^^^^^^^^^^^
docs/devel/tcg-plugins.rst +7 -7
index 18c6581d85c..9ac4ef88718 100644
@@ -34,11 +34,11 @@ version they were built against. This can be done simply by::
   QEMU_PLUGIN_EXPORT int qemu_plugin_version = QEMU_PLUGIN_VERSION;
 
 The core code will refuse to load a plugin that doesn't export a
-`qemu_plugin_version` symbol or if plugin version is outside of QEMU's
+``qemu_plugin_version`` symbol or if plugin version is outside of QEMU's
 supported range of API versions.
 
-Additionally the `qemu_info_t` structure which is passed to the
-`qemu_plugin_install` method of a plugin will detail the minimum and
+Additionally the ``qemu_info_t`` structure which is passed to the
+``qemu_plugin_install`` method of a plugin will detail the minimum and
 current API versions supported by QEMU. The API version will be
 incremented if new APIs are added. The minimum API version will be
 incremented if existing APIs are changed or removed.
@@ -145,12 +145,12 @@ Example Plugins
 
 There are a number of plugins included with QEMU and you are
 encouraged to contribute your own plugins plugins upstream. There is a
-`contrib/plugins` directory where they can go.
+``contrib/plugins`` directory where they can go.
 
 - tests/plugins
 
 These are some basic plugins that are used to test and exercise the
-API during the `make check-tcg` target.
+API during the ``make check-tcg`` target.
 
 - contrib/plugins/hotblocks.c
 
@@ -162,7 +162,7 @@ with linux-user execution as system emulation tends to generate
 re-translations as blocks from different programs get swapped in and
 out of system memory.
 
-If your program is single-threaded you can use the `inline` option for
+If your program is single-threaded you can use the ``inline`` option for
 slightly faster (but not thread safe) counters.
 
 Example::
@@ -250,7 +250,7 @@ which will lead to a sorted list after the class breakdown::
   ...
 
 To find the argument shorthand for the class you need to examine the
-source code of the plugin at the moment, specifically the `*opt`
+source code of the plugin at the moment, specifically the ``*opt``
 argument in the InsnClassExecCount tables.
 
 - contrib/plugins/lockstep.c
docs/devel/testing.rst +4 -4
index 1da4c4e4c4e..8c720ced892 100644
@@ -775,7 +775,7 @@ The base test class has also support for tests with more than one
 QEMUMachine. The way to get machines is through the ``self.get_vm()``
 method which will return a QEMUMachine instance. The ``self.get_vm()``
 method accepts arguments that will be passed to the QEMUMachine creation
-and also an optional `name` attribute so you can identify a specific
+and also an optional ``name`` attribute so you can identify a specific
 machine and get it more than once through the tests methods. A simple
 and hypothetical example follows:
 
@@ -954,7 +954,7 @@ Here is a list of the most used variables:
 AVOCADO_ALLOW_LARGE_STORAGE
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~
 Tests which are going to fetch or produce assets considered *large* are not
-going to run unless that `AVOCADO_ALLOW_LARGE_STORAGE=1` is exported on
+going to run unless that ``AVOCADO_ALLOW_LARGE_STORAGE=1`` is exported on
 the environment.
 
 The definition of *large* is a bit arbitrary here, but it usually means an
@@ -968,7 +968,7 @@ skipped by default. The definition of *not safe* is also arbitrary but
 usually it means a blob which either its source or build process aren't
 public available.
 
-You should export `AVOCADO_ALLOW_UNTRUSTED_CODE=1` on the environment in
+You should export ``AVOCADO_ALLOW_UNTRUSTED_CODE=1`` on the environment in
 order to allow tests which make use of those kind of assets.
 
 AVOCADO_TIMEOUT_EXPECTED
@@ -982,7 +982,7 @@ property defined in the test class, for further details::
 Even though the timeout can be set by the test developer, there are some tests
 that may not have a well-defined limit of time to finish under certain
 conditions. For example, tests that take longer to execute when QEMU is
-compiled with debug flags. Therefore, the `AVOCADO_TIMEOUT_EXPECTED` variable
+compiled with debug flags. Therefore, the ``AVOCADO_TIMEOUT_EXPECTED`` variable
 has been used to determine whether those tests should run or not.
 
 GITLAB_CI
docs/interop/live-block-operations.rst +2 -2
index 1073b930dce..63ac264a462 100644
@@ -638,7 +638,7 @@ at this point:
         (QEMU) block-job-complete device=job0
 
 In either of the above cases, if you once again run the
-`query-block-jobs` command, there should not be any active block
+``query-block-jobs`` command, there should not be any active block
 operation.
 
 Comparing 'commit' and 'mirror': In both then cases, the overlay images
@@ -777,7 +777,7 @@ the content of image [D].
         }
 
 (6) [On *destination* QEMU] Finally, resume the guest vCPUs by issuing the
-    QMP command `cont`::
+    QMP command ``cont``::
 
         (QEMU) cont
         {
docs/system/arm/cpu-features.rst +58 -58

274 lines not on this page · raw message

docs/system/arm/nuvoton.rst +1 -1
index d3cf2d9cd7e..299ea0763ac 100644
@@ -78,7 +78,7 @@ Boot options
 ------------
 
 The Nuvoton machines can boot from an OpenBMC firmware image, or directly into
-a kernel using the ``-kernel`` option. OpenBMC images for `quanta-gsj` and
+a kernel using the ``-kernel`` option. OpenBMC images for ``quanta-gsj`` and
 possibly others can be downloaded from the OpenPOWER jenkins :
 
    https://openpower.xyz/
docs/system/arm/sbsa.rst +2 -2
index b8ecfdb62fd..e9be76ad257 100644
@@ -2,9 +2,9 @@ Arm Server Base System Architecture Reference board (``sbsa-ref``)
 ==================================================================
 
 While the `virt` board is a generic board platform that doesn't match
-any real hardware the `sbsa-ref` board intends to look like real
+any real hardware the ``sbsa-ref`` board intends to look like real
 hardware. The `Server Base System Architecture
-<https://developer.arm.com/documentation/den0029/latest>` defines a
+<https://developer.arm.com/documentation/den0029/latest>`_ defines a
 minimum base line of hardware support and importantly how the firmware
 reports that to any operating system. It is a static system that
 reports a very minimal DT to the firmware for non-discoverable
docs/system/cpu-hotplug.rst +1 -1
index bd0663616e8..015ce2b6ec3 100644
@@ -78,7 +78,7 @@ vCPU hotplug
       }
       (QEMU)
 
-(5) Optionally, run QMP `query-cpus-fast` for some details about the
+(5) Optionally, run QMP ``query-cpus-fast`` for some details about the
     vCPUs::
 
       (QEMU) query-cpus-fast
docs/system/guest-loader.rst +3 -3
index 37d03cbd892..c64f1b15ab4 100644
@@ -27,12 +27,12 @@ multi-boot capability. A typical example would look like:
 In the above example the Xen hypervisor is loaded by the -kernel
 parameter and passed it's boot arguments via -append. The Dom0 guest
 is loaded into the areas of memory. Each blob will get
-`/chosen/module@<addr>` entry in the FDT to indicate it's location and
+``/chosen/module@<addr>`` entry in the FDT to indicate it's location and
 size. Additional information can be passed with by using additional
 arguments.
 
 Currently the only supported machines which use FDT data to boot are
-the ARM and RiscV `virt` machines.
+the ARM and RiscV ``virt`` machines.
 
 Arguments
 ^^^^^^^^^
@@ -51,4 +51,4 @@ The full syntax of the guest-loader is::
 
 ``bootargs=<args>``
   This is an optional field for kernel blobs which will pass command
-  like via the `/chosen/module@<addr>/bootargs` node.
+  like via the ``/chosen/module@<addr>/bootargs`` node.
docs/system/ppc/powernv.rst +4 -4
index 43c58bc32e7..4c4cdea527e 100644
@@ -48,15 +48,15 @@ Firmware
 --------
 
 The OPAL firmware (OpenPower Abstraction Layer) for OpenPower systems
-includes the runtime services `skiboot` and the bootloader kernel and
-initramfs `skiroot`. Source code can be found on GitHub:
+includes the runtime services ``skiboot`` and the bootloader kernel and
+initramfs ``skiroot``. Source code can be found on GitHub:
 
   https://github.com/open-power.
 
-Prebuilt images of `skiboot` and `skiboot` are made available on the `OpenPOWER <https://openpower.xyz/job/openpower/job/openpower-op-build/>`__ site. To boot a POWER9 machine, use the `witherspoon <https://openpower.xyz/job/openpower/job/openpower-op-build/label=slave,target=witherspoon/lastSuccessfulBuild/>`__ images. For POWER8, use
+Prebuilt images of ``skiboot`` and ``skiboot`` are made available on the `OpenPOWER <https://openpower.xyz/job/openpower/job/openpower-op-build/>`__ site. To boot a POWER9 machine, use the `witherspoon <https://openpower.xyz/job/openpower/job/openpower-op-build/label=slave,target=witherspoon/lastSuccessfulBuild/>`__ images. For POWER8, use
 the `palmetto <https://openpower.xyz/job/openpower/job/openpower-op-build/label=slave,target=palmetto/lastSuccessfulBuild/>`__ images.
 
-QEMU includes a prebuilt image of `skiboot` which is updated when a
+QEMU includes a prebuilt image of ``skiboot`` which is updated when a
 more recent version is required by the models.
 
 Boot options
docs/system/removed-features.rst +1 -1
index 29e90601a51..fa7479c5114 100644
@@ -124,7 +124,7 @@ devices.  Drives the board doesn't pick up can no longer be used with
 '''''''''''''''''''''''''''''''''''''
 
 This option was undocumented and not used in the field.
-Use `-device usb-ccid`` instead.
+Use ``-device usb-ccid`` instead.
 
 
 QEMU Machine Protocol (QMP) commands
docs/system/riscv/microchip-icicle-kit.rst +1 -1
index 4fe97bce3f0..9980d2c21f9 100644
@@ -75,7 +75,7 @@ Then we can boot the machine by:
       -serial chardev:serial1
 
 With above command line, current terminal session will be used for the first
-serial port. Open another terminal window, and use `minicom` to connect the
+serial port. Open another terminal window, and use ``minicom`` to connect the
 second serial port.
 
 .. code-block:: bash
docs/system/s390x/protvirt.rst +6 -6
index 0f481043d99..aee63ed7ec9 100644
@@ -14,11 +14,11 @@ Prerequisites
 To run PVMs, a machine with the Protected Virtualization feature, as
 indicated by the Ultravisor Call facility (stfle bit 158), is
 required. The Ultravisor needs to be initialized at boot by setting
-`prot_virt=1` on the host's kernel command line.
+``prot_virt=1`` on the host's kernel command line.
 
 Running PVMs requires using the KVM hypervisor.
 
-If those requirements are met, the capability `KVM_CAP_S390_PROTECTED`
+If those requirements are met, the capability ``KVM_CAP_S390_PROTECTED``
 will indicate that KVM can support PVMs on that LPAR.
 
 
@@ -26,15 +26,15 @@ Running a Protected Virtual Machine
 -----------------------------------
 
 To run a PVM you will need to select a CPU model which includes the
-`Unpack facility` (stfle bit 161 represented by the feature
-`unpack`/`S390_FEAT_UNPACK`), and add these options to the command line::
+``Unpack facility`` (stfle bit 161 represented by the feature
+``unpack``/``S390_FEAT_UNPACK``), and add these options to the command line::
 
     -object s390-pv-guest,id=pv0 \
     -machine confidential-guest-support=pv0
 
 Adding these options will:
 
-* Ensure the `unpack` facility is available
+* Ensure the ``unpack`` facility is available
 * Enable the IOMMU by default for all I/O devices
 * Initialize the PV mechanism
 
@@ -63,5 +63,5 @@ from the disk boot. This memory layout includes the encrypted
 components (kernel, initrd, cmdline), the stage3a loader and
 metadata. In case this boot method is used, the command line
 options -initrd and -cmdline are ineffective. The preparation of a PVM
-image is done via the `genprotimg` tool from the s390-tools
+image is done via the ``genprotimg`` tool from the s390-tools
 collection.
qapi/block-core.json +2 -2
index 6d227924d06..97622bef10f 100644
@@ -430,11 +430,11 @@
 # @granularity: granularity of the dirty bitmap in bytes (since 1.4)
 #
 # @recording: true if the bitmap is recording new writes from the guest.
-#             Replaces `active` and `disabled` statuses. (since 4.0)
+#             Replaces ``active`` and ``disabled`` statuses. (since 4.0)
 #
 # @busy: true if the bitmap is in-use by some operation (NBD or jobs)
 #        and cannot be modified via QMP or used by another operation.
-#        Replaces `locked` and `frozen` statuses. (since 4.0)
+#        Replaces ``locked`` and ``frozen`` statuses. (since 4.0)
 #
 # @persistent: true if the bitmap was stored on disk, is scheduled to be stored
 #              on disk, or both. (since 4.0)
Signature · 1 line
2.30.2
author
#2 lore raw

PATCH v2 2/4 docs/sphinx: change default role to "any"

In reply to John Snow

This interprets single-backtick syntax in all of our Sphinx docs as a cross-reference to *something*, including Python symbols.

---
 docs/conf.py | 3 +++
 1 file changed, 3 insertions(+)
docs/conf.py +3 -0
index 2ee61118725..8752e436ebe 100644
@@ -84,6 +84,9 @@
 # The master toctree document.
 master_doc = 'index'
 
+# Interpret `this` to be a cross-reference to "anything".
+default_role = 'any'
+
 # General information about the project.
 project = u'QEMU'
 copyright = u'2020, The QEMU Project Developers'
Signature · 1 line
2.30.2
author
#3 lore raw

PATCH v2 3/4 docs: enable sphinx-autodoc for scripts/qapi

In reply to John Snow

This is just POC to prove that the docstrings, where they are written, are correct to some minimum standard. It is included here for reviewing/testing convenience.

---
 docs/conf.py                          |  3 ++-
 docs/devel/index.rst                  |  1 +
 docs/devel/python/index.rst           |  7 +++++++
 docs/devel/python/qapi.commands.rst   |  7 +++++++
 docs/devel/python/qapi.common.rst     |  7 +++++++
 docs/devel/python/qapi.error.rst      |  7 +++++++
 docs/devel/python/qapi.events.rst     |  7 +++++++
 docs/devel/python/qapi.expr.rst       |  7 +++++++
 docs/devel/python/qapi.gen.rst        |  7 +++++++
 docs/devel/python/qapi.introspect.rst |  7 +++++++
 docs/devel/python/qapi.main.rst       |  7 +++++++
 docs/devel/python/qapi.parser.rst     |  8 ++++++++
 docs/devel/python/qapi.rst            | 26 ++++++++++++++++++++++++++
 docs/devel/python/qapi.schema.rst     |  7 +++++++
 docs/devel/python/qapi.source.rst     |  7 +++++++
 docs/devel/python/qapi.types.rst      |  7 +++++++
 docs/devel/python/qapi.visit.rst      |  7 +++++++
 17 files changed, 128 insertions(+), 1 deletion(-)
 create mode 100644 docs/devel/python/index.rst
 create mode 100644 docs/devel/python/qapi.commands.rst
 create mode 100644 docs/devel/python/qapi.common.rst
 create mode 100644 docs/devel/python/qapi.error.rst
 create mode 100644 docs/devel/python/qapi.events.rst
 create mode 100644 docs/devel/python/qapi.expr.rst
 create mode 100644 docs/devel/python/qapi.gen.rst
 create mode 100644 docs/devel/python/qapi.introspect.rst
 create mode 100644 docs/devel/python/qapi.main.rst
 create mode 100644 docs/devel/python/qapi.parser.rst
 create mode 100644 docs/devel/python/qapi.rst
 create mode 100644 docs/devel/python/qapi.schema.rst
 create mode 100644 docs/devel/python/qapi.source.rst
 create mode 100644 docs/devel/python/qapi.types.rst
 create mode 100644 docs/devel/python/qapi.visit.rst
docs/conf.py +2 -1
index 8752e436ebe..628e5dceb4b 100644
@@ -70,7 +70,8 @@
 # Add any Sphinx extension module names here, as strings. They can be
 # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
 # ones.
-extensions = ['kerneldoc', 'qmp_lexer', 'hxtool', 'depfile', 'qapidoc']
+extensions = ['kerneldoc', 'qmp_lexer', 'hxtool',
+              'depfile', 'qapidoc', 'sphinx.ext.autodoc']
 
 # Add any paths that contain templates here, relative to this directory.
 templates_path = ['_templates']
docs/devel/index.rst +1 -0
index 6cf7e2d2330..01d83a2eaf4 100644
@@ -42,3 +42,4 @@ Contents:
    qom
    block-coroutine-wrapper
    multi-process
+   python/index
docs/devel/python/index.rst new file +7 -0
new file mode 100644
index 00000000000..31c470154b3
@@ -0,0 +1,7 @@
+qapi
+====
+
+.. toctree::
+   :maxdepth: 4
+
+   qapi
docs/devel/python/qapi.commands.rst new file +7 -0
new file mode 100644
index 00000000000..018f7b08a9c
@@ -0,0 +1,7 @@
+qapi.commands module
+====================
+
+.. automodule:: qapi.commands
+   :members:
+   :undoc-members:
+   :show-inheritance:
docs/devel/python/qapi.common.rst new file +7 -0
new file mode 100644
index 00000000000..128a90d74be
@@ -0,0 +1,7 @@
+qapi.common module
+==================
+
+.. automodule:: qapi.common
+   :members:
+   :undoc-members:
+   :show-inheritance:
docs/devel/python/qapi.error.rst new file +7 -0
new file mode 100644
index 00000000000..980e32b63de
@@ -0,0 +1,7 @@
+qapi.error module
+=================
+
+.. automodule:: qapi.error
+   :members:
+   :undoc-members:
+   :show-inheritance:
docs/devel/python/qapi.events.rst new file +7 -0
new file mode 100644
index 00000000000..1fce85b044e
@@ -0,0 +1,7 @@
+qapi.events module
+==================
+
+.. automodule:: qapi.events
+   :members:
+   :undoc-members:
+   :show-inheritance:
docs/devel/python/qapi.expr.rst new file +7 -0
new file mode 100644
index 00000000000..0660270629c
@@ -0,0 +1,7 @@
+qapi.expr module
+================
+
+.. automodule:: qapi.expr
+   :members:
+   :undoc-members:
+   :show-inheritance:
docs/devel/python/qapi.gen.rst new file +7 -0
new file mode 100644
index 00000000000..7b495fd4bf2
@@ -0,0 +1,7 @@
+qapi.gen module
+===============
+
+.. automodule:: qapi.gen
+   :members:
+   :undoc-members:
+   :show-inheritance:
docs/devel/python/qapi.introspect.rst new file +7 -0
new file mode 100644
index 00000000000..f65ebfccd1b
@@ -0,0 +1,7 @@
+qapi.introspect module
+======================
+
+.. automodule:: qapi.introspect
+   :members:
+   :undoc-members:
+   :show-inheritance:
docs/devel/python/qapi.main.rst new file +7 -0
new file mode 100644
index 00000000000..1255fcda633
@@ -0,0 +1,7 @@
+qapi.main module
+================
+
+.. automodule:: qapi.main
+   :members:
+   :undoc-members:
+   :show-inheritance:
docs/devel/python/qapi.parser.rst new file +8 -0
new file mode 100644
index 00000000000..1a8f7b347eb
@@ -0,0 +1,8 @@
+qapi.parser module
+==================
+
+.. automodule:: qapi.parser
+   :members:
+   :undoc-members:
+   :show-inheritance:
+   :private-members:
docs/devel/python/qapi.rst new file +26 -0
new file mode 100644
index 00000000000..c762019aad3
@@ -0,0 +1,26 @@
+qapi package
+============
+
+.. automodule:: qapi
+   :members:
+   :undoc-members:
+   :show-inheritance:
+
+Submodules
+----------
+
+.. toctree::
+
+   qapi.commands
+   qapi.common
+   qapi.error
+   qapi.events
+   qapi.expr
+   qapi.gen
+   qapi.introspect
+   qapi.main
+   qapi.parser
+   qapi.schema
+   qapi.source
+   qapi.types
+   qapi.visit
docs/devel/python/qapi.schema.rst new file +7 -0
new file mode 100644
index 00000000000..a08f75ed720
@@ -0,0 +1,7 @@
+qapi.schema module
+==================
+
+.. automodule:: qapi.schema
+   :members:
+   :undoc-members:
+   :show-inheritance:
docs/devel/python/qapi.source.rst new file +7 -0
new file mode 100644
index 00000000000..e61e9f60212
@@ -0,0 +1,7 @@
+qapi.source module
+==================
+
+.. automodule:: qapi.source
+   :members:
+   :undoc-members:
+   :show-inheritance:
docs/devel/python/qapi.types.rst new file +7 -0
new file mode 100644
index 00000000000..6eea827557d
@@ -0,0 +1,7 @@
+qapi.types module
+=================
+
+.. automodule:: qapi.types
+   :members:
+   :undoc-members:
+   :show-inheritance:
docs/devel/python/qapi.visit.rst new file +7 -0
new file mode 100644
index 00000000000..84307cbc236
@@ -0,0 +1,7 @@
+qapi.visit module
+=================
+
+.. automodule:: qapi.visit
+   :members:
+   :undoc-members:
+   :show-inheritance:
Signature · 1 line
2.30.2
author
#4 lore raw

PATCH v2 4/4 : Add some ad-hoc linting helpers.

In reply to John Snow

These aren't ready for upstream inclusion, because they do not properly manage version dependencies, execution environment and so on. These are just the tools I use in my Own Special Environment :tm: for testing and debugging.

I *think*, but can't exhaustively guarantee, that these should work:

Python >= 3.6
isort >= 5.7.0 (But possibly earlier)
mypy >= 0.770 (Currently using 0.800)
pylint >= 2.6.0 (Currently using 2.7.4)

My python packaging series does a more exhaustive treatment and exploration of minimum package requirements; eventually these two series will converge and these dependencies will be handled in one place.

---
 scripts/qapi-lint.sh  | 29 +++++++++++++++++++++++++++++
 scripts/qapi/Makefile |  5 +++++
 2 files changed, 34 insertions(+)
 create mode 100755 scripts/qapi-lint.sh
 create mode 100644 scripts/qapi/Makefile
scripts/qapi-lint.sh new file +29 -0
new file mode 100755
index 00000000000..2c2f2808ca6
@@ -0,0 +1,29 @@
+#!/usr/bin/env bash
+set -e
+
+if [[ -f qapi/.flake8 ]]; then
+    echo "flake8 --config=qapi/.flake8 qapi/"
+    flake8 --config=qapi/.flake8 qapi/
+fi
+if [[ -f qapi/pylintrc ]]; then
+    echo "pylint --rcfile=qapi/pylintrc qapi/"
+    pylint --rcfile=qapi/pylintrc qapi/
+fi
+if [[ -f qapi/mypy.ini ]]; then
+    echo "mypy --config-file=qapi/mypy.ini qapi/"
+    mypy --config-file=qapi/mypy.ini qapi/
+fi
+
+if [[ -f qapi/.isort.cfg ]]; then
+    pushd qapi
+    echo "isort -c ."
+    isort -c .
+    popd
+fi
+
+pushd ../bin/git
+make -j9
+make check-qapi-schema
+make docs
+make sphinxdocs
+popd
scripts/qapi/Makefile new file +5 -0
new file mode 100644
index 00000000000..314e8a5505e
@@ -0,0 +1,5 @@
+check:
+	isort -c .
+	flake8 .
+	cd .. && pylint --rcfile=qapi/pylintrc qapi
+	cd .. && mypy -p qapi --config-file=qapi/mypy.ini
Signature · 1 line
2.30.2