Pierrick Bouvier and Philippe Mathieu-Daudé
38838f0837
cpu-target: build compilation unit once for user/system
...
Reviewed-by: Richard Henderson <richard.henderson@linaro.org >
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org >
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org >
Message-ID: <20250730220519.1140447-2-pierrick.bouvier@linaro.org >
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org >
2025-09-02 17:57:05 +02:00
Stefan Hajnoczi
f96b157ebb
Merge tag 'accel-20250715' of https://github.com/philmd/qemu into staging
...
Accelerators patches
- Unify x86/arm hw/xen/arch_hvm.h header
- Move non-system-specific 'accel/accel-ops.h' and 'accel-cpu-ops.h' to accel/
- Move KVM definitions qapi/accelerator.json
- Add @qom-type field to CpuInfoFast QAPI structure
- Display CPU model name in 'info cpus' HMP command
- Introduce @x-accel-stats QMP command
- Add 'info accel' on HMP
- Improve qemu_add_vm_change_state_handler*() docstring
- Extract TCG statistic related code to tcg-stats.c
- Implement AccelClass::get_[vcpu]_stats() handlers for TCG and HVF
- Do not dump NaN in TCG statistics
- Revert incomplete "accel/tcg: Unregister the RCU before exiting RR thread"
# -----BEGIN PGP SIGNATURE-----
#
# iQIzBAABCAAdFiEE+qvnXhKRciHc/Wuy4+MsLN6twN4FAmh2r4UACgkQ4+MsLN6t
# wN5i6xAAkOvwFh1GmsPUdz5RxzsWoIUDvyENg6E8Axwe5tSEMRFiPjabbTQJomQg
# GZt75XIS24LZFZ+hvqrLSA+dFgXTgWv08ZE81EjwjmAMBlLCOPhCgeN6C1p8100Y
# scSvRJbP9k9lpA5K7et/1X4AkK2cZyh+LGJgCjr2Al2mbERpPueDF8fxqeohFvXQ
# nTSks4XlA0yQ06+9r49aQAiuXvgg9lDT1wIglD2HEV7vOVs/ud+yyL8+z5YMeFzx
# pSIc6wDu4PqdA46w4MZs90uTy7S/PMvBiYDEiV3tKzg0MLttvFGlT58/YjVtguTP
# mNkfwIEwQtDQzoxsFIJO7yBTlTRBs95V4aIVk3pB+Gb/bideRPIkeVQvgMSEBKj7
# N0pEXWOxfB9iIWO6b1utYpQ4uxeDOU/8DPUCit1IBbNgKTaJkJb77fboYk7NaB0K
# KEtObAk6jMatB/xr+vUFWc4sMk9wlm72w8wcQzgKZ0xV2U3d1/Y/9nS4GvI510ev
# TRQ3mKj7N319uCeId1czF6W8rillCJ2u8ZK53u+Nfp7R3PbsRSMc6IDJ1UdDUlyR
# HFcWHxbcbEGhe8SnFGab4Qd6fWChcn2EaEoAJJz+Rqv0k3zcwqccNM5waCABAjTE
# 0S22JIHePJKcpkMLGq3EOUAQuu+8Zsol7gPCLxSAMclVqPTl9ck=
# =rAav
# -----END PGP SIGNATURE-----
# gpg: Signature made Tue 15 Jul 2025 15:44:05 EDT
# gpg: using RSA key FAABE75E12917221DCFD6BB2E3E32C2CDEADC0DE
# gpg: Good signature from "Philippe Mathieu-Daudé (F4BUG) <f4bug@amsat.org >" [full]
# Primary key fingerprint: FAAB E75E 1291 7221 DCFD 6BB2 E3E3 2C2C DEAD C0DE
* tag 'accel-20250715' of https://github.com/philmd/qemu :
system/runstate: Document qemu_add_vm_change_state_handler_prio* in hdr
system/runstate: Document qemu_add_vm_change_state_handler()
accel/hvf: Implement AccelClass::get_vcpu_stats() handler
accel/tcg: Implement AccelClass::get_stats() handler
accel/tcg: Propagate AccelState to dump_accel_info()
accel/system: Add 'info accel' on human monitor
accel/system: Introduce @x-accel-stats QMP command
accel/tcg: Extract statistic related code to tcg-stats.c
Revert "accel/tcg: Unregister the RCU before exiting RR thread"
accel: Extract AccelClass definition to 'accel/accel-ops.h'
accel: Rename 'system/accel-ops.h' -> 'accel/accel-cpu-ops.h'
accel/tcg: Do not dump NaN statistics
hw/core/machine: Display CPU model name in 'info cpus' command
qapi/machine: Add @qom-type field to CpuInfoFast structure
qapi/accel: Move definitions related to accelerators in their own file
hw/arm/xen-pvh: Remove unnecessary 'hw/xen/arch_hvm.h' header
hw/xen/arch_hvm: Unify x86 and ARM variants
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com >
Conflicts:
qapi/machine.json
Commit 0462da9d6b ("qapi: remove trivial "Returns:" sections")
removed trivial "Returns:". This caused a conflict with the move from
machine.json to accelerator.json.
2025-07-16 07:13:40 -04:00
Philippe Mathieu-Daudé
05927e9dc9
accel: Rename 'system/accel-ops.h' -> 'accel/accel-cpu-ops.h'
...
Unfortunately "system/accel-ops.h" handlers are not only
system-specific. For example, the cpu_reset_hold() hook
is part of the vCPU creation, after it is realized.
Mechanical rename to drop 'system' using:
$ sed -i -e s_system/accel-ops.h_accel/accel-cpu-ops.h_g \
$(git grep -l system/accel-ops.h)
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org >
Reviewed-by: Zhao Liu <zhao1.liu@intel.com >
Reviewed-by: Richard Henderson <richard.henderson@linaro.org >
Message-Id: <20250703173248.44995-38-philmd@linaro.org >
2025-07-15 19:34:33 +02:00
Philippe Mathieu-Daudé and Michael S. Tsirkin
749c21cf6d
qemu: Convert target_words_bigendian() to TargetInfo API
...
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org >
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org >
Reviewed-by: Richard Henderson <richard.henderson@linaro.org >
Message-Id: <20250708215320.70426-6-philmd@linaro.org >
Reviewed-by: Michael S. Tsirkin <mst@redhat.com >
Signed-off-by: Michael S. Tsirkin <mst@redhat.com >
2025-07-15 02:56:39 -04: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
Philippe Mathieu-Daudé
2492008d0d
cpus: Move target-agnostic methods out of cpu-target.c
...
Various methods of cpu-target.c don't use any target-specific
knowledge at all and can be built once in the target-agnostic
cpu-common.c file.
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org >
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org >
Message-Id: <20250417165430.58213-4-philmd@linaro.org >
2025-04-25 17:09:58 +02:00
Philippe Mathieu-Daudé
5e15bb7d66
cpus: Replace CPU_RESOLVING_TYPE -> target_cpu_type()
...
Replace the target-specific CPU_RESOLVING_TYPE definition
by a call to the target-agnostic target_cpu_type() runtime
helper.
Since the big "cpu.h" is not required anymore in tcg-all.c,
remove it, using the tinier "cpu-param.h" header.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org >
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org >
Message-Id: <20250417165430.58213-3-philmd@linaro.org >
2025-04-25 17:09:58 +02:00
Philippe Mathieu-Daudé
b939b8e42a
exec: Rename target_words_bigendian() -> target_big_endian()
...
In commit 98ed8ecfc9 ("exec: introduce target_words_bigendian()
helper") target_words_bigendian() was matching the definition it
was depending on (TARGET_WORDS_BIGENDIAN). Later in commit
ee3eb3a7ce ("Replace TARGET_WORDS_BIGENDIAN") the definition was
renamed as TARGET_BIG_ENDIAN but we didn't update the helper.
Do it now mechanically using:
$ sed -i -e s/target_words_bigendian/target_big_endian/g \
$(git grep -wl target_words_bigendian)
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org >
Reviewed-by: Michael S. Tsirkin <mst@redhat.com >
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org >
Message-Id: <20250417210025.68322-1-philmd@linaro.org >
2025-04-25 17:00:42 +02:00
Philippe Mathieu-Daudé
edbb66bb30
cpus: Remove #ifdef check on cpu_list definition
...
Since we removed all definitions of cpu_list, the #ifdef
check is always true. Remove it, inlining cpu_list().
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org >
Reviewed-by: Thomas Huth <thuth@redhat.com >
Reviewed-by: Richard Henderson <richard.henderson@linaro.org >
Reviewed-by: Zhao Liu <zhao1.liu@intel.com >
Message-Id: <20250324185837.46506-7-philmd@linaro.org >
2025-04-25 12:59:09 +02:00
Philippe Mathieu-Daudé
0a5692fecc
cpus: Introduce CPUClass::list_cpus() callback
...
Some targets define cpu_list to a method listing their
CPUs on stdout. In order to make list_cpus() generic,
introduce the CPUClass::list_cpus() callback.
When no callback is registered, list_cpus() defaults
to the cpu_list definition.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org >
Reviewed-by: Thomas Huth <thuth@redhat.com >
Reviewed-by: Richard Henderson <richard.henderson@linaro.org >
Reviewed-by: Zhao Liu <zhao1.liu@intel.com >
Message-Id: <20250324185837.46506-2-philmd@linaro.org >
2025-04-25 12:59:09 +02:00
Pierrick Bouvier and Richard Henderson
d97c3b06de
exec/cpu-all: transfer exec/cpu-common include to cpu.h headers
...
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org >
Reviewed-by: Richard Henderson <richard.henderson@linaro.org >
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org >
Signed-off-by: Richard Henderson <richard.henderson@linaro.org >
Message-ID: <20250325045915.994760-15-pierrick.bouvier@linaro.org >
2025-04-23 15:04:57 -07:00
Pierrick Bouvier and Richard Henderson
8d535c312c
include/exec/cpu-all: move compile time check for CPUArchState to cpu-target.c
...
Tested-by: Philippe Mathieu-Daudé <philmd@linaro.org >
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org >
Reviewed-by: Richard Henderson <richard.henderson@linaro.org >
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org >
Signed-off-by: Richard Henderson <richard.henderson@linaro.org >
Message-ID: <20250325045915.994760-4-pierrick.bouvier@linaro.org >
2025-04-23 15:04:57 -07:00
Pierrick Bouvier and Richard Henderson
cfac5cdff5
exec/tswap: target code can use TARGET_BIG_ENDIAN instead of target_words_bigendian()
...
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org >
Reviewed-by: Richard Henderson <richard.henderson@linaro.org >
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org >
Signed-off-by: Richard Henderson <richard.henderson@linaro.org >
Message-ID: <20250317183417.285700-2-pierrick.bouvier@linaro.org >
2025-04-23 13:52:06 -07:00
Philippe Mathieu-Daudé
43610f3184
cpus: Build cpu_exec_[un]realizefn() methods once
...
Now that cpu_exec_realizefn() and cpu_exec_unrealizefn()
methods don't use any target specific definition anymore,
we can move them to cpu-common.c to be able to build them
once.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org >
Reviewed-by: Richard Henderson <richard.henderson@linaro.org >
Message-Id: <20250123234415.59850-21-philmd@linaro.org >
2025-03-09 17:00:47 +01:00
Philippe Mathieu-Daudé
ca05578fc8
cpus: Register VMState per user / system emulation
...
Simplify cpu-target.c by extracting mixed vmstate code
into the cpu_vmstate_register() / cpu_vmstate_unregister()
helpers, implemented in cpu-user.c and cpu-system.c.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org >
Reviewed-by: Richard Henderson <richard.henderson@linaro.org >
Message-Id: <20250123234415.59850-20-philmd@linaro.org >
2025-03-09 17:00:46 +01:00
Philippe Mathieu-Daudé and Richard Henderson
6ff5da1600
exec: Declare tlb_flush*() in 'exec/cputlb.h'
...
Move CPU TLB related methods to "exec/cputlb.h".
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org >
Reviewed-by: Richard Henderson <richard.henderson@linaro.org >
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org >
Message-ID: <20241114011310.3615-19-philmd@linaro.org >
Signed-off-by: Richard Henderson <richard.henderson@linaro.org >
2025-03-08 07:56:14 -08:00
Philippe Mathieu-Daudé
a86cf967a1
cpus: Have cpu_exec_initfn() per user / system emulation
...
Slighly simplify cpu-target.c again by extracting cpu_exec_initfn()
to cpu-{system,user}.c, adding an empty stub for user emulation.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org >
Reviewed-by: Richard Henderson <richard.henderson@linaro.org >
Message-Id: <20250123234415.59850-19-philmd@linaro.org >
2025-03-06 15:46:18 +01:00
Philippe Mathieu-Daudé
e3a575f560
cpus: Have cpu_class_init_props() per user / system emulation
...
Rather than maintaining a mix of system / user code for CPU
class properties, move system properties to cpu-system.c
and user ones to the new cpu-user.c unit.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org >
Reviewed-by: Richard Henderson <richard.henderson@linaro.org >
Message-Id: <20250123234415.59850-18-philmd@linaro.org >
2025-03-06 15:46:18 +01:00
Philippe Mathieu-Daudé
530c7139f6
cpus: Restrict cpu_common_post_load() code to TCG
...
CPU_INTERRUPT_EXIT was removed in commit 3098dba01c
("Use a dedicated function to request exit from execution
loop"), tlb_flush() and tb_flush() are related to TCG
accelerator.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org >
Reviewed-by: Richard Henderson <richard.henderson@linaro.org >
Message-Id: <20250123234415.59850-17-philmd@linaro.org >
2025-03-06 15:46:18 +01:00
Philippe Mathieu-Daudé
c90476325c
cpus: Fix style in cpu-target.c
...
Fix style on code we are going to modify.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org >
Reviewed-by: Richard Henderson <richard.henderson@linaro.org >
Message-Id: <20250123234415.59850-16-philmd@linaro.org >
2025-03-06 15:46:18 +01:00
Philippe Mathieu-Daudé
585d4b1229
accel/tcg: Move cpu_memory_rw_debug() user implementation to user-exec.c
...
cpu_memory_rw_debug() system implementation is defined in
system/physmem.c. Move the user one to accel/tcg/user-exec.c
to simplify cpu-target.c maintenance.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org >
Reviewed-by: Richard Henderson <richard.henderson@linaro.org >
Message-Id: <20250217130610.18313-6-philmd@linaro.org >
2025-03-06 15:46:18 +01:00
Philippe Mathieu-Daudé
eacd1f8445
accel/tcg: Avoid using lock_user() in cpu_memory_rw_debug()
...
We checked the page flags with page_get_flags(), so
locking the page is superfluous. Remove the lock_user()
calls and directly use g2h() in place.
Suggested-by: Richard Henderson <richard.henderson@linaro.org >
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org >
Reviewed-by: Richard Henderson <richard.henderson@linaro.org >
Message-Id: <20250217130610.18313-5-philmd@linaro.org >
2025-03-06 15:46:18 +01:00
Philippe Mathieu-Daudé
964a4f2c29
accel/tcg: Take mmap lock in the whole cpu_memory_rw_debug() function
...
Simplify user implementation of cpu_memory_rw_debug() by
taking the mmap lock globally. See commit 87ab270429
("linux-user: Allow gdbstub to ignore page protection")
for why this lock is necessary.
Suggested-by: Richard Henderson <richard.henderson@linaro.org >
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org >
Reviewed-by: Richard Henderson <richard.henderson@linaro.org >
Message-Id: <20250217130610.18313-4-philmd@linaro.org >
2025-03-06 15:46:18 +01:00
Philippe Mathieu-Daudé
0f66536a01
accel: Forward-declare AccelOpsClass in 'qemu/typedefs.h'
...
The heavily imported "system/cpus.h" header includes "accel-ops.h"
to get AccelOpsClass type declaration. Reduce headers pressure by
forward declaring it in "qemu/typedefs.h", where we already
declare the AccelCPUState type.
Reduce "system/cpus.h" inclusions by only including
"system/accel-ops.h" when necessary.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org >
Reviewed-by: Richard Henderson <richard.henderson@linaro.org >
Message-Id: <20250123234415.59850-14-philmd@linaro.org >
2025-03-06 15:46:18 +01:00
Philippe Mathieu-Daudé
b12a0f8566
accel: Rename 'hw/core/accel-cpu.h' -> 'accel/accel-cpu-target.h'
...
AccelCPUClass is for accelerator to initialize target specific
features of a vCPU. Not really related to hardware emulation,
rename "hw/core/accel-cpu.h" as "accel/accel-cpu-target.h"
(using the explicit -target suffix).
More importantly, target specific header often access the
target specific definitions which are in each target/FOO/cpu.h
header, usually included generically as "cpu.h" relative to
target/FOO/. However, there is already a "cpu.h" in hw/core/
which takes precedence. This change allows "accel-cpu-target.h"
to include a target "cpu.h".
Mechanical change doing:
$ git mv include/hw/core/accel-cpu.h \
include/accel/accel-cpu-target.h
$ sed -i -e 's,hw/core/accel-cpu.h,accel/accel-cpu-target.h,' \
$(git grep -l hw/core/accel-cpu.h)
and renaming header guard 'ACCEL_CPU_TARGET_H'.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org >
Reviewed-by: Richard Henderson <richard.henderson@linaro.org >
Message-Id: <20250123234415.59850-12-philmd@linaro.org >
2025-03-06 15:46:17 +01:00