accel: Rename 'hax_vcpu' as 'accel' in CPUState

All accelerators will share a single opaque context
in CPUState. Start by renaming 'hax_vcpu' as 'accel'.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20230624174121.11508-7-philmd@linaro.org>
master
Philippe Mathieu-Daudé 2023-03-29 18:56:35 +02:00
parent 83d0f7f95c
commit 6ecd2cd0dc
5 changed files with 17 additions and 17 deletions

View File

@ -443,7 +443,7 @@ struct CPUState {
/* Used for user-only emulation of prctl(PR_SET_UNALIGN). */ /* Used for user-only emulation of prctl(PR_SET_UNALIGN). */
bool prctl_unalign_sigbus; bool prctl_unalign_sigbus;
struct hax_vcpu_state *hax_vcpu; struct hax_vcpu_state *accel;
struct hvf_vcpu_state *hvf; struct hvf_vcpu_state *hvf;

View File

@ -71,7 +71,7 @@ static void hax_start_vcpu_thread(CPUState *cpu)
cpu->cpu_index); cpu->cpu_index);
qemu_thread_create(cpu->thread, thread_name, hax_cpu_thread_fn, qemu_thread_create(cpu->thread, thread_name, hax_cpu_thread_fn,
cpu, QEMU_THREAD_JOINABLE); cpu, QEMU_THREAD_JOINABLE);
assert(cpu->hax_vcpu); assert(cpu->accel);
#ifdef _WIN32 #ifdef _WIN32
cpu->hThread = qemu_thread_get_handle(cpu->thread); cpu->hThread = qemu_thread_get_handle(cpu->thread);
#endif #endif

View File

