[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RFC PATCH 06/19] accel/whpx: Add typedef for 'struct whpx_vcpu'
From: |
Philippe Mathieu-Daudé |
Subject: |
[RFC PATCH 06/19] accel/whpx: Add typedef for 'struct whpx_vcpu' |
Date: |
Wed, 3 Mar 2021 19:22:06 +0100 |
Use the 'whpx_vcpu' typedef instead of 'struct whpx_vcpu'.
This will make the next commits easier to review.
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
target/i386/whpx/whpx-all.c | 28 +++++++++++++++-------------
1 file changed, 15 insertions(+), 13 deletions(-)
diff --git a/target/i386/whpx/whpx-all.c b/target/i386/whpx/whpx-all.c
index f0a35df3bba..6469e388b6d 100644
--- a/target/i386/whpx/whpx-all.c
+++ b/target/i386/whpx/whpx-all.c
@@ -148,6 +148,8 @@ struct whpx_register_set {
WHV_REGISTER_VALUE values[RTL_NUMBER_OF(whpx_register_names)];
};
+typedef struct whpx_vcpu whpx_vcpu;
+
struct whpx_vcpu {
WHV_EMULATOR_HANDLE emulator;
bool window_registered;
@@ -173,9 +175,9 @@ struct WHPDispatch whp_dispatch;
* VP support
*/
-static struct whpx_vcpu *get_whpx_vcpu(CPUState *cpu)
+static whpx_vcpu *get_whpx_vcpu(CPUState *cpu)
{
- return (struct whpx_vcpu *)cpu->hax_vcpu;
+ return (whpx_vcpu *)cpu->hax_vcpu;
}
static WHV_X64_SEGMENT_REGISTER whpx_seg_q2h(const SegmentCache *qs, int v86,
@@ -259,7 +261,7 @@ static int whpx_set_tsc(CPUState *cpu)
static void whpx_set_registers(CPUState *cpu, int level)
{
struct whpx_state *whpx = &whpx_global;
- struct whpx_vcpu *vcpu = get_whpx_vcpu(cpu);
+ whpx_vcpu *vcpu = get_whpx_vcpu(cpu);
struct CPUX86State *env = (CPUArchState *)(cpu->env_ptr);
X86CPU *x86_cpu = X86_CPU(cpu);
struct whpx_register_set vcxt;
@@ -448,7 +450,7 @@ static int whpx_get_tsc(CPUState *cpu)
static void whpx_get_registers(CPUState *cpu)
{
struct whpx_state *whpx = &whpx_global;
- struct whpx_vcpu *vcpu = get_whpx_vcpu(cpu);
+ whpx_vcpu *vcpu = get_whpx_vcpu(cpu);
struct CPUX86State *env = (CPUArchState *)(cpu->env_ptr);
X86CPU *x86_cpu = X86_CPU(cpu);
struct whpx_register_set vcxt;
@@ -712,7 +714,7 @@ static const WHV_EMULATOR_CALLBACKS whpx_emu_callbacks = {
static int whpx_handle_mmio(CPUState *cpu, WHV_MEMORY_ACCESS_CONTEXT *ctx)
{
HRESULT hr;
- struct whpx_vcpu *vcpu = get_whpx_vcpu(cpu);
+ whpx_vcpu *vcpu = get_whpx_vcpu(cpu);
WHV_EMULATOR_STATUS emu_status;
hr = whp_dispatch.WHvEmulatorTryMmioEmulation(
@@ -737,7 +739,7 @@ static int whpx_handle_portio(CPUState *cpu,
WHV_X64_IO_PORT_ACCESS_CONTEXT *ctx)
{
HRESULT hr;
- struct whpx_vcpu *vcpu = get_whpx_vcpu(cpu);
+ whpx_vcpu *vcpu = get_whpx_vcpu(cpu);
WHV_EMULATOR_STATUS emu_status;
hr = whp_dispatch.WHvEmulatorTryIoEmulation(
@@ -780,7 +782,7 @@ static void whpx_vcpu_pre_run(CPUState *cpu)
{
HRESULT hr;
struct whpx_state *whpx = &whpx_global;
- struct whpx_vcpu *vcpu = get_whpx_vcpu(cpu);
+ whpx_vcpu *vcpu = get_whpx_vcpu(cpu);
struct CPUX86State *env = (CPUArchState *)(cpu->env_ptr);
X86CPU *x86_cpu = X86_CPU(cpu);
int irq;
@@ -902,7 +904,7 @@ static void whpx_vcpu_pre_run(CPUState *cpu)
static void whpx_vcpu_post_run(CPUState *cpu)
{
- struct whpx_vcpu *vcpu = get_whpx_vcpu(cpu);
+ whpx_vcpu *vcpu = get_whpx_vcpu(cpu);
struct CPUX86State *env = (CPUArchState *)(cpu->env_ptr);
X86CPU *x86_cpu = X86_CPU(cpu);
@@ -929,7 +931,7 @@ static void whpx_vcpu_process_async_events(CPUState *cpu)
{
struct CPUX86State *env = (CPUArchState *)(cpu->env_ptr);
X86CPU *x86_cpu = X86_CPU(cpu);
- struct whpx_vcpu *vcpu = get_whpx_vcpu(cpu);
+ whpx_vcpu *vcpu = get_whpx_vcpu(cpu);
if ((cpu->interrupt_request & CPU_INTERRUPT_INIT) &&
!(env->hflags & HF_SMM_MASK)) {
@@ -968,7 +970,7 @@ static int whpx_vcpu_run(CPUState *cpu)
{
HRESULT hr;
struct whpx_state *whpx = &whpx_global;
- struct whpx_vcpu *vcpu = get_whpx_vcpu(cpu);
+ whpx_vcpu *vcpu = get_whpx_vcpu(cpu);
int ret;
whpx_vcpu_process_async_events(cpu);
@@ -1331,7 +1333,7 @@ int whpx_init_vcpu(CPUState *cpu)
{
HRESULT hr;
struct whpx_state *whpx = &whpx_global;
- struct whpx_vcpu *vcpu = NULL;
+ whpx_vcpu *vcpu = NULL;
Error *local_error = NULL;
struct CPUX86State *env = (CPUArchState *)(cpu->env_ptr);
X86CPU *x86_cpu = X86_CPU(cpu);
@@ -1356,7 +1358,7 @@ int whpx_init_vcpu(CPUState *cpu)
}
}
- vcpu = g_malloc0(sizeof(struct whpx_vcpu));
+ vcpu = g_malloc0(sizeof(whpx_vcpu));
if (!vcpu) {
error_report("WHPX: Failed to allocte VCPU context.");
@@ -1475,7 +1477,7 @@ int whpx_vcpu_exec(CPUState *cpu)
void whpx_destroy_vcpu(CPUState *cpu)
{
struct whpx_state *whpx = &whpx_global;
- struct whpx_vcpu *vcpu = get_whpx_vcpu(cpu);
+ whpx_vcpu *vcpu = get_whpx_vcpu(cpu);
whp_dispatch.WHvDeleteVirtualProcessor(whpx->partition, cpu->cpu_index);
whp_dispatch.WHvEmulatorDestroyEmulator(vcpu->emulator);
--
2.26.2
- [RFC PATCH 00/19] accel: Introduce AccelvCPUState opaque structure, Philippe Mathieu-Daudé, 2021/03/03
- [PATCH 01/19] target/i386/hvf: Use boolean value for vcpu_dirty, Philippe Mathieu-Daudé, 2021/03/03
- [PATCH 02/19] target/s390x/kvm: Simplify debug code, Philippe Mathieu-Daudé, 2021/03/03
- [PATCH 03/19] target/s390x/kvm: Reduce deref by declaring 'struct kvm_run' on stack, Philippe Mathieu-Daudé, 2021/03/03
- [PATCH 04/19] cpu: Croup accelerator-specific fields altogether, Philippe Mathieu-Daudé, 2021/03/03
- [RFC PATCH 05/19] cpu: Introduce AccelvCPUState opaque structure, Philippe Mathieu-Daudé, 2021/03/03
- [RFC PATCH 06/19] accel/whpx: Add typedef for 'struct whpx_vcpu',
Philippe Mathieu-Daudé <=
- [RFC PATCH 07/19] accel/whpx: Rename struct whpx_vcpu -> AccelvCPUState, Philippe Mathieu-Daudé, 2021/03/03
- [RFC PATCH 08/19] accel/whpx: Use 'accel_vcpu' generic pointer, Philippe Mathieu-Daudé, 2021/03/03
- [RFC PATCH 09/19] accel/hax: Add typedef for 'struct hax_vcpu_state', Philippe Mathieu-Daudé, 2021/03/03
- [RFC PATCH 10/19] accel/hax: Use 'accel_vcpu' generic pointer, Philippe Mathieu-Daudé, 2021/03/03
- [RFC PATCH 11/19] accel/kvm: Introduce kvm_vcpu_state() helper, Philippe Mathieu-Daudé, 2021/03/03
- [RFC PATCH 13/19] accel/kvm: Declare and allocate AccelvCPUState struct, Philippe Mathieu-Daudé, 2021/03/03
- [RFC PATCH 12/19] accel/kvm: Use kvm_vcpu_state() when possible, Philippe Mathieu-Daudé, 2021/03/03
- [RFC PATCH 14/19] accel/kvm: Move the 'kvm_fd' field to AccelvCPUState, Philippe Mathieu-Daudé, 2021/03/03
- [RFC PATCH 15/19] accel/kvm: Move the 'kvm_state' field to AccelvCPUState, Philippe Mathieu-Daudé, 2021/03/03
- [RFC PATCH 16/19] accel/kvm: Move the 'kvm_run' field to AccelvCPUState, Philippe Mathieu-Daudé, 2021/03/03