mirror of
https://gitlab.com/qemu-project/qemu
synced 2024-11-05 20:35:44 +00:00
hw/i386/xen: rearrange xen_hvm_init_pc
In preparation to moving most of xen-hvm code to an arch-neutral location, move non IOREQ references to: - xen_get_vmport_regs_pfn - xen_suspend_notifier - xen_wakeup_notifier - xen_ram_init towards the end of the xen_hvm_init_pc() function. This is done to keep the common ioreq functions in one place which will be moved to new function in next patch in order to make it common to both x86 and aarch64 machines. Signed-off-by: Vikram Garhwal <vikram.garhwal@amd.com> Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com> Reviewed-by: Paul Durrant <paul@xen.org>
This commit is contained in:
parent
e7218dd57c
commit
33087aacfa
1 changed files with 25 additions and 24 deletions
|
@ -1419,12 +1419,6 @@ void xen_hvm_init_pc(PCMachineState *pcms, MemoryRegion **ram_memory)
|
|||
state->exit.notify = xen_exit_notifier;
|
||||
qemu_add_exit_notifier(&state->exit);
|
||||
|
||||
state->suspend.notify = xen_suspend_notifier;
|
||||
qemu_register_suspend_notifier(&state->suspend);
|
||||
|
||||
state->wakeup.notify = xen_wakeup_notifier;
|
||||
qemu_register_wakeup_notifier(&state->wakeup);
|
||||
|
||||
/*
|
||||
* Register wake-up support in QMP query-current-machine API
|
||||
*/
|
||||
|
@ -1435,23 +1429,6 @@ void xen_hvm_init_pc(PCMachineState *pcms, MemoryRegion **ram_memory)
|
|||
goto err;
|
||||
}
|
||||
|
||||
rc = xen_get_vmport_regs_pfn(xen_xc, xen_domid, &ioreq_pfn);
|
||||
if (!rc) {
|
||||
DPRINTF("shared vmport page at pfn %lx\n", ioreq_pfn);
|
||||
state->shared_vmport_page =
|
||||
xenforeignmemory_map(xen_fmem, xen_domid, PROT_READ|PROT_WRITE,
|
||||
1, &ioreq_pfn, NULL);
|
||||
if (state->shared_vmport_page == NULL) {
|
||||
error_report("map shared vmport IO page returned error %d handle=%p",
|
||||
errno, xen_xc);
|
||||
goto err;
|
||||
}
|
||||
} else if (rc != -ENOSYS) {
|
||||
error_report("get vmport regs pfn returned error %d, rc=%d",
|
||||
errno, rc);
|
||||
goto err;
|
||||
}
|
||||
|
||||
/* Note: cpus is empty at this point in init */
|
||||
state->cpu_by_vcpu_id = g_new0(CPUState *, max_cpus);
|
||||
|
||||
|
@ -1490,7 +1467,6 @@ void xen_hvm_init_pc(PCMachineState *pcms, MemoryRegion **ram_memory)
|
|||
#else
|
||||
xen_map_cache_init(NULL, state);
|
||||
#endif
|
||||
xen_ram_init(pcms, ms->ram_size, ram_memory);
|
||||
|
||||
qemu_add_vm_change_state_handler(xen_hvm_change_state_handler, state);
|
||||
|
||||
|
@ -1511,6 +1487,31 @@ void xen_hvm_init_pc(PCMachineState *pcms, MemoryRegion **ram_memory)
|
|||
QLIST_INIT(&xen_physmap);
|
||||
xen_read_physmap(state);
|
||||
|
||||
state->suspend.notify = xen_suspend_notifier;
|
||||
qemu_register_suspend_notifier(&state->suspend);
|
||||
|
||||
state->wakeup.notify = xen_wakeup_notifier;
|
||||
qemu_register_wakeup_notifier(&state->wakeup);
|
||||
|
||||
rc = xen_get_vmport_regs_pfn(xen_xc, xen_domid, &ioreq_pfn);
|
||||
if (!rc) {
|
||||
DPRINTF("shared vmport page at pfn %lx\n", ioreq_pfn);
|
||||
state->shared_vmport_page =
|
||||
xenforeignmemory_map(xen_fmem, xen_domid, PROT_READ|PROT_WRITE,
|
||||
1, &ioreq_pfn, NULL);
|
||||
if (state->shared_vmport_page == NULL) {
|
||||
error_report("map shared vmport IO page returned error %d handle=%p",
|
||||
errno, xen_xc);
|
||||
goto err;
|
||||
}
|
||||
} else if (rc != -ENOSYS) {
|
||||
error_report("get vmport regs pfn returned error %d, rc=%d",
|
||||
errno, rc);
|
||||
goto err;
|
||||
}
|
||||
|
||||
xen_ram_init(pcms, ms->ram_size, ram_memory);
|
||||
|
||||
/* Disable ACPI build because Xen handles it */
|
||||
pcms->acpi_build_enabled = false;
|
||||
|
||||
|
|
Loading…
Reference in a new issue