Patchwork [36/40] xen: only create dummy env when necessary

login
register
mail settings
Submitter Alexander Graf
Date Nov. 2, 2010, 4:26 p.m.
Message ID <1288715174-28495-1-git-send-email-agraf@suse.de>
Download mbox | patch
Permalink /patch/69907/
State New
Headers show

Comments

Alexander Graf - Nov. 2, 2010, 4:26 p.m.
For native Xen machines, we need to create a dummy env so qemu always has
something to work on.

When using xenner however, we don't want that dummy env but create real envs
instead.

Signed-off-by: Alexander Graf <agraf@suse.de>
---
 hw/xen_machine_pv.c |   22 ++++++++++++++--------
 1 files changed, 14 insertions(+), 8 deletions(-)

Patch

diff --git a/hw/xen_machine_pv.c b/hw/xen_machine_pv.c
index b94d6e9..6f2666d 100644
--- a/hw/xen_machine_pv.c
+++ b/hw/xen_machine_pv.c
@@ -30,16 +30,9 @@ 
 #include "xen_domainbuild.h"
 #include "blockdev.h"
 
-static void xen_init_pv(ram_addr_t ram_size,
-			const char *boot_device,
-			const char *kernel_filename,
-			const char *kernel_cmdline,
-			const char *initrd_filename,
-			const char *cpu_model)
+static void create_dummy_env(const char *cpu_model)
 {
     CPUState *env;
-    DriveInfo *dinfo;
-    int i;
 
     /* Initialize a dummy CPU */
     if (cpu_model == NULL) {
@@ -51,6 +44,17 @@  static void xen_init_pv(ram_addr_t ram_size,
     }
     env = cpu_init(cpu_model);
     env->halted = 1;
+}
+
+static void xen_init_pv(ram_addr_t ram_size,
+			const char *boot_device,
+			const char *kernel_filename,
+			const char *kernel_cmdline,
+			const char *initrd_filename,
+			const char *cpu_model)
+{
+    DriveInfo *dinfo;
+    int i;
 
     /* Initialize backend core & drivers */
     if (xen_be_init() != 0) {
@@ -60,9 +64,11 @@  static void xen_init_pv(ram_addr_t ram_size,
 
     switch (xen_mode) {
     case XEN_ATTACH:
+        create_dummy_env(cpu_model);
         /* nothing to do, xend handles everything */
         break;
     case XEN_CREATE:
+        create_dummy_env(cpu_model);
         if (xen_domain_build_pv(kernel_filename, initrd_filename,
                                 kernel_cmdline) < 0) {
             fprintf(stderr, "xen pv domain creation failed\n");