[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 10/30] accel: Move HAX hThread to accelerator context
From: |
Philippe Mathieu-Daudé |
Subject: |
[PULL 10/30] accel: Move HAX hThread to accelerator context |
Date: |
Wed, 28 Jun 2023 17:52:53 +0200 |
hThread variable is only used by the HAX accelerator,
so move it to the accelerator specific context.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20230624174121.11508-9-philmd@linaro.org>
---
include/hw/core/cpu.h | 1 -
target/i386/hax/hax-i386.h | 3 +++
target/i386/hax/hax-accel-ops.c | 2 +-
target/i386/hax/hax-all.c | 2 +-
target/i386/hax/hax-windows.c | 2 +-
5 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h
index 45e30911e7..476b39e42e 100644
--- a/include/hw/core/cpu.h
+++ b/include/hw/core/cpu.h
@@ -338,7 +338,6 @@ struct CPUState {
struct QemuThread *thread;
#ifdef _WIN32
- HANDLE hThread;
QemuSemaphore sem;
#endif
int thread_id;
diff --git a/target/i386/hax/hax-i386.h b/target/i386/hax/hax-i386.h
index 4372ee596d..87153f40ab 100644
--- a/target/i386/hax/hax-i386.h
+++ b/target/i386/hax/hax-i386.h
@@ -27,6 +27,9 @@ typedef HANDLE hax_fd;
extern struct hax_state hax_global;
struct AccelCPUState {
+#ifdef _WIN32
+ HANDLE hThread;
+#endif
hax_fd fd;
int vcpu_id;
struct hax_tunnel *tunnel;
diff --git a/target/i386/hax/hax-accel-ops.c b/target/i386/hax/hax-accel-ops.c
index a8512efcd5..5031096760 100644
--- a/target/i386/hax/hax-accel-ops.c
+++ b/target/i386/hax/hax-accel-ops.c
@@ -73,7 +73,7 @@ static void hax_start_vcpu_thread(CPUState *cpu)
cpu, QEMU_THREAD_JOINABLE);
assert(cpu->accel);
#ifdef _WIN32
- cpu->hThread = qemu_thread_get_handle(cpu->thread);
+ cpu->accel->hThread = qemu_thread_get_handle(cpu->thread);
#endif
}
diff --git a/target/i386/hax/hax-all.c b/target/i386/hax/hax-all.c
index 9d9011cc38..18d78e5b6b 100644
--- a/target/i386/hax/hax-all.c
+++ b/target/i386/hax/hax-all.c
@@ -206,7 +206,7 @@ int hax_vcpu_destroy(CPUState *cpu)
hax_close_fd(vcpu->fd);
hax_global.vm->vcpus[vcpu->vcpu_id] = NULL;
#ifdef _WIN32
- CloseHandle(cpu->hThread);
+ CloseHandle(vcpu->hThread);
#endif
g_free(vcpu);
cpu->accel = NULL;
diff --git a/target/i386/hax/hax-windows.c b/target/i386/hax/hax-windows.c
index bf4b0ad941..4bf6cc08d2 100644
--- a/target/i386/hax/hax-windows.c
+++ b/target/i386/hax/hax-windows.c
@@ -476,7 +476,7 @@ void hax_kick_vcpu_thread(CPUState *cpu)
*/
cpu->exit_request = 1;
if (!qemu_cpu_is_self(cpu)) {
- if (!QueueUserAPC(dummy_apc_func, cpu->hThread, 0)) {
+ if (!QueueUserAPC(dummy_apc_func, cpu->accel->hThread, 0)) {
fprintf(stderr, "%s: QueueUserAPC failed with error %lu\n",
__func__, GetLastError());
exit(1);
--
2.38.1
- [PULL 00/30] Accelerator patches for 2023-06-28, Philippe Mathieu-Daudé, 2023/06/28
- [PULL 01/30] MAINTAINERS: Update Roman Bolshakov email address, Philippe Mathieu-Daudé, 2023/06/28
- [PULL 02/30] docs/devel/testing: Update the 'Docker Debugging' section, Philippe Mathieu-Daudé, 2023/06/28
- [PULL 03/30] accel: Re-enable WHPX cross-build on case sensitive filesystems, Philippe Mathieu-Daudé, 2023/06/28
- [PULL 04/30] accel: Document generic accelerator headers, Philippe Mathieu-Daudé, 2023/06/28
- [PULL 05/30] accel: Remove unused hThread variable on TCG/WHPX, Philippe Mathieu-Daudé, 2023/06/28
- [PULL 06/30] accel: Fix a leak on Windows HAX, Philippe Mathieu-Daudé, 2023/06/28
- [PULL 07/30] accel: Destroy HAX vCPU threads once done, Philippe Mathieu-Daudé, 2023/06/28
- [PULL 08/30] accel: Rename 'hax_vcpu' as 'accel' in CPUState, Philippe Mathieu-Daudé, 2023/06/28
- [PULL 09/30] accel: Rename HAX 'struct hax_vcpu_state' -> AccelCPUState, Philippe Mathieu-Daudé, 2023/06/28
- [PULL 10/30] accel: Move HAX hThread to accelerator context,
Philippe Mathieu-Daudé <=
- [PULL 11/30] accel: Remove NVMM unreachable error path, Philippe Mathieu-Daudé, 2023/06/28
- [PULL 12/30] accel: Rename NVMM 'struct qemu_vcpu' -> AccelCPUState, Philippe Mathieu-Daudé, 2023/06/28
- [PULL 13/30] accel: Inline NVMM get_qemu_vcpu(), Philippe Mathieu-Daudé, 2023/06/28
- [PULL 14/30] accel: Remove WHPX unreachable error path, Philippe Mathieu-Daudé, 2023/06/28
- [PULL 15/30] accel: Rename WHPX 'struct whpx_vcpu' -> AccelCPUState, Philippe Mathieu-Daudé, 2023/06/28
- [PULL 17/30] accel: Rename 'cpu_state' -> 'cs', Philippe Mathieu-Daudé, 2023/06/28
- [PULL 16/30] accel: Inline WHPX get_whpx_vcpu(), Philippe Mathieu-Daudé, 2023/06/28
- [PULL 19/30] accel/kvm: Re-include "exec/memattrs.h" header, Philippe Mathieu-Daudé, 2023/06/28
- [PULL 18/30] accel: Rename HVF 'struct hvf_vcpu_state' -> AccelCPUState, Philippe Mathieu-Daudé, 2023/06/28
- [PULL 21/30] hw/intc/arm_gic: Un-inline GIC*/ITS class_name() helpers, Philippe Mathieu-Daudé, 2023/06/28