summaryrefslogtreecommitdiffstats
path: root/include/qemu/plugin.h
Commit message (Collapse)AuthorAgeFilesLines
* plugins: add [pre|post]fork helpers to linux-userAlex Bennée2022-10-061-0/+24
| | | | | | | | | | | | Special care needs to be taken in ensuring locks are in a consistent state across fork events. Add helpers so the plugin system can ensure that. Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Fixes: https://gitlab.com/qemu-project/qemu/-/issues/358 Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Tested-by: Daniel P. Berrangé <berrange@redhat.com> Message-Id: <20221004115221.2174499-1-alex.bennee@linaro.org>
* plugins: try and make plugin_insn_append more ergonomicAlex Bennée2021-11-041-2/+5
| | | | | | | | | | | | | | | | | | Currently we make the assumption that the guest frontend loads all op code bytes sequentially. This mostly holds up for regular fixed encodings but some architectures like s390x like to re-read the instruction which causes weirdness to occur. Rather than changing the frontends make the plugin API a little more ergonomic and able to handle the re-read case. Stuff will still get strange if we read ahead of the opcode but so far no front ends have done that and this patch asserts the case so we can catch it early if they do. Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Suggested-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20211026102234.3961636-21-alex.bennee@linaro.org>
* plugins: Reorg arguments to qemu_plugin_vcpu_mem_cbRichard Henderson2021-10-061-2/+24
| | | | | | | | | | Use the MemOpIdx directly, rather than the rearrangement of the same bits currently done by the trace infrastructure. Pass in enum qemu_plugin_mem_rw so that we are able to treat read-modify-write operations as a single operation. Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
* tcg/plugins: implement a qemu_plugin_user_exit helperAlex Bennée2021-07-231-0/+12
| | | | | | | | | | | | | | | | In user-mode emulation there is a small race between preexit_cleanup and exit_group() which means we may end up calling instrumented instructions before the kernel reaps child threads. To solve this we implement a new helper which ensures the callbacks are flushed along with any translations before we let the host do it's a thing. While we are at it make the documentation of qemu_plugin_register_atexit_cb clearer as to what the user can expect. Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Mahmoud Mandour <ma.mandourr@gmail.com> Acked-by: Warner Losh <imp@bsdimp.com> Message-Id: <20210720232703.10650-21-alex.bennee@linaro.org>
* plugins: Drop tcg_flags from struct qemu_plugin_dyn_cbRichard Henderson2021-06-191-1/+0Star
| | | | | | | | | As noted by qemu-plugins.h, enum qemu_plugin_cb_flags is currently unused -- plugins can neither read nor write guest registers. Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
* accel/tcg: allow plugin instrumentation to be disable via cflagsAlex Bennée2021-02-181-0/+4
| | | | | | | | | | | | | | | | | | | When icount is enabled and we recompile an MMIO access we end up double counting the instruction execution. To avoid this we introduce the CF_MEMI cflag which only allows memory instrumentation for the next TB (which won't yet have been counted). As this is part of the hashed compile flags we will only execute the generated TB while coming out of a cpu_io_recompile. While we are at it delete the old TODO. We might as well keep the translation handy as it's likely you will repeatedly hit it on each MMIO access. Reported-by: Aaron Lindsay <aaron@os.amperecomputing.com> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Tested-by: Aaron Lindsay <aaron@os.amperecomputing.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20210213130325.14781-21-alex.bennee@linaro.org>
* plugin: propagate errorsPaolo Bonzini2020-12-151-2/+2
| | | | | | | | | | | | qemu_finish_machine_init currently can only exit QEMU if it fails. Prepare for giving it proper error propagation, and possibly for adding a plugin_add monitor command that calls an accelerator method. While at it, make all errors from plugin_load look the same. Reviewed-by: Igor Mammedov <imammedo@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* qemu/plugin: Move !CONFIG_PLUGIN stubs altogetherPhilippe Mathieu-Daudé2020-05-151-18/+15Star
| | | | | | | | | | Simplify the ifdef'ry by moving all stubs together. Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Reviewed-by: Emilio G. Cota <cota@braap.org> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Message-Id: <20200510171119.20827-3-f4bug@amsat.org> Message-Id: <20200513173200.11830-3-alex.bennee@linaro.org>
* qemu/plugin: Trivial code movementPhilippe Mathieu-Daudé2020-05-151-16/+16
| | | | | | | | | | | Move the qemu_plugin_event enum declaration earlier. This will make the next commit easier to review. Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Reviewed-by: Emilio G. Cota <cota@braap.org> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Message-Id: <20200510171119.20827-2-f4bug@amsat.org> Message-Id: <20200513173200.11830-2-alex.bennee@linaro.org>
* plugin: add core codeEmilio G. Cota2019-10-281-0/+255
Signed-off-by: Emilio G. Cota <cota@braap.org> [AJB: moved directory and merged various fixes] Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>