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@xxxxxxxxxx> --- 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