]> git.proxmox.com Git - qemu.git/commitdiff
machine, Add default_machine_opts to QEMUMachine.
authorAnthony PERARD <anthony.perard@citrix.com>
Mon, 22 Nov 2010 15:44:15 +0000 (15:44 +0000)
committerAlexander Graf <agraf@suse.de>
Sun, 8 May 2011 08:09:59 +0000 (10:09 +0200)
With this new field, we can specified which accelerator use to run the
machine, if the accelerator is not already specified by either a
configuration file or the command line options.

Currently, the only use will be made in the xenfv machine.

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
hw/boards.h
vl.c

index 6f0f0d79259e3601e1c6cb5f002379e4b2284eb1..716fd7b1a66627509ef87ef62a3b49537539d004 100644 (file)
@@ -27,6 +27,7 @@ typedef struct QEMUMachine {
         no_cdrom:1,
         no_sdcard:1;
     int is_default;
+    const char *default_machine_opts;
     GlobalProperty *compat_props;
     struct QEMUMachine *next;
 } QEMUMachine;
diff --git a/vl.c b/vl.c
index a44556e85e1217435c3485a8e7847d84204d51cc..463246906569d1889265a1994b292c558bf80e59 100644 (file)
--- a/vl.c
+++ b/vl.c
@@ -2914,6 +2914,28 @@ int main(int argc, char **argv, char **envp)
         exit(1);
     }
 
+    /*
+     * Get the default machine options from the machine if it is not already
+     * specified either by the configuration file or by the command line.
+     */
+    if (machine->default_machine_opts) {
+        QemuOptsList *list = qemu_find_opts("machine");
+        const char *p = NULL;
+
+        if (!QTAILQ_EMPTY(&list->head)) {
+            p = qemu_opt_get(QTAILQ_FIRST(&list->head), "accel");
+        }
+        if (p == NULL) {
+            opts = qemu_opts_parse(qemu_find_opts("machine"),
+                                   machine->default_machine_opts, 0);
+            if (!opts) {
+                fprintf(stderr, "parse error for machine %s: %s\n",
+                        machine->name, machine->default_machine_opts);
+                exit(1);
+            }
+        }
+    }
+
     qemu_opts_foreach(qemu_find_opts("device"), default_driver_check, NULL, 0);
     qemu_opts_foreach(qemu_find_opts("global"), default_driver_check, NULL, 0);