Richard Henderson
36bc99bc78
plugins: Use translator_st for qemu_plugin_insn_data
...
Use the bytes that we record for the entire TB, rather than
a per-insn GByteArray. Record the length of the insn in
plugin_gen_insn_end rather than infering from the length
of the array.
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org >
Signed-off-by: Richard Henderson <richard.henderson@linaro.org >
2024-05-15 08:55:18 +02:00
Richard Henderson
4abc892362
plugins: Copy memory in qemu_plugin_insn_data
...
Instead of returning a host pointer, copy the data into
storage provided by the caller.
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org >
Signed-off-by: Richard Henderson <richard.henderson@linaro.org >
2024-05-15 08:55:18 +02:00
Philippe Mathieu-Daudé
80f034c5b2
accel/tcg: Move @plugin_mem_cbs from CPUState to CPUNegativeOffsetState
...
@plugin_mem_cbs is accessed by tcg generated code, move it
to CPUNegativeOffsetState.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org >
Reviewed-by: Richard Henderson <richard.henderson@linaro.org >
Message-Id: <20240429213050.55177-4-philmd@linaro.org >
2024-05-06 11:24:14 +02:00
Richard Henderson
97c872276d
Merge tag 'accel-sh4-ui-20240503' of https://github.com/philmd/qemu into staging
...
- Fix NULL dereference in NVMM & WHPX init_vcpu()
- Move user emulation headers "exec/user" to "user"
- Fix SH-4 ADDV / SUBV opcodes
- Drop Cocoa compatility on macOS <= 10.12
- Update Anthony PERARD email
# -----BEGIN PGP SIGNATURE-----
#
# iQIzBAABCAAdFiEE+qvnXhKRciHc/Wuy4+MsLN6twN4FAmY1BE4ACgkQ4+MsLN6t
# wN73jg//dbdHQU+4oM7BgTduDZn1ulKz5DtNEJawRP6vxIcSQ+Co2Yd+gdLOSXNI
# 2BaoiOQ8cyDEHj1Uud3WVB0GsQYvHrqgXcjeHpX6yFFCZNyRvzEXizJPHKCtq+4e
# XQFtfTFftlJdaKCLqyDqVnrVNRacFPm7kinrEQbTSmglAhwnyu3GwsokDAYiJTqp
# g0n6mX/pWVEMDNY1HrDsk2Q/pyIZFmzhtuRyXRvi/bh8/BnmMCpySG+2463dnu1O
# xIGr2w8ldc+mKn2w2k3wYKDnUHz/NhOkE86tL/ZxIgjCzeenZXwXNdzM+cuAmOZX
# L9KIu5io6bTevYVwwHhd5/N6MCqVEhoRmsUQfF0CIkIzxXbyF14M89YHXZo3YJAd
# n2uoJ7i6hF/4Pt6Uqlg09+vEk7onwrobnTPnbKHEKNWHNOMKXpq1CBxxcVz2qe24
# +CTAAOOhHqaTjODPSexzHZDZYxugCy1XSqps9AFF1HqUcmsPCL/PQ75YGTJJO0oF
# 0V1Yvzjhin26AQS9SglIeXnHxYC26Cg2mXnUpVbryWnG888r0XAGpRl+FEuXK7Ln
# /dGuCIWTozypSkG9304IlxlYsOoXhL11NZqINW+W/Tor3dMRQhWUQcHqv98Jl4Ad
# rnpzZ0Dhd9ityZdbI0CCMZZZLY5dw1Rq5q407GTJr1CDU4PJBh0=
# =N8q0
# -----END PGP SIGNATURE-----
# gpg: Signature made Fri 03 May 2024 08:35:42 AM PDT
# gpg: using RSA key FAABE75E12917221DCFD6BB2E3E32C2CDEADC0DE
# gpg: Good signature from "Philippe Mathieu-Daudé (F4BUG) <f4bug@amsat.org >" [full]
* tag 'accel-sh4-ui-20240503' of https://github.com/philmd/qemu :
ui/cocoa.m: Drop old macOS-10.12-and-earlier compat ifdefs
target/sh4: Rename TCGv variables as manual for SUBV opcode
target/sh4: Rename TCGv variables as manual for ADDV opcode
target/sh4: Fix SUBV opcode
target/sh4: Fix ADDV opcode
MAINTAINERS: Update my email address
plugins: Update stale comment
plugins/api: Only include 'exec/ram_addr.h' with system emulation
coverity: Update user emulation regexp
user: Move 'thunk.h' from 'exec/user' to 'user'
user: Move 'abitypes.h' from 'exec/user' to 'user'
exec: Include missing license in 'exec/cpu-common.h'
accel/whpx: Fix NULL dereference in whpx_init_vcpu()
accel/nvmm: Fix NULL dereference in nvmm_init_vcpu()
Signed-off-by: Richard Henderson <richard.henderson@linaro.org >
2024-05-03 14:42:50 -07:00
Philippe Mathieu-Daudé
e096d370ad
plugins: Update stale comment
...
"plugin_mask" was renamed as "event_mask" in commit c006147122
("plugins: create CPUPluginState and migrate plugin_mask").
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org >
Reviewed-by: Richard Henderson <richard.henderson@linaro.org >
Message-Id: <20240427155714.53669-3-philmd@linaro.org >
2024-05-03 17:21:20 +02:00
Philippe Mathieu-Daudé
155fb465b1
plugins/api: Only include 'exec/ram_addr.h' with system emulation
...
"exec/ram_addr.h" shouldn't be used with user emulation.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org >
Acked-by: Richard Henderson <richard.henderson@linaro.org >
Message-Id: <20240427155714.53669-4-philmd@linaro.org >
2024-05-03 17:21:20 +02:00
Richard Henderson
ccd8f17e02
plugins: Introduce PLUGIN_CB_MEM_REGULAR
...
Use different enumerators for vcpu_udata and vcpu_mem callbacks.
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org >
Signed-off-by: Richard Henderson <richard.henderson@linaro.org >
2024-04-30 16:12:05 -07:00
Richard Henderson
db409c01fd
plugins: Simplify callback queues
...
We have qemu_plugin_dyn_cb.type to differentiate the various
callback types, so we do not need to keep them in separate queues.
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org >
Signed-off-by: Richard Henderson <richard.henderson@linaro.org >
2024-04-30 16:12:05 -07:00
Richard Henderson
b0748975b8
tcg: Remove TCG_CALL_PLUGIN
...
Since we no longer emit plugin helpers during the initial code
translation phase, we don't need to specially mark plugin helpers.
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org >
Signed-off-by: Richard Henderson <richard.henderson@linaro.org >
2024-04-30 16:12:05 -07:00
Richard Henderson
ac977170bf
plugins: Use emit_before_op for PLUGIN_GEN_FROM_INSN
...
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org >
Signed-off-by: Richard Henderson <richard.henderson@linaro.org >
2024-04-30 16:12:05 -07:00
Richard Henderson
21a3f62ff2
plugins: Use emit_before_op for PLUGIN_GEN_FROM_TB
...
By having the qemu_plugin_cb_flags be recorded in the TCGHelperInfo,
we no longer need to distinguish PLUGIN_CB_REGULAR from
PLUGIN_CB_REGULAR_R, so place all TB callbacks in the same queue.
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org >
Signed-off-by: Richard Henderson <richard.henderson@linaro.org >
2024-04-30 16:12:05 -07:00
Richard Henderson
c7ba94836a
plugins: Create TCGHelperInfo for all out-of-line callbacks
...
TCGHelperInfo includes the ABI for every function call.
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org >
Signed-off-by: Richard Henderson <richard.henderson@linaro.org >
2024-04-30 16:12:05 -07:00
Richard Henderson
aff56de576
plugins: Move function pointer in qemu_plugin_dyn_cb
...
The out-of-line function pointer is mutually exclusive
with inline expansion, so move it into the union.
Wrap the pointer in a structure named 'regular' to match
PLUGIN_CB_REGULAR.
Reviewed-by: Alex Bennée <alex.bennee@linaro.org >
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org >
Signed-off-by: Richard Henderson <richard.henderson@linaro.org >
2024-04-30 16:12:05 -07:00
Richard Henderson
25875fe92e
plugins: Zero new qemu_plugin_dyn_cb entries
...
Reviewed-by: Alex Bennée <alex.bennee@linaro.org >
Signed-off-by: Richard Henderson <richard.henderson@linaro.org >
2024-04-30 16:12:05 -07:00
Marc-André Lureau and Philippe Mathieu-Daudé
c65288de4d
plugins: fix -Werror=maybe-uninitialized false-positive
...
../plugins/loader.c:405:15: error: ‘ctx’ may be used uninitialized [-Werror=maybe-uninitialized]
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com >
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org >
Message-ID: <20240328102052.3499331-15-marcandre.lureau@redhat.com >
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org >
2024-04-02 16:15:07 +02:00
Pierrick Bouvier and Alex Bennée
3077be2545
plugins: cleanup codepath for previous inline operation
...
Reviewed-by: Richard Henderson <richard.henderson@linaro.org >
Reviewed-by: Alex Bennée <alex.bennee@linaro.org >
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org >
Message-Id: <20240304130036.124418-13-pierrick.bouvier@linaro.org >
Signed-off-by: Alex Bennée <alex.bennee@linaro.org >
Message-Id: <20240305121005.3528075-26-alex.bennee@linaro.org >
2024-03-06 12:35:50 +00:00
Pierrick Bouvier and Alex Bennée
fba3b490a2
plugins: remove non per_vcpu inline operation from API
...
Now we have a thread-safe equivalent of inline operation, and that all
plugins were changed to use it, there is no point to keep the old API.
In more, it will help when we implement more functionality (conditional
callbacks), as we can assume that we operate on a scoreboard.
API version bump was already done as part of this series.
Reviewed-by: Richard Henderson <richard.henderson@linaro.org >
Reviewed-by: Alex Bennée <alex.bennee@linaro.org >
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org >
Message-Id: <20240304130036.124418-12-pierrick.bouvier@linaro.org >
Signed-off-by: Alex Bennée <alex.bennee@linaro.org >
Message-Id: <20240305121005.3528075-25-alex.bennee@linaro.org >
2024-03-06 12:35:46 +00:00
Pierrick Bouvier and Alex Bennée
0bcebaba45
plugins: add inline operation per vcpu
...
Extends API with three new functions:
qemu_plugin_register_vcpu_{tb, insn, mem}_exec_inline_per_vcpu().
Those functions takes a qemu_plugin_u64 as input.
This allows to have a thread-safe and type-safe version of inline
operations.
Reviewed-by: Alex Bennée <alex.bennee@linaro.org >
Reviewed-by: Richard Henderson <richard.henderson@linaro.org >
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org >
Message-Id: <20240304130036.124418-5-pierrick.bouvier@linaro.org >
Signed-off-by: Alex Bennée <alex.bennee@linaro.org >
Message-Id: <20240305121005.3528075-18-alex.bennee@linaro.org >
2024-03-06 12:35:29 +00:00
Pierrick Bouvier and Alex Bennée
62f92b8d97
plugins: implement inline operation relative to cpu_index
...
Instead of working on a fixed memory location, allow to address it based
on cpu_index, an element size and a given offset.
Result address: ptr + offset + cpu_index * element_size.
With this, we can target a member in a struct array from a base pointer.
Current semantic is not modified, thus inline operation still targets
always the same memory location.
Reviewed-by: Richard Henderson <richard.henderson@linaro.org >
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org >
Message-Id: <20240304130036.124418-4-pierrick.bouvier@linaro.org >
Signed-off-by: Alex Bennée <alex.bennee@linaro.org >
Message-Id: <20240305121005.3528075-17-alex.bennee@linaro.org >
2024-03-06 12:35:26 +00:00
Pierrick Bouvier and Alex Bennée
8042e2eadf
plugins: define qemu_plugin_u64
...
Additionally to the scoreboard, we define a qemu_plugin_u64, which is a
simple struct holding a pointer to a scoreboard, and a given offset.
This allows to have a scoreboard containing structs, without having to
bring offset to operate on a specific field.
Since most of the plugins are simply collecting a sum of per-cpu values,
qemu_plugin_u64 directly support this operation as well.
All inline operations defined later will use a qemu_plugin_u64 as input.
New functions:
- qemu_plugin_u64_add
- qemu_plugin_u64_get
- qemu_plugin_u64_set
- qemu_plugin_u64_sum
New macros:
- qemu_plugin_scoreboard_u64
- qemu_plugin_scoreboard_u64_in_struct
Reviewed-by: Richard Henderson <richard.henderson@linaro.org >
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org >
Message-Id: <20240304130036.124418-3-pierrick.bouvier@linaro.org >
Signed-off-by: Alex Bennée <alex.bennee@linaro.org >
Message-Id: <20240305121005.3528075-16-alex.bennee@linaro.org >
2024-03-06 12:35:23 +00:00
Pierrick Bouvier and Alex Bennée
a3c2cf0b89
plugins: scoreboard API
...
We introduce a cpu local storage, automatically managed (and extended)
by QEMU itself. Plugin allocate a scoreboard, and don't have to deal
with how many cpus are launched.
This API will be used by new inline functions but callbacks can benefit
from this as well. This way, they can operate without a global lock for
simple operations.
At any point during execution, any scoreboard will be dimensioned with
at least qemu_plugin_num_vcpus entries.
New functions:
- qemu_plugin_scoreboard_find
- qemu_plugin_scoreboard_free
- qemu_plugin_scoreboard_new
Reviewed-by: Richard Henderson <richard.henderson@linaro.org >
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org >
Message-Id: <20240304130036.124418-2-pierrick.bouvier@linaro.org >
Signed-off-by: Alex Bennée <alex.bennee@linaro.org >
Message-Id: <20240305121005.3528075-15-alex.bennee@linaro.org >
2024-03-06 12:35:19 +00:00
Ilya Leoshkevich and Alex Bennée
e4e5cb4a54
{linux,bsd}-user: Introduce get_task_state()
...
A CPU's TaskState is stored in the CPUState's void *opaque field,
accessing which is somewhat awkward due to having to use a cast.
Introduce a wrapper and use it everywhere.
Suggested-by: Alex Bennée <alex.bennee@linaro.org >
Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com >
Reviewed-by: Warner Losh <imp@bsdimp.com >
Reviewed-by: Richard Henderson <richard.henderson@linaro.org >
Message-Id: <20240219141628.246823-3-iii@linux.ibm.com >
Signed-off-by: Alex Bennée <alex.bennee@linaro.org >
Message-Id: <20240305121005.3528075-4-alex.bennee@linaro.org >
2024-03-06 12:35:19 +00:00
Alex Bennée
8df5e27cf7
plugins: add an API to read registers
...
We can only request a list of registers once the vCPU has been
initialised so the user needs to use either call the get function on
vCPU initialisation or during the translation phase.
We don't expose the reg number to the plugin instead hiding it behind
an opaque handle. For now this is just the gdb_regnum encapsulated in
an anonymous GPOINTER but in future as we add more state for plugins
to track we can expand it.
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1706
Based-on: <20231025093128.33116-18-akihiko.odaki@daynix.com >
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org >
Reviewed-by: Akihiko Odaki <akihiko.odaki@daynix.com >
Signed-off-by: Alex Bennée <alex.bennee@linaro.org >
Message-Id: <20240227144335.1196131-24-alex.bennee@linaro.org >
2024-02-28 09:11:42 +00:00
Alex Bennée
c006147122
plugins: create CPUPluginState and migrate plugin_mask
...
As we expand the per-vCPU data for plugins we don't want to pollute
CPUState. For now this just moves the plugin_mask (renamed to
event_mask) as the memory callbacks are accessed directly by TCG
generated code.
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org >
Signed-off-by: Alex Bennée <alex.bennee@linaro.org >
Message-Id: <20240227144335.1196131-23-alex.bennee@linaro.org >
2024-02-28 09:11:42 +00:00
Akihiko Odaki and Alex Bennée
33a277fec0
plugins: Use different helpers when reading registers
...
This avoids optimizations incompatible when reading registers.
Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com >
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org >
Message-Id: <20231213-gdb-v17-12-777047380591@daynix.com >
Reviewed-by: Richard Henderson <richard.henderson@linaro.org >
Signed-off-by: Alex Bennée <alex.bennee@linaro.org >
Message-Id: <20240227144335.1196131-21-alex.bennee@linaro.org >
2024-02-28 09:11:42 +00:00