aboutsummaryrefslogtreecommitdiff
path: root/scripts
AgeCommit message (Collapse)Author
2020-10-09qapi: Add a 'coroutine' flag for commandsKevin Wolf
This patch adds a new 'coroutine' flag to QMP command definitions that tells the QMP dispatcher that the command handler is safe to be run in a coroutine. The documentation of the new flag pretends that this flag is already used as intended, which it isn't yet after this patch. We'll implement this in another patch in this series. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Message-Id: <20201005155855.256490-9-kwolf@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
2020-10-06kernel-doc: Remove $decl_type='type name' hackEduardo Habkost
The $decl_type='type name' hack makes it impossible to document macros with uppercase names (e.g. most of the macros in object.h). Now that we have explicitly tagged the struct and typedef doc comments in memory.h and object.h, we don't need that hack anymore. This will make the documentation for the macros in object.h finally be rendered as expected. Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Message-Id: <20201003024123.193840-6-ehabkost@redhat.com> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
2020-10-06kernel-doc: Handle function typedefs without asterisksEduardo Habkost
Example of typedef that was not parsed by kernel-doc: typedef void (ObjectUnparent)(Object *obj); Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Message-Id: <20201003024123.193840-3-ehabkost@redhat.com> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
2020-10-06kernel-doc: Handle function typedefs that return pointersEduardo Habkost
One example that was not being parsed correctly by kernel-doc is: typedef Object *(ObjectPropertyResolve)(Object *obj, void *opaque, const char *part); Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Message-Id: <20201003024123.193840-2-ehabkost@redhat.com> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
2020-10-06Merge remote-tracking branch ↵Peter Maydell
'remotes/stefanha-gitlab/tags/block-pull-request' into staging Pull request v2: * Removed clang-format call from scripts/block-coroutine-wrapper.py. This avoids the issue with clang version incompatibility. It could be added back in the future but the code is readable without reformatting and it also makes the build less dependent on the environment. # gpg: Signature made Mon 05 Oct 2020 16:42:28 BST # gpg: using RSA key 8695A8BFD3F97CDAAC35775A9CA4ABB381AB73C8 # gpg: Good signature from "Stefan Hajnoczi <stefanha@redhat.com>" [full] # gpg: aka "Stefan Hajnoczi <stefanha@gmail.com>" [full] # Primary key fingerprint: 8695 A8BF D3F9 7CDA AC35 775A 9CA4 ABB3 81AB 73C8 * remotes/stefanha-gitlab/tags/block-pull-request: util/vfio-helpers: Rework the IOVA allocator to avoid IOVA reserved regions util/vfio-helpers: Collect IOVA reserved regions docs: add 'io_uring' option to 'aio' param in qemu-options.hx include/block/block.h: drop non-ascii quotation mark block/io: refactor save/load vmstate block: drop bdrv_prwv block: generate coroutine-wrapper code scripts: add block-coroutine-wrapper.py block: declare some coroutine functions in block/coroutines.h block/io: refactor coroutine wrappers block: return error-code from bdrv_invalidate_cache block/nvme: Replace magic value by SCALE_MS definition block/nvme: Use register definitions from 'block/nvme.h' block/nvme: Drop NVMeRegs structure, directly use NvmeBar block/nvme: Reduce I/O registers scope block/nvme: Map doorbells pages write-only util/vfio-helpers: Pass page protections to qemu_vfio_pci_map_bar() Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2020-10-05scripts: add block-coroutine-wrapper.pyVladimir Sementsov-Ogievskiy
We have a very frequent pattern of creating a coroutine from a function with several arguments: - create a structure to pack parameters - create _entry function to call original function taking parameters from struct - do different magic to handle completion: set ret to NOT_DONE or EINPROGRESS or use separate bool field - fill the struct and create coroutine from _entry function with this struct as a parameter - do coroutine enter and BDRV_POLL_WHILE loop Let's reduce code duplication by generating coroutine wrappers. This patch adds scripts/block-coroutine-wrapper.py together with some friends, which will generate functions with declared prototypes marked by the 'generated_co_wrapper' specifier. The usage of new code generation is as follows: 1. define the coroutine function somewhere int coroutine_fn bdrv_co_NAME(...) {...} 2. declare in some header file int generated_co_wrapper bdrv_NAME(...); with same list of parameters (generated_co_wrapper is defined in "include/block/block.h"). 3. Make sure the block_gen_c declaration in block/meson.build mentions the file with your marker function. Still, no function is now marked, this work is for the following commit. Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-Id: <20200924185414.28642-5-vsementsov@virtuozzo.com> [Added encoding='utf-8' to open() calls as requested by Vladimir. Fixed typo and grammar issues pointed out by Eric Blake. Removed clang-format dependency that caused build test issues. --Stefan] Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2020-10-04meson: move sparse detection to Meson and rewrite check_sparse.pyPaolo Bonzini
Pass the path to the program to scripts/check_sparse.py, which previously was not included in config-host.mak. Change scripts/check_sparse.py to work with cgcc, which seems to work better with sparse 0.6.x. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2020-09-30checkpatch: Detect '%#' or '%0#' in printf-style format stringsDov Murik
According to the coding style document, we should use literal '0x' prefix instead of printf's '#' flag (which appears as '%#' or '%0#' in the format string). Add a checkpatch rule to enforce that. Note that checkpatch already had a similar rule for trace-events files. Example usage: $ scripts/checkpatch.pl --file chardev/baum.c ... ERROR: Don't use '#' flag of printf format ('%#') in format strings, use '0x' prefix instead #366: FILE: chardev/baum.c:366: + DPRINTF("Broken packet %#2x, tossing\n", req); \ ... ERROR: Don't use '#' flag of printf format ('%#') in format strings, use '0x' prefix instead #472: FILE: chardev/baum.c:472: + DPRINTF("unrecognized request %0#2x\n", req); ... Signed-off-by: Dov Murik <dovmurik@linux.vnet.ibm.com> Message-Id: <20200914172623.72955-1-dovmurik@linux.vnet.ibm.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
2020-09-30checkpatch: avoid error on cover letter filesStefano Garzarella
Running checkpatch on a directory that contains a cover letter reports this error: Checking /tmp/tmpbnngauy3/0000-cover-letter.patch... ERROR: Does not appear to be a unified-diff format patch total: 1 errors, 0 warnings, 0 lines checked Let's skip cover letter as it is already done in the Linux kernel commits 06330fc40e3f ("checkpatch: avoid NOT_UNIFIED_DIFF errors on cover-letter.patch files") and a08ffbef4ab7 ("checkpatch: fix ignoring cover-letter logic"). Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Signed-off-by: Stefano Garzarella <sgarzare@redhat.com> Message-Id: <20200917170212.92672-1-sgarzare@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2020-09-30mtest2make: add support for introspected test dependenciesPaolo Bonzini
Right now all "make check" targets depend blindly on "all". If Meson is 0.56.0 or newer, we can use the correct dependencies using the new "depends" entry in "meson introspect --tests". Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2020-09-30ninjatool: rebuild multi-output targets if outputs are missingPaolo Bonzini
The "stamp file trick" used to group targets of a single multi-output rule prevents the user from deleting one such target in order to force its rebuild. Doing so will not touch the stamp file, and therefore only the dummy ":" command will be executed. With this patch, ninjatool writes rules that force-rebuild the stamp file if any of its outputs are missing. Rebuilding the missing target therefore causes the stamp file to be rebuilt too. Reported-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2020-09-29Remove texinfo dependency from docker and CI configsPeter Maydell
We don't need texinfo to build the docs any more, so we can drop that dependency from our docker and other CI configs. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Message-Id: <20200925162316.21205-22-peter.maydell@linaro.org> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
2020-09-29Remove Texinfo related line from git.orderfilePeter Maydell
We don't use Texinfo any more; we can remove the references to the .texi source file from our git.orderfile. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Message-Id: <20200925162316.21205-20-peter.maydell@linaro.org> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
2020-09-29scripts/texi2pod: Delete unused scriptPeter Maydell
We no longer need the texi2pod script, so we can delete it, and the special-casing it had in the checkpatch script. Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Message-Id: <20200925162316.21205-19-peter.maydell@linaro.org> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
2020-09-29scripts/qapi: Remove texinfo generation supportPeter Maydell
We no longer use the generated texinfo format documentation, so delete the code that generates it, and the test case for the generation. Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Message-Id: <20200925162316.21205-17-peter.maydell@linaro.org> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
2020-09-29scripts/qapi/parser.py: improve doc comment indent handlingPeter Maydell
Make the handling of indentation in doc comments more sophisticated, so that when we see a section like: Notes: some text some more text indented line 3 we save it for the doc-comment processing code as: some text some more text indented line 3 and when we see a section with the heading on its own line: Notes: some text some more text indented text we also accept that and save it in the same form. If we detect that the comment document text is not indented as much as we expect it to be, we throw a parse error. (We don't complain about over-indented sections, because for rST this can be legitimate markup.) The golden reference for the doc comment text is updated to remove the two 'wrong' indents; these now form a test case that we correctly stripped leading whitespace from an indented multi-line argument definition. We update the documentation in docs/devel/qapi-code-gen.txt to describe the new indentation rules. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Message-Id: <20200925162316.21205-6-peter.maydell@linaro.org> Reviewed-by: Markus Armbruster <armbru@redhat.com> [Whitespace between sentences tweaked] Signed-off-by: Markus Armbruster <armbru@redhat.com>
2020-09-29scripts/qapi: Move doc-comment whitespace stripping to doc.pyPeter Maydell
As we accumulate lines from doc comments when parsing the JSON, the QAPIDoc class generally strips leading and trailing whitespace using line.strip() when it calls _append_freeform(). This is fine for Texinfo, but for rST leading whitespace is significant. We'd like to move to having the text in doc comments be rST format rather than a custom syntax, so move the removal of leading whitespace from the QAPIDoc class to the texinfo-specific processing code in texi_format() in qapi/doc.py. (Trailing whitespace will always be stripped by the rstrip() in Section::append regardless.) In a followup commit we will make the whitespace in the lines of doc comment sections more consistently follow the input source. There is no change to the generated .texi files before and after this commit. Because the qapi-schema test checks the exact values of the documentation comments against a reference, we need to update that reference to match the new whitespace. In the first four places this is now correctly checking that we did put in the amount of whitespace to pass a rST-formatted list to the backend; in the last two places the extra whitespace is 'wrong' and will go away again in the following commit. Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Message-Id: <20200925162316.21205-5-peter.maydell@linaro.org> Signed-off-by: Markus Armbruster <armbru@redhat.com>
2020-09-23qemu/atomic.h: rename atomic_ to qatomic_Stefan Hajnoczi
clang's C11 atomic_fetch_*() functions only take a C11 atomic type pointer argument. QEMU uses direct types (int, etc) and this causes a compiler error when a QEMU code calls these functions in a source file that also included <stdatomic.h> via a system header file: $ CC=clang CXX=clang++ ./configure ... && make ../util/async.c:79:17: error: address argument to atomic operation must be a pointer to _Atomic type ('unsigned int *' invalid) Avoid using atomic_*() names in QEMU's atomic.h since that namespace is used by <stdatomic.h>. Prefix QEMU's APIs with 'q' so that atomic.h and <stdatomic.h> can co-exist. I checked /usr/include on my machine and searched GitHub for existing "qatomic_" users but there seem to be none. This patch was generated using: $ git grep -h -o '\<atomic\(64\)\?_[a-z0-9_]\+' include/qemu/atomic.h | \ sort -u >/tmp/changed_identifiers $ for identifier in $(</tmp/changed_identifiers); do sed -i "s%\<$identifier\>%q$identifier%g" \ $(git grep -I -l "\<$identifier\>") done I manually fixed line-wrap issues and misaligned rST tables. Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Acked-by: Paolo Bonzini <pbonzini@redhat.com> Message-Id: <20200923105646.47864-1-stefanha@redhat.com>
2020-09-22Merge remote-tracking branch ↵Peter Maydell
'remotes/vivier2/tags/trivial-branch-for-5.2-pull-request' into staging Pull request trivial patches 20200919 # gpg: Signature made Sat 19 Sep 2020 19:43:35 BST # 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-for-5.2-pull-request: contrib/: fix some comment spelling errors qapi/: fix some comment spelling errors disas/: fix some comment spelling errors linux-user/: fix some comment spelling errors util/: fix some comment spelling errors scripts/: fix some comment spelling errors docs/: fix some comment spelling errors migration/: fix some comment spelling errors qemu/: fix some comment spelling errors scripts/git.orderfile: Display meson files along with buildsys ones hw/timer/hpet: Fix debug format strings hw/timer/hpet: Remove unused functions hpet_ram_readb, hpet_ram_readw meson: remove empty else and duplicated gio deps manual: escape backslashes in "parsed-literal" blocks ui/spice-input: Remove superfluous forward declaration hw/ppc/ppc4xx_pci: Replace magic value by the PCI_NUM_PINS definition hw/gpio/max7310: Remove impossible check Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2020-09-21Merge remote-tracking branch ↵Peter Maydell
'remotes/ehabkost/tags/machine-next-pull-request' into staging QOM queue, 2020-09-18 Fixes: * Error value corrections (Markus Armbruster) * Correct object_class_dynamic_cast_assert() documentation (Eduardo Habkost) * Ensure objects using QEMU_ALIGNED are properly aligned (Richard Henderson) QOM cleanups (Eduardo Habkost): * Rename some constants * Simplify parameters of OBJECT_DECLARE* macros * Additional DECLARE_*CHECKER* usage * Additional OBJECT_DECLARE_TYPE usage * Additional OBJECT_DECLARE_SIMPLE_TYPE usage # gpg: Signature made Fri 18 Sep 2020 21:45:29 BST # gpg: using RSA key 5A322FD5ABC4D3DBACCFD1AA2807936F984DC5A6 # gpg: issuer "ehabkost@redhat.com" # gpg: Good signature from "Eduardo Habkost <ehabkost@redhat.com>" [full] # Primary key fingerprint: 5A32 2FD5 ABC4 D3DB ACCF D1AA 2807 936F 984D C5A6 * remotes/ehabkost/tags/machine-next-pull-request: Use OBJECT_DECLARE_SIMPLE_TYPE when possible Use OBJECT_DECLARE_TYPE when possible qom: Remove module_obj_name parameter from OBJECT_DECLARE* macros qom: Remove ParentClassType argument from OBJECT_DECLARE_SIMPLE_TYPE scripts/codeconverter: Update to latest version target/s390x: Set instance_align on S390CPU TypeInfo target/riscv: Set instance_align on RISCVCPU TypeInfo target/ppc: Set instance_align on PowerPCCPU TypeInfo target/arm: Set instance_align on CPUARM TypeInfo qom: Allow objects to be allocated with increased alignment qom: Correct error values in two contracts qom: Clean up object_property_get_enum()'s error value qom: Correct object_class_dynamic_cast_assert() documentation sifive: Use DECLARE_*CHECKER* macros sifive: Move QOM typedefs and add missing includes sifive_u: Rename memmap enum constants sifive_e: Rename memmap enum constants Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2020-09-18scripts/codeconverter: Update to latest versionEduardo Habkost
I'm not documenting every single change in the codeconverter script because most of that code will be deleted once we finish the QOM code conversion. This patch updates the script to the latest version that was used to perform changes in the QOM code. Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Message-Id: <20200916182519.415636-2-ehabkost@redhat.com> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
2020-09-18analyze-migration.py: fix read_migration_debug_json() return typeAlexey Kirillov
Since we use result of read_migration_debug_json() as JSON formatted string, we must provide proper type. Before Python 3.6 json.loads() method support only str typed input. Signed-off-by: Alexey Kirillov <lekiravi@yandex-team.ru> Message-Id: <20200715152135.20287-1-lekiravi@yandex-team.ru> [ehabkost: added comment explaining why decode() is needed} Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
2020-09-18scripts/simplebench: compare write request performanceAndrey Shinkevich
The script 'bench_write_req.py' allows comparing performances of write request for two qemu-img binary files. An example with (qemu-img binary 1) and without (qemu-img binary 2) the applied patch "qcow2: skip writing zero buffers to empty COW areas" (git commit ID: c8bb23cbdbe32f5) has the following results: SSD: ---------------- ------------------- ------------------- <qemu-img binary 1> <qemu-img binary 2> <cluster front> 0.10 +- 0.00 8.16 +- 0.65 <cluster middle> 0.10 +- 0.00 7.37 +- 1.10 <cross cluster> 7.40 +- 1.08 21.97 +- 4.19 <cluster 64K> 2.14 +- 0.94 8.48 +- 1.66 ---------------- ------------------- ------------------- HDD: ---------------- ------------------- ------------------- <qemu-img binary 1> <qemu-img binary 2> <cluster front> 2.30 +- 0.01 6.19 +- 0.06 <cluster middle> 2.20 +- 0.09 6.20 +- 0.06 <cross cluster> 8.32 +- 0.16 8.26 +- 0.14 <cluster 64K> 8.20 +- 0.05 6.26 +- 0.10 ---------------- ------------------- ------------------- Suggested-by: Denis V. Lunev <den@openvz.org> Suggested-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> Signed-off-by: Andrey Shinkevich <andrey.shinkevich@virtuozzo.com> Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> Message-Id: <1594741846-475697-1-git-send-email-andrey.shinkevich@virtuozzo.com> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
2020-09-17scripts/: fix some comment spelling errorszhaolichang
I found that there are many spelling errors in the comments of qemu, so I used the spellcheck tool to check the spelling errors and finally found some spelling errors in the scripts folder. Signed-off-by: zhaolichang <zhaolichang@huawei.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Message-Id: <20200917075029.313-5-zhaolichang@huawei.com> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2020-09-16scripts/git.orderfile: Display meson files along with buildsys onesPhilippe Mathieu-Daudé
Since commit a56650518f5 ("configure: integrate Meson in the build system") we replaced many Makefile by Meson files. Adapt the git.orderfile script to display the new file at the same position. Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> Reviewed-by: Stefano Garzarella <sgarzare@redhat.com> Message-Id: <20200907161222.41915-1-philmd@redhat.com> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2020-09-14decodetree: Improve identifier matchingRichard Henderson
Only argument set members have to be C identifiers, everything else gets prefixed during conversion to C. Some places just checked the leading character, and some places matched a leading character plus a C identifier. Convert everything to match full identifiers, including the [&%@&] prefix, and drop the full C identifier requirement. Reported-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Message-id: 20200903192334.1603773-1-richard.henderson@linaro.org Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2020-09-11Merge remote-tracking branch ↵Peter Maydell
'remotes/ehabkost/tags/machine-next-pull-request' into staging QOM boilerplate cleanup Documentation build fix: * memory: Remove kernel-doc comment marker (Eduardo Habkost) QOM cleanups: * Rename QOM macros for consistency between TYPE_* and type checking constants (Eduardo Habkost) QOM new macros: * OBJECT_DECLARE_* and OBJECT_DEFINE_* macros (Daniel P. Berrangé) * DECLARE_*_CHECKER macros (Eduardo Habkost) Automated QOM boilerplate changes: * Automated changes to use DECLARE_*_CHECKER (Eduardo Habkost * Automated changes to use OBJECT_DECLARE* (Eduardo Habkost) # gpg: Signature made Thu 10 Sep 2020 19:17:49 BST # gpg: using RSA key 5A322FD5ABC4D3DBACCFD1AA2807936F984DC5A6 # gpg: issuer "ehabkost@redhat.com" # gpg: Good signature from "Eduardo Habkost <ehabkost@redhat.com>" [full] # Primary key fingerprint: 5A32 2FD5 ABC4 D3DB ACCF D1AA 2807 936F 984D C5A6 * remotes/ehabkost/tags/machine-next-pull-request: (33 commits) virtio-vga: Use typedef name for instance_size vhost-user-vga: Use typedef name for instance_size xilinx_axienet: Use typedef name for instance_size lpc_ich9: Use typedef name for instance_size omap_intc: Use typedef name for instance_size xilinx_axidma: Use typedef name for instance_size tusb6010: Rename TUSB to TUSB6010 pc87312: Rename TYPE_PC87312_SUPERIO to TYPE_PC87312 vfio: Rename PCI_VFIO to VFIO_PCI usb: Rename USB_SERIAL_DEV to USB_SERIAL sabre: Rename SABRE_DEVICE to SABRE rs6000_mc: Rename RS6000MC_DEVICE to RS6000MC filter-rewriter: Rename FILTER_COLO_REWRITER to FILTER_REWRITER esp: Rename ESP_STATE to ESP ahci: Rename ICH_AHCI to ICH9_AHCI vmgenid: Rename VMGENID_DEVICE to TYPE_VMGENID vfio: Rename VFIO_AP_DEVICE_TYPE to TYPE_VFIO_AP_DEVICE dev-smartcard-reader: Rename CCID_DEV_NAME to TYPE_USB_CCID_DEV ap-device: Rename AP_DEVICE_TYPE to TYPE_AP_DEVICE gpex: Fix type checking function name ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2020-09-09scripts/cleanup-trace-events: Emit files in alphabetical orderMarkus Armbruster
Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-id: 20200806141334.3646302-3-armbru@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2020-09-09scripts/cleanup-trace-events: Fix for vcpu propertyMarkus Armbruster
Commit a44cf524f8 "scripts/cleanup-trace-events: Update for current practice" limited search to the input file's directory. That's wrong for events with the vcpu property, because these can only be defined in root directory. Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-id: 20200806141334.3646302-2-armbru@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2020-09-09scripts/tracetool: Use void pointer for vcpuRoman Bolshakov
dtrace on macOS complains that CPUState * is used for a few probes: dtrace: failed to compile script trace-dtrace-root.dtrace: line 130: syntax error near "CPUState" A comment in scripts/tracetool/__init__.py mentions that: We only want to allow standard C types or fixed sized integer types. We don't want QEMU specific types as we can't assume trace backends can resolve all the typedefs Fixes: 3d211d9f4dbee ("trace: Add 'vcpu' event property to trace guest vCPU") Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Roman Bolshakov <r.bolshakov@yadro.com> Message-id: 20200717093517.73397-3-r.bolshakov@yadro.com Cc: Cameron Esfahani <dirty@apple.com> Signed-off-by: Roman Bolshakov <r.bolshakov@yadro.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2020-09-09scripts/tracetool: Fix dtrace generation for macOSRoman Bolshakov
dtrace USDT is fully supported since OS X 10.6. There are a few peculiarities compared to other dtrace flavors. 1. It doesn't accept empty files. 2. It doesn't recognize bool type but accepts C99 _Bool. 3. It converts int8_t * in probe points to char * in header files and introduces [-Wpointer-sign] warning. Cc: Cameron Esfahani <dirty@apple.com> Signed-off-by: Roman Bolshakov <r.bolshakov@yadro.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Message-id: 20200717093517.73397-2-r.bolshakov@yadro.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2020-09-08codeconverter: script for automating QOM code cleanupsEduardo Habkost
This started as a simple script that scanned for regular expressions, but became more and more complex when exceptions to the rules were found. I don't know if this should be maintained in the QEMU source tree long term (maybe it can be reused for other code transformations that Coccinelle can't handle). In either case, this is included as part of the patch series to document how exactly the automated code transformations in the next patches were done. Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Message-Id: <20200831210740.126168-7-ehabkost@redhat.com> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
2020-09-08Merge remote-tracking branch 'remotes/armbru/tags/pull-qapi-2020-09-08' into ↵Peter Maydell
staging QAPI patches patches for 2020-09-08 # gpg: Signature made Tue 08 Sep 2020 07:06:52 BST # 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-09-08: qapi/block-core.json: Fix nbd-server-start docs qapi: Fix indentation, again qapi/migration.json: Fix indentation qapi: Make section headings start a new doc comment block qapi: Reject section markup in definition documentation Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2020-09-08meson: Convert undefsym.sh to undefsym.pyYonggang Luo
Shell scripts are not easily invoked from the build process on MSYS, so convert undefsym.sh to a python script. Signed-off-by: Yonggang Luo <luoyonggang@gmail.com> Message-Id: <20200902170054.810-3-luoyonggang@gmail.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2020-09-08oss-fuzz: fix rpathAlexander Bulekov
Prior to this change, readelf -d build/out/qemu/qemu-fuzz-i386-target-virtio-net-slirp ... 0x000000000000000f (RPATH) Library rpath: ['$$ORIGIN/lib':$ORIGIN/migration:$ORIGIN/] As of 1a4db552d8 ("ninjatool: quote dollars in variables"), we don't need to manually double the dollars. Also, remove the single-quotes as they are copied into the rpath. After this change: 0x000000000000000f (RPATH) Library rpath: [$ORIGIN/lib:$ORIGIN/migration:$ORIGIN/] Signed-off-by: Alexander Bulekov <alxndr@bu.edu> Message-Id: <20200902142657.112879-3-alxndr@bu.edu> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2020-09-08meson: compute config_all_devices directlyPaolo Bonzini
There is no need anymore to produce config-all-devices.mak, compute the resulting dictionary directly instead of going through grepy.sh. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2020-09-08meson: convert the speed testsPaolo Bonzini
Use meson benchmark() for them, adjust mtest2make.py for that. A new target "make bench" can be used to run all benchmarks. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20200828110734.1638685-14-marcandre.lureau@redhat.com> [Rewrite mtest2make part. - Paolo] Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2020-09-08ninjatool: use constant names for stamp filesPaolo Bonzini
Numbering files according to rules causes confusion, because CUSTOM_COMMAND3.stamp from a previous build might represent completely different targets after Makefile.ninja is regenerated. As a result, the new targets are not rebuilt and compilation fails. Use the targets to build a SHA1 hash; the chances for collision are one in 2^24 even with a 12-character prefix of the hash. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2020-09-08mtest2make: unify tests that appear in multiple suitesPaolo Bonzini
Whenever a test appears in multiple suites, the rules generated by mtest2make are currently running it twice. Instead, after this patch we generate a phony target for each test and we have a generic "run-tests" target depend on all the tests that were chosen on the command line. Tests that appear in multiple suites will be added to the prerequisites just once. This has other advantages: it removes the handling of -k and it increases parallelism. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2020-09-08mtest2make: hide output of successful testsPaolo Bonzini
The softfloat tests are quite noisy; before the Meson conversion they buffered the output in a file and emitted the output only if the test failed. Tweak mtest2make.py so that the courtesy is extended to all non-TAP tests. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2020-09-08mtest2make: split working directory from test commandPaolo Bonzini
Pass the working directory and test command in separate macro arguments, so that we will be able to insert a test driver in the next patch. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2020-09-08mtest2make: split environment from test commandPaolo Bonzini
Pass the environment and test command in separate macro arguments, so that we will be able to insert a test driver in the next patch. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2020-09-07qapi: Make section headings start a new doc comment blockMarkus Armbruster
Our current QAPI doc-comment markup allows section headers (introduced with a leading '=' or '==') anywhere in a free-form documentation comment. This works for Texinfo because the generator simply prints a Texinfo section command at that point in the output stream. For rST generation, since we're assembling a tree of docutils nodes, this is awkward because a new section implies starting a new section node at the top level of the tree and generating text into there. Make section headers start a new free-form documentation block, so the future rST document generator doesn't have to look at every line in free-form blocks and handle headings in odd places. This change makes no difference to the generated Texinfo. Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20200320091805.5585-3-armbru@redhat.com>
2020-09-07qapi: Reject section markup in definition documentationMarkus Armbruster
Section markup in definition documentation makes no sense and can produce invalid Texinfo. Reject. Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20200320091805.5585-2-armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
2020-09-03scripts/qmp/qom-fuse: Fix getattr(), read() for files in /Markus Armbruster
path, prop = "type".rsplit('/', 1) sets path to "", which doesn't work. Correct to "/". Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20200723142738.1868568-4-armbru@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Reviewed-by: John Snow <jsnow@redhat.com>
2020-09-03scripts/qmp/qom-fuse: Port to current Python module fuseMarkus Armbruster
Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20200723142738.1868568-3-armbru@redhat.com> Reviewed-by: John Snow <jsnow@redhat.com>
2020-09-03scripts/qmp/qom-fuse: Unbreak import of QEMUMonitorProtocolMarkus Armbruster
Commit c7b942d7f8 "scripts/qmp: Fix shebang and imports" messed with it for reasons I don't quite understand. I do understand how it fails now: it neglects to import sys. Fix that. It now fails because it expects an old version of module fuse. That's next. Fixes: c7b942d7f84ef54f266921bf7668d43f1f2c7c79 Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20200723142738.1868568-2-armbru@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Reviewed-by: John Snow <jsnow@redhat.com>
2020-09-03qapi: enable use of g_autoptr with QAPI typesDaniel P. Berrangé
Currently QAPI generates a type and function for free'ing it: typedef struct QCryptoBlockCreateOptions QCryptoBlockCreateOptions; void qapi_free_QCryptoBlockCreateOptions(QCryptoBlockCreateOptions *obj); This is used in the traditional manner: QCryptoBlockCreateOptions *opts = NULL; opts = g_new0(QCryptoBlockCreateOptions, 1); ....do stuff with opts... qapi_free_QCryptoBlockCreateOptions(opts); Since bumping the min glib to 2.48, QEMU has incrementally adopted the use of g_auto/g_autoptr. This allows the compiler to run a function to free a variable when it goes out of scope, the benefit being the compiler can guarantee it is freed in all possible code ptahs. This benefit is applicable to QAPI types too, and given the seriously long method names for some qapi_free_XXXX() functions, is much less typing. This change thus makes the code generator emit: G_DEFINE_AUTOPTR_CLEANUP_FUNC(QCryptoBlockCreateOptions, qapi_free_QCryptoBlockCreateOptions) The above code example now becomes g_autoptr(QCryptoBlockCreateOptions) opts = NULL; opts = g_new0(QCryptoBlockCreateOptions, 1); ....do stuff with opts... Note, if the local pointer needs to live beyond the scope holding the variable, then g_steal_pointer can be used. This is useful to return the pointer to the caller in the success codepath, while letting it be freed in all error codepaths. return g_steal_pointer(&opts); The crypto/block.h header needs updating to avoid symbol clash now that the g_autoptr support is a standard QAPI feature. Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> Message-Id: <20200723153845.2934357-1-berrange@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
2020-09-01meson: add NSIS buildingMarc-André Lureau
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Message-Id: <20200826110419.528931-9-marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2020-09-01meson: install scripts/qemu-trace-stapMarc-André Lureau
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20200826130622.553318-3-marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>