Skip to contentSkip to conversation

accel/tcg: Make more files target agnostic (& exec/ housekeeping)

PATCH In review Philippe Mathieu-Daudé 2 participants 27 messages Sep 14, 2023 – Sep 15, 2023 Arm/Amlogic Meson SoC support

lore
Share & tools
lore
#0 lore raw

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
#1 lore raw

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
index 3b1cec390b..71efc2d404 100644
@@ -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
index 41788c0bdd..360b8298a4 100644
@@ -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
Reviewed-by Anton Johansson on v1 1/11
#2 lore raw

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".

---
 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
index 3b1cec390b..71efc2d404 100644
@@ -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
index 41788c0bdd..360b8298a4 100644
@@ -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
#3 lore raw

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
index 360b8298a4..605b160a7e 100644
@@ -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
index 2e4d337805..ee90ef122b 100644
@@ -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
Reviewed-by Anton Johansson on v1 2/11
#4 lore raw

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.

---
 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
index 360b8298a4..605b160a7e 100644
@@ -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
index 2e4d337805..ee90ef122b 100644
@@ -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
#5 lore raw

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
index e8cbbde581..cd6b9eb7f0 100644
@@ -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
index 71efc2d404..221ada2b6d 100644
@@ -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
Reviewed-by Anton Johansson on v1 3/11
#6 lore raw

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.

---
 accel/tcg/internal.h   | 2 ++
 include/exec/cpu-all.h | 5 -----
 2 files changed, 2 insertions(+), 5 deletions(-)
accel/tcg/internal.h +2 -0
index e8cbbde581..cd6b9eb7f0 100644
@@ -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
index 71efc2d404..221ada2b6d 100644
@@ -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
#7 lore raw

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
index 638a9a03ba..76f3cbc530 100644
@@ -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
Reviewed-by Anton Johansson on v1 4/11
#8 lore raw

Re: [PATCH 04/11] accel: Make accel-blocker.o target agnostic

Quoted 22 lines · 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
index 638a9a03ba..76f3cbc530 100644
@@ -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
#9 lore raw

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
similarity index 100%
rename from accel/accel-common.c
rename to accel/accel-target.c
accel/meson.build +1 -1
index 76f3cbc530..fda3157a6e 100644
@@ -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
Reviewed-by Anton Johansson on v1 5/11
#10 lore raw

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.

---
 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
similarity index 100%
rename from accel/accel-common.c
rename to accel/accel-target.c
accel/meson.build +1 -1
index 76f3cbc530..fda3157a6e 100644
@@ -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
#11 lore raw

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
index 00562f924f..12261d8eaf 100644
@@ -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
index 5150a74831..3e86a6cebf 100644
@@ -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
similarity index 100%
rename from cpus-common.c
rename to cpu-common.c
cpu-target.c renamed from cpu.c +0 -0
similarity index 100%
rename from cpu.c
rename to cpu-target.c
Signature · 1 line
2.41.0
Reviewed-by Anton Johansson on v1 6/11
#12 lore raw

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. 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 -1
index 00562f924f..12261d8eaf 100644
@@ -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,

#13 lore raw

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. 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%)

Quoted 11 lines

MAINTAINERS R: Paolo Bonzini <[email protected]> · line 143

Quoted 11 lines
MAINTAINERS +2 -1
index 00562f924f..12261d8eaf 100644
@@ -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 -1
  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

Was the maintainer switch intentional?

(yes, see earlier)

Quoted 3 lines

Either way,

Thanks!

#14 lore raw

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
index 12261d8eaf..ff436dbf21 100644
@@ -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
index 3e86a6cebf..3282f888a3 100644
@@ -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
similarity index 100%
rename from page-vary.c
rename to page-vary-target.c
Signature · 1 line
2.41.0
Reviewed-by Anton Johansson on v1 7/11
#15 lore raw

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.

---
 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
index 12261d8eaf..ff436dbf21 100644
@@ -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
index 3e86a6cebf..3282f888a3 100644
@@ -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
similarity index 100%
rename from page-vary.c
rename to page-vary-target.c
Signature · 1 line
2.41.0
#16 lore raw

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
similarity index 96%
rename from accel/tcg/internal.h
rename to accel/tcg/internal-target.h
index cd6b9eb7f0..4ce3b29056 100644
@@ -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
index 8ac2af4d0c..55980417b4 100644
@@ -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
index 0e7eeef001..f5625e047a 100644
@@ -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
index 31e34700ea..a912d746a9 100644
@@ -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
index d48de23999..30724fdb98 100644
@@ -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
index 32ae8af61c..85cf51445d 100644
@@ -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
index 03dfd67e9e..b32e0b80ec 100644
@@ -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
index 83e07b830f..6c09b7f50d 100644
@@ -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
index d9fcb4cbe8..65219b52eb 100644
@@ -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
index 17f9aff0cf..f925dd0305 100644
@@ -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"
 
 __thread uintptr_t helper_retaddr;
 
