aboutsummaryrefslogtreecommitdiff
path: root/scripts
AgeCommit message (Collapse)AuthorFilesLines
2020-05-04checkpatch: ignore allowed diff listMichael S. Tsirkin1-5/+6
Allow changing allowed diff list at any point: - when changing code under test - when adding expected files It's just a list of files so easy to review and merge anyway. Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2020-05-04checkpatch: fix acpi check with multiple file nameMichael S. Tsirkin1-10/+12
Using global expected/nonexpected values causes false positives when testing multiple patches in one checkpatch run: one patch can change expected, another one non-expected. Use local variables within process() to fix that. Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2020-04-30qapi: Generate simpler marshalling code when no argumentsMarkus Armbruster1-16/+24
When command FOO has no arguments, its generated qmp_marshal_FOO() is a bit confusing. Make it simpler: visit_start_struct(v, NULL, NULL, 0, &err); if (err) { goto out; } - - if (!err) { - visit_check_struct(v, &err); - } + visit_check_struct(v, &err); visit_end_struct(v, NULL); if (err) { goto out; } Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20200424084338.26803-16-armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
2020-04-30qapi: Disallow qmp_marshal_FOO(NULL, ...)Markus Armbruster1-24/+2
For QMP commands without arguments, gen_marshal() laboriously generates a qmp_marshal_FOO() that copes with null @args. Turns there's just one caller that passes null instead of an empty QDict. Adjust that caller, and simplify gen_marshal(). Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20200424084338.26803-15-armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
2020-04-30qapi: Assert non-input visitors see only valid alternate tagsMarkus Armbruster1-0/+1
An alternate type's visit_type_FOO() fails when it runs into an invalid ->type. This is appropriate with an input visitor: visit_start_alternate() sets ->type according to the input, and bad input can lead to bad ->type. It should never happen with an output, clone or dealloc visitor: if it did, the alternate being output, cloned or deallocated would be messed up beyond repair. Assert that. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-Id: <20200424084338.26803-12-armbru@redhat.com>
2020-04-30qapi: Clean up visitor's recovery from input with invalid typeMarkus Armbruster1-0/+3
An alternate type's visit_type_FOO() fails when it runs into an invalid ->type. If it's an input visit, we then need to free the the object we got from visit_start_alternate(). We do that with qapi_free_FOO(), which uses the dealloc visitor. Trouble is that object is in a bad state: its ->type is invalid. So the dealloc visitor will run into the same error again, and the error recovery skips deallocating the alternate's (invalid) alternative. Works, because qapi_free_FOO() ignores the error. Avoid it instead: free the messed up object with by g_free(). Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20200424084338.26803-11-armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
2020-04-30qapi: Assert incomplete object occurs only in dealloc visitorMarkus Armbruster1-0/+4
Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-Id: <20200424084338.26803-7-armbru@redhat.com>
2020-04-14kernel-doc: Use c:struct for Sphinx 3.0 and laterPeter Maydell1-1/+15
The kernel-doc Sphinx plugin and associated script currently emit 'c:type' directives for "struct foo" documentation. Sphinx 3.0 warns about this: /home/petmay01/linaro/qemu-from-laptop/qemu/docs/../include/exec/memory.h:3: WARNING: Type must be either just a name or a typedef-like declaration. If just a name: Error in declarator or parameters Invalid C declaration: Expected identifier in nested name, got keyword: struct [error at 6] struct MemoryListener ------^ If typedef-like declaration: Error in declarator or parameters Invalid C declaration: Expected identifier in nested name. [error at 21] struct MemoryListener ---------------------^ because it wants us to use the new-in-3.0 'c:struct' instead. Plumb the Sphinx version through to the kernel-doc script and use it to select 'c:struct' for newer versions than 3.0. Fixes: LP:1872113 Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
2020-04-14scripts/kernel-doc: Add missing close-paren in c:function directivesPeter Maydell1-1/+1
When kernel-doc generates a 'c:function' directive for a function one of whose arguments is a function pointer, it fails to print the close-paren after the argument list of the function pointer argument, for instance in the memory API documentation: .. c:function:: void memory_region_init_resizeable_ram (MemoryRegion * mr, struct Object * owner, const char * name, uint64_t size, uint64_t max_size, void (*resized) (const char*, uint64_t length, void *host, Error ** errp) which should have a ')' after the 'void *host' which is the last argument to 'resized'. Older versions of Sphinx don't try to parse the argumnet to c:function, but Sphinx 3.0 does do this and will complain: /home/petmay01/linaro/qemu-from-laptop/qemu/docs/../include/exec/memory.h:834: WARNING: Error in declarator or parameters Invalid C declaration: Expecting "," or ")" in parameters, got "EOF". [error at 208] void memory_region_init_resizeable_ram (MemoryRegion * mr, struct Object * owner, const char * name, uint64_t size, uint64_t max_size, void (*resized) (const char*, uint64_t length, void *host, Error ** errp) ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------^ Add the missing close-paren. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-id: 20200411182934.28678-3-peter.maydell@linaro.org Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
2020-04-14scripts/coverity-scan: Add Docker supportPeter Maydell2-0/+221
Add support for running the Coverity Scan tools inside a Docker container rather than directly on the host system. Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Message-id: 20200319193323.2038-7-peter.maydell@linaro.org
2020-04-14scripts/run-coverity-scan: Script to run Coverity Scan buildPeter Maydell1-0/+311
Add a new script to automate the process of running the Coverity Scan build tools and uploading the resulting tarball to the website. This is intended eventually to be driven from Travis, but it can be run locally, if you are a maintainer of the QEMU project on the Coverity Scan website and have the secret upload token. The script must be run on a Fedora 30 system. Support for using a Docker container is added in a following commit. Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Message-id: 20200319193323.2038-6-peter.maydell@linaro.org
2020-04-04scripts/coccinelle: add error-use-after-free.cocciVladimir Sementsov-Ogievskiy1-0/+52
Add script to find and fix trivial use-after-free of Error objects. How to use: spatch --sp-file scripts/coccinelle/error-use-after-free.cocci \ --macro-file scripts/cocci-macro-file.h --in-place \ --no-show-diff ( FILES... | --use-gitgrep . ) Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> Message-Id: <20200324153630.11882-2-vsementsov@virtuozzo.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Markus Armbruster <armbru@redhat.com> [Pastos in commit message and comment fixed, globbing in MAINTAINERS expanded] Signed-off-by: Markus Armbruster <armbru@redhat.com>
2020-03-31Merge remote-tracking branch 'remotes/mst/tags/for_upstream' into stagingPeter Maydell1-0/+25
virtio, pci, pc: bugfixes, checkpatch, maintainers Bugfixes all over the place. Add a new balloon maintainer. A checkpatch enhancement to enforce ACPI change rules. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> # gpg: Signature made Tue 31 Mar 2020 15:54:36 BST # gpg: using RSA key 5D09FD0871C8F85B94CA8A0D281F0DB8D28D5469 # gpg: issuer "mst@redhat.com" # gpg: Good signature from "Michael S. Tsirkin <mst@kernel.org>" [full] # gpg: aka "Michael S. Tsirkin <mst@redhat.com>" [full] # Primary key fingerprint: 0270 606B 6F3C DF3D 0B17 0970 C350 3912 AFBE 8E67 # Subkey fingerprint: 5D09 FD08 71C8 F85B 94CA 8A0D 281F 0DB8 D28D 5469 * remotes/mst/tags/for_upstream: vhost-vsock: fix double close() in the realize() error path acpi: add acpi=OnOffAuto machine property to x86 and arm virt fix vhost_user_blk_watch crash hw/i386/amd_iommu.c: Fix corruption of log events passed to guest virtio-iommu: avoid memleak in the unrealize virtio-blk: delete vqs on the error path in realize() acpi: pcihp: fix left shift undefined behavior in acpi_pcihp_eject_slot() virtio-serial-bus: Plug memory leak on realize() error paths MAINTAINERS: Add myself as virtio-balloon co-maintainer checkpatch: enforce process for expected files Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2020-03-30decodetree: Use Python3 floor division operatorPhilippe Mathieu-Daudé1-2/+2
This script started using Python2, where the 'classic' division operator returns the floor result. In commit 3d004a371 we started to use Python3, where the division operator returns the float result ('true division'). To keep the same behavior, use the 'floor division' operator "//" which returns the floor result. Fixes: 3d004a371 Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Message-Id: <20200330121345.14665-1-f4bug@amsat.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2020-03-29checkpatch: enforce process for expected filesMichael S. Tsirkin1-0/+25
If the process documented in tests/qtest/bios-tables-test.c is followed, then same patch never touches both expected files and code. Teach checkpatch to enforce this rule. Tested-by: Igor Mammedov <imammedo@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2020-03-20Merge remote-tracking branch ↵Peter Maydell3-0/+208
'remotes/vivier2/tags/linux-user-for-5.0-pull-request' into staging update syscall numbers to linux 5.5 (with scripts) add clock_gettime64/clock_settime64 add AT_EXECFN v4: restore syscall.tbl series but remove vsyscall series v3: remove syscall.tbl series v2: guard copy_to_user_timezone() with TARGET_NR_gettimeofday remove "Support futex_time64" patch guard sys_futex with TARGET_NR_exit # gpg: Signature made Fri 20 Mar 2020 15:23:29 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/linux-user-for-5.0-pull-request: (32 commits) linux-user, openrisc: sync syscall numbers with kernel v5.5 linux-user, nios2: sync syscall numbers with kernel v5.5 linux-user, aarch64: sync syscall numbers with kernel v5.5 scripts: add a script to generate syscall_nr.h linux-user,mips: update syscall-args-o32.c.inc linux-user,mips: move content of mips_syscall_args linux-user: update syscall.tbl from linux 0bf999f9c5e7 linux-user, scripts: add a script to update syscall.tbl linux-user, mips64: add syscall table generation support linux-user, mips: add syscall table generation support linux-user, x86_64: add syscall table generation support linux-user, i386: add syscall table generation support linux-user, x86_64, i386: cleanup TARGET_NR_arch_prctl linux-user, sparc, sparc64: add syscall table generation support linux-user, s390x: add syscall table generation support linux-user, s390x: remove syscall definitions for !TARGET_S390X linux-user, ppc: add syscall table generation support linux-user, arm: add syscall table generation support linux-user, microblaze: add syscall table generation support linux-user, sh4: add syscall table generation support ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2020-03-20scripts: add a script to generate syscall_nr.hLaurent Vivier1-0/+102
This script is needed for targets based on asm-generic syscall numbers generation Signed-off-by: Laurent Vivier <laurent@vivier.eu> Reviewed-by: Alistair Francis <alistair.francis@wdc.com> Reviewed-by: Taylor Simpson <tsimpson@quicinc.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20200316085620.309769-2-laurent@vivier.eu> [lv: added file in MAINTAINERS]
2020-03-20linux-user,mips: update syscall-args-o32.c.incLaurent Vivier1-0/+57
Add a script to update the file from strace github and run it Signed-off-by: Laurent Vivier <laurent@vivier.eu> Reviewed-by: Taylor Simpson <tsimpson@quicinc.com> Message-Id: <20200310103403.3284090-22-laurent@vivier.eu> [lv: added file in MAINTAINERS] Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2020-03-20linux-user, scripts: add a script to update syscall.tblLaurent Vivier1-0/+49
scripts/update-syscalltbl.sh has the list of syscall.tbl to update and can copy them from the linux source directory Signed-off-by: Laurent Vivier <laurent@vivier.eu> Reviewed-by: Taylor Simpson <tsimpson@quicinc.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20200310103403.3284090-19-laurent@vivier.eu> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2020-03-20Merge remote-tracking branch ↵Peter Maydell3-0/+327
'remotes/ehabkost/tags/python-next-pull-request' into staging Python queue for 5.0 soft freeze * Add scripts/simplebench (Vladimir Sementsov-Ogievskiy) # gpg: Signature made Wed 18 Mar 2020 01:11:49 GMT # 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/python-next-pull-request: MAINTAINERS: add simplebench scripts/simplebench: add example usage of simplebench scripts/simplebench: add qemu/bench_block_job.py scripts/simplebench: add simplebench.py Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2020-03-19Merge remote-tracking branch ↵Peter Maydell1-0/+47
'remotes/ehabkost/tags/x86-and-machine-pull-request' into staging x86 and machine queue for 5.0 soft freeze Bug fixes: * memory encryption: Disable mem merge (Dr. David Alan Gilbert) Features: * New EPYC CPU definitions (Babu Moger) * Denventon-v2 CPU model (Tao Xu) * New 'note' field on versioned CPU models (Tao Xu) Cleanups: * x86 CPU topology cleanups (Babu Moger) * cpu: Use DeviceClass reset instead of a special CPUClass reset (Peter Maydell) # gpg: Signature made Wed 18 Mar 2020 01:16:43 GMT # 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/x86-and-machine-pull-request: hw/i386: Rename apicid_from_topo_ids to x86_apicid_from_topo_ids hw/i386: Update structures to save the number of nodes per package hw/i386: Remove unnecessary initialization in x86_cpu_new machine: Add SMP Sockets in CpuTopology hw/i386: Consolidate topology functions hw/i386: Introduce X86CPUTopoInfo to contain topology info cpu: Use DeviceClass reset instead of a special CPUClass reset machine/memory encryption: Disable mem merge hw/i386: Rename X86CPUTopoInfo structure to X86CPUTopoIDs i386: Add 2nd Generation AMD EPYC processors i386: Add missing cpu feature bits in EPYC model target/i386: Add new property note to versioned CPU models target/i386: Add Denverton-v2 (no MPX) CPU model Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2020-03-19Merge remote-tracking branch 'remotes/armbru/tags/pull-qapi-2020-03-17' into ↵Peter Maydell8-291/+329
staging QAPI patches for 2020-03-17 # gpg: Signature made Tue 17 Mar 2020 20:50:54 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-03-17: (30 commits) net: Track netdevs in NetClientState rather than QemuOpt net: Complete qapi-fication of netdev_add qmp: constify QmpCommand and list qapi: Mark deprecated QMP parts with feature 'deprecated' qapi: New special feature flag "deprecated" qapi: Replace qmp_dispatch()'s TODO comment by an explanation qapi: Simplify how qmp_dispatch() gets the request ID qapi: Simplify how qmp_dispatch() deals with QCO_NO_SUCCESS_RESP qapi: Inline do_qmp_dispatch() into qmp_dispatch() qapi: Add feature flags to struct members qapi/schema: Call QAPIDoc.connect_member() in just one place qapi/schema: Rename QAPISchemaObjectType{Variant,Variants} qapi/schema: Reorder classes so related ones are together qapi/schema: Change _make_features() to a take feature list qapi/introspect: Factor out _make_tree() qapi/introspect: Rename *qlit* to reduce confusion qapi: Consistently put @features parameter right after @ifcond qapi: Add feature flags to remaining definitions qapi/schema: Clean up around QAPISchemaEntity.connect_doc() tests/test-qmp-event: Check event is actually emitted ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2020-03-17scripts/simplebench: add example usage of simplebenchVladimir Sementsov-Ogievskiy1-0/+80
This example may be used as a template for custom benchmark. It illustrates three things to prepare: - define bench_func - define test environments (columns) - define test cases (rows) And final call of simplebench API. Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> Reviewed-by: Aleksandar Markovic <amarkovic@wavecomp.com> Message-Id: <20200228071914.11746-4-vsementsov@virtuozzo.com> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
2020-03-17scripts/simplebench: add qemu/bench_block_job.pyVladimir Sementsov-Ogievskiy1-0/+119
Add block-job benchmarking helper functions. Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> Reviewed-by: Aleksandar Markovic <amarkovic@wavecomp.com> Message-Id: <20200228071914.11746-3-vsementsov@virtuozzo.com> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
2020-03-17scripts/simplebench: add simplebench.pyVladimir Sementsov-Ogievskiy1-0/+128
Add simple benchmark table creator. Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> Reviewed-by: Aleksandar Markovic <amarkovic@wavecomp.com> Message-Id: <20200228071914.11746-2-vsementsov@virtuozzo.com> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
2020-03-17cpu: Use DeviceClass reset instead of a special CPUClass resetPeter Maydell1-0/+47
The CPUClass has a 'reset' method. This is a legacy from when TYPE_CPU used not to inherit from TYPE_DEVICE. We don't need it any more, as we can simply use the TYPE_DEVICE reset. The 'cpu_reset()' function is kept as the API which most places use to reset a CPU; it is now a wrapper which calls device_cold_reset() and then the tracepoint function. This change should not cause CPU objects to be reset more often than they are at the moment, because: * nobody is directly calling device_cold_reset() or qdev_reset_all() on CPU objects * no CPU object is on a qbus, so they will not be reset either by somebody calling qbus_reset_all()/bus_cold_reset(), or by the main "reset sysbus and everything in the qbus tree" reset that most devices are reset by Note that this does not change the need for each machine or whatever to use qemu_register_reset() to arrange to call cpu_reset() -- that is necessary because CPU objects are not on any qbus, so they don't get reset when the qbus tree rooted at the sysbus bus is reset, and this isn't being changed here. All the changes to the files under target/ were made using the included Coccinelle script, except: (1) the deletion of the now-inaccurate and not terribly useful "CPUClass::reset" comments was done with a perl one-liner afterwards: perl -n -i -e '/ CPUClass::reset/ or print' target/*/*.c (2) this bit of the s390 change was done by hand, because the Coccinelle script is not sophisticated enough to handle the parent_reset call being inside another function: | @@ -96,8 +96,9 @@ static void s390_cpu_reset(CPUState *s, cpu_reset_type type) | S390CPU *cpu = S390_CPU(s); | S390CPUClass *scc = S390_CPU_GET_CLASS(cpu); | CPUS390XState *env = &cpu->env; |+ DeviceState *dev = DEVICE(s); | |- scc->parent_reset(s); |+ scc->parent_reset(dev); | cpu->env.sigp_order = 0; | s390_cpu_set_state(S390_CPU_STATE_STOPPED, cpu); Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Message-Id: <20200303100511.5498-1-peter.maydell@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
2020-03-17qapi: New special feature flag "deprecated"Markus Armbruster1-0/+6
Unlike regular feature flags, the new special feature flag "deprecated" is recognized by the QAPI generator. For now, it's only permitted with commands, events, and struct members. It will be put to use shortly. Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20200317115459.31821-26-armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> [Doc typo fixed]
2020-03-17qapi: Add feature flags to struct membersMarkus Armbruster3-7/+23
Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20200317115459.31821-21-armbru@redhat.com>
2020-03-17qapi/schema: Call QAPIDoc.connect_member() in just one placeMarkus Armbruster1-11/+12
The .connect_doc() of classes that have QAPISchemaMember connect them to their documentation. Change them to delegate the actual work to new QAPISchemaMember.connect_doc(). Matches the .connect_doc() that already exist. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20200317115459.31821-20-armbru@redhat.com>
2020-03-17qapi/schema: Rename QAPISchemaObjectType{Variant,Variants}Markus Armbruster1-11/+11
QAPISchemaObjectTypeVariants represents both object type and alternate type variants. Rename to QAPISchemaVariants. Rename QAPISchemaObjectTypeVariant the same way. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20200317115459.31821-19-armbru@redhat.com>
2020-03-17qapi/schema: Reorder classes so related ones are togetherMarkus Armbruster1-134/+134
Move QAPISchemaAlternateType up some, so that all QAPISchemaFOOType are together. Move QAPISchemaObjectTypeVariants right behind its users. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20200317115459.31821-18-armbru@redhat.com>
2020-03-17qapi/schema: Change _make_features() to a take feature listMarkus Armbruster1-8/+9
QAPISchema._make_features() takes a definition expression, and extracts its 'features' member. The other ._make_FOO() leave destructuring expressions to their callers. Change ._make_features() to match them. Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20200317115459.31821-17-armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
2020-03-17qapi/introspect: Factor out _make_tree()Markus Armbruster1-20/+24
The value of @qmp_schema_qlit is generated from an expression tree. Tree nodes are created in several places. Factor out the common code into _make_tree(). This isn't much of a win now. It will pay off when we add feature flags in the next few commits. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20200317115459.31821-16-armbru@redhat.com>
2020-03-17qapi/introspect: Rename *qlit* to reduce confusionMarkus Armbruster1-17/+18
We generate the value of qmp_schema_qlit from an expression tree. The function doing that is named to_qlit(), and its inputs are accumulated in QAPISchemaGenIntrospectVisitor._qlits. We call both its input and its output "qlit". This is confusing. Use "tree" for input, and "qlit" only for output: rename to_qlit() to _tree_to_qlit(), ._qlits to ._trees, ._gen_qlit() to ._gen_tree(). Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20200317115459.31821-15-armbru@redhat.com>
2020-03-17qapi: Consistently put @features parameter right after @ifcondMarkus Armbruster6-36/+34
Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-Id: <20200317115459.31821-14-armbru@redhat.com>
2020-03-17qapi: Add feature flags to remaining definitionsMarkus Armbruster7-74/+80
In v4.1.0, we added feature flags just to struct types (commit 6a8c0b5102^..f3ed93d545), to satisfy an immediate need (commit c9d4070991 "file-posix: Add dynamic-auto-read-only QAPI feature"). In v4.2.0, we added them to commands (commit 23394b4c39 "qapi: Add feature flags to commands") to satisfy another immediate need (commit d76744e65e "qapi: Allow introspecting fix for savevm's cooperation with blockdev"). Add them to the remaining definitions: enumeration types, union types, alternate types, and events. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-Id: <20200317115459.31821-13-armbru@redhat.com>
2020-03-17qapi/schema: Clean up around QAPISchemaEntity.connect_doc()Markus Armbruster1-4/+9
QAPISchemaEntity calls doc.connect_feature() in .check(). Improper since commit ee1e6a1f6c8 split .connect_doc() off .check(). Move the call. Requires making the children call super().connect_doc() as they should. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-Id: <20200317115459.31821-12-armbru@redhat.com>
2020-03-17scripts/cocci: Patch to let devices own their MemoryRegionsPhilippe Mathieu-Daudé1-0/+56
When a device creates a MemoryRegion without setting its ownership, the MemoryRegion is added to the machine "/unattached" container in the QOM tree. Example with the Samsung SMDKC210 board: $ arm-softmmu/qemu-system-arm -M smdkc210 -S -monitor stdio (qemu) info qom-tree /machine (smdkc210-machine) /unattached (container) /io[0] (qemu:memory-region) /exynos4210.dram0[0] (qemu:memory-region) /exynos4210.irom[0] (qemu:memory-region) /exynos4210.iram[0] (qemu:memory-region) /exynos4210.chipid[0] (qemu:memory-region) ... /device[26] (exynos4210.uart) /exynos4210.uart[0] (qemu:memory-region) /soc (exynos4210) ^ \__ [*] The irom/iram/chipid regions should go under 'soc' at [*]. Add a semantic patch to let the device own the memory region. Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
2020-03-17scripts/cocci: Patch to remove unnecessary memory_region_set_readonly()Philippe Mathieu-Daudé1-0/+15
Add a semantic patch to remove memory_region_set_readonly() calls on ROM memory regions. Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
2020-03-17scripts/cocci: Patch to detect potential use of memory_region_init_romPhilippe Mathieu-Daudé1-0/+19
Add a semantic patch to detect potential replacement of memory_region_init_ram(readonly) by memory_region_init_rom(). Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
2020-03-17scripts/cocci: Patch to replace memory_region_init_{ram,readonly -> rom}Philippe Mathieu-Daudé1-0/+18
Add a semantic patch to replace memory_region_init_ram(readonly) by memory_region_init_rom(). Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
2020-03-17scripts/cocci: Rename memory-region-{init-ram -> housekeeping}Philippe Mathieu-Daudé1-0/+13
As we are going to add various semantic changes related to the memory region API, rename this script to be more generic. Add a 'usage' header, and an entry in MAINTAINERS to avoid checkpatch warning. Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
2020-03-12hxtool: Remove Texinfo generation supportPeter Maydell1-77/+1
All the STEXI/ETEXI blocks and the Makfile rules that use them have now been removed from the codebase. We can remove the code from the hxtool script which handles the STEXI/ETEXI directives and the '-t' option. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-id: 20200306171749.10756-4-peter.maydell@linaro.org
2020-03-09maint: Include top-level *.rst files early in git diffEric Blake1-0/+1
We are converting more doc files to *.rst rather than *.texi. Most doc files are already listed early in diffs due to our catchall docs/*, but a few top-level files get missed by that glob. Signed-off-by: Eric Blake <eblake@redhat.com> Reviewed-by: Stefano Garzarella <sgarzare@redhat.com> Message-Id: <20200220162214.3474280-1-eblake@redhat.com> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2020-03-06qemu-storage-daemon: Add --monitor optionKevin Wolf1-0/+5
This adds and parses the --monitor option, so that a QMP monitor can be used in the storage daemon. The monitor offers commands defined in the QAPI schema at storage-daemon/qapi/qapi-schema.json. The --monitor options currently allows to create multiple monitors with the same ID. This part of the interface is considered unstable. We will reject such configurations as soon as we have a design for the monitor subsystem to perform these checks. (In the system emulator, we depend on QemuOpts rejecting duplicate IDs.) Signed-off-by: Kevin Wolf <kwolf@redhat.com> Message-Id: <20200224143008.13362-21-kwolf@redhat.com> Acked-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2020-03-06scripts/hxtool-conv: Archive script used in qemu-options.hx conversionPeter Maydell1-0/+137
This commit archives the perl script used to do conversion of the STEXI/ETEXI blocks in qemu-options.hx. (The other .hx files were manually converted, but qemu-options.hx is complicated enough that I felt I needed some scripting.) Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Tested-by: Alex Bennée <alex.bennee@linaro.org> Message-id: 20200228153619.9906-26-peter.maydell@linaro.org
2020-03-06texi2pod: parse @include directives outside "@c man" blocksPaolo Bonzini1-18/+18
This enables splitting the huge qemu-doc.texi file and keeping parallel Texinfo and rST versions of the documentation. texi2pod is not going to live much longer and hardly anyone cares about its upstream status, so the temporary fork should be acceptable. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Tested-by: Alex Bennée <alex.bennee@linaro.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Message-id: 20200228153619.9906-4-peter.maydell@linaro.org Message-id: 20200226113034.6741-4-pbonzini@redhat.com Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2020-03-05qapi: Brush off some (py)lintMarkus Armbruster6-18/+15
Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20200304155932.20452-5-armbru@redhat.com> Reviewed-by: John Snow <jsnow@redhat.com>
2020-03-05qapi: Use super() now we have Python 3Markus Armbruster9-44/+43
Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20200304155932.20452-4-armbru@redhat.com> Reviewed-by: John Snow <jsnow@redhat.com>
2020-03-05qapi: Drop conditionals for Python 2Markus Armbruster3-15/+3
Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Message-Id: <20200304155932.20452-3-armbru@redhat.com> Reviewed-by: John Snow <jsnow@redhat.com>