From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: qemu-devel@nongnu.org
Cc: "Paolo Bonzini" <pbonzini@redhat.com>,
"Alex Bennée" <alex.bennee@linaro.org>,
xen-devel@lists.xenproject.org, kvm@vger.kernel.org,
"Philippe Mathieu-Daudé" <philmd@linaro.org>,
"Eduardo Habkost" <eduardo@habkost.net>,
"Marcel Apfelbaum" <marcel.apfelbaum@gmail.com>,
"Yanan Wang" <wangyanan55@huawei.com>,
"Reinoud Zandijk" <reinoud@netbsd.org>,
"Sunil Muthuswamy" <sunilmut@microsoft.com>
Subject: [PATCH 05/14] accel: Rename 'hax_vcpu' as 'accel' in CPUState
Date: Wed, 5 Apr 2023 12:18:02 +0200 [thread overview]
Message-ID: <20230405101811.76663-6-philmd@linaro.org> (raw)
In-Reply-To: <20230405101811.76663-1-philmd@linaro.org>
All accelerators will share a single opaque context
in CPUState. Start by renaming 'hax_vcpu' as 'accelCPUState'.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
include/hw/core/cpu.h | 2 +-
target/i386/hax/hax-accel-ops.c | 2 +-
target/i386/hax/hax-all.c | 18 +++++++++---------
target/i386/nvmm/nvmm-all.c | 6 +++---
target/i386/whpx/whpx-all.c | 6 +++---
5 files changed, 17 insertions(+), 17 deletions(-)
diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h
index 397fd3ac68..193494cde4 100644
--- a/include/hw/core/cpu.h
+++ b/include/hw/core/cpu.h
@@ -442,7 +442,7 @@ struct CPUState {
/* Used for user-only emulation of prctl(PR_SET_UNALIGN). */
bool prctl_unalign_sigbus;
- struct hax_vcpu_state *hax_vcpu;
+ struct hax_vcpu_state *accel;
struct hvf_vcpu_state *hvf;
diff --git a/target/i386/hax/hax-accel-ops.c b/target/i386/hax/hax-accel-ops.c
index 0157a628a3..a8512efcd5 100644
--- a/target/i386/hax/hax-accel-ops.c
+++ b/target/i386/hax/hax-accel-ops.c
@@ -71,7 +71,7 @@ static void hax_start_vcpu_thread(CPUState *cpu)
cpu->cpu_index);
qemu_thread_create(cpu->thread, thread_name, hax_cpu_thread_fn,
cpu, QEMU_THREAD_JOINABLE);
- assert(cpu->hax_vcpu);
+ assert(cpu->accel);
#ifdef _WIN32
cpu->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 38a4323a3c..3865ff9419 100644
--- a/target/i386/hax/hax-all.c
+++ b/target/i386/hax/hax-all.c
@@ -62,7 +62,7 @@ int valid_hax_tunnel_size(uint16_t size)
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) {
return HAX_INVALID_FD;
}
@@ -188,7 +188,7 @@ int hax_vcpu_create(int id)
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) {
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);
#endif
g_free(vcpu);
- cpu->hax_vcpu = NULL;
+ cpu->accel = NULL;
return 0;
}
@@ -223,7 +223,7 @@ int hax_init_vcpu(CPUState *cpu)
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;
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)
{
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;
/*
@@ -447,7 +447,7 @@ static int hax_vcpu_interrupt(CPUArchState *env)
void hax_raise_event(CPUState *cpu)
{
- struct hax_vcpu_state *vcpu = cpu->hax_vcpu;
+ struct hax_vcpu_state *vcpu = cpu->accel;
if (!vcpu) {
return;
@@ -468,7 +468,7 @@ static int hax_vcpu_hax_exec(CPUArchState *env)
int ret = 0;
CPUState *cpu = env_cpu(env);
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;
if (!hax_enabled()) {
@@ -1114,8 +1114,8 @@ void hax_reset_vcpu_state(void *opaque)
{
CPUState *cpu;
for (cpu = first_cpu; cpu != NULL; cpu = CPU_NEXT(cpu)) {
- cpu->hax_vcpu->tunnel->user_event_pending = 0;
- cpu->hax_vcpu->tunnel->ready_for_interrupt_injection = 0;
+ cpu->accel->tunnel->user_event_pending = 0;
+ cpu->accel->tunnel->ready_for_interrupt_injection = 0;
}
}
diff --git a/target/i386/nvmm/nvmm-all.c b/target/i386/nvmm/nvmm-all.c
index b75738ee9c..cf4f0af24b 100644
--- a/target/i386/nvmm/nvmm-all.c
+++ b/target/i386/nvmm/nvmm-all.c
@@ -52,7 +52,7 @@ static struct qemu_machine qemu_mach;
static struct qemu_vcpu *
get_qemu_vcpu(CPUState *cpu)
{
- return (struct qemu_vcpu *)cpu->hax_vcpu;
+ return (struct qemu_vcpu *)cpu->accel;
}
static struct nvmm_machine *
@@ -995,7 +995,7 @@ nvmm_init_vcpu(CPUState *cpu)
}
cpu->vcpu_dirty = true;
- cpu->hax_vcpu = (struct hax_vcpu_state *)qcpu;
+ cpu->accel = (struct hax_vcpu_state *)qcpu;
return 0;
}
@@ -1030,7 +1030,7 @@ nvmm_destroy_vcpu(CPUState *cpu)
struct qemu_vcpu *qcpu = get_qemu_vcpu(cpu);
nvmm_vcpu_destroy(mach, &qcpu->vcpu);
- g_free(cpu->hax_vcpu);
+ g_free(cpu->accel);
}
/* -------------------------------------------------------------------------- */
diff --git a/target/i386/whpx/whpx-all.c b/target/i386/whpx/whpx-all.c
index 52af81683c..d1ad6f156a 100644
--- a/target/i386/whpx/whpx-all.c
+++ b/target/i386/whpx/whpx-all.c
@@ -262,7 +262,7 @@ static bool whpx_has_xsave(void)
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,
@@ -2258,7 +2258,7 @@ int whpx_init_vcpu(CPUState *cpu)
vcpu->interruptable = 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);
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.WHvEmulatorDestroyEmulator(vcpu->emulator);
- g_free(cpu->hax_vcpu);
+ g_free(cpu->accel);
return;
}
--
2.38.1
next prev parent reply other threads:[~2023-04-05 10:19 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-05 10:17 [PATCH 00/14] accel: Share CPUState accel context (HAX/NVMM/WHPX/HVF) Philippe Mathieu-Daudé
2023-04-05 10:17 ` [PATCH 01/14] accel: Document generic accelerator headers Philippe Mathieu-Daudé
2023-04-07 23:01 ` Richard Henderson
2023-04-05 10:17 ` [PATCH 02/14] accel: Remove unused hThread variable on TCG/WHPX Philippe Mathieu-Daudé
2023-04-07 23:01 ` Richard Henderson
2023-04-05 10:18 ` [PATCH 03/14] accel: Fix a leak on Windows HAX Philippe Mathieu-Daudé
2023-04-07 23:01 ` Richard Henderson
2023-04-05 10:18 ` [PATCH 04/14] accel: Destroy HAX vCPU threads once done Philippe Mathieu-Daudé
2023-04-05 10:18 ` Philippe Mathieu-Daudé [this message]
2023-04-07 23:03 ` [PATCH 05/14] accel: Rename 'hax_vcpu' as 'accel' in CPUState Richard Henderson
2023-04-05 10:18 ` [PATCH 06/14] accel: Use a typedef for struct hax_vcpu_state Philippe Mathieu-Daudé
2023-04-05 10:18 ` [PATCH 07/14] accel: Rename struct hax_vcpu_state -> struct AccelvCPUState Philippe Mathieu-Daudé
2023-04-07 23:07 ` Richard Henderson
2023-04-07 23:09 ` Richard Henderson
2023-04-05 10:18 ` [PATCH 08/14] accel: Move HAX hThread to accelerator context Philippe Mathieu-Daudé
2023-04-07 23:07 ` Richard Henderson
2023-04-05 10:18 ` [PATCH 09/14] accel: Allocate NVMM vCPU using g_try_FOO() Philippe Mathieu-Daudé
2023-04-05 13:55 ` Alex Bennée
2023-04-05 15:18 ` Philippe Mathieu-Daudé
2023-04-05 10:18 ` [PATCH 10/14] accel: Rename NVMM struct qemu_vcpu -> struct AccelvCPUState Philippe Mathieu-Daudé
2023-04-07 23:11 ` Richard Henderson
2023-04-05 10:18 ` [PATCH 11/14] accel: Inline NVMM get_qemu_vcpu() Philippe Mathieu-Daudé
2023-04-07 23:11 ` Richard Henderson
2023-04-05 10:18 ` [PATCH 12/14] accel: Rename WHPX struct whpx_vcpu -> struct AccelvCPUState Philippe Mathieu-Daudé
2023-04-07 23:13 ` Richard Henderson
2023-04-05 10:18 ` [PATCH 13/14] accel: Inline WHPX get_whpx_vcpu() Philippe Mathieu-Daudé
2023-04-07 23:13 ` Richard Henderson
2023-04-05 10:18 ` [PATCH 14/14] accel: Rename HVF struct hvf_vcpu_state -> struct AccelvCPUState Philippe Mathieu-Daudé
2023-04-07 23:14 ` Richard Henderson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230405101811.76663-6-philmd@linaro.org \
--to=philmd@linaro.org \
--cc=alex.bennee@linaro.org \
--cc=eduardo@habkost.net \
--cc=kvm@vger.kernel.org \
--cc=marcel.apfelbaum@gmail.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=reinoud@netbsd.org \
--cc=sunilmut@microsoft.com \
--cc=wangyanan55@huawei.com \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).