From: Stefano Stabellini <sstabellini@kernel.org>
To: peter.maydell@linaro.org
Cc: sstabellini@kernel.org, qemu-devel@nongnu.org,
vikram.garhwal@amd.com, richard.henderson@linaro.org,
Stefano Stabellini <stefano.stabellini@amd.com>,
Paul Durrant <paul@xen.org>
Subject: [PULL v4 02/10] hw/i386/xen: rearrange xen_hvm_init_pc
Date: Fri, 9 Jun 2023 10:07:43 -0700 [thread overview]
Message-ID: <20230609170751.4059054-2-sstabellini@kernel.org> (raw)
In-Reply-To: <alpine.DEB.2.22.394.2306091007210.3803068@ubuntu-linux-20-04-desktop>
From: Vikram Garhwal <vikram.garhwal@amd.com>
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>
---
hw/i386/xen/xen-hvm.c | 49 ++++++++++++++++++++++---------------------
1 file changed, 25 insertions(+), 24 deletions(-)
diff --git a/hw/i386/xen/xen-hvm.c b/hw/i386/xen/xen-hvm.c
index ab8f1b61ee..7a7764240e 100644
--- a/hw/i386/xen/xen-hvm.c
+++ b/hw/i386/xen/xen-hvm.c
@@ -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;
--
2.25.1
next prev parent reply other threads:[~2023-06-09 17:09 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-09 17:07 [PULL v4 0/10] xenpvh4-tag Stefano Stabellini
2023-06-09 17:07 ` [PULL v4 01/10] hw/i386/xen/: move xen-mapcache.c to hw/xen/ Stefano Stabellini
2023-06-09 17:07 ` Stefano Stabellini [this message]
2023-06-09 17:07 ` [PULL v4 03/10] hw/i386/xen/xen-hvm: move x86-specific fields out of XenIOState Stefano Stabellini
2023-06-09 17:07 ` [PULL v4 04/10] xen-hvm: reorganize xen-hvm and move common function to xen-hvm-common Stefano Stabellini
2023-06-09 17:07 ` [PULL v4 05/10] include/hw/xen/xen_common: return error from xen_create_ioreq_server Stefano Stabellini
2023-06-09 17:07 ` [PULL v4 06/10] hw/xen/xen-hvm-common: skip ioreq creation on ioreq registration failure Stefano Stabellini
2023-06-09 17:07 ` [PULL v4 07/10] hw/xen/xen-hvm-common: Use g_new and error_report Stefano Stabellini
2023-06-09 17:07 ` [PULL v4 08/10] meson.build: do not set have_xen_pci_passthrough for aarch64 targets Stefano Stabellini
2023-06-09 17:07 ` [PULL v4 09/10] hw/arm: introduce xenpvh machine Stefano Stabellini
2023-06-09 22:59 ` Richard Henderson
2023-06-12 0:10 ` Vikram Garhwal
2023-06-14 4:20 ` Richard Henderson
2023-06-09 17:07 ` [PULL v4 10/10] meson.build: enable xenpv machine build for ARM Stefano Stabellini
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=20230609170751.4059054-2-sstabellini@kernel.org \
--to=sstabellini@kernel.org \
--cc=paul@xen.org \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.org \
--cc=stefano.stabellini@amd.com \
--cc=vikram.garhwal@amd.com \
/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).