aboutsummaryrefslogtreecommitdiff
path: root/scripts
AgeCommit message (Collapse)Author
2020-01-23virtiofsd: Pull in kernel's fuse.hDr. David Alan Gilbert
Update scripts/update-linux-headers.sh to add fuse.h and use it to pull in fuse.h from the kernel; from v5.5-rc1 Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
2020-01-21scripts/git.orderfile: Display decodetree before C sourcePhilippe Mathieu-Daudé
To avoid scrolling each instruction when reviewing tcg helpers written for the decodetree script, display the .decode files (similar to header declarations) before the C source (implementation of previous declarations). Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> Reviewed-by: Stefano Garzarella <sgarzare@redhat.com> Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Message-Id: <20191230082856.30556-1-philmd@redhat.com> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2020-01-20qapi: Fix code generation with Python 3.5Markus Armbruster
Recent commit 3e7fb5811b "qapi: Fix code generation for empty modules" modules" switched QAPISchema.visit() from for entity in self._entity_list: effectively to for mod in self._module_dict.values(): for entity in mod._entity_list: Visits in the same order as long as .values() is in insertion order. That's the case only for Python 3.6 and later. Before, it's in some arbitrary order, which results in broken generated code. Fix by making self._module_dict an OrderedDict rather than a dict. Fixes: 3e7fb5811baab213dcc7149c3aa69442d683c26c Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Tested-by: Thomas Huth <thuth@redhat.com> Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com> Tested-by: BALATON Zoltan <balaton@eik.bme.hu> Tested-by: Alex Bennée <alex.bennee@linaro.org> Message-id: 20200116202558.31473-1-armbru@redhat.com Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2020-01-14Merge remote-tracking branch 'remotes/armbru/tags/pull-qapi-2020-01-14' into ↵Peter Maydell
staging QAPI patches for 2020-01-14 # gpg: Signature made Tue 14 Jan 2020 10:15:22 GMT # gpg: using RSA key 354BC8B3D7EB2A6B68674E5F3870B400EB918653 # gpg: issuer "armbru@redhat.com" # gpg: Good signature from "Markus Armbruster <armbru@redhat.com>" [full] # gpg: aka "Markus Armbruster <armbru@pond.sub.org>" [full] # Primary key fingerprint: 354B C8B3 D7EB 2A6B 6867 4E5F 3870 B400 EB91 8653 * remotes/armbru/tags/pull-qapi-2020-01-14: qapi: Simplify QAPISchemaModularCVisitor qapi: Fix code generation for empty modules qapi: Proper intermediate representation for modules qapi: Generate command registration stuff into separate files tests/Makefile.include: Fix missing test-qapi-emit-events.[ch] qapi: Tweak "command returns a nice type" check for clarity Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2020-01-14qapi: Simplify QAPISchemaModularCVisitorMarkus Armbruster
Since the previous commit, QAPISchemaVisitor.visit_module() is called just once. Simplify QAPISchemaModularCVisitor accordingly. Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20191120182551.23795-7-armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
2020-01-14qapi: Fix code generation for empty modulesMarkus Armbruster
When a sub-module doesn't contain any definitions, we don't generate code for it, but we do generate the #include. We generate code only for modules that get visited. QAPISchema.visit() visits only modules that have definitions. It can visit modules multiple times. Clean this up as follows. Collect entities in their QAPISchemaModule. Have QAPISchema.visit() call QAPISchemaModule.visit() for each module. Have QAPISchemaModule.visit() call .visit_module() for itself, and QAPISchemaEntity.visit() for each of its entities. This way, we visit each module exactly once. Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20191120182551.23795-6-armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
2020-01-14qapi: Proper intermediate representation for modulesMarkus Armbruster
Modules are represented only by their names so far. Introduce class QAPISchemaModule. So far, it merely wraps the name. The next patch will put it to more interesting use. Once again, arrays spice up the patch a bit. For any other type, @info points to the definition, which lets us map from @info to module. For arrays, there is no definition, and @info points to the first use instead. We have to use the element type's module instead, which is only available after .check(). Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20191120182551.23795-5-armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
2020-01-14qapi: Generate command registration stuff into separate filesMarkus Armbruster
Having to include qapi-commands.h just for qmp_init_marshal() is suboptimal. Generate it into separate files. This lets monitor/misc.c, qga/main.c, and the generated qapi-commands-FOO.h include less. Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20191120182551.23795-4-armbru@redhat.com> [Typos in docs/devel/qapi-code-gen.txt fixed] Reviewed-by: Eric Blake <eblake@redhat.com>
2020-01-14qapi: Tweak "command returns a nice type" check for clarityMarkus Armbruster
Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20191120182551.23795-2-armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
2020-01-13trace: update qemu-trace-stap to Python 3Stefan Hajnoczi
qemu-trace-stap does not support Python 3 yet: $ scripts/qemu-trace-stap list path/to/qemu-system-x86_64 Traceback (most recent call last): File "scripts/qemu-trace-stap", line 175, in <module> main() File "scripts/qemu-trace-stap", line 171, in main args.func(args) File "scripts/qemu-trace-stap", line 118, in cmd_list print_probes(args.verbose, "*") File "scripts/qemu-trace-stap", line 114, in print_probes if line.startswith(prefix): TypeError: startswith first arg must be bytes or a tuple of bytes, not str Now that QEMU requires Python 3.5 or later we can switch to pure Python 3. Use Popen()'s universal_newlines=True argument to treat stdout as text instead of binary. Fixes: 62dd1048c0bd ("trace: add ability to do simple printf logging via systemtap") Buglink: https://bugzilla.redhat.com/show_bug.cgi?id=1787395 Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Message-id: 20200107112438.383958-1-stefanha@redhat.com Message-Id: <20200107112438.383958-1-stefanha@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2019-12-17docs: tweak kernel-doc for QEMU coding standardsPaolo Bonzini
Surprisingly, QEMU does have a pretty consistent doc comment style and it is not very different from the Linux kernel's. Of the documentation "sigils", only "#" separates the QEMU doc comment style from Linux's, and it has 200+ instances vs. 6 for the kernel's '&struct foo' (all in accel/tcg/translate-all.c), so it's clear that the two standards are different in this respect. In addition, our structs are typedefed and recognized by CamelCase names. Adjust kernel-doc's parser for these two aspects of the QEMU coding standards. The patch has been valid, with hardly any change, for over two years, so it should not be an issue to keep kernel-doc in sync with the Linux copy. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2019-12-17docs: import Linux kernel-doc script and extensionPaolo Bonzini
Import Linux's kernel-doc script as of commit 15e2544ed38a1e, as well as the Sphinx extension to call kernel-doc according to the arguments and parameters given to a reStructuredText directive. The kernel-doc extension accepts a filename, which is relative to the QEMU source tree root. The extension also notifies Sphinx about the document dependency on the file, causing the document to be rebuilt when the file has been changed. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2019-12-16analyze-migration.py: replace numpy with python 3.2Marc-André Lureau
Use int.from_bytes() from python 3.2 instead. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20191127101038.327080-3-marcandre.lureau@redhat.com> Reviewed-by: Eduardo Habkost <ehabkost@redhat.com> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Signed-off-by: Cleber Rosa <crosa@redhat.com>
2019-12-16analyze-migration.py: fix find() type errorMarc-André Lureau
Traceback (most recent call last): File "../scripts/analyze-migration.py", line 611, in <module> dump.read(desc_only = True) File "../scripts/analyze-migration.py", line 513, in read self.load_vmsd_json(file) File "../scripts/analyze-migration.py", line 556, in load_vmsd_json vmsd_json = file.read_migration_debug_json() File "../scripts/analyze-migration.py", line 89, in read_migration_debug_json nulpos = data.rfind("\0") TypeError: argument should be integer or bytes-like object, not 'str' Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20191127101038.327080-2-marcandre.lureau@redhat.com> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Signed-off-by: Cleber Rosa <crosa@redhat.com>
2019-11-25vmstate-static-checker: Fix for current pythonDr. David Alan Gilbert
Python 3.7.5 on f31 doesn't seem to like the old type=file syntax on argparse. Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Message-Id: <20191121185303.51685-1-dgilbert@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Reviewed-by: Cleber Rosa <crosa@redhat.com> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
2019-11-19scripts: Detect git worktrees for get_maintainer.pl --gitAlexey Kardashevskiy
Recent git versions support worktrees where .git is not a directory but a file with a path to the .git repository; however the get_maintainer.pl script only recognises the .git directory, let's fix it. Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru> Reviewed-by: Greg Kurz <groug@kaod.org> Reviewed-by: Stefano Garzarella <sgarzare@redhat.com> Tested-by: Stefano Garzarella <sgarzare@redhat.com> Message-Id: <20191112034532.69079-1-aik@ozlabs.ru> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2019-11-07Merge remote-tracking branch ↵Peter Maydell
'remotes/vivier2/tags/trivial-branch-pull-request' into staging Trivial fixes (20191105-v3) v3: remove disas/libvixl/vixl/invalset.h changes v2: remove patch from Greg that has lines with more than 80 columns # gpg: Signature made Wed 06 Nov 2019 16:23:45 GMT # gpg: using RSA key CD2F75DDC8E3A4DC2E4F5173F30C38BD3F2FBE3C # gpg: issuer "laurent@vivier.eu" # gpg: Good signature from "Laurent Vivier <lvivier@redhat.com>" [full] # gpg: aka "Laurent Vivier <laurent@vivier.eu>" [full] # gpg: aka "Laurent Vivier (Red Hat) <lvivier@redhat.com>" [full] # Primary key fingerprint: CD2F 75DD C8E3 A4DC 2E4F 5173 F30C 38BD 3F2F BE3C * remotes/vivier2/tags/trivial-branch-pull-request: global: Squash 'the the' hw/misc/grlib_ahb_apb_pnp: Fix 8-bit accesses hw/misc/grlib_ahb_apb_pnp: Avoid crash when writing to PnP registers Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2019-11-06global: Squash 'the the'Dr. David Alan Gilbert
'the' has a tendency to double up; squash them back down. Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Laurent Vivier <laurent@vivier.eu> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Message-Id: <20191104185202.102504-1-dgilbert@redhat.com> [lv: removed disas/libvixl/vixl/invalset.h change] Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2019-11-06scripts/qemu-binfmt-conf: Update for sparc64Richard Henderson
Also note that we were missing the qemu_target_list entry for plain sparc; fix that at the same time. Reviewed-by: Laurent Vivier <laurent@vivier.eu> Tested-by: Laurent Vivier <laurent@vivier.eu> Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20191106113318.10226-2-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2019-10-30Merge remote-tracking branch ↵Peter Maydell
'remotes/stsquad/tags/pull-tcg-plugins-281019-4' into staging TCG Plugins initial implementation - use --enable-plugins @ configure - low impact introspection (-plugin empty.so to measure overhead) - plugins cannot alter guest state - example plugins included in source tree (tests/plugins) - -d plugin to enable plugin output in logs - check-tcg runs extra tests when plugins enabled - documentation in docs/devel/plugins.rst # gpg: Signature made Mon 28 Oct 2019 15:13:23 GMT # gpg: using RSA key 6685AE99E75167BCAFC8DF35FBD0DB095A9E2A44 # gpg: Good signature from "Alex Bennée (Master Work Key) <alex.bennee@linaro.org>" [full] # Primary key fingerprint: 6685 AE99 E751 67BC AFC8 DF35 FBD0 DB09 5A9E 2A44 * remotes/stsquad/tags/pull-tcg-plugins-281019-4: (57 commits) travis.yml: enable linux-gcc-debug-tcg cache MAINTAINERS: add me for the TCG plugins code scripts/checkpatch.pl: don't complain about (foo, /* empty */) .travis.yml: add --enable-plugins tests include/exec: wrap cpu_ldst.h in CONFIG_TCG accel/stubs: reduce headers from tcg-stub tests/plugin: add hotpages to analyse memory access patterns tests/plugin: add instruction execution breakdown tests/plugin: add a hotblocks plugin tests/tcg: enable plugin testing tests/tcg: drop test-i386-fprem from TESTS when not SLOW tests/tcg: move "virtual" tests to EXTRA_TESTS tests/tcg: set QEMU_OPTS for all cris runs tests/tcg/Makefile.target: fix path to config-host.mak tests/plugin: add sample plugins linux-user: support -plugin option vl: support -plugin option plugin: add qemu_plugin_outs helper plugin: add qemu_plugin_insn_disas helper plugin: expand the plugin_init function to include an info block ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2019-10-29qapi: Check feature documentation against the schemaMarkus Armbruster
Commit f3ed93d545 "qapi: Allow documentation for features" neglected to check documentation against the schema. Fix that: check them the same way we check arguments. Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20191024110237.30963-20-armbru@redhat.com>
2019-10-29qapi: Polish reporting of bogus member documentationMarkus Armbruster
Improve error messages from the following documented members are not in the declaration: a the following documented members are not in the declaration: aa, bb to the more concise documented member 'a' does not exist documented members 'aa', 'bb' do not exist Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20191024110237.30963-19-armbru@redhat.com>
2019-10-29qapi: Lift features into QAPISchemaEntityMarkus Armbruster
Commit 6a8c0b5102 "qapi: Add feature flags to struct types" added features to QAPISchemaObjectType. Commit a95daa5093 "qapi: Add feature flags to commands in qapi" added them to QAPISchemaCommand, duplicating the code. Tolerable, but the duplication will only get worse as we add features to more definitions. To de-duplicate, lift features from QAPISchemaObjectType and QAPISchemaCommand into QAPISchemaEntity. Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20191024110237.30963-18-armbru@redhat.com>
2019-10-29qapi: Fold normalize_enum() into check_enum()Markus Armbruster
check_features() is always called together with normalize_features(). Fold the latter into the former. Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20191024110237.30963-17-armbru@redhat.com>
2019-10-29qapi: Fold normalize_features() into check_features()Markus Armbruster
check_features() is always called together with normalize_features(): the former in check_struct() and check_command(), the latter in their caller check_exprs(). Fold the latter into the former. Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20191024110237.30963-16-armbru@redhat.com>
2019-10-29qapi: Fold normalize_if() into check_if()Markus Armbruster
check_if() is always called together with normalize_if(). Fold the latter into the former. Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20191024110237.30963-15-armbru@redhat.com>
2019-10-29qapi: Eliminate .check_doc() overridesMarkus Armbruster
All sub-classes of QAPISchemaEntity now override .check_doc() the same way, except for QAPISchemaType and and QAPISchemaArrayType. Put the overrides' code in QAPISchemaEntity.check_doc(), and drop the overrides. QAPISchemaType doesn't care because it's abstract. QAPISchemaArrayType doesn't care because its .doc is always None. Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20191024110237.30963-14-armbru@redhat.com>
2019-10-29qapi: Simplify ._make_implicit_object_type()Markus Armbruster
All callers now pass doc=None. Drop the argument. Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20191024110237.30963-13-armbru@redhat.com>
2019-10-29qapi: Fix doc comment checking for commands and eventsMarkus Armbruster
When a command's 'data' is an object, its doc comment describes the arguments defined there. When 'data' names a type, the doc comment does not describe arguments. Instead, the doc generator inserts a pointer to the named type. An event's doc comment works the same. We don't actually check doc comments for commands and events. Instead, QAPISchema._def_command() forwards the doc comment to the implicit argument type, where it gets checked. Works because the check only cares for the implicit argument type's members. Not only is this needlessly hard to understand, it actually falls apart in two cases: * When 'data' is empty, there is nothing to forward to, and the doc comment remains unchecked. Demonstrated by test doc-bad-event-arg. * When 'data' names a type, we can't forward, as the type has its own doc comment. The command or event's doc comment remains unchecked. Demonstrated by test doc-bad-boxed-command-arg. The forwarding goes back to commit 069fb5b250 "qapi: Prepare for requiring more complete documentation", put to use in commit 816a57cd6e "qapi: Fix detection of bogus member documentation". That fix was incomplete. To fix this, make QAPISchemaCommand and QAPISchemaEvent check doc comments, and drop the forwarding of doc comments to implicit argument types. Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20191024110237.30963-12-armbru@redhat.com>
2019-10-29qapi: Clean up doc comment checking for implicit union baseMarkus Armbruster
An object type's doc comment describes the type's members, less the ones defined in a named base type. Cases: * Struct: the members are defined in 'data' and inherited from 'base'. Since the base type cannot be implicit, the doc comment describes just 'data'. * Simple union: the only member is the implicit tag member @type, and the doc comment describes it. * Flat union with implicit base type: the members are defined in 'base', and the doc comment describes it. * Flat union with named base type: the members are inherited from 'base'. The doc comment describes no members. Before we can check a doc comment with .check_doc(), we need .connect_doc() connect each of its "argument sections" to the member it documents. For structs and simple unions, this is straightforward: the members in question are in .local_members, and .connect_doc() connects them. For flat unions with a named base type, it's trivial: .local_members is empty, and .connect_doc() does nothing. For flat unions with an implicit base type, it's tricky. We have QAPISchema._make_implicit_object_type() forward the union's doc comment to the implicit base type, so that the base type's .connect_doc() connects the members. The union's .connect_doc() does nothing, as .local_members is empty. Dirt effect: we check the doc comment twice, once for the union type, and once for the implicit base type. This is needlessly brittle and hard to understand. Clean up as follows. Make the union's .connect_doc() connect an implicit base's members itself. Do not forward the union's doc comment to its implicit base type. Requires extending .connect_doc() so it can work with a doc comment other than self.doc. Add an optional argument for that. Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20191024110237.30963-11-armbru@redhat.com>
2019-10-29qapi: Fix enum doc comment checkingMarkus Armbruster
Enumeration type documentation comments are not checked, as demonstrated by test doc-bad-enum-member. This is because we neglect to call self.doc.check() for enumeration types. Messed up in 816a57cd6e "qapi: Fix detection of bogus member documentation". Fix it. Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20191024110237.30963-10-armbru@redhat.com>
2019-10-29qapi: Split .connect_doc(), .check_doc() off .check()Markus Armbruster
Splitting documentation checking off the .check() methods makes them a bit more focused, which is welcome, as some of them are pretty big. It also prepares the ground for the following commits. Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20191024110237.30963-9-armbru@redhat.com>
2019-10-29qapi: De-duplicate entity documentation generation codeMarkus Armbruster
QAPISchemaGenDocVisitor.visit_command() duplicates texi_entity() for its boxed arguments case. The previous commit added another copy in .visit_event(). Replace texi_entity() by texi_type() and texi_msg(). Use texi_msg() for the boxed arguments case as well. Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20191024110237.30963-8-armbru@redhat.com>
2019-10-29qapi: Implement boxed event argument documentationMarkus Armbruster
Generate a reference "Arguments: the members of ...", just like we do for commands since commit c2dd311cb7 "qapi2texi: Implement boxed argument documentation". No change to generated QMP documentation; we don't yet use boxed events outside tests/. Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20191024110237.30963-7-armbru@redhat.com>
2019-10-28scripts/checkpatch.pl: don't complain about (foo, /* empty */)Alex Bennée
It's quite common to have a mini comment inside braces to acknowledge we know it's empty. Expand the inline detection to allow closing braces before the end of line. Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Aaron Lindsay <aaron@os.amperecomputing.com>
2019-10-28trace: add mmu_index to mem_infoAlex Bennée
We are going to re-use mem_info later for plugins and will need to track the mmu_idx for softmmu code. Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
2019-10-26Merge commit 'df84f17' into HEADPaolo Bonzini
This merge fixes a semantic conflict with the trivial tree. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2019-10-23checkpatch: suggest qemu_real_host_page_size instead of getpagesize() or ↵Wei Yang
sysconf(_SC_PAGESIZE) Signed-off-by: Wei Yang <richardw.yang@linux.intel.com> CC: Richard Henderson <richard.henderson@linaro.org> CC: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Message-Id: <20191017004633.13229-1-richardw.yang@linux.intel.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2019-10-22qapi: Add feature flags to commandsPeter Krempa
Similarly to features for struct types introduce the feature flags also for commands. This will allow notifying management layers of fixes and compatible changes in the behaviour of a command which may not be detectable any other way. The changes were heavily inspired by commit 6a8c0b51025. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20191018081454.21369-3-armbru@redhat.com>
2019-10-22qapi: Clear scripts/qapi/doc.py executable bits againMarkus Armbruster
Commit fbf09a2fa4 "qapi: add 'ifcond' to visitor methods" brought back the executable bits. Fix that. Drop the #! line for good measure. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-Id: <20191018074345.24034-8-armbru@redhat.com>
2019-10-22qapi: Split up scripts/qapi/common.pyMarkus Armbruster
The QAPI code generator clocks in at some 3100 SLOC in 8 source files. Almost 60% of the code is in qapi/common.py. Split it into more focused modules: * Move QAPISchemaPragma and QAPISourceInfo to qapi/source.py. * Move QAPIError and its sub-classes to qapi/error.py. * Move QAPISchemaParser and QAPIDoc to parser.py. Use the opportunity to put QAPISchemaParser first. * Move check_expr() & friends to qapi/expr.py. Use the opportunity to put the code into a more sensible order. * Move QAPISchema & friends to qapi/schema.py * Move QAPIGen and its sub-classes, ifcontext, QAPISchemaModularCVisitor, and QAPISchemaModularCVisitor to qapi/gen.py * Delete camel_case(), it's unused since commit e98859a9b9 "qapi: Clean up after recent conversions to QAPISchemaVisitor" A number of helper functions remain in qapi/common.py. I considered moving the code generator helpers to qapi/gen.py, but decided not to. Perhaps we should rewrite them as methods of QAPIGen some day. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-Id: <20191018074345.24034-7-armbru@redhat.com> [Add "# -*- coding: utf-8 -*-" lines]
2019-10-22qapi: Move gen_enum(), gen_enum_lookup() back to qapi/types.pyMarkus Armbruster
The next commit will split up qapi/common.py. gen_enum() needs QAPISchemaEnumMember, and that's in the way. Move it to qapi/types.py along with its buddy gen_enum_lookup(). Permit me a short a digression on history: how did gen_enum() end up in qapi/common.py? Commit 21cd70dfc1 "qapi script: add event support" duplicated qapi-types.py's gen_enum() and gen_enum_lookup() in qapi-event.py. Simply importing them would have been cleaner, but wasn't possible as qapi-types.py was a program, not a module. Commit efd2eaa6c2 "qapi: De-duplicate enum code generation" de-duplicated by moving them to qapi.py, which was a module. Since then, program qapi-types.py has morphed into module types.py. It's where gen_enum() and gen_enum_lookup() started, and where they belong. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-Id: <20191018074345.24034-6-armbru@redhat.com>
2019-10-22qapi: Eliminate accidental global frontend stateMarkus Armbruster
The frontend can't be run more than once due to its global state. A future commit will want to do that. The only global frontend state remaining is accidental: QAPISchemaParser.__init__()'s parameter previously_included=[]. Python evaluates the default once, at definition time. Any modifications to it are visible in subsequent calls. Well-known Python trap. Change the default to None and replace it by the real default in the function body. Use the opportunity to convert previously_included to a set. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-Id: <20191018074345.24034-4-armbru@redhat.com>
2019-10-22qapi: Store pragma state in QAPISourceInfo, not global stateMarkus Armbruster
The frontend can't be run more than once due to its global state. A future commit will want to do that. Recent commit "qapi: Move context-sensitive checking to the proper place" got rid of many global variables already, but pragma state is still stored in global variables (that's why a pragma directive's scope is the complete schema). Move the pragma state to QAPISourceInfo. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-Id: <20191018074345.24034-3-armbru@redhat.com>
2019-10-22qapi: Don't suppress doc generation without pragma doc-requiredMarkus Armbruster
Commit bc52d03ff5 "qapi: Make doc comments optional where we don't need them" made scripts/qapi2texi.py fail[*] unless the schema had pragma 'doc-required': true. The stated reason was inability to cope with incomplete documentation. When commit fb0bc835e5 "qapi-gen: New common driver for code and doc generators" folded scripts/qapi2texi.py into scripts/qapi-gen.py, it turned the failure into silent suppression. The doc generator can cope with incomplete documentation now. I don't know since when, or what the problem was, or even whether it ever existed. Drop the silent suppression. [*] The fail part was broken, fixed in commit e8ba07ea9a. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-Id: <20191018074345.24034-2-armbru@redhat.com>
2019-10-15trace: avoid "is" with a literal Python 3.8 warningsStefan Hajnoczi
The following statement produces a SyntaxWarning with Python 3.8: if len(format) is 0: scripts/tracetool/__init__.py:459: SyntaxWarning: "is" with a literal. Did you mean "=="? Use the conventional len(x) == 0 syntax instead. Reported-by: Daniel P. Berrangé <berrange@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Message-Id: <20191010122154.10553-1-stefanha@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2019-10-07make-release: pull in edk2 submodules so we can build it from tarballsMichael Roth
The `make efi` target added by 536d2173 is built from the roms/edk2 submodule, which in turn relies on additional submodules nested under roms/edk2. The make-release script currently only pulls in top-level submodules, so these nested submodules are missing in the resulting tarball. We could try to address this situation more generally by recursively pulling in all submodules, but this doesn't necessarily ensure the end-result will build properly (this case also required other changes). Additionally, due to the nature of submodules, we may not always have control over how these sorts of things are dealt with, so for now we continue to handle it on a case-by-case in the make-release script. Cc: Laszlo Ersek <lersek@redhat.com> Cc: Bruce Rogers <brogers@suse.com> Cc: qemu-stable@nongnu.org # v4.1.0 Reported-by: Bruce Rogers <brogers@suse.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com> Message-Id: <20190912231202.12327-2-mdroth@linux.vnet.ibm.com> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
2019-10-04vmxcap: correct the name of the variablesPaolo Bonzini
The low bits are 1 if the control must be one, the high bits are 1 if the control can be one. Correct the variable names as they are very confusing. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2019-09-28qapi: Improve source file read error handlingMarkus Armbruster
qapi-gen.py crashes when it can't open the main schema file, and when it can't read from any schema file. Lazy. Change QAPISchema.__init__() to take a file name instead of a file object. Move the open code from _include() to __init__(), so it's used for the main schema file, too. Move the read into the try for good measure, and rephrase the error message. Reporting open or read failure for the main schema file needs a QAPISourceInfo representing "no source". Make QAPISourceInfo cope with fname=None. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-Id: <20190927134639.4284-27-armbru@redhat.com>
2019-09-28qapi: Improve reporting of redefinitionMarkus Armbruster
Point to the previous definition, unless it's a built-in. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-Id: <20190927134639.4284-26-armbru@redhat.com>