Ziyang Zhang
731525c276
plugins: use int64_t for the syscall filter return value
...
The syscall return value passed back through the syscall filter
callback is semantically signed: negative values encode errno codes.
Declaring the sysret pointer as uint64_t * is therefore misleading and
forces callers to launder the value through an unsigned temporary.
Change the sysret pointer to int64_t * across the public plugin API
typedef (qemu_plugin_vcpu_syscall_filter_cb_t), the internal
qemu_plugin_vcpu_syscall_filter() prototypes and stub, its
implementation in plugins/core.c, the linux-user caller, and the
in-tree example plugins.
Signed-off-by: Ziyang Zhang <functioner@sjtu.edu.cn >
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com >
Link: https://lore.kernel.org/qemu-devel/20260618082426.790315-2-functioner@sjtu.edu.cn
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com >
2026-06-18 16:47:12 -07:00
Philippe Mathieu-Daudé
2368ea9744
accel/tcg: Move cpu_loop_exit_*() out of 'exec/cpu-common.h'
...
Move the following TCG-specific cpu_loop_exit_*() declarations
out of the generic "exec/cpu-common.h" header, to the recently
created "accel/tcg/cpu-loop.h" one, documenting them:
- cpu_loop_exit_noexc()
- cpu_loop_exit_atomic()
- cpu_loop_exit_restore()
- cpu_loop_exit()
Include "accel/tcg/cpu-loop.h" where appropriate.
Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com >
Reviewed-by: Richard Henderson <richard.henderson@linaro.org >
Message-Id: <20260617171438.75914-11-philmd@oss.qualcomm.com >
2026-06-18 14:27:21 +02:00
Pierrick Bouvier
25c6c15f7d
plugins: add userdata to qemu_plugin_register_vcpu_syscall_ret_cb
...
Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org >
Link: https://lore.kernel.org/qemu-devel/20260615193526.2883349-23-pierrick.bouvier@oss.qualcomm.com
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com >
2026-06-16 10:59:05 -07:00
Pierrick Bouvier
6a6001021e
plugins: remove qemu_plugin_id from qemu_plugin_vcpu_syscall_ret_cb_t
...
Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org >
Link: https://lore.kernel.org/qemu-devel/20260615193526.2883349-22-pierrick.bouvier@oss.qualcomm.com
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com >
2026-06-16 10:59:05 -07:00
Pierrick Bouvier
d7706f7e89
plugins: add userdata to qemu_plugin_register_vcpu_syscall_filter_cb
...
Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org >
Link: https://lore.kernel.org/qemu-devel/20260615193526.2883349-21-pierrick.bouvier@oss.qualcomm.com
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com >
2026-06-16 10:59:05 -07:00
Pierrick Bouvier
b8cdea393f
plugins: remove qemu_plugin_id from qemu_plugin_vcpu_syscall_filter_cb_t
...
Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org >
Link: https://lore.kernel.org/qemu-devel/20260615193526.2883349-20-pierrick.bouvier@oss.qualcomm.com
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com >
2026-06-16 10:59:05 -07:00
Pierrick Bouvier
1abe87fd59
plugins: add userdata to qemu_plugin_register_vcpu_syscall_cb
...
Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org >
Link: https://lore.kernel.org/qemu-devel/20260615193526.2883349-19-pierrick.bouvier@oss.qualcomm.com
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com >
2026-06-16 10:59:05 -07:00
Pierrick Bouvier
0d71602089
plugins: remove qemu_plugin_id from qemu_plugin_vcpu_syscall_cb_t
...
Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org >
Link: https://lore.kernel.org/qemu-devel/20260615193526.2883349-18-pierrick.bouvier@oss.qualcomm.com
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com >
2026-06-16 10:59:05 -07:00
Pierrick Bouvier
285c40aaac
plugins: add userdata to qemu_plugin_vcpu_tb_trans_cb_t
...
Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org >
Link: https://lore.kernel.org/qemu-devel/20260615193526.2883349-17-pierrick.bouvier@oss.qualcomm.com
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com >
2026-06-16 10:59:05 -07:00
Pierrick Bouvier
ab24e19b42
plugins: remove qemu_plugin_id from qemu_plugin_vcpu_tb_trans_cb_t
...
Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org >
Link: https://lore.kernel.org/qemu-devel/20260615193526.2883349-16-pierrick.bouvier@oss.qualcomm.com
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com >
2026-06-16 10:59:05 -07:00
Pierrick Bouvier
65f399bce2
plugins: remove qemu_plugin_id from qemu_plugin_vcpu_discon_cb_t
...
Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org >
Link: https://lore.kernel.org/qemu-devel/20260615193526.2883349-15-pierrick.bouvier@oss.qualcomm.com
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com >
2026-06-16 10:59:05 -07:00
Pierrick Bouvier
041dca1e1b
plugins: add userdata to qemu_plugin_register_vcpu_discon_cb
...
Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org >
Link: https://lore.kernel.org/qemu-devel/20260615193526.2883349-14-pierrick.bouvier@oss.qualcomm.com
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com >
2026-06-16 10:59:05 -07:00
Pierrick Bouvier
0079bbd8d5
plugins: add userdata to qemu_plugin_vcpu_for_each
...
Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org >
Link: https://lore.kernel.org/qemu-devel/20260615193526.2883349-12-pierrick.bouvier@oss.qualcomm.com
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com >
2026-06-16 10:59:05 -07:00
Pierrick Bouvier
e12944179a
plugins: add userdata to qemu_plugin_register_vcpu_resume_cb
...
Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org >
Link: https://lore.kernel.org/qemu-devel/20260615193526.2883349-11-pierrick.bouvier@oss.qualcomm.com
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com >
2026-06-16 10:59:05 -07:00
Pierrick Bouvier
89662f8903
plugins: add userdata to qemu_plugin_register_vcpu_idle_cb
...
Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org >
Link: https://lore.kernel.org/qemu-devel/20260615193526.2883349-10-pierrick.bouvier@oss.qualcomm.com
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com >
2026-06-16 10:59:05 -07:00
Pierrick Bouvier
214d9c0e33
plugins: add userdata to qemu_plugin_register_vcpu_exit_cb
...
Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org >
Link: https://lore.kernel.org/qemu-devel/20260615193526.2883349-9-pierrick.bouvier@oss.qualcomm.com
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com >
2026-06-16 10:59:05 -07:00
Pierrick Bouvier
7cb918441a
plugins: add userdata to qemu_plugin_register_vcpu_init_cb
...
Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org >
Link: https://lore.kernel.org/qemu-devel/20260615193526.2883349-8-pierrick.bouvier@oss.qualcomm.com
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com >
2026-06-16 10:59:05 -07:00
Pierrick Bouvier
6be156bd4d
plugins: remove qemu_plugin_id_t from qemu_plugin_vcpu_simple_cb_t
...
Not used in all our plugins.
Future commits will remove qemu_plugin_vcpu_simple_cb_t completely, and
replace it with qemu_plugin_vcpu_udata_cb_t, so id information can be
passed using userdata if needed.
Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org >
Reviewed-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com >
Link: https://lore.kernel.org/qemu-devel/20260615193526.2883349-7-pierrick.bouvier@oss.qualcomm.com
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com >
2026-06-16 10:59:05 -07:00
Pierrick Bouvier
32a0ddf36a
plugins: remove qemu_plugin_id_t from qemu_plugin_udata_cb_t
...
We can now rely on userdata being always available to pass down this id
if needed.
In our plugins, only tests/tcg/plugins/reset.c was using it.
Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org >
Link: https://lore.kernel.org/qemu-devel/20260615193526.2883349-6-pierrick.bouvier@oss.qualcomm.com
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com >
2026-06-16 10:59:05 -07:00
Pierrick Bouvier
58ba4498d8
plugins: add userdata to qemu_plugin_register_flush_cb
...
Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org >
Link: https://lore.kernel.org/qemu-devel/20260615193526.2883349-4-pierrick.bouvier@oss.qualcomm.com
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com >
2026-06-16 10:59:05 -07:00
Pierrick Bouvier
d3b790036a
plugins: add userdata for qemu_plugin_{uninstall, reset}
...
We do both at the same time because they internally use the same
implementation.
Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org >
Link: https://lore.kernel.org/qemu-devel/20260615193526.2883349-3-pierrick.bouvier@oss.qualcomm.com
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com >
2026-06-16 10:59:05 -07:00
Pierrick Bouvier
e5dcb06798
plugins: bump version
...
Next commits will be breaking changes, so bump min version and version
accordingly.
Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org >
Link: https://lore.kernel.org/qemu-devel/20260615193526.2883349-2-pierrick.bouvier@oss.qualcomm.com
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com >
2026-06-16 10:59:05 -07:00
Peter Maydell
db28f0efdd
plugins/api.c: Use cpu_translate_for_debug()
...
We want to remove the cpu_get_phys_addr_debug() function; update the
plugin code to use cpu_translate_for_debug() instead.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org >
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org >
Reviewed-by: Richard Henderson <richard.henderson@linaro.org >
Message-ID: <20260430093810.2762539-25-peter.maydell@linaro.org >
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org >
2026-05-12 22:35:54 +02:00
Peter Maydell
3bccc43918
plugins/api.c: Trust cpu_get_phys_addr_debug() return address
...
In qemu_plugin_translate_vaddr() we have a workaround for not all
implementations of get_phys_addr_debug returning an exact physaddr
for the input virtual address: we OR back in the page offset to the
return value.
Now that we guarantee that get_phys_addr_debug returns the exact
physaddr for the input virtual address, we can drop this workaround.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org >
Reviewed-by: Richard Henderson <richard.henderson@linaro.org >
Message-id: 20260417173105.1648172-14-peter.maydell@linaro.org
Message-ID: <20260430093810.2762539-15-peter.maydell@linaro.org >
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org >
2026-05-12 22:35:54 +02:00
Peter Maydell
d6aefbc524
target: Rename cpu_get_phys_page_{,attrs_}debug
...
Rename cpu_phys_page_debug() and cpu_phys_page_attrs_debug() to
cpu_phys_addr_debug() and cpu_phys_addr_attrs_debug().
Commit created with:
sed -i -e 's/cpu_get_phys_page_debug/cpu_get_phys_addr_debug/g;s/cpu_get_phys_page_attrs_debug/cpu_get_phys_addr_attrs_debug/g' $(git grep -l cpu_get_phys_page)
Signed-off-by: Peter Maydell <peter.maydell@linaro.org >
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org >
Reviewed-by: Richard Henderson <richard.henderson@linaro.org >
Message-id: 20260417173105.1648172-10-peter.maydell@linaro.org
Message-ID: <20260430093810.2762539-11-peter.maydell@linaro.org >
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org >
2026-05-12 22:35:54 +02:00
Trieu Huynh
db52193355
plugins/api-system: Handle migrate_add_blocker() failure
...
migrate_add_blocker() can fail (e.g. if migration is already in
progress), in which case it returns a negative value and populates
its errp argument with the reason.
The previous code ignored the return value. Pass &error_fatal so
that on failure QEMU exits cleanly with an informative error message
rather than continuing in an inconsistent state.
Resolves: CID 1645470
Signed-off-by: Trieu Huynh <vikingtc4@gmail.com >
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org >
Tested-by: Pierrick Bouvier <pierrick.bouvier@linaro.org >
Link: https://lore.kernel.org/qemu-devel/20260317134733.126584-1-vikingtc4@gmail.com
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org >
2026-03-17 12:13:16 -07:00
Florian Hofhammer
55327b85ce
plugins: prohibit writing to read-only registers
...
The opaque register handle encodes whether a register is read-only in
the lowest bit and prevents writing to the register via the plugin API
in this case.
Reviewed-by: Alex Bennée <alex.bennee@linaro.org >
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org >
Signed-off-by: Florian Hofhammer <florian.hofhammer@epfl.ch >
Link: https://lore.kernel.org/qemu-devel/20260305-setpc-v5-v7-7-4c3adba52403@epfl.ch
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org >
2026-03-05 10:54:09 -08:00
Florian Hofhammer
3ebd871cbd
plugins: add read-only property for registers
...
Some registers should be marked as read-only from a plugin API
perspective, as writing to them via qemu_plugin_write_register has no
effect. This includes the program counter, and we expose this fact to
the plugins with this patch.
Reviewed-by: Alex Bennée <alex.bennee@linaro.org >
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org >
Signed-off-by: Florian Hofhammer <florian.hofhammer@epfl.ch >
Link: https://lore.kernel.org/qemu-devel/20260305-setpc-v5-v7-6-4c3adba52403@epfl.ch
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org >
2026-03-05 10:54:09 -08:00
Florian Hofhammer
4f55cd7801
plugins: add PC diversion API function
...
This patch adds a plugin API function that allows diverting the program
counter during execution. A potential use case for this functionality is
to skip over parts of the code, e.g., by hooking into a specific
instruction and setting the PC to the next instruction in the callback.
Link: https://lists.nongnu.org/archive/html/qemu-devel/2025-08/msg00656.html
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org >
Signed-off-by: Florian Hofhammer <florian.hofhammer@epfl.ch >
Link: https://lore.kernel.org/qemu-devel/20260305-setpc-v5-v7-4-4c3adba52403@epfl.ch
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org >
2026-03-05 10:54:09 -08:00
Florian Hofhammer
d16ffa4244
plugins: add flag to specify whether PC is rw
...
In addition to the flags specifying whether general-purpose registers
are read-write (rw) during a plugin callback, we add an additional flag
explicitly stating whether the PC is writable. This is in preparation of
a patch that allows to explicitly set the PC to divert control flow from
within a plugin callback, which is currently not possible.
Reviewed-by: Alex Bennée <alex.bennee@linaro.org >
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org >
Signed-off-by: Florian Hofhammer <florian.hofhammer@epfl.ch >
Link: https://lore.kernel.org/qemu-devel/20260305-setpc-v5-v7-2-4c3adba52403@epfl.ch
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org >
2026-03-05 10:54:09 -08:00
Pierrick Bouvier
2cc35f14ba
plugins/core: clamp syscall arguments if target is 32-bit
...
Syscall arguments are abi_long in user code, and plugin syscall
interface works with uint64_t only.
According to C integer promotion rules, the value is sign extended
before becoming unsigned, thus setting high bits when only 32-bit lower
ones should have a significant value.
As a result, we need to clamp values we receive from user-code
accordingly.
Reviewed-by: Alex Bennée <alex.bennee@linaro.org >
Link: https://lore.kernel.org/qemu-devel/20260305-setpc-v5-v7-1-4c3adba52403@epfl.ch
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org >
2026-03-05 10:54:09 -08:00
Mohamed Mediouni
b0353beebb
plugins: fix cross-build using LLVM for Windows targets
...
llvm-dlltool assumes that it's by default targeting the host architecture
it's running on. That assumption doesn't hold true when cross-compiling.
Signed-off-by: Mohamed Mediouni <mohamed@unpredictable.fr >
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org >
Tested-by: Pierrick Bouvier <pierrick.bouvier@linaro.org >
Link: https://lore.kernel.org/qemu-devel/20260210040722.11375-1-mohamed@unpredictable.fr
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org >
2026-02-10 12:58:31 -08:00
Pierrick Bouvier
cab15547f1
plugins: move qemu-plugin.h to include/plugins/
...
This change has two benefits:
- ensure plugins can't include anything else from QEMU than plugins API
- when compiling a C++ module, solves the header conflict with iostream
header that includes transitively the wrong ctype.h, which already
exists in include/qemu.
By Hyrum's law, there was already one usage of other headers with mem
plugin, which has been eliminated in previous commit.
Reviewed-by: Richard Henderson <richard.henderson@linaro.org >
Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org >
Link: https://lore.kernel.org/qemu-devel/20260124182921.531562-7-pierrick.bouvier@linaro.org
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org >
2026-01-29 09:34:14 -08:00
Pierrick Bouvier
e115d55110
plugins: factorize plugin dependencies and library details
...
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com >
Link: https://lore.kernel.org/qemu-devel/20260124182921.531562-3-pierrick.bouvier@linaro.org
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org >
2026-01-29 09:34:14 -08:00
Pierrick Bouvier
3b781315cc
plugins: move win32_linker.c file to plugins directory
...
Reviewed-by: Richard Henderson <richard.henderson@linaro.org >
Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org >
Link: https://lore.kernel.org/qemu-devel/20260124182921.531562-2-pierrick.bouvier@linaro.org
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org >
2026-01-29 09:34:14 -08:00
Florian Hofhammer
c22ea55b3b
plugins: return bool from register r/w API
...
The qemu_plugin_{read,write} register API previously was inconsistent
with regard to its docstring (where a return value of both -1 and 0
would indicate an error) and to the memory read/write APIs, which
already return a boolean value to indicate success or failure.
Returning the number of bytes read or written is superfluous, as the
GByteArray* passed to the API functions already encodes the length.
See the linked thread for more details.
This patch moves from returning an int (number of bytes read/written) to
returning a bool from the register read/write API, bumps the plugin API
version, and adjusts plugins and tests accordingly.
Signed-off-by: Florian Hofhammer <florian.hofhammer@fhofhammer.de >
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org >
Link: https://lore.kernel.org/qemu-devel/f877dd79-1285-4752-811e-f0d430ff27fe@fhofhammer.de
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org >
2026-01-29 09:34:14 -08:00
Ziyang Zhang
5ed628d1d3
linux-user: add plugin API to filter syscalls
...
This commit adds a syscall filter API to the TCG plugin API set.
Plugins can register a filter callback to QEMU to decide whether
to intercept a syscall, process it and bypass the QEMU syscall
handler.
Signed-off-by: Ziyang Zhang <functioner@sjtu.edu.cn >
Co-authored-by: Mingyuan Xia <xiamy@ultrarisc.com >
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org >
[Pierrick - move send_through_syscall_filters to linux-user/syscall.c]
Link: https://lore.kernel.org/qemu-devel/20251214144620.179282-2-functioner@sjtu.edu.cn
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org >
2026-01-29 09:34:14 -08:00
Paolo Bonzini
1942b61b74
include: move hw/boards.h to hw/core/
...
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com >
2025-12-27 10:11:06 +01:00
Alex Bennée
81c5a3f867
plugins/core: allow reading of registers during discon events
...
We have protections that prevent callbacks that didn't declare
themselves as wanting to access registers. However for discontinuities
the system state is fully rectified so they should always be able to
read the register values.
a1688bc86c (plugins: add hooks for new discontinuity related callbacks)
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org >
Cc: Julian Ganz <neither@nut.email >
Reviewed-by: Julian Ganz <neither@nut.email >
Message-ID: <20251204194902.1340008-12-alex.bennee@linaro.org >
Signed-off-by: Alex Bennée <alex.bennee@linaro.org >
2025-12-05 15:26:19 +00:00
Alex Bennée
78bd26bbf0
plugins/core: add missing QEMU_DISABLE_CFI annotations
...
Most of the memory callbacks come directly from the generated code
however we have do have a a direct from C callback for the slow-path
and memory helpers.
There is also a reset callback that calls out to plugins.
Like the other plugin points we need to disable CFI as we are making
function calls to dynamically linked libraries.
Fixes: https://gitlab.com/qemu-project/qemu/-/issues/3175
Reported-by: Peter Maydell <peter.maydell@linaro.org >
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org >
Message-ID: <20251027110344.2289945-33-alex.bennee@linaro.org >
Signed-off-by: Alex Bennée <alex.bennee@linaro.org >
2025-10-29 14:12:43 +00:00
Julian Ganz
a1688bc86c
plugins: add hooks for new discontinuity related callbacks
...
The plugin API allows registration of callbacks for a variety of VCPU
related events, such as VCPU reset, idle and resume. In addition, we
recently introduced API for registering callbacks for discontinuity
events, specifically for interrupts, exceptions and host calls.
This change introduces the corresponding hooks called from target
specific code inside qemu.
Signed-off-by: Julian Ganz <neither@nut.email >
Message-ID: <20251027110344.2289945-10-alex.bennee@linaro.org >
Signed-off-by: Alex Bennée <alex.bennee@linaro.org >
2025-10-29 14:12:43 +00:00
Julian Ganz
aac73d85d2
plugins: add API for registering discontinuity callbacks
...
The plugin API allows registration of callbacks for a variety of VCPU
related events, such as VCPU reset, idle and resume. In addition to
those events, we recently defined discontinuity events, which include
traps.
This change introduces a function to register callbacks for these
events. We define one distinct plugin event type for each type of
discontinuity, granting fine control to plugins in term of which events
they receive.
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org >
Reviewed-by: Richard Henderson <richard.henderson@linaro.org >
Reviewed-by: Alex Bennée <alex.bennee@linaro.org >
Signed-off-by: Julian Ganz <neither@nut.email >
Message-ID: <20251027110344.2289945-9-alex.bennee@linaro.org >
Signed-off-by: Alex Bennée <alex.bennee@linaro.org >
2025-10-29 14:12:43 +00:00
Richard Henderson
7330741b3e
plugins: Use tb_flush__exclusive_or_serial
...
In all cases, we are already within start_exclusive.
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org >
Signed-off-by: Richard Henderson <richard.henderson@linaro.org >
2025-09-24 10:29:43 -07:00
Rowan Hart
30424b8d42
plugins: Add memory hardware address read/write API
...
This patch adds functions to the plugins API to allow plugins to read
and write memory via hardware addresses. The functions use the current
address space of the current CPU in order to avoid exposing address
space information to users. A later patch may want to add a function to
permit a specified address space, for example to facilitate
architecture-specific plugins that want to operate on them, for example
reading ARM secure memory.
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org >
Signed-off-by: Rowan Hart <rowanbhart@gmail.com >
Message-ID: <20250624175351.440780-6-rowanbhart@gmail.com >
Signed-off-by: Alex Bennée <alex.bennee@linaro.org >
Message-ID: <20250627112512.1880708-10-alex.bennee@linaro.org >
2025-07-02 10:09:48 +01:00
Rowan Hart
f00373b895
plugins: Add memory virtual address write API
...
This patch adds functions to the plugins API to allow reading and
writing memory via virtual addresses. These functions only permit doing
so on the current CPU, because there is no way to ensure consistency if
plugins are allowed to read or write to other CPUs that aren't currently
in the context of the plugin.
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org >
Signed-off-by: Rowan Hart <rowanbhart@gmail.com >
Message-ID: <20250624175351.440780-5-rowanbhart@gmail.com >
Signed-off-by: Alex Bennée <alex.bennee@linaro.org >
Message-ID: <20250627112512.1880708-9-alex.bennee@linaro.org >
2025-07-02 10:09:48 +01:00
Rowan Hart
766e00bd57
plugins: Add enforcement of QEMU_PLUGIN_CB flags in register R/W callbacks
...
This patch adds functionality to enforce the requested QEMU_PLUGIN_CB_
flags level passed when registering a callback function using the
plugins API. Each time a callback is about to be invoked, a thread-local
variable will be updated with the level that callback requested. Then,
called API functions (in particular, the register read and write API)
will call qemu_plugin_get_cb_flags() to check the level is at least the
level they require.
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org >
Signed-off-by: Rowan Hart <rowanbhart@gmail.com >
Message-ID: <20250624175351.440780-4-rowanbhart@gmail.com >
Signed-off-by: Alex Bennée <alex.bennee@linaro.org >
Message-ID: <20250627112512.1880708-8-alex.bennee@linaro.org >
2025-07-02 10:09:48 +01:00
Rowan Hart
1a92b65859
plugins: Add register write API
...
This patch adds a function to the plugins API to allow plugins to write
register contents. It also moves the qemu_plugin_read_register function
so all the register-related functions are grouped together in the file.
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org >
Signed-off-by: Rowan Hart <rowanbhart@gmail.com >
Message-ID: <20250624175351.440780-3-rowanbhart@gmail.com >
Signed-off-by: Alex Bennée <alex.bennee@linaro.org >
Message-ID: <20250627112512.1880708-7-alex.bennee@linaro.org >
2025-07-02 10:09:48 +01:00
oltolm
9761ad5f65
meson: fix Windows build
...
The build fails on Windows. Replace calls to Unix programs like ´cat´,
´sed´ and ´true´ with calls to ´python´ and wrap calls to
´os.path.relpath´ in try-except because it can fail when the two paths
are on different drives. Make sure to convert the Windows paths to Unix
paths to prevent warnings in generated files.
Signed-off-by: oltolm <oleg.tolmatcev@gmail.com >
Message-id: 20250612221521.1109-2-oleg.tolmatcev@gmail.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com >
2025-06-16 13:16:27 -04:00
Pierrick Bouvier
d33717d7fc
meson: remove lib{system, user}_ss aliases
...
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org >
Tested-by: Philippe Mathieu-Daudé <philmd@linaro.org >
Link: https://lore.kernel.org/r/20250521223414.248276-7-pierrick.bouvier@linaro.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com >
2025-05-26 17:31:06 +02:00
Philippe Mathieu-Daudé
3d881164d4
qemu: Convert target_name() to TargetInfo API
...
Have target_name() be a target-agnostic method, dispatching
to a per-target TargetInfo singleton structure.
By default a stub singleton is used. No logical change
expected.
Inspired-by: Pierrick Bouvier <pierrick.bouvier@linaro.org >
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org >
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org >
Reviewed-by: Richard Henderson <richard.henderson@linaro.org >
Message-Id: <20250424222112.36194-3-philmd@linaro.org >
2025-04-25 17:09:58 +02:00