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