Rowan Hart and Alex Bennée
595cd9ce2e
plugins: add plugin API to read guest memory
...
Signed-off-by: Rowan Hart <rowanbhart@gmail.com >
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org >
Message-Id: <20240827215329.248434-2-rowanbhart@gmail.com >
[AJB: tweaked cpu_memory_rw_debug call]
Signed-off-by: Alex Bennée <alex.bennee@linaro.org >
Message-Id: <20240916085400.1046925-17-alex.bennee@linaro.org >
2024-09-19 15:58:01 +01:00
Pierrick Bouvier and Alex Bennée
9505f85e2d
plugins: extend API to get latest memory value accessed
...
This value can be accessed only during a memory callback, using
new qemu_plugin_mem_get_value function.
Returned value can be extended when QEMU will support accesses wider
than 128 bits.
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1719
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2152
Reviewed-by: Richard Henderson <richard.henderson@linaro.org >
Reviewed-by: Xingtao Yao <yaoxt.fnst@fujitsu.com >
Reviewed-by: Alex Bennée <alex.bennee@linaro.org >
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org >
Message-Id: <20240724194708.1843704-3-pierrick.bouvier@linaro.org >
Signed-off-by: Alex Bennée <alex.bennee@linaro.org >
Message-Id: <20240916085400.1046925-6-alex.bennee@linaro.org >
2024-09-19 15:58:01 +01:00
Alex Bennée
508036532c
plugins: add migration blocker
...
If the plugin in controlling time there is some state that might be
missing from the plugin tracking it. Migration is unlikely to work in
this case so lets put a migration blocker in to let the user know if
they try.
Suggested-by: Dr. David Alan Gilbert <dave@treblig.org >
Reviewed-by: Thomas Huth <thuth@redhat.com >
Reviewed-by: Richard Henderson <richard.henderson@linaro.org >
Signed-off-by: Alex Bennée <alex.bennee@linaro.org >
Message-Id: <20240620152220.2192768-10-alex.bennee@linaro.org >
2024-06-24 10:15:10 +01:00
Alex Bennée
847a65dd76
plugins: add time control API
...
Expose the ability to control time through the plugin API. Only one
plugin can control time so it has to request control when loaded.
There are probably more corner cases to catch here.
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org >
[AJB: tweaked user-mode handling, merged QEMU_PLUGIN_API fix]
Message-Id: <20240530220610.1245424-6-pierrick.bouvier@linaro.org >
Signed-off-by: Alex Bennée <alex.bennee@linaro.org >
Message-Id: <20240620152220.2192768-9-alex.bennee@linaro.org >
2024-06-24 10:15:04 +01:00
Akihiko Odaki and Alex Bennée
ad59d5caee
plugins: Ensure register handles are not NULL
...
Ensure register handles are not NULL so that a plugin can assume NULL is
invalid as a register handle.
Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com >
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org >
Message-Id: <20240229-null-v1-1-e716501d981e@daynix.com >
Signed-off-by: Alex Bennée <alex.bennee@linaro.org >
Reviewed-by: Richard Henderson <richard.henderson@linaro.org >
Message-Id: <20240620152220.2192768-4-alex.bennee@linaro.org >
2024-06-24 10:14:22 +01:00
Pierrick Bouvier and Alex Bennée
7de77d3788
plugins: conditional callbacks
...
Extend plugins API to support callback called with a given criteria
(evaluated inline).
Added functions:
- qemu_plugin_register_vcpu_tb_exec_cond_cb
- qemu_plugin_register_vcpu_insn_exec_cond_cb
They expect as parameter a condition, a qemu_plugin_u64_t (op1) and an
immediate (op2). Callback is called if op1 |cond| op2 is true.
Reviewed-by: Richard Henderson <richard.henderson@linaro.org >
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org >
Message-Id: <20240502211522.346467-6-pierrick.bouvier@linaro.org >
Reviewed-by: Michael S. Tsirkin <mst@redhat.com >
[AJB: fix re-base conflict with tb_is_mem_only()]
Signed-off-by: Alex Bennée <alex.bennee@linaro.org >
Message-Id: <20240514174253.694591-8-alex.bennee@linaro.org >
2024-05-16 08:55:02 +01:00
Richard Henderson
4c833c60e0
disas: Use translator_st to get disassembly data
...
Read from already translated pages, or saved mmio data.
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org >
Signed-off-by: Richard Henderson <richard.henderson@linaro.org >
2024-05-15 08:55:19 +02:00
Richard Henderson
e763953a24
plugins: Use DisasContextBase for qemu_plugin_tb_vaddr
...
We do not need to separately record the start of the TB.
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
d3ace10590
plugins: Use DisasContextBase for qemu_plugin_insn_haddr
...
We can delay the computation of haddr until the plugin
actually requests it.
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org >
Signed-off-by: Richard Henderson <richard.henderson@linaro.org >
2024-05-15 08:55:18 +02:00
Richard Henderson
e501325991
plugins: Read mem_only directly from TB cflags
...
Do not pass around a boolean between multiple structures,
just read it from the TranslationBlock in the TCGContext.
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
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
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é
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
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
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
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
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
Pierrick Bouvier and Alex Bennée
4a448b148c
plugins: add qemu_plugin_num_vcpus function
...
We now keep track of how many vcpus were started. This way, a plugin can
easily query number of any vcpus at any point of execution, which
unifies user and system mode workflows.
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org >
Reviewed-by: Richard Henderson <richard.henderson@linaro.org >
Message-Id: <20240213094009.150349-3-pierrick.bouvier@linaro.org >
Signed-off-by: Alex Bennée <alex.bennee@linaro.org >
Message-Id: <20240227144335.1196131-17-alex.bennee@linaro.org >
2024-02-28 09:11:36 +00:00
Pierrick Bouvier and Alex Bennée
926e146eff
plugins: remove previous n_vcpus functions from API
...
This information is already accessible using qemu_info_t during plugin
install.
We will introduce another function (qemu_plugin_num_vcpus) which
represent how many cpus were enabled, by tracking new cpu indexes.
It's a breaking change, so we bump API version.
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org >
Reviewed-by: Richard Henderson <richard.henderson@linaro.org >
Message-Id: <20240213094009.150349-2-pierrick.bouvier@linaro.org >
Signed-off-by: Alex Bennée <alex.bennee@linaro.org >
Message-Id: <20240227144335.1196131-16-alex.bennee@linaro.org >
2024-02-28 09:11:34 +00:00
Richard Henderson
405c02d85d
plugin: Simplify struct qemu_plugin_hwaddr
...
Rather than saving MemoryRegionSection and offset,
save phys_addr and MemoryRegion. This matches up
much closer with the plugin api.
Reviewed-by: Alex Bennée <alex.bennee@linaro.org >
Signed-off-by: Richard Henderson <richard.henderson@linaro.org >
2023-09-16 14:57:15 +00:00
Richard Henderson and Alex Bennée
5413c37f3b
plugins: Assert mmu_idx in range before use in qemu_plugin_get_hwaddr
...
Coverity reports out-of-bound accesses here. This should be a
false positive due to how the index is decoded from MemOpIdx.
Fixes: Coverity CID 1487201
Signed-off-by: Richard Henderson <richard.henderson@linaro.org >
Reviewed-by: Damien Hedde <damien.hedde@greensocs.com >
Message-Id: <20220401190233.329360-1-richard.henderson@linaro.org >
Signed-off-by: Alex Bennée <alex.bennee@linaro.org >
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org >
Message-Id: <20220929114231.583801-37-alex.bennee@linaro.org >
2022-10-06 11:53:40 +01:00
Philippe Mathieu-Daudé and Thomas Huth
cd6174843b
exec/exec-all: Move 'qemu/log.h' include in units requiring it
...
Many files use "qemu/log.h" declarations but neglect to include
it (they inherit it via "exec/exec-all.h"). "exec/exec-all.h" is
a core component and shouldn't be used that way. Move the
"qemu/log.h" inclusion locally to each unit requiring it.
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org >
Reviewed-by: Richard Henderson <richard.henderson@linaro.org >
Acked-by: Thomas Huth <thuth@redhat.com >
Message-Id: <20220207082756.82600-10-f4bug@amsat.org >
Signed-off-by: Thomas Huth <thuth@redhat.com >
2022-02-21 10:18:06 +01:00
Ivanov Arkady and Alex Bennée
91d4032710
plugins: add helper functions for coverage plugins
...
Which provide information about:
- start_code.
- end_code.
- entry.
- path to the executable binary.
Signed-off-by: Ivanov Arkady <arkadiy.ivanov@ispras.ru >
Message-Id: <163491883461.304355.8210754161847179432.stgit@pc-System-Product-Name>
[AJB: reword title, better descriptions, defaults, rm export, fix include]
Signed-off-by: Alex Bennée <alex.bennee@linaro.org >
Message-Id: <20220204204335.1689602-22-alex.bennee@linaro.org >
2022-02-09 12:08:42 +00:00
Richard Henderson
37aff08726
plugins: Reorg arguments to qemu_plugin_vcpu_mem_cb
...
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 >
2021-10-05 16:53:17 -07:00
Mahmoud Mandour and Alex Bennée
6a9e8a086d
plugins/api: added a boolean parsing plugin api
...
This call will help boolean argument parsing since arguments are now
passed to plugins as a name and value.
Signed-off-by: Mahmoud Mandour <ma.mandourr@gmail.com >
Reviewed-by: Alex Bennée <alex.bennee@linaro.org >
Message-Id: <20210730135817.17816-3-ma.mandourr@gmail.com >
[AJB: add to symbols]
Signed-off-by: Alex Bennée <alex.bennee@linaro.org >
2021-09-02 11:29:34 +01:00
Aaron Lindsay and Alex Bennée
2da42253ef
plugins: Fix physical address calculation for IO regions
...
The address calculation for IO regions introduced by
commit 787148bf92
Author: Aaron Lindsay <aaron@os.amperecomputing.com >
plugins: Expose physical addresses instead of device offsets
is not always accurate. Use the more correct
MemoryRegionSection.offset_within_address_space.
Signed-off-by: Aaron Lindsay <aaron@os.amperecomputing.com >
Signed-off-by: Alex Bennée <alex.bennee@linaro.org >
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com >
Message-Id: <20210720195735.3934473-1-aaron@os.amperecomputing.com >
Message-Id: <20210720232703.10650-25-alex.bennee@linaro.org >
2021-07-23 17:22:16 +01:00
Alex Bennée
2d93203998
plugins: fix-up handling of internal hostaddr for 32 bit
...
The compiler rightly complains when we build on 32 bit that casting
uint64_t into a void is a bad idea. We are really dealing with a host
pointer at this point so treat it as such. This does involve
a uintptr_t cast of the result of the TLB addend as we know that has
to point to the host memory.
Signed-off-by: Alex Bennée <alex.bennee@linaro.org >
Reviewed-by: Richard Henderson <richard.henderson@linaro.org >
Message-Id: <20210709143005.1554-28-alex.bennee@linaro.org >
2021-07-14 14:33:53 +01:00
Alex Bennée
7c4ab60f18
plugins/api: expose symbol lookup to plugins
...
This is a quality of life helper for plugins so they don't need to
re-implement symbol lookup when dumping an address. The strings are
constant so don't need to be duplicated. One minor tweak is to return
NULL instead of a zero length string to show lookup failed.
Signed-off-by: Alex Bennée <alex.bennee@linaro.org >
Signed-off-by: Mahmoud Mandour <ma.mandourr@gmail.com >
Message-Id: <20210608040532.56449-2-ma.mandourr@gmail.com >
Message-Id: <20210623102749.25686-8-alex.bennee@linaro.org >
2021-06-25 10:08:37 +01:00
Thomas Huth and Laurent Vivier
2068cabd3f
Do not include cpu.h if it's not really necessary
...
Stop including cpu.h in files that don't need it.
Signed-off-by: Thomas Huth <thuth@redhat.com >
Message-Id: <20210416171314.2074665-4-thuth@redhat.com >
Signed-off-by: Laurent Vivier <laurent@vivier.eu >
2021-05-02 17:24:51 +02:00
Thomas Huth and Laurent Vivier
4c386f8064
Do not include sysemu/sysemu.h if it's not really necessary
...
Stop including sysemu/sysemu.h in files that don't need it.
Signed-off-by: Thomas Huth <thuth@redhat.com >
Message-Id: <20210416171314.2074665-2-thuth@redhat.com >
Signed-off-by: Laurent Vivier <laurent@vivier.eu >
2021-05-02 17:24:50 +02:00
Yonggang Luo and Alex Bennée
a2b8816977
plugins: getting qemu_plugin_get_hwaddr only expose one function prototype
...
This is used for counting how much function are export to qemu plugin.
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com >
Signed-off-by: Alex Bennée <alex.bennee@linaro.org >
Reviewed-by: Alex Bennée <alex.bennee@linaro.org >
Message-Id: <20201013002806.1447-2-luoyonggang@gmail.com >
Message-Id: <20210312172821.31647-14-alex.bennee@linaro.org >
2021-03-17 07:17:46 +00:00
Aaron Lindsay and Alex Bennée
787148bf92
plugins: Expose physical addresses instead of device offsets
...
This allows plugins to query for full virtual-to-physical address
translation for a given `qemu_plugin_hwaddr` and stops exposing the
offset within the device itself. As this change breaks the API,
QEMU_PLUGIN_VERSION is incremented.
Signed-off-by: Aaron Lindsay <aaron@os.amperecomputing.com >
Signed-off-by: Alex Bennée <alex.bennee@linaro.org >
Message-Id: <20210309202802.211756-1-aaron@os.amperecomputing.com >
Message-Id: <20210312172821.31647-3-alex.bennee@linaro.org >
2021-03-17 07:17:46 +00:00
Alex Bennée
cfd405eae6
accel/tcg: allow plugin instrumentation to be disable via cflags
...
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 >
2021-02-18 08:19:23 +00:00
Alex Bennée
b853a79f65
plugins: add API to return a name for a IO device
...
This may well end up being anonymous but it should always be unique.
Signed-off-by: Alex Bennée <alex.bennee@linaro.org >
Reviewed-by: Clement Deschamps <clement.deschamps@greensocs.com >
Reviewed-by: Emilio G. Cota <cota@braap.org >
Reviewed-by: Richard Henderson <richard.henderson@linaro.org >
Message-Id: <20210213130325.14781-3-alex.bennee@linaro.org >
2021-02-18 08:16:50 +00:00
Philippe Mathieu-Daudé and Alex Bennée
308e754964
qemu/qemu-plugin: Make qemu_plugin_hwaddr_is_io() hwaddr argument const
...
Rename qemu_plugin_hwaddr_is_io() address argument 'haddr'
similarly to qemu_plugin_hwaddr_device_offset(), and make
it const.
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-4-f4bug@amsat.org >
Message-Id: <20200513173200.11830-4-alex.bennee@linaro.org >
2020-05-15 15:25:16 +01:00
Richard Henderson
208b2d2420
plugins: Include trace/mem.h in api.c
...
Code movement in an upcoming patch will show that this file
was implicitly depending on trace/mem.h being included beforehand.
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com >
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com >
Reported-by: Alex Bennée <alex.bennee@linaro.org >
Signed-off-by: Richard Henderson <richard.henderson@linaro.org >
2020-01-15 15:13:09 -10:00
Alex Bennée
ca76a66975
plugin: add qemu_plugin_outs helper
...
Having the plugins grab stdout and spew stuff there is a bit ugly and
certainly makes the tests look ugly. Provide a hook back into QEMU
which can be redirected as needed.
Signed-off-by: Alex Bennée <alex.bennee@linaro.org >
Reviewed-by: Aaron Lindsay <aaron@os.amperecomputing.com >
2019-10-28 15:12:38 +00:00
Alex Bennée
cbafa2362a
plugin: add qemu_plugin_insn_disas helper
...
Give the plugins access to the QEMU dissasembler so they don't have to
re-invent the wheel. We generate a warning when there are spare bytes
in the decode buffer. This is usually due to the front end loading in
more bytes than decoded.
Signed-off-by: Alex Bennée <alex.bennee@linaro.org >
Reviewed-by: Richard Henderson <richard.henderson@linaro.org >
2019-10-28 15:12:38 +00:00
Alex Bennée
235537fa73
plugins: implement helpers for resolving hwaddr
...
We need to keep a local per-cpu copy of the data as other threads may
be running. Currently we can provide insight as to if the access was
IO or not and give the offset into a given device (usually the main
RAMBlock). We store enough information to get details such as the
MemoryRegion which might be useful in later expansions to the API.
Signed-off-by: Alex Bennée <alex.bennee@linaro.org >
Reviewed-by: Richard Henderson <richard.henderson@linaro.org >
2019-10-28 15:12:38 +00:00
Alex Bennée
5c5d69b0d5
plugin: add implementation of the api
...
[AJB: split from the core code commit]
Signed-off-by: Alex Bennée <alex.bennee@linaro.org >
Reviewed-by: Richard Henderson <richard.henderson@linaro.org >
2019-10-28 15:12:38 +00:00