diff mbox series

[QEMU,v3,04/12] xen_arm: Add "accel = xen" and drop extra interface openings

Message ID 20230125084356.6684-5-vikram.garhwal@amd.com (mailing list archive)
State New, archived
Headers show
Series Introduce xenpvh machine for arm architecture | expand

Commit Message

Vikram Garhwal Jan. 25, 2023, 8:43 a.m. UTC
In order to use virtio backends we need to make sure that Xen accelerator
is enabled (xen_enabled() returns true) as the memory/cache systems
check for xen_enabled() to perform specific actions. Without that
the xen-mapcache (which is needed for mapping guest memory) is not in use.

Also drop extra interface opening as this is already done in xen-all.c
(so drop xen_init_ioreq() completely) and skip virtio/tpm initialization
if device emulation is not available.

Signed-off-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
Signed-off-by: Vikram Garhwal <vikram.garhwal@amd.com>
Reviewed-by: Stefano Stabellini <stefano.stabellini@amd.com>
---
 hw/arm/xen_arm.c | 29 ++---------------------------
 1 file changed, 2 insertions(+), 27 deletions(-)
diff mbox series

Patch

diff --git a/hw/arm/xen_arm.c b/hw/arm/xen_arm.c
index fde919df29..4ac425a3c5 100644
--- a/hw/arm/xen_arm.c
+++ b/hw/arm/xen_arm.c
@@ -137,30 +137,6 @@  void qmp_xen_set_global_dirty_log(bool enable, Error **errp)
 {
 }
 
-static int xen_init_ioreq(XenIOState *state, unsigned int max_cpus)
-{
-    xen_dmod = xendevicemodel_open(0, 0);
-    xen_xc = xc_interface_open(0, 0, 0);
-
-    if (xen_xc == NULL) {
-        perror("xen: can't open xen interface\n");
-        return -1;
-    }
-
-    xen_fmem = xenforeignmemory_open(0, 0);
-    if (xen_fmem == NULL) {
-        perror("xen: can't open xen fmem interface\n");
-        xc_interface_close(xen_xc);
-        return -1;
-    }
-
-    xen_register_ioreq(state, max_cpus, xen_memory_listener);
-
-    xenstore_record_dm_state(xenstore, "running");
-
-    return 0;
-}
-
 static void xen_enable_tpm(void)
 {
 #ifdef CONFIG_TPM
@@ -198,9 +174,7 @@  static void xen_arm_init(MachineState *machine)
 
     xen_init_ram(machine);
 
-    if (xen_init_ioreq(xam->state, machine->smp.cpus)) {
-        return;
-    }
+    xen_register_ioreq(xam->state, machine->smp.cpus, xen_memory_listener);
 
     xen_create_virtio_mmio_devices(xam);
 
@@ -218,6 +192,7 @@  static void xen_arm_machine_class_init(ObjectClass *oc, void *data)
     mc->max_cpus = 1;
     /* Set explicitly here to make sure that real ram_size is passed */
     mc->default_ram_size = 0;
+    mc->default_machine_opts = "accel=xen";
 
     machine_class_allow_dynamic_sysbus_dev(mc, TYPE_TPM_TIS_SYSBUS);
 }