@ -62,7 +62,7 @@ int valid_hax_tunnel_size(uint16_t size)
hax_fd hax_vcpu_get_fd(CPUArchState *env) hax_fd hax_vcpu_get_fd(CPUArchState *env)
{ {
struct hax_vcpu_state *vcpu = env_cpu(env)->hax_vcpu; struct hax_vcpu_state *vcpu = env_cpu(env)->accel;
if (!vcpu) { if (!vcpu) {
return HAX_INVALID_FD; return HAX_INVALID_FD;
} }
@ -188,7 +188,7 @@ int hax_vcpu_create(int id)
int hax_vcpu_destroy(CPUState *cpu) int hax_vcpu_destroy(CPUState *cpu)
{ {
struct hax_vcpu_state *vcpu = cpu->hax_vcpu; struct hax_vcpu_state *vcpu = cpu->accel;
if (!hax_global.vm) { if (!hax_global.vm) {
fprintf(stderr, "vcpu %x destroy failed, vm is null\n", vcpu->vcpu_id); fprintf(stderr, "vcpu %x destroy failed, vm is null\n", vcpu->vcpu_id);
@ -209,7 +209,7 @@ int hax_vcpu_destroy(CPUState *cpu)
CloseHandle(cpu->hThread); CloseHandle(cpu->hThread);
#endif #endif
g_free(vcpu); g_free(vcpu);
cpu->hax_vcpu = NULL; cpu->accel = NULL;
return 0; return 0;
} }
@ -223,7 +223,7 @@ int hax_init_vcpu(CPUState *cpu)
exit(-1); exit(-1);
} }
cpu->hax_vcpu = hax_global.vm->vcpus[cpu->cpu_index]; cpu->accel = hax_global.vm->vcpus[cpu->cpu_index];
cpu->vcpu_dirty = true; cpu->vcpu_dirty = true;
qemu_register_reset(hax_reset_vcpu_state, cpu->env_ptr); qemu_register_reset(hax_reset_vcpu_state, cpu->env_ptr);
@ -415,7 +415,7 @@ static int hax_handle_io(CPUArchState *env, uint32_t df, uint16_t port,
static int hax_vcpu_interrupt(CPUArchState *env) static int hax_vcpu_interrupt(CPUArchState *env)
{ {
CPUState *cpu = env_cpu(env); CPUState *cpu = env_cpu(env);
struct hax_vcpu_state *vcpu = cpu->hax_vcpu; struct hax_vcpu_state *vcpu = cpu->accel;
struct hax_tunnel *ht = vcpu->tunnel; struct hax_tunnel *ht = vcpu->tunnel;
/* /*
@ -447,7 +447,7 @@ static int hax_vcpu_interrupt(CPUArchState *env)
void hax_raise_event(CPUState *cpu) void hax_raise_event(CPUState *cpu)
{ {
struct hax_vcpu_state *vcpu = cpu->hax_vcpu; struct hax_vcpu_state *vcpu = cpu->accel;
if (!vcpu) { if (!vcpu) {
return; return;
@ -468,7 +468,7 @@ static int hax_vcpu_hax_exec(CPUArchState *env)
int ret = 0; int ret = 0;
CPUState *cpu = env_cpu(env); CPUState *cpu = env_cpu(env);
X86CPU *x86_cpu = X86_CPU(cpu); X86CPU *x86_cpu = X86_CPU(cpu);
struct hax_vcpu_state *vcpu = cpu->hax_vcpu; struct hax_vcpu_state *vcpu = cpu->accel;
struct hax_tunnel *ht = vcpu->tunnel; struct hax_tunnel *ht = vcpu->tunnel;
if (!hax_enabled()) { if (!hax_enabled()) {
@ -1114,8 +1114,8 @@ void hax_reset_vcpu_state(void *opaque)
{ {
CPUState *cpu; CPUState *cpu;
for (cpu = first_cpu; cpu != NULL; cpu = CPU_NEXT(cpu)) { for (cpu = first_cpu; cpu != NULL; cpu = CPU_NEXT(cpu)) {
cpu->hax_vcpu->tunnel->user_event_pending = 0; cpu->accel->tunnel->user_event_pending = 0;
cpu->hax_vcpu->tunnel->ready_for_interrupt_injection = 0; cpu->accel->tunnel->ready_for_interrupt_injection = 0;
} }
} }

View File

@ -52,7 +52,7 @@ static struct qemu_machine qemu_mach;
static struct qemu_vcpu * static struct qemu_vcpu *
get_qemu_vcpu(CPUState *cpu) get_qemu_vcpu(CPUState *cpu)
{ {
return (struct qemu_vcpu *)cpu->hax_vcpu; return (struct qemu_vcpu *)cpu->accel;
} }
static struct nvmm_machine * static struct nvmm_machine *
@ -995,7 +995,7 @@ nvmm_init_vcpu(CPUState *cpu)
} }
cpu->vcpu_dirty = true; cpu->vcpu_dirty = true;
cpu->hax_vcpu = (struct hax_vcpu_state *)qcpu; cpu->accel = (struct hax_vcpu_state *)qcpu;
return 0; return 0;
} }
@ -1030,7 +1030,7 @@ nvmm_destroy_vcpu(CPUState *cpu)
struct qemu_vcpu *qcpu = get_qemu_vcpu(cpu); struct qemu_vcpu *qcpu = get_qemu_vcpu(cpu);
nvmm_vcpu_destroy(mach, &qcpu->vcpu); nvmm_vcpu_destroy(mach, &qcpu->vcpu);
g_free(cpu->hax_vcpu); g_free(cpu->accel);
} }
/* -------------------------------------------------------------------------- */ /* -------------------------------------------------------------------------- */

View File

@ -262,7 +262,7 @@ static bool whpx_has_xsave(void)
static struct whpx_vcpu *get_whpx_vcpu(CPUState *cpu) static struct whpx_vcpu *get_whpx_vcpu(CPUState *cpu)
{ {
return (struct whpx_vcpu *)cpu->hax_vcpu; return (struct whpx_vcpu *)cpu->accel;
} }
static WHV_X64_SEGMENT_REGISTER whpx_seg_q2h(const SegmentCache *qs, int v86, static WHV_X64_SEGMENT_REGISTER whpx_seg_q2h(const SegmentCache *qs, int v86,
@ -2258,7 +2258,7 @@ int whpx_init_vcpu(CPUState *cpu)
vcpu->interruptable = true; vcpu->interruptable = true;
cpu->vcpu_dirty = true; cpu->vcpu_dirty = true;
cpu->hax_vcpu = (struct hax_vcpu_state *)vcpu; cpu->accel = (struct hax_vcpu_state *)vcpu;
max_vcpu_index = max(max_vcpu_index, cpu->cpu_index); max_vcpu_index = max(max_vcpu_index, cpu->cpu_index);
qemu_add_vm_change_state_handler(whpx_cpu_update_state, cpu->env_ptr); qemu_add_vm_change_state_handler(whpx_cpu_update_state, cpu->env_ptr);
@ -2300,7 +2300,7 @@ void whpx_destroy_vcpu(CPUState *cpu)
whp_dispatch.WHvDeleteVirtualProcessor(whpx->partition, cpu->cpu_index); whp_dispatch.WHvDeleteVirtualProcessor(whpx->partition, cpu->cpu_index);
whp_dispatch.WHvEmulatorDestroyEmulator(vcpu->emulator); whp_dispatch.WHvEmulatorDestroyEmulator(vcpu->emulator);
g_free(cpu->hax_vcpu); g_free(cpu->accel);
return; return;
} }