accel/tcg: Make more files target agnostic (& exec/ housekeeping)
cover accel/tcg: Make more files target agnostic (& exec/ housekeeping)
While reviewing Anton/Richard series [*] it was a bit hard for me to figure out which headers are target specific and "taint" the source which include them, in that we can not compile them once for all targets.
My understanding is -all.h suffix is a target specific header, and -common.c is a target agnostic file. I tried to consolidate a bit renaming some files with the -target.c suffix (I'd like to rename -all.h -> .target.h for parity / clarity, but that is too much code churn at this point).
This series basically:
- Rename few files using -common/-target suffix,
- Move icount to accel/tcg/
- Make 3 files from accel/tcg/ target agnostic.
Based-on: <[email protected]>
[*] https://lore.kernel.org/qemu-devel/[email protected]/
Philippe Mathieu-Daudé (11):
exec: Make EXCP_FOO definitions target agnostic
exec: Move cpu_loop_foo() target agnostic functions to 'cpu-common.h' accel/tcg: Restrict dump_exec_info() declaration
accel: Make accel-blocker.o target agnostic
accel: Rename accel-common.c -> accel-target.c
exec: Rename cpu.c -> cpu-target.c
exec: Rename target specific page-vary.c -> page-vary-target.c accel/tcg: Rename target-specific 'internal.h' -> 'internal-target.h' accel/tcg: Make monitor.c a target-agnostic unit accel/tcg: Make icount.o a target agnostic unit
accel/tcg: Make cpu-exec-common.c a target agnostic unit
MAINTAINERS | 7 ++--
meson.build | 6 +--
accel/tcg/internal-common.h | 28 +++++++++++++
accel/tcg/{internal.h => internal-target.h} | 18 ++-------
include/exec/cpu-all.h | 12 ------
include/exec/cpu-common.h | 39 +++++++++++++++++++
include/exec/exec-all.h | 30 --------------
accel/{accel-common.c => accel-target.c} | 0
accel/tcg/cpu-exec-common.c | 3 +-
accel/tcg/cpu-exec.c | 3 +-
accel/tcg/cputlb.c | 3 +-
softmmu/icount.c => accel/tcg/icount-common.c | 3 +-
accel/tcg/monitor.c | 2 +-
accel/tcg/tb-maint.c | 3 +-
accel/tcg/tcg-all.c | 2 +-
accel/tcg/translate-all.c | 3 +-
accel/tcg/translator.c | 2 +-
accel/tcg/user-exec.c | 3 +-
cpus-common.c => cpu-common.c | 0
cpu.c => cpu-target.c | 0
page-vary.c => page-vary-target.c | 0
accel/meson.build | 4 +-
accel/tcg/meson.build | 8 +++-
softmmu/meson.build | 4 --
24 files changed, 100 insertions(+), 83 deletions(-)
create mode 100644 accel/tcg/internal-common.h
rename accel/tcg/{internal.h => internal-target.h} (89%)
rename accel/{accel-common.c => accel-target.c} (100%)
rename softmmu/icount.c => accel/tcg/icount-common.c (99%)
rename cpus-common.c => cpu-common.c (100%)
rename cpu.c => cpu-target.c (100%)
rename page-vary.c => page-vary-target.c (100%)Signature · 1 line
2.41.0
PATCH 1/11 exec: Make EXCP_FOO definitions target agnostic
The EXCP_* definitions don't need to be target specific, move them to "exec/cpu-common.h".
--- include/exec/cpu-all.h | 7 ------- include/exec/cpu-common.h | 7 +++++++ 2 files changed, 7 insertions(+), 7 deletions(-)
include/exec/cpu-all.h +0 -7
@@ -26,13 +26,6 @@#include "hw/core/cpu.h" #include "qemu/rcu.h" -#define EXCP_INTERRUPT 0x10000/* async interruption */ -#define EXCP_HLT 0x10001/* hlt instruction reached */ -#define EXCP_DEBUG 0x10002/* cpu stopped after a breakpoint or singlestep */ -#define EXCP_HALTED 0x10003/* cpu is halted (waiting for external event) */ -#define EXCP_YIELD 0x10004/* cpu wants to yield timeslice to another */ -#define EXCP_ATOMIC 0x10005/* stop-the-world and emulate atomic */ -/* some important defines: * * HOST_BIG_ENDIAN : whether the host cpu is big endian and
include/exec/cpu-common.h +7 -0
@@ -7,6 +7,13 @@#include "exec/hwaddr.h" #endif +#define EXCP_INTERRUPT 0x10000/* async interruption */ +#define EXCP_HLT 0x10001/* hlt instruction reached */ +#define EXCP_DEBUG 0x10002/* cpu stopped after a breakpoint or singlestep */ +#define EXCP_HALTED 0x10003/* cpu is halted (waiting for external event) */ +#define EXCP_YIELD 0x10004/* cpu wants to yield timeslice to another */ +#define EXCP_ATOMIC 0x10005/* stop-the-world and emulate atomic */ +/** * vaddr: * Type wide enough to contain any #target_ulong virtual address.
Signature · 1 line
2.41.0
Re: [PATCH 01/11] exec: Make EXCP_FOO definitions target agnostic
Quoted 48 lines · Philippe Mathieu-Daudé
The EXCP_* definitions don't need to be target specific, move them to "
exec/cpu-common.h".Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- include/exec/cpu-all.h | 7 ------- include/exec/cpu-common.h | 7 +++++++ 2 files changed, 7 insertions(+), 7 deletions(-)include/exec/cpu-all.h +0
-7@@ -26,13 +26,6 @@#include "hw/core/cpu.h" #include "qemu/rcu.h" -#define EXCP_INTERRUPT 0x10000/* async interruption */ -#define EXCP_HLT 0x10001/* hlt instruction reached */ -#define EXCP_DEBUG 0x10002/* cpu stopped after a breakpoint or singlestep */ -#define EXCP_HALTED 0x10003/* cpu is halted (waiting for external event) */ -#define EXCP_YIELD 0x10004/* cpu wants to yield timeslice to another */ -#define EXCP_ATOMIC 0x10005/* stop-the-world and emulate atomic */ -/* some important defines: * * HOST_BIG_ENDIAN : whether the host cpu is big endian and include/exec/cpu-common.h +7
-0@@ -7,6 +7,13 @@#include "exec/hwaddr.h" #endif +#define EXCP_INTERRUPT 0x10000/* async interruption */ +#define EXCP_HLT 0x10001/* hlt instruction reached */ +#define EXCP_DEBUG 0x10002/* cpu stopped after a breakpoint or singlestep */ +#define EXCP_HALTED 0x10003/* cpu is halted (waiting for external event) */ +#define EXCP_YIELD 0x10004/* cpu wants to yield timeslice to another */ +#define EXCP_ATOMIC 0x10005/* stop-the-world and emulate atomic */ +/** * vaddr: * Type wide enough to contain any #target_ulong virtual address. Signature · 1 line
2.41.0
PATCH 2/11 exec: Move cpu_loop_foo() target agnostic functions to 'cpu-common.h'
In reply to Philippe Mathieu-DaudéWhile these functions are not TCG specific, they are not target specific. Move them to "exec/cpu-common.h" so their callers don't have to be tainted as target specific.
--- include/exec/cpu-common.h | 32 ++++++++++++++++++++++++++++++++ include/exec/exec-all.h | 30 ------------------------------ 2 files changed, 32 insertions(+), 30 deletions(-)
include/exec/cpu-common.h +32 -0
@@ -173,4 +173,36 @@ int cpu_memory_rw_debug(CPUState *cpu, vaddr addr,/* vl.c */ void list_cpus (void ); +#ifdef CONFIG_TCG +/** +* cpu_unwind_state_data: +* @cpu: the cpu context +* @host_pc: the host pc within the translation +* @data: output data +* +* Attempt to load the the unwind state for a host pc occurring in +* translated code. If @host_pc is not in translated code, the +* function returns false; otherwise @data is loaded. +* This is the same unwind info as given to restore_state_to_opc. +*/ +bool cpu_unwind_state_data (CPUState *cpu,uintptr_t host_pc,uint64_t *data); + +/** +* cpu_restore_state: +* @cpu: the cpu context +* @host_pc: the host pc within the translation +* @return: true if state was restored, false otherwise +* +* Attempt to restore the state for a fault occurring in translated +* code. If @host_pc is not in translated code no state is +* restored and the function returns false. +*/ +bool cpu_restore_state (CPUState *cpu,uintptr_t host_pc); + +G_NORETURN void cpu_loop_exit_noexc(CPUState *cpu); +G_NORETURN void cpu_loop_exit_atomic(CPUState *cpu, uintptr_t pc); +#endif /* CONFIG_TCG */ +G_NORETURN void cpu_loop_exit(CPUState *cpu); +G_NORETURN void cpu_loop_exit_restore(CPUState *cpu, uintptr_t pc); +#endif /* CPU_COMMON_H */
include/exec/exec-all.h +0 -30
@@ -27,36 +27,6 @@#include "exec/translation-block.h" #include "qemu/clang-tsa.h" -/** -* cpu_unwind_state_data: -* @cpu: the cpu context -* @host_pc: the host pc within the translation -* @data: output data -* -* Attempt to load the the unwind state for a host pc occurring in -* translated code. If @host_pc is not in translated code, the -* function returns false; otherwise @data is loaded. -* This is the same unwind info as given to restore_state_to_opc. -*/ -bool cpu_unwind_state_data (CPUState *cpu,uintptr_t host_pc,uint64_t *data); - -/** -* cpu_restore_state: -* @cpu: the cpu context -* @host_pc: the host pc within the translation -* @return: true if state was restored, false otherwise -* -* Attempt to restore the state for a fault occurring in translated -* code. If @host_pc is not in translated code no state is -* restored and the function returns false. -*/ -bool cpu_restore_state (CPUState *cpu,uintptr_t host_pc); - -G_NORETURN void cpu_loop_exit_noexc(CPUState *cpu); -G_NORETURN void cpu_loop_exit(CPUState *cpu); -G_NORETURN void cpu_loop_exit_restore(CPUState *cpu, uintptr_t pc); -G_NORETURN void cpu_loop_exit_atomic(CPUState *cpu, uintptr_t pc); -/** * cpu_loop_exit_requested: * @cpu: The CPU state to be tested
Signature · 1 line
2.41.0
Re: [PATCH 02/11] exec: Move cpu_loop_foo() target agnostic functions to 'cpu-common.h'
Quoted 95 lines · Philippe Mathieu-Daudé
While these functions are not TCG specific, they are not target specific. Move them to "
exec/cpu-common.h" so their callers don't have to be tainted as target specific.Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- include/exec/cpu-common.h | 32 ++++++++++++++++++++++++++++++++ include/exec/exec-all.h | 30 ------------------------------ 2 files changed, 32 insertions(+), 30 deletions(-)include/exec/cpu-common.h +32
-0@@ -173,4 +173,36 @@ int cpu_memory_rw_debug(CPUState *cpu, vaddr addr,/* vl.c */ void list_cpus (void ); +#ifdef CONFIG_TCG +/** +* cpu_unwind_state_data: +* @cpu: the cpu context +* @host_pc: the host pc within the translation +* @data: output data +* +* Attempt to load the the unwind state for a host pc occurring in +* translated code. If @host_pc is not in translated code, the +* function returns false; otherwise @data is loaded. +* This is the same unwind info as given to restore_state_to_opc. +*/ +bool cpu_unwind_state_data (CPUState *cpu,uintptr_t host_pc,uint64_t *data); + +/** +* cpu_restore_state: +* @cpu: the cpu context +* @host_pc: the host pc within the translation +* @return: true if state was restored, false otherwise +* +* Attempt to restore the state for a fault occurring in translated +* code. If @host_pc is not in translated code no state is +* restored and the function returns false. +*/ +bool cpu_restore_state (CPUState *cpu,uintptr_t host_pc); + +G_NORETURN void cpu_loop_exit_noexc(CPUState *cpu); +G_NORETURN void cpu_loop_exit_atomic(CPUState *cpu, uintptr_t pc); +#endif /* CONFIG_TCG */ +G_NORETURN void cpu_loop_exit(CPUState *cpu); +G_NORETURN void cpu_loop_exit_restore(CPUState *cpu, uintptr_t pc); +#endif /* CPU_COMMON_H */ include/exec/exec-all.h +0
-30@@ -27,36 +27,6 @@#include "exec/translation-block.h" #include "qemu/clang-tsa.h" -/** -* cpu_unwind_state_data: -* @cpu: the cpu context -* @host_pc: the host pc within the translation -* @data: output data -* -* Attempt to load the the unwind state for a host pc occurring in -* translated code. If @host_pc is not in translated code, the -* function returns false; otherwise @data is loaded. -* This is the same unwind info as given to restore_state_to_opc. -*/ -bool cpu_unwind_state_data (CPUState *cpu,uintptr_t host_pc,uint64_t *data); - -/** -* cpu_restore_state: -* @cpu: the cpu context -* @host_pc: the host pc within the translation -* @return: true if state was restored, false otherwise -* -* Attempt to restore the state for a fault occurring in translated -* code. If @host_pc is not in translated code no state is -* restored and the function returns false. -*/ -bool cpu_restore_state (CPUState *cpu,uintptr_t host_pc); - -G_NORETURN void cpu_loop_exit_noexc(CPUState *cpu); -G_NORETURN void cpu_loop_exit(CPUState *cpu); -G_NORETURN void cpu_loop_exit_restore(CPUState *cpu, uintptr_t pc); -G_NORETURN void cpu_loop_exit_atomic(CPUState *cpu, uintptr_t pc); -/** * cpu_loop_exit_requested: * @cpu: The CPU state to be tested Signature · 1 line
2.41.0
PATCH 3/11 accel/tcg: Restrict dump_exec_info() declaration
In reply to Philippe Mathieu-DaudéIn commit 00c9a5c2c3 ("accel/tcg: Restrict 'qapi-commands-machine.h' to system emulation") we moved the definition to accel/tcg/ which is where this function is called. No need to expose it outside.
--- accel/tcg/internal.h | 2 ++ include/exec/cpu-all.h | 5 ----- 2 files changed, 2 insertions(+), 5 deletions(-)
accel/tcg/internal.h +2 -0
@@ -102,6 +102,8 @@ static inline bool cpu_in_serial_context(CPUState *cs)extern int64_t max_delay;extern int64_t max_advance; +void dump_exec_info (GString *buf); +extern bool one_insn_per_tb;/**
include/exec/cpu-all.h +0 -5
@@ -406,11 +406,6 @@ static inline bool tlb_hit(uint64_t tlb_addr, vaddr addr) return tlb_hit_page(tlb_addr, addr & TARGET_PAGE_MASK); } -#ifdef CONFIG_TCG -/* accel/tcg/translate-all.c */ -void dump_exec_info (GString *buf); -#endif /* CONFIG_TCG */ -#endif /* !CONFIG_USER_ONLY */ /* accel/tcg/cpu-exec.c */
Signature · 1 line
2.41.0
Re: [PATCH 03/11] accel/tcg: Restrict dump_exec_info() declaration
Quoted 42 lines · Philippe Mathieu-Daudé
In commit
00c9a5c2c3("accel/tcg: Restrict 'qapi-commands-machine.h' to system emulation") we moved the definition to accel/tcg/ which is where this function is called. No need to expose it outside.Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- accel/tcg/internal.h | 2 ++ include/exec/cpu-all.h | 5 ----- 2 files changed, 2 insertions(+), 5 deletions(-)accel/tcg/internal.h +2
-0@@ -102,6 +102,8 @@ static inline bool cpu_in_serial_context(CPUState *cs)extern int64_t max_delay;extern int64_t max_advance; +void dump_exec_info (GString *buf); +extern bool one_insn_per_tb;/** include/exec/cpu-all.h +0
-5@@ -406,11 +406,6 @@ static inline bool tlb_hit(uint64_t tlb_addr, vaddr addr) return tlb_hit_page(tlb_addr, addr & TARGET_PAGE_MASK); } -#ifdef CONFIG_TCG -/* accel/tcg/translate-all.c */ -void dump_exec_info (GString *buf); -#endif /* CONFIG_TCG */ -#endif /* !CONFIG_USER_ONLY */ /* accel/tcg/cpu-exec.c */ Signature · 1 line
2.41.0
PATCH 4/11 accel: Make accel-blocker.o target agnostic
In reply to Philippe Mathieu-Daudéaccel-blocker.c is not target specific, move it to system_ss[].
--- accel/meson.build | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
accel/meson.build +2 -2
@@ -1,5 +1,5 @@ -specific_ss.add(files('accel-common.c', 'accel-blocker.c')) -system_ss.add(files('accel-softmmu.c')) +specific_ss.add(files('accel-common.c')) +system_ss.add(files('accel-softmmu.c', 'accel-blocker.c')) user_ss.add(files('accel-user.c')) subdir('tcg')
Signature · 1 line
2.41.0
Re: [PATCH 04/11] accel: Make accel-blocker.o target agnostic
Quoted 22 lines · Philippe Mathieu-Daudé
accel-blocker.cis not target specific, move it to system_ss[].Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- accel/meson.build | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)accel/meson.build +2
-2@@ -1,5 +1,5 @@ -specific_ss.add(files('accel-common.c', 'accel-blocker.c')) -system_ss.add(files('accel-softmmu.c')) +specific_ss.add(files('accel-common.c')) +system_ss.add(files('accel-softmmu.c', 'accel-blocker.c')) user_ss.add(files('accel-user.c')) subdir('tcg')Signature · 1 line
2.41.0
PATCH 5/11 accel: Rename accel-common.c -> accel-target.c
In reply to Philippe Mathieu-DaudéWe use the '-common.c' suffix for target agnostic units. This file is target specific, rename it using the '-target' suffix.
---
accel/{accel-common.c => accel-target.c} | 0
accel/meson.build | 2 +-
2 files changed, 1 insertion(+), 1 deletion(-)
rename accel/{accel-common.c => accel-target.c} (100%)accel/accel-target.c renamed from accel/accel-common.c +0 -0
accel/meson.build +1 -1
@@ -1,4 +1,4 @@ -specific_ss.add(files('accel-common.c')) +specific_ss.add(files('accel-target.c')) system_ss.add(files('accel-softmmu.c', 'accel-blocker.c')) user_ss.add(files('accel-user.c'))
Signature · 1 line
2.41.0
Re: [PATCH 05/11] accel: Rename accel-common.c -> accel-target.c
Quoted 28 lines · Philippe Mathieu-Daudé
We use the '
-common.c' suffix for target agnostic units. This file is target specific, rename it using the '-target' suffix.Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- accel/{accel-common.c => accel-target.c} | 0 accel/meson.build | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename accel/{accel-common.c => accel-target.c} (100%)accel/accel-target.c renamed from accel/accel-common.c +0
-0accel/meson.build +1
-1@@ -1,4 +1,4 @@ -specific_ss.add(files('accel-common.c')) +specific_ss.add(files('accel-target.c')) system_ss.add(files('accel-softmmu.c', 'accel-blocker.c')) user_ss.add(files('accel-user.c'))Signature · 1 line
2.41.0
PATCH 6/11 exec: Rename cpu.c -> cpu-target.c
In reply to Philippe Mathieu-DaudéWe have exec/cpu code split in 2 files for target agnostic ("common") and specific. Rename 'cpu.c' which is target specific using the '-target' suffix. Update MAINTAINERS. Remove the 's from 'cpus-common.c' to match the API cpu_foo() functions.
--- MAINTAINERS | 4 ++-- meson.build | 4 ++-- cpus-common.c => cpu-common.c | 0 cpu.c => cpu-target.c | 0 4 files changed, 4 insertions(+), 4 deletions(-) rename cpus-common.c => cpu-common.c (100%) rename cpu.c => cpu-target.c (100%)
MAINTAINERS +2 -2
@@ -139,7 +139,8 @@ R: Paolo Bonzini <[email protected]> S: Maintained F: softmmu/cpus.c F: softmmu/watchpoint.c -F: cpus-common.c +F: cpu-common.c +F: cpu-target.c F: page-vary.c F: page-vary-common.c F: accel/tcg/
@@ -1772,7 +1773,6 @@ M: Marcel Apfelbaum <[email protected]> R: Philippe Mathieu-Daudé <[email protected]> R: Yanan Wang <[email protected]> S: Supported -F: cpu.c F: hw/core/cpu.c F: hw/core/machine-qmp-cmds.c F: hw/core/machine.c
meson.build +2 -2
@@ -3416,8 +3416,8 @@ if have_block system_ss.add(when: 'CONFIG_WIN32', if_true: [files('os-win32.c')]) endif -common_ss.add(files('cpus-common.c')) -specific_ss.add(files('cpu.c')) +common_ss.add(files('cpu-common.c')) +specific_ss.add(files('cpu-target.c')) subdir('softmmu')
cpu-common.c renamed from cpus-common.c +0 -0
cpu-target.c renamed from cpu.c +0 -0
Signature · 1 line
2.41.0
Re: [PATCH 06/11] exec: Rename cpu.c -> cpu-target.c
Quoted 31 lines · Philippe Mathieu-Daudé
We have exec/cpu code split in 2 files for target agnostic ("common") and specific. Rename '
cpu.c' which is target specific using the '-target' suffix. UpdateMAINTAINERS. Remove the 's from 'cpus-common.c' to match the APIcpu_foo()functions.Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- MAINTAINERS | 4 ++-- meson.build | 4 ++-- cpus-common.c => cpu-common.c | 0 cpu.c => cpu-target.c | 0 4 files changed, 4 insertions(+), 4 deletions(-) rename cpus-common.c => cpu-common.c (100%) rename cpu.c => cpu-target.c (100%)MAINTAINERS +2
-1@@ -139,7 +139,8 @@ R: Paolo Bonzini <[email protected]> S: Maintained F: softmmu/cpus.c F: softmmu/watchpoint.c -F: cpus-common.c +F: cpu-common.c +F: cpu-target.c F: page-vary.c F: page-vary-common.c F: accel/tcg/
MAINTAINERS M: Marcel Apfelbaum <[email protected]> · line 1775
Quoted 4 lines
MAINTAINERS +0
-1@@ -1772,7 +1773,6 @@ M: Marcel Apfelbaum <[email protected]> R: Philippe Mathieu-Daudé <[email protected]> R: Yanan Wang <[email protected]> S: Supported -F: cpu.c
Was the maintainer switch intentional?
Either way,
Re: [PATCH 06/11] exec: Rename cpu.c -> cpu-target.c
Quoted 17 lines · Anton Johansson
Quoted 16 lines · Philippe Mathieu-Daudé
We have exec/cpu code split in 2 files for target agnostic ("common") and specific. Rename '
cpu.c' which is target specific using the '-target' suffix. UpdateMAINTAINERS. Remove the 's from 'cpus-common.c' to match the APIcpu_foo()functions.Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- MAINTAINERS | 4 ++-- meson.build | 4 ++-- cpus-common.c => cpu-common.c | 0 cpu.c => cpu-target.c | 0 4 files changed, 4 insertions(+), 4 deletions(-)rename
cpus-common.c=>cpu-common.c(100%)
renamecpu.c=>cpu-target.c(100%)
Quoted 11 lines
MAINTAINERS R: Paolo Bonzini <[email protected]> · line 143
Quoted 11 lines
MAINTAINERS +2
-1@@ -139,7 +139,8 @@ R: Paolo Bonzini <[email protected]> S: Maintained F: softmmu/cpus.c F: softmmu/watchpoint.c -F: cpus-common.c +F: cpu-common.c +F: cpu-target.c
The renamed file is here ^
Quoted 9 lines
MAINTAINERS M: Marcel Apfelbaum <[email protected]> · line 1775
Quoted 8 lines
MAINTAINERS +0
-1F: page-vary.c F: page-vary-common.c F: accel/tcg/@@ -1772,7 +1773,6 @@ M: Marcel Apfelbaum <[email protected]> R: Philippe Mathieu-Daudé <[email protected]> R: Yanan Wang <[email protected]> S: Supported -F: cpu.cWas the maintainer switch intentional?
(yes, see earlier)
Quoted 3 lines
Either way,
Reviewed-by Anton Johansson <[email protected]>
Thanks!
PATCH 7/11 exec: Rename target specific page-vary.c -> page-vary-target.c
In reply to Philippe Mathieu-DaudéThis matches the target agnostic 'page-vary-common.c' counterpart.
--- MAINTAINERS | 2 +- meson.build | 2 +- page-vary.c => page-vary-target.c | 0 3 files changed, 2 insertions(+), 2 deletions(-) rename page-vary.c => page-vary-target.c (100%)
MAINTAINERS +1 -1
@@ -141,7 +141,7 @@ F: softmmu/cpus.c F: softmmu/watchpoint.c F: cpu-common.c F: cpu-target.c -F: page-vary.c +F: page-vary-target.c F: page-vary-common.c F: accel/tcg/ F: accel/stubs/tcg-stub.c
meson.build +1 -1
@@ -3439,7 +3439,7 @@ if get_option('b_lto') pagevary = declare_dependency(link_with: pagevary) endif common_ss.add(pagevary) -specific_ss.add(files('page-vary.c')) +specific_ss.add(files('page-vary-target.c')) subdir('backends') subdir('disas')
page-vary-target.c renamed from page-vary.c +0 -0
Signature · 1 line
2.41.0
Re: [PATCH 07/11] exec: Rename target specific page-vary.c -> page-vary-target.c
Quoted 43 lines · Philippe Mathieu-Daudé
This matches the target agnostic '
page-vary-common.c' counterpart.Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- MAINTAINERS | 2 +- meson.build | 2 +- page-vary.c => page-vary-target.c | 0 3 files changed, 2 insertions(+), 2 deletions(-) rename page-vary.c => page-vary-target.c (100%)MAINTAINERS +1
-1@@ -141,7 +141,7 @@ F: softmmu/cpus.c F: softmmu/watchpoint.c F: cpu-common.c F: cpu-target.c -F: page-vary.c +F: page-vary-target.c F: page-vary-common.c F: accel/tcg/ F: accel/stubs/tcg-stub.cmeson.build +1
-1@@ -3439,7 +3439,7 @@ if get_option('b_lto') pagevary = declare_dependency(link_with: pagevary) endif common_ss.add(pagevary) -specific_ss.add(files('page-vary.c')) +specific_ss.add(files('page-vary-target.c')) subdir('backends') subdir('disas')page-vary-target.c renamed from page-vary.c +0
-0Signature · 1 line
2.41.0
PATCH 8/11 accel/tcg: Rename target-specific 'internal.h' -> 'internal-target.h'
In reply to Philippe Mathieu-Daudéaccel/tcg/internal.h contains target specific declarations. Unit files including it become "target tainted": they can not be compiled as target agnostic. Rename using the '-target' suffix to make this explicit.
---
accel/tcg/{internal.h => internal-target.h} | 6 +++---
accel/tcg/cpu-exec-common.c | 2 +-
accel/tcg/cpu-exec.c | 2 +-
accel/tcg/cputlb.c | 2 +-
accel/tcg/monitor.c | 2 +-
accel/tcg/tb-maint.c | 2 +-
accel/tcg/tcg-all.c | 2 +-
accel/tcg/translate-all.c | 2 +-
accel/tcg/translator.c | 2 +-
accel/tcg/user-exec.c | 2 +-
10 files changed, 12 insertions(+), 12 deletions(-)
rename accel/tcg/{internal.h => internal-target.h} (96%)accel/tcg/internal-target.h renamed from accel/tcg/internal.h +3 -3
@@ -1,13 +1,13 @@/* -* Internal execution defines for qemu +* Internal execution defines for qemu (target specific) * * Copyright (c) 2003 Fabrice Bellard * * SPDX-License-Identifier: LGPL-2.1-or-later */ -#ifndef ACCEL_TCG_INTERNAL_H -#define ACCEL_TCG_INTERNAL_H +#ifndef ACCEL_TCG_INTERNAL_TARGET_H +#define ACCEL_TCG_INTERNAL_TARGET_H #include "exec/exec-all.h" #include "exec/translate-all.h"
accel/tcg/cpu-exec-common.c +1 -1
@@ -22,7 +22,7 @@#include "sysemu/tcg.h" #include "exec/exec-all.h" #include "qemu/plugin.h" -#include "internal.h" +#include "internal-target.h" bool tcg_allowed;
accel/tcg/cpu-exec.c +1 -1
@@ -42,7 +42,7 @@#include "tb-jmp-cache.h" #include "tb-hash.h" #include "tb-context.h" -#include "internal.h" +#include "internal-target.h" /* -icount align implementation. */
accel/tcg/cputlb.c +1 -1
@@ -35,7 +35,7 @@#include "exec/translate-all.h" #include "trace.h" #include "tb-hash.h" -#include "internal.h" +#include "internal-target.h" #ifdef CONFIG_PLUGIN #include "qemu/plugin-memory.h" #endif
accel/tcg/monitor.c +1 -1
@@ -16,7 +16,7 @@#include "sysemu/cpu-timers.h" #include "sysemu/tcg.h" #include "tcg/tcg.h" -#include "internal.h" +#include "internal-target.h" static void dump_drift_info (GString *buf)
accel/tcg/tb-maint.c +1 -1
@@ -29,7 +29,7 @@#include "tcg/tcg.h" #include "tb-hash.h" #include "tb-context.h" -#include "internal.h" +#include "internal-target.h" /* List iterators for lists of tagged pointers in TranslationBlock. */
accel/tcg/tcg-all.c +1 -1
@@ -38,7 +38,7 @@#if !defined(CONFIG_USER_ONLY )#include "hw/boards.h" #endif -#include "internal.h" +#include "internal-target.h" struct TCGState {AccelState parent_obj;
accel/tcg/translate-all.c +1 -1
@@ -61,7 +61,7 @@#include "tb-jmp-cache.h" #include "tb-hash.h" #include "tb-context.h" -#include "internal.h" +#include "internal-target.h" #include "perf.h" #include "tcg/insn-start-words.h"
accel/tcg/translator.c +1 -1
@@ -14,7 +14,7 @@#include "exec/translator.h" #include "exec/plugin-gen.h" #include "tcg/tcg-op-common.h" -#include "internal.h" +#include "internal-target.h" static void gen_io_start (void ) {
accel/tcg/user-exec.c +1 -1
@@ -29,7 +29,7 @@#include "qemu/atomic128.h" #include "trace/trace-root.h" #include "tcg/tcg-ldst.h" -#include "internal.h" +#include "internal-target.h" __threaduintptr_t helper_retaddr;
Signature · 1 line
2.41.0
Re: [PATCH 08/11] accel/tcg: Rename target-specific 'internal.h' -> 'internal-target.h'
Quoted 164 lines · Philippe Mathieu-Daudé
accel/tcg/internal.hcontains target specific declarations. Unit files including it become "target tainted": they can not be compiled as target agnostic. Rename using the '-target' suffix to make this explicit.Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- accel/tcg/{internal.h => internal-target.h} | 6 +++--- accel/tcg/cpu-exec-common.c | 2 +- accel/tcg/cpu-exec.c | 2 +- accel/tcg/cputlb.c | 2 +- accel/tcg/monitor.c | 2 +- accel/tcg/tb-maint.c | 2 +- accel/tcg/tcg-all.c | 2 +- accel/tcg/translate-all.c | 2 +- accel/tcg/translator.c | 2 +- accel/tcg/user-exec.c | 2 +- 10 files changed, 12 insertions(+), 12 deletions(-) rename accel/tcg/{internal.h => internal-target.h} (96%)accel/tcg/internal-target.h renamed from accel/tcg/internal.h +3
-3@@ -1,13 +1,13 @@/* -* Internal execution defines for qemu +* Internal execution defines for qemu (target specific) * * Copyright (c) 2003 Fabrice Bellard * * SPDX-License-Identifier: LGPL-2.1-or-later */ -#ifndef ACCEL_TCG_INTERNAL_H -#define ACCEL_TCG_INTERNAL_H +#ifndef ACCEL_TCG_INTERNAL_TARGET_H +#define ACCEL_TCG_INTERNAL_TARGET_H #include "exec/exec-all.h" #include "exec/translate-all.h" accel/tcg/cpu-exec-common.c +1
-1@@ -22,7 +22,7 @@#include "sysemu/tcg.h" #include "exec/exec-all.h" #include "qemu/plugin.h" -#include "internal.h" +#include "internal-target.h" bool tcg_allowed;accel/tcg/cpu-exec.c +1
-1@@ -42,7 +42,7 @@#include "tb-jmp-cache.h" #include "tb-hash.h" #include "tb-context.h" -#include "internal.h" +#include "internal-target.h" /* -icount align implementation. */ accel/tcg/cputlb.c +1
-1@@ -35,7 +35,7 @@#include "exec/translate-all.h" #include "trace.h" #include "tb-hash.h" -#include "internal.h" +#include "internal-target.h" #ifdef CONFIG_PLUGIN #include "qemu/plugin-memory.h" #endif accel/tcg/monitor.c +1
-1@@ -16,7 +16,7 @@#include "sysemu/cpu-timers.h" #include "sysemu/tcg.h" #include "tcg/tcg.h" -#include "internal.h" +#include "internal-target.h" static void dump_drift_info (GString *buf)accel/tcg/tb-maint.c +1
-1@@ -29,7 +29,7 @@#include "tcg/tcg.h" #include "tb-hash.h" #include "tb-context.h" -#include "internal.h" +#include "internal-target.h" /* List iterators for lists of tagged pointers in TranslationBlock. */ accel/tcg/tcg-all.c +1
-1@@ -38,7 +38,7 @@#if !defined(CONFIG_USER_ONLY )#include "hw/boards.h" #endif -#include "internal.h" +#include "internal-target.h" struct TCGState {AccelState parent_obj;accel/tcg/translate-all.c +1
-1@@ -61,7 +61,7 @@#include "tb-jmp-cache.h" #include "tb-hash.h" #include "tb-context.h" -#include "internal.h" +#include "internal-target.h" #include "perf.h" #include "tcg/insn-start-words.h" accel/tcg/translator.c +1
-1@@ -14,7 +14,7 @@#include "exec/translator.h" #include "exec/plugin-gen.h" #include "tcg/tcg-op-common.h" -#include "internal.h" +#include "internal-target.h" static void gen_io_start (void ) {accel/tcg/user-exec.c +1
-1@@ -29,7 +29,7 @@#include "qemu/atomic128.h" #include "trace/trace-root.h" #include "tcg/tcg-ldst.h" -#include "internal.h" +#include "internal-target.h" __threaduintptr_t helper_retaddr;Signature · 1 line
2.41.0
PATCH 9/11 accel/tcg: Make monitor.c a target-agnostic unit
In reply to Philippe Mathieu-DaudéMove target-agnostic declarations from "internal-target.h" to a new "internal-common.h" header.monitor.c now don't include target specific headers and can be compiled once in system_ss[].
--- accel/tcg/internal-common.h | 17 +++++++++++++++++ accel/tcg/internal-target.h | 5 ----- accel/tcg/cpu-exec.c | 1 + accel/tcg/monitor.c | 2 +- accel/tcg/translate-all.c | 1 + accel/tcg/meson.build | 3 +++ 6 files changed, 23 insertions(+), 6 deletions(-) create mode 100644 accel/tcg/internal-common.h
accel/tcg/internal-common.h new file +17 -0
@@ -0,0 +1,17 @@ +/* +* Internal execution defines for qemu (target agnostic) +* +* Copyright (c) 2003 Fabrice Bellard +* +* SPDX-License-Identifier: LGPL-2.1-or-later +*/ + +#ifndef ACCEL_TCG_INTERNAL_COMMON_H +#define ACCEL_TCG_INTERNAL_COMMON_H + +extern int64_t max_delay; +extern int64_t max_advance; + +void dump_exec_info (GString *buf); + +#endif
accel/tcg/internal-target.h +0 -5
@@ -99,11 +99,6 @@ static inline bool cpu_in_serial_context(CPUState *cs)return !(cs->tcg_cflags &CF_PARALLEL ) ||cpu_in_exclusive_context (cs); } -extern int64_t max_delay; -extern int64_t max_advance; - -void dump_exec_info (GString *buf); -extern bool one_insn_per_tb;/**
accel/tcg/cpu-exec.c +1 -0
@@ -42,6 +42,7 @@#include "tb-jmp-cache.h" #include "tb-hash.h" #include "tb-context.h" +#include "internal-common.h" #include "internal-target.h" /* -icount align implementation. */
accel/tcg/monitor.c +1 -1
@@ -16,7 +16,7 @@#include "sysemu/cpu-timers.h" #include "sysemu/tcg.h" #include "tcg/tcg.h" -#include "internal-target.h" +#include "internal-common.h" static void dump_drift_info (GString *buf)
accel/tcg/translate-all.c +1 -0
@@ -61,6 +61,7 @@#include "tb-jmp-cache.h" #include "tb-hash.h" #include "tb-context.h" +#include "internal-common.h" #include "internal-target.h" #include "perf.h" #include "tcg/insn-start-words.h"
accel/tcg/meson.build +3 -0
@@ -20,6 +20,9 @@ specific_ss.add_all(when: 'CONFIG_TCG', if_true: tcg_ss) specific_ss.add(when: ['CONFIG_SYSTEM_ONLY', 'CONFIG_TCG'], if_true: files( 'cputlb.c', +)) + +system_ss.add(when: ['CONFIG_TCG'], if_true: files( 'monitor.c', ))
Signature · 1 line
2.41.0
Re: [PATCH 09/11] accel/tcg: Make monitor.c a target-agnostic unit
Quoted 109 lines · Philippe Mathieu-Daudé
Move target-agnostic declarations from "
internal-target.h" to a new "internal-common.h" header.monitor.cnow don't include target specific headers and can be compiled once in system_ss[].Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- accel/tcg/internal-common.h | 17 +++++++++++++++++ accel/tcg/internal-target.h | 5 ----- accel/tcg/cpu-exec.c | 1 + accel/tcg/monitor.c | 2 +- accel/tcg/translate-all.c | 1 + accel/tcg/meson.build | 3 +++ 6 files changed, 23 insertions(+), 6 deletions(-) create mode 100644 accel/tcg/internal-common.haccel/tcg/internal-common.h new file +17
-0@@ -0,0 +1,17 @@ +/* +* Internal execution defines for qemu (target agnostic) +* +* Copyright (c) 2003 Fabrice Bellard +* +* SPDX-License-Identifier: LGPL-2.1-or-later +*/ + +#ifndef ACCEL_TCG_INTERNAL_COMMON_H +#define ACCEL_TCG_INTERNAL_COMMON_H + +extern int64_t max_delay; +extern int64_t max_advance; + +void dump_exec_info (GString *buf); + +#endif accel/tcg/internal-target.h +0
-5@@ -99,11 +99,6 @@ static inline bool cpu_in_serial_context(CPUState *cs)return !(cs->tcg_cflags &CF_PARALLEL ) ||cpu_in_exclusive_context (cs); } -extern int64_t max_delay; -extern int64_t max_advance; - -void dump_exec_info (GString *buf); -extern bool one_insn_per_tb;/** accel/tcg/cpu-exec.c +1
-0@@ -42,6 +42,7 @@#include "tb-jmp-cache.h" #include "tb-hash.h" #include "tb-context.h" +#include "internal-common.h" #include "internal-target.h" /* -icount align implementation. */ accel/tcg/monitor.c +1
-1@@ -16,7 +16,7 @@#include "sysemu/cpu-timers.h" #include "sysemu/tcg.h" #include "tcg/tcg.h" -#include "internal-target.h" +#include "internal-common.h" static void dump_drift_info (GString *buf)accel/tcg/translate-all.c +1
-0@@ -61,6 +61,7 @@#include "tb-jmp-cache.h" #include "tb-hash.h" #include "tb-context.h" +#include "internal-common.h" #include "internal-target.h" #include "perf.h" #include "tcg/insn-start-words.h" accel/tcg/meson.build +3
-0@@ -20,6 +20,9 @@ specific_ss.add_all(when: 'CONFIG_TCG', if_true: tcg_ss) specific_ss.add(when: ['CONFIG_SYSTEM_ONLY', 'CONFIG_TCG'], if_true: files( 'cputlb.c', +)) + +system_ss.add(when: ['CONFIG_TCG'], if_true: files( 'monitor.c', ))Signature · 1 line
2.41.0
PATCH 10/11 accel/tcg: Make icount.o a target agnostic unit
In reply to Philippe Mathieu-DaudéRemove the unused "exec/exec-all.h" header. There is no more target specific code in it: make it target agnostic (rename using the '-common' suffix). Since it is TCG specific, move it to accel/tcg, updating MAINTAINERS.
--- MAINTAINERS | 1 - softmmu/icount.c => accel/tcg/icount-common.c | 3 +-- accel/tcg/meson.build | 1 + softmmu/meson.build | 4 ---- 4 files changed, 2 insertions(+), 7 deletions(-) rename softmmu/icount.c => accel/tcg/icount-common.c (99%)
MAINTAINERS +0 -1
@@ -2912,7 +2912,6 @@ F: softmmu/main.c F: softmmu/cpus.c F: softmmu/cpu-throttle.c F: softmmu/cpu-timers.c -F: softmmu/icount.c F: softmmu/runstate* F: qapi/run-state.json
accel/tcg/icount-common.c renamed from softmmu/icount.c +1 -2
@@ -27,7 +27,6 @@#include "migration/vmstate.h" #include "qapi/error.h" #include "qemu/error-report.h" -#include "exec/exec-all.h" #include "sysemu/cpus.h" #include "sysemu/qtest.h" #include "qemu/main-loop.h"
@@ -38,7 +37,7 @@#include "hw/core/cpu.h" #include "sysemu/cpu-timers.h" #include "sysemu/cpu-throttle.h" -#include "timers-state.h" +#include "softmmu/timers-state.h" /* * ICOUNT: Instruction Counter
accel/tcg/meson.build +1 -0
@@ -23,6 +23,7 @@ specific_ss.add(when: ['CONFIG_SYSTEM_ONLY', 'CONFIG_TCG'], if_true: files( )) system_ss.add(when: ['CONFIG_TCG'], if_true: files( + 'icount-common.c', 'monitor.c', ))
softmmu/meson.build +0 -4
@@ -6,10 +6,6 @@ specific_ss.add(when: 'CONFIG_SYSTEM_ONLY', if_true: [files( 'watchpoint.c', )]) -specific_ss.add(when: ['CONFIG_SYSTEM_ONLY', 'CONFIG_TCG'], if_true: [files( - 'icount.c', -)]) - system_ss.add(files( 'balloon.c', 'bootdevice.c',
Signature · 1 line
2.41.0
Re: [PATCH 10/11] accel/tcg: Make icount.o a target agnostic unit
Quoted 20 lines · Philippe Mathieu-Daudé
Remove the unused "
exec/exec-all.h" header. There is no more target specific code in it: make it target agnostic (rename using the '-common' suffix). Since it is TCG specific, move it to accel/tcg, updatingMAINTAINERS.Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- MAINTAINERS | 1 - softmmu/icount.c => accel/tcg/icount-common.c | 3 +-- accel/tcg/meson.build | 1 + softmmu/meson.build | 4 ---- 4 files changed, 2 insertions(+), 7 deletions(-) rename softmmu/icount.c => accel/tcg/icount-common.c (99%)MAINTAINERS +0
-0
MAINTAINERS F: softmmu/main.c · line 2915
Quoted 4 lines
MAINTAINERS +0
-1@@ -2912,7 +2912,6 @@ F: softmmu/main.c F: softmmu/cpus.c F: softmmu/cpu-throttle.c F: softmmu/cpu-timers.c -F: softmmu/icount.c
Would also be a maintainer switch
Otherwise,
Re: [PATCH 10/11] accel/tcg: Make icount.o a target agnostic unit
Quoted 16 lines · Anton Johansson
Quoted 15 lines · Philippe Mathieu-Daudé
Remove the unused "
exec/exec-all.h" header. There is no more target specific code in it: make it target agnostic (rename using the '-common' suffix). Since it is TCG specific, move it to accel/tcg, updatingMAINTAINERS.Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- MAINTAINERS | 1 - softmmu/icount.c => accel/tcg/icount-common.c | 3 +-- accel/tcg/meson.build | 1 + softmmu/meson.build | 4 ---- 4 files changed, 2 insertions(+), 7 deletions(-)rename
softmmu/icount.c=>accel/tcg/icount-common.c(99%)
Quoted 10 lines
MAINTAINERS F: softmmu/main.c · line 2915
Quoted 9 lines
MAINTAINERS +0
-1@@ -2912,7 +2912,6 @@ F: softmmu/main.c F: softmmu/cpus.c F: softmmu/cpu-throttle.c F: softmmu/cpu-timers.c -F: softmmu/icount.cWould also be a maintainer switch
OK, now I understood your comment. I should have mentioned it in the commit description. This move from "Main loop" to "Overall TCG". Icount is a TCG feature.
(Less work for Paolo, but more for Richard...)
Quoted 2 lines
Otherwise,
Reviewed-by Anton Johansson <[email protected]>
Re: [PATCH 10/11] accel/tcg: Make icount.o a target agnostic unit
Quoted 28 lines · Philippe Mathieu-Daudé
Quoted 16 lines · Anton Johansson
Quoted 15 lines · Philippe Mathieu-Daudé
Remove the unused "
exec/exec-all.h" header. There is no more target specific code in it: make it target agnostic (rename using the '-common' suffix). Since it is TCG specific, move it to accel/tcg, updatingMAINTAINERS.Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- MAINTAINERS | 1 - softmmu/icount.c => accel/tcg/icount-common.c | 3 +-- accel/tcg/meson.build | 1 + softmmu/meson.build | 4 ---- 4 files changed, 2 insertions(+), 7 deletions(-)rename
softmmu/icount.c=>accel/tcg/icount-common.c(99%)Quoted 10 lines
MAINTAINERS F: softmmu/main.c · line 2915
Quoted 9 lines
MAINTAINERS +0
-1@@ -2912,7 +2912,6 @@ F: softmmu/main.c F: softmmu/cpus.c F: softmmu/cpu-throttle.c F: softmmu/cpu-timers.c -F: softmmu/icount.cWould also be a maintainer switch
Quoted 4 lines
OK, now I understood your comment. I should have mentioned it in the commit description. This move from "Main loop" to "Overall TCG". Icount is a TCG feature.
(Less work for Paolo, but more for Richard...)
Ah that makes sense, just wanted to make sure:)
PATCH 11/11 accel/tcg: Make cpu-exec-common.c a target agnostic unit
In reply to Philippe Mathieu-Daudécpu_in_serial_context() is not target specific, move it declaration to "internal-common.h" (which we include in the 4 source files modified).
Remove the unused "exec/exec-all.h" header from cpu-exec-common.c. There is no more target specific code in this file: make it target agnostic.
--- accel/tcg/internal-common.h | 11 +++++++++++ accel/tcg/internal-target.h | 9 --------- accel/tcg/cpu-exec-common.c | 3 +-- accel/tcg/cputlb.c | 1 + accel/tcg/tb-maint.c | 1 + accel/tcg/user-exec.c | 1 + accel/tcg/meson.build | 4 +++- 7 files changed, 18 insertions(+), 12 deletions(-)
accel/tcg/internal-common.h +11 -0
@@ -9,9 +9,20 @@#ifndef ACCEL_TCG_INTERNAL_COMMON_H #define ACCEL_TCG_INTERNAL_COMMON_H +#include "exec/translation-block.h" +extern int64_t max_delay;extern int64_t max_advance;void dump_exec_info (GString *buf); +/* +* Return true if CS is not running in parallel with other cpus, either +* because there are no other cpus or we are within an exclusive context. +*/ +static inline bool cpu_in_serial_context (CPUState *cs) +{ +return !(cs->tcg_cflags &CF_PARALLEL ) ||cpu_in_exclusive_context (cs); +} +#endif
accel/tcg/internal-target.h +0 -9
@@ -90,15 +90,6 @@ static inline vaddr log_pc(CPUState *cpu, const TranslationBlock *tb) } } -/* -* Return true if CS is not running in parallel with other cpus, either -* because there are no other cpus or we are within an exclusive context. -*/ -static inline bool cpu_in_serial_context (CPUState *cs) -{ -return !(cs->tcg_cflags &CF_PARALLEL ) ||cpu_in_exclusive_context (cs); -} -extern bool one_insn_per_tb;/**
accel/tcg/cpu-exec-common.c +1 -2
@@ -20,9 +20,8 @@#include "qemu/osdep.h" #include "sysemu/cpus.h" #include "sysemu/tcg.h" -#include "exec/exec-all.h" #include "qemu/plugin.h" -#include "internal-target.h" +#include "internal-common.h" bool tcg_allowed;
accel/tcg/cputlb.c +1 -0
@@ -35,6 +35,7 @@#include "exec/translate-all.h" #include "trace.h" #include "tb-hash.h" +#include "internal-common.h" #include "internal-target.h" #ifdef CONFIG_PLUGIN #include "qemu/plugin-memory.h"
accel/tcg/tb-maint.c +1 -0
@@ -29,6 +29,7 @@#include "tcg/tcg.h" #include "tb-hash.h" #include "tb-context.h" +#include "internal-common.h" #include "internal-target.h"
accel/tcg/user-exec.c +1 -0
@@ -29,6 +29,7 @@#include "qemu/atomic128.h" #include "trace/trace-root.h" #include "tcg/tcg-ldst.h" +#include "internal-common.h" #include "internal-target.h" __threaduintptr_t helper_retaddr;
accel/tcg/meson.build +3 -1
@@ -1,7 +1,9 @@ tcg_ss = ss.source_set() +common_ss.add(when: 'CONFIG_TCG', if_true: files( + 'cpu-exec-common.c', +)) tcg_ss.add(files( 'tcg-all.c', - 'cpu-exec-common.c', 'cpu-exec.c', 'tb-maint.c', 'tcg-runtime-gvec.c',
Signature · 1 line
2.41.0
Re: [PATCH 11/11] accel/tcg: Make cpu-exec-common.c a target agnostic unit
Quoted 133 lines · Philippe Mathieu-Daudé
cpu_in_serial_context()is not target specific, move it declaration to "internal-common.h" (which we include in the 4 source files modified).Remove the unused "
exec/exec-all.h" header fromcpu-exec-common.c. There is no more target specific code in this file: make it target agnostic.Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- accel/tcg/internal-common.h | 11 +++++++++++ accel/tcg/internal-target.h | 9 --------- accel/tcg/cpu-exec-common.c | 3 +-- accel/tcg/cputlb.c | 1 + accel/tcg/tb-maint.c | 1 + accel/tcg/user-exec.c | 1 + accel/tcg/meson.build | 4 +++- 7 files changed, 18 insertions(+), 12 deletions(-)accel/tcg/internal-common.h +11
-0@@ -9,9 +9,20 @@#ifndef ACCEL_TCG_INTERNAL_COMMON_H #define ACCEL_TCG_INTERNAL_COMMON_H +#include "exec/translation-block.h" +extern int64_t max_delay;extern int64_t max_advance;void dump_exec_info (GString *buf); +/* +* Return true if CS is not running in parallel with other cpus, either +* because there are no other cpus or we are within an exclusive context. +*/ +static inline bool cpu_in_serial_context (CPUState *cs) +{ +return !(cs->tcg_cflags &CF_PARALLEL ) ||cpu_in_exclusive_context (cs); +} +#endif accel/tcg/internal-target.h +0
-9@@ -90,15 +90,6 @@ static inline vaddr log_pc(CPUState *cpu, const TranslationBlock *tb) } } -/* -* Return true if CS is not running in parallel with other cpus, either -* because there are no other cpus or we are within an exclusive context. -*/ -static inline bool cpu_in_serial_context (CPUState *cs) -{ -return !(cs->tcg_cflags &CF_PARALLEL ) ||cpu_in_exclusive_context (cs); -} -extern bool one_insn_per_tb;/** accel/tcg/cpu-exec-common.c +1
-2@@ -20,9 +20,8 @@#include "qemu/osdep.h" #include "sysemu/cpus.h" #include "sysemu/tcg.h" -#include "exec/exec-all.h" #include "qemu/plugin.h" -#include "internal-target.h" +#include "internal-common.h" bool tcg_allowed;accel/tcg/cputlb.c +1
-0@@ -35,6 +35,7 @@#include "exec/translate-all.h" #include "trace.h" #include "tb-hash.h" +#include "internal-common.h" #include "internal-target.h" #ifdef CONFIG_PLUGIN #include "qemu/plugin-memory.h" accel/tcg/tb-maint.c +1
-0@@ -29,6 +29,7 @@#include "tcg/tcg.h" #include "tb-hash.h" #include "tb-context.h" +#include "internal-common.h" #include "internal-target.h" accel/tcg/user-exec.c +1
-0@@ -29,6 +29,7 @@#include "qemu/atomic128.h" #include "trace/trace-root.h" #include "tcg/tcg-ldst.h" +#include "internal-common.h" #include "internal-target.h" __threaduintptr_t helper_retaddr;accel/tcg/meson.build +3
-1@@ -1,7 +1,9 @@ tcg_ss = ss.source_set() +common_ss.add(when: 'CONFIG_TCG', if_true: files( + 'cpu-exec-common.c', +)) tcg_ss.add(files( 'tcg-all.c', - 'cpu-exec-common.c', 'cpu-exec.c', 'tb-maint.c', 'tcg-runtime-gvec.c',Signature · 1 line
2.41.0
Quoted 10 lines · Philippe Mathieu-Daudé
While reviewing Anton/Richard series [*] it was a bit hard for me to figure out which headers are target specific and "taint" the source which include them, in that we can not compile them once for all targets.
My understanding is
-all.hsuffix is a target specific header, and-common.cis a target agnostic file. I tried to consolidate a bit renaming some files with the-target.csuffix (I'd like to rename-all.h->.target.hfor parity / clarity, but that is too much code churn at this point).
Nice, very much appreciated, I've also been struggling a bit with keeping track of especially target-agnostic/dependent headers.
Signature · 2 lines
Anton Johansson rev.ng Labs Srl.