[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 05/24] accel/tcg: Extract tcg_cpu_exit() from cpu_exit()
From: |
Philippe Mathieu-Daudé |
Subject: |
[PATCH 05/24] accel/tcg: Extract tcg_cpu_exit() from cpu_exit() |
Date: |
Mon, 29 Apr 2024 00:14:31 +0200 |
Extract tcg_cpu_exit() from the user cpu_exit() implementation.
In few commits we will re-use it in the system one (via a
per-accel handler).
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
accel/tcg/internal-common.h | 2 ++
accel/tcg/translate-all.c | 7 +++++++
accel/tcg/user-exec.c | 4 +---
3 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/accel/tcg/internal-common.h b/accel/tcg/internal-common.h
index ead53cb8a5..df317e7496 100644
--- a/accel/tcg/internal-common.h
+++ b/accel/tcg/internal-common.h
@@ -24,4 +24,6 @@ static inline bool cpu_in_serial_context(CPUState *cs)
return !tcg_cflags_has(cs, CF_PARALLEL) || cpu_in_exclusive_context(cs);
}
+void tcg_cpu_exit(CPUState *cpu);
+
#endif
diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c
index fdf6d8ac19..b67adce20e 100644
--- a/accel/tcg/translate-all.c
+++ b/accel/tcg/translate-all.c
@@ -663,3 +663,10 @@ void tcg_flush_jmp_cache(CPUState *cpu)
qatomic_set(&jc->array[i].tb, NULL);
}
}
+
+void tcg_cpu_exit(CPUState *cpu)
+{
+ /* Ensure cpu_exec will see the exit request after TCG has exited. */
+ smp_wmb();
+ qatomic_set(&cpu->neg.icount_decr.u16.high, -1);
+}
diff --git a/accel/tcg/user-exec.c b/accel/tcg/user-exec.c
index 404d8a145c..d7e5f00c97 100644
--- a/accel/tcg/user-exec.c
+++ b/accel/tcg/user-exec.c
@@ -49,9 +49,7 @@ void cpu_interrupt(CPUState *cpu, int mask)
void cpu_exit(CPUState *cpu)
{
qatomic_set(&cpu->exit_request, 1);
- /* Ensure cpu_exec will see the exit request after TCG has exited. */
- smp_wmb();
- qatomic_set(&cpu->neg.icount_decr.u16.high, -1);
+ tcg_cpu_exit(cpu);
}
/*
--
2.41.0
- [PATCH 00/24] exec: Rework around CPUState user fields (part 2), Philippe Mathieu-Daudé, 2024/04/28
- [PATCH 01/24] exec/user: Move 'thunk.h' from 'exec/user' to 'user', Philippe Mathieu-Daudé, 2024/04/28
- [PATCH 02/24] coverity: Update user emulation regexp, Philippe Mathieu-Daudé, 2024/04/28
- [PATCH 03/24] accel/tcg: Move user definition of cpu_interrupt() to user-exec.c, Philippe Mathieu-Daudé, 2024/04/28
- [PATCH 04/24] accel/tcg: Duplicate cpu_exit() for user / system, Philippe Mathieu-Daudé, 2024/04/28
- [PATCH 05/24] accel/tcg: Extract tcg_cpu_exit() from cpu_exit(),
Philippe Mathieu-Daudé <=
- [PATCH 06/24] accel: Introduce AccelOpsClass::exit_vcpu_thread() handler, Philippe Mathieu-Daudé, 2024/04/28
- [PATCH 07/24] accel/tcg: Implement AccelOpsClass::exit_vcpu_thread() handler, Philippe Mathieu-Daudé, 2024/04/28
- [PATCH 08/24] user: Forward declare TaskState type definition, Philippe Mathieu-Daudé, 2024/04/28
- [PATCH 09/24] user: Declare get_task_state() once in 'accel/tcg/vcpu-state.h', Philippe Mathieu-Daudé, 2024/04/28
- [PATCH 10/24] user: Use get_task_state() helper, Philippe Mathieu-Daudé, 2024/04/28