diff mbox series

[12/24] accel/tcg: Move TaskState from CPUState to TCG AccelCPUState

Message ID 20240428221450.26460-13-philmd@linaro.org
State New
Headers show
Series exec: Rework around CPUState user fields (part 2) | expand

Commit Message

Philippe Mathieu-Daudé April 28, 2024, 10:14 p.m. UTC
TaskState is specific to TCG user emulation, move it
to AccelCPUState.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 accel/tcg/vcpu-state.h | 6 ++++--
 include/hw/core/cpu.h  | 2 --
 bsd-user/main.c        | 2 +-
 linux-user/main.c      | 2 +-
 linux-user/syscall.c   | 2 +-
 5 files changed, 7 insertions(+), 7 deletions(-)

Comments

Richard Henderson April 29, 2024, 2:31 p.m. UTC | #1
On 4/28/24 15:14, Philippe Mathieu-Daudé wrote:
> TaskState is specific to TCG user emulation, move it
> to AccelCPUState.
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>   accel/tcg/vcpu-state.h | 6 ++++--
>   include/hw/core/cpu.h  | 2 --
>   bsd-user/main.c        | 2 +-
>   linux-user/main.c      | 2 +-
>   linux-user/syscall.c   | 2 +-
>   5 files changed, 7 insertions(+), 7 deletions(-)

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

r~
diff mbox series

Patch

diff --git a/accel/tcg/vcpu-state.h b/accel/tcg/vcpu-state.h
index d0dd1bbff8..cf8e3acef9 100644
--- a/accel/tcg/vcpu-state.h
+++ b/accel/tcg/vcpu-state.h
@@ -12,13 +12,15 @@ 
  * AccelCPUState:
  */
 struct AccelCPUState {
-    /* Empty */
+#ifdef CONFIG_USER_ONLY
+    TaskState *ts;
+#endif
 };
 
 #ifdef CONFIG_USER_ONLY
 static inline TaskState *get_task_state(const CPUState *cs)
 {
-    return cs->opaque;
+    return cs->accel->ts;
 }
 #endif
 
diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h
index 46b99a7ea5..9b99d8e8fe 100644
--- a/include/hw/core/cpu.h
+++ b/include/hw/core/cpu.h
@@ -490,8 +490,6 @@  struct CPUState {
     QTAILQ_HEAD(, CPUWatchpoint) watchpoints;
     CPUWatchpoint *watchpoint_hit;
 
-    void *opaque;
-
     /* In order to avoid passing too many arguments to the MMIO helpers,
      * we store some rarely used information in the CPU context.
      */
diff --git a/bsd-user/main.c b/bsd-user/main.c
index 29a629d877..1ce4b0b6e4 100644
--- a/bsd-user/main.c
+++ b/bsd-user/main.c
@@ -590,7 +590,7 @@  int main(int argc, char **argv)
     init_task_state(ts);
     ts->info = info;
     ts->bprm = &bprm;
-    cpu->opaque = ts;
+    cpu->accel->ts = ts;
 
     target_set_brk(info->brk);
     syscall_init();
diff --git a/linux-user/main.c b/linux-user/main.c
index 94e4c47f05..5f7f03f4b0 100644
--- a/linux-user/main.c
+++ b/linux-user/main.c
@@ -949,7 +949,7 @@  int main(int argc, char **argv, char **envp)
     /* build Task State */
     ts->info = info;
     ts->bprm = &bprm;
-    cpu->opaque = ts;
+    cpu->accel->ts = ts;
     task_settid(ts);
 
     fd_trans_init();
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index b9b5a387b3..49db3052aa 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -6594,7 +6594,7 @@  static int do_fork(CPUArchState *env, unsigned int flags, abi_ulong newsp,
         cpu_clone_regs_child(new_env, newsp, flags);
         cpu_clone_regs_parent(env, flags);
         new_cpu = env_cpu(new_env);
-        new_cpu->opaque = ts;
+        new_cpu->accel->ts = ts;
         ts->bprm = parent_ts->bprm;
         ts->info = parent_ts->info;
         ts->signal_mask = parent_ts->signal_mask;