Signature · 1 line
2.41.0
Reviewed-by Anton Johansson on v1 8/11
#17 lore raw

Re: [PATCH 08/11] accel/tcg: Rename target-specific 'internal.h' -> 'internal-target.h'

Quoted 164 lines · 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
similarity index 96%
rename from accel/tcg/internal.h
rename to accel/tcg/internal-target.h
index cd6b9eb7f0..4ce3b29056 100644
@@ -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
index 8ac2af4d0c..55980417b4 100644
@@ -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
index 0e7eeef001..f5625e047a 100644
@@ -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
index 31e34700ea..a912d746a9 100644
@@ -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
index d48de23999..30724fdb98 100644
@@ -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
index 32ae8af61c..85cf51445d 100644
@@ -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
index 03dfd67e9e..b32e0b80ec 100644
@@ -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
index 83e07b830f..6c09b7f50d 100644
@@ -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
index d9fcb4cbe8..65219b52eb 100644
@@ -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
index 17f9aff0cf..f925dd0305 100644
@@ -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"
 
 __thread uintptr_t helper_retaddr;
 
Signature · 1 line
2.41.0
#18 lore raw

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
new file mode 100644
index 0000000000..5d5247442e
@@ -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
index 4ce3b29056..f9eec1ce28 100644
@@ -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
index f5625e047a..95dd8a30cb 100644
@@ -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
index 30724fdb98..caf1189e0b 100644
@@ -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
index 6c09b7f50d..8cb6ad3511 100644
@@ -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
index 8ace783707..0fb03bd7d3 100644
@@ -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
Reviewed-by Anton Johansson on v1 9/11
#19 lore raw

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.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
new file mode 100644
index 0000000000..5d5247442e
@@ -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
index 4ce3b29056..f9eec1ce28 100644
@@ -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
index f5625e047a..95dd8a30cb 100644
@@ -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
index 30724fdb98..caf1189e0b 100644
@@ -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
index 6c09b7f50d..8cb6ad3511 100644
@@ -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
index 8ace783707..0fb03bd7d3 100644
@@ -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
#20 lore raw

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
index ff436dbf21..047d143b9d 100644
@@ -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
similarity index 99%
rename from softmmu/icount.c
rename to accel/tcg/icount-common.c
index 4527bfbd6e..0bf5bb5e21 100644
@@ -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
index 0fb03bd7d3..4633a34d28 100644
@@ -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
index c18b7ad738..3a64dd89de 100644
@@ -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
Reviewed-by Anton Johansson on v1 10/11
#21 lore raw

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, 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 -0
index ff436dbf21..047d143b9d 100644

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,

#22 lore raw

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, 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%)

Quoted 10 lines

MAINTAINERS F: softmmu/main.c · line 2915

Quoted 9 lines
MAINTAINERS +0 -1
index ff436dbf21..047d143b9d 100644
@@ -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

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,

#23 lore raw

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, 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%)

Quoted 10 lines

MAINTAINERS F: softmmu/main.c · line 2915

Quoted 9 lines
MAINTAINERS +0 -1
index ff436dbf21..047d143b9d 100644
@@ -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

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:)

#24 lore raw

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
index 5d5247442e..3b2277e6e9 100644
@@ -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
index f9eec1ce28..932bbe4b63 100644
@@ -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
index 55980417b4..b6cc387482 100644
@@ -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
index a912d746a9..400d9ee0d0 100644
@@ -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
index 85cf51445d..b194f8f065 100644
@@ -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
index f925dd0305..5bf2761bf4 100644
@@ -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"
 
 __thread uintptr_t helper_retaddr;
accel/tcg/meson.build +3 -1
index 4633a34d28..8783edd06e 100644
@@ -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
Reviewed-by Anton Johansson on v1 11/11
#25 lore raw

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 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
index 5d5247442e..3b2277e6e9 100644
@@ -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
index f9eec1ce28..932bbe4b63 100644
@@ -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
index 55980417b4..b6cc387482 100644
@@ -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
index a912d746a9..400d9ee0d0 100644
@@ -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
index 85cf51445d..b194f8f065 100644
@@ -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
index f925dd0305..5bf2761bf4 100644
@@ -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"
 
 __thread uintptr_t helper_retaddr;
accel/tcg/meson.build +3 -1
index 4633a34d28..8783edd06e 100644
@@ -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
#26 lore raw
In reply to Philippe Mathieu-Daudé
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.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).

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.