[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RFC PATCH 18/19] accel/hvf: Declare and allocate AccelvCPUState struct
From: |
Philippe Mathieu-Daudé |
Subject: |
[RFC PATCH 18/19] accel/hvf: Declare and allocate AccelvCPUState struct |
Date: |
Wed, 3 Mar 2021 19:22:18 +0100 |
In preparation of moving HVF-specific fields from CPUState
to the accelerator-specific AccelvCPUState structure, first
declare it empty and allocate it. This will make the following
commits easier to review.
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
target/i386/hvf/hvf-i386.h | 3 +++
target/i386/hvf/hvf.c | 4 +++-
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/target/i386/hvf/hvf-i386.h b/target/i386/hvf/hvf-i386.h
index 59cfca8875e..1f12eb647a0 100644
--- a/target/i386/hvf/hvf-i386.h
+++ b/target/i386/hvf/hvf-i386.h
@@ -51,6 +51,9 @@ struct HVFState {
};
extern HVFState *hvf_state;
+struct AccelvCPUState {
+};
+
void hvf_set_phys_mem(MemoryRegionSection *, bool);
void hvf_handle_io(CPUArchState *, uint16_t, void *, int, int, int);
hvf_slot *hvf_find_overlap_slot(uint64_t, uint64_t);
diff --git a/target/i386/hvf/hvf.c b/target/i386/hvf/hvf.c
index effee39ee9b..342659f1e15 100644
--- a/target/i386/hvf/hvf.c
+++ b/target/i386/hvf/hvf.c
@@ -451,6 +451,7 @@ void hvf_vcpu_destroy(CPUState *cpu)
hv_return_t ret = hv_vcpu_destroy((hv_vcpuid_t)cpu->hvf_fd);
g_free(env->hvf_mmio_buf);
assert_hvf_ok(ret);
+ g_free(cpu->accel_vcpu);
}
static void dummy_signal(int sig)
@@ -534,9 +535,10 @@ int hvf_init_vcpu(CPUState *cpu)
}
r = hv_vcpu_create(&hvf_fd, HV_VCPU_DEFAULT);
- cpu->vcpu_dirty = true;
assert_hvf_ok(r);
+ cpu->accel_vcpu = g_new(struct AccelvCPUState, 1);
cpu->hvf_fd = (int)hvf_fd
+ cpu->vcpu_dirty = true;
if (hv_vmx_read_capability(HV_VMX_CAP_PINBASED,
&hvf_state->hvf_caps->vmx_cap_pinbased)) {
--
2.26.2
- [RFC PATCH 08/19] accel/whpx: Use 'accel_vcpu' generic pointer, (continued)
- [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 12/19] accel/kvm: Use kvm_vcpu_state() when possible, 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 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
- [RFC PATCH 17/19] accel/hvf: Reduce deref by declaring 'hv_vcpuid_t hvf_fd' on stack, Philippe Mathieu-Daudé, 2021/03/03
- [RFC PATCH 18/19] accel/hvf: Declare and allocate AccelvCPUState struct,
Philippe Mathieu-Daudé <=
- [RFC PATCH 19/19] accel/hvf: Move the 'hvf_fd' field to AccelvCPUState, Philippe Mathieu-Daudé, 2021/03/03
- Re: [RFC PATCH 00/19] accel: Introduce AccelvCPUState opaque structure, Paolo Bonzini, 2021/03/04