]> xenbits.xensource.com Git - people/pauldu/qemu.git/commitdiff
i386/xen: Initialize XenBus and legacy backends from pc_basic_device_init()
authorDavid Woodhouse <dwmw@amazon.co.uk>
Tue, 10 Jan 2023 08:01:47 +0000 (08:01 +0000)
committerPaul Durrant <pdurrant@amazon.com>
Mon, 30 Jan 2023 14:34:23 +0000 (14:34 +0000)
Now that we have a XenStore implementation and can use the PV backends
without actual Xen, move the bus instantiation from xen_hvm_init_pc() to
pc_basic_device_init().

Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
hw/i386/pc.c
hw/i386/xen/xen-hvm.c

index 5ec3518b9e11e340fb66c6e8ef6b674d0d645615..d1002644ea3b28690e0d4df50cd7b425af6290c6 100644 (file)
 #include "trace.h"
 #include CONFIG_DEVICES
 
+#ifdef CONFIG_XEN_BUS
+#include "hw/xen/xen-legacy-backend.h"
+#include "hw/xen/xen-bus.h"
+#endif
+
 /*
  * Helper for setting model-id for CPU models that changed model-id
  * depending on QEMU versions up to QEMU 2.4.
@@ -1275,6 +1280,20 @@ void pc_basic_device_init(struct PCMachineState *pcms,
     memory_region_init_io(ioportF0_io, NULL, &ioportF0_io_ops, NULL, "ioportF0", 1);
     memory_region_add_subregion(isa_bus->address_space_io, 0xf0, ioportF0_io);
 
+#ifdef CONFIG_XEN_BUS
+    if (xen_mode != XEN_DISABLED) {
+        /* Initialize backend core & drivers */
+        xen_bus_init();
+
+        if (xen_be_init() != 0) {
+            error_report("xen backend core setup failed");
+            exit(1);
+        }
+        xen_be_register_common();
+    }
+#endif
+
+
     /*
      * Check if an HPET shall be created.
      *
index 543e5a7a94d1925192445ac68bd01e46b1b54d9d..da21bac378289e8e9c140c14feb0b22c8704f08c 100644 (file)
@@ -20,8 +20,6 @@
 #include "hw/i386/apic-msidef.h"
 #include "hw/xen/xen_native.h"
 #include "hw/xen/xen_backend_ops.h"
-#include "hw/xen/xen-legacy-backend.h"
-#include "hw/xen/xen-bus.h"
 #include "hw/xen/xen-x86.h"
 #include "qapi/error.h"
 #include "qapi/qapi-commands-migration.h"
@@ -1505,15 +1503,6 @@ void xen_hvm_init_pc(PCMachineState *pcms, MemoryRegion **ram_memory)
     QLIST_INIT(&state->dev_list);
     device_listener_register(&state->device_listener);
 
-    xen_bus_init();
-
-    /* Initialize backend core & drivers */
-    if (xen_be_init() != 0) {
-        error_report("xen backend core setup failed");
-        goto err;
-    }
-    xen_be_register_common();
-
     QLIST_INIT(&xen_physmap);
     xen_read_physmap(state);