qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 18/32] provide --accel option


From: Glauber Costa
Subject: [Qemu-devel] [PATCH 18/32] provide --accel option
Date: Thu, 23 Oct 2008 12:19:02 -0200

The --accel option will provide us the ability of defining which
accelerator to pick at run time. It has the advantage of not using
the not-well-accepted constructor directives, and also, of stabilishing
a way to define priorities among accelerators.

The ones registered first, are tried first.

Signed-off-by: Glauber Costa <address@hidden>
---
 vl.c |   24 +++++++++++++++++++++---
 1 files changed, 21 insertions(+), 3 deletions(-)

diff --git a/vl.c b/vl.c
index c584ea3..964205d 100644
--- a/vl.c
+++ b/vl.c
@@ -255,6 +255,13 @@ static QEMUTimer *icount_vm_timer;
 
 uint8_t qemu_uuid[16];
 
+QEMUAccel *available_accels[] = {
+/* list of available accelerators */
+#ifdef USE_KQEMU
+    &kqemu_accel,
+#endif
+};
+
 #define TFR(expr) do { if ((expr) != -1) break; } while (errno == EINTR)
 
 /***********************************************************/
@@ -8355,6 +8362,7 @@ enum {
     QEMU_OPTION_no_quit,
     QEMU_OPTION_pidfile,
     QEMU_OPTION_no_kqemu,
+    QEMU_OPTION_accel,
     QEMU_OPTION_kernel_kqemu,
     QEMU_OPTION_win2k_hack,
     QEMU_OPTION_usb,
@@ -8442,6 +8450,7 @@ static const QEMUOption qemu_options[] = {
     { "no-kqemu", 0, QEMU_OPTION_no_kqemu },
     { "kernel-kqemu", 0, QEMU_OPTION_kernel_kqemu },
 #endif
+    { "accel", HAS_ARG, QEMU_OPTION_accel},
 #if defined(TARGET_PPC) || defined(TARGET_SPARC)
     { "g", 1, QEMU_OPTION_g },
 #endif
@@ -8816,9 +8825,6 @@ int main(int argc, char **argv)
     }
 #endif
 
-    register_qemu_accel(&kqemu_accel);
-    register_qemu_accel(&noaccel);
-
     register_machines();
     machine = first_machine;
     cpu_model = NULL;
@@ -9267,6 +9273,15 @@ int main(int argc, char **argv)
                 kqemu_allowed = 2;
                 break;
 #endif
+            case QEMU_OPTION_accel:
+                {
+                    int i;
+                    for (i = 0; i < ARRAY_SIZE(available_accels); i++) {
+                        if (!strcasecmp(optarg, available_accels[i]->name))
+                            register_qemu_accel(available_accels[i]);
+                    }
+                }
+                break;
             case QEMU_OPTION_usb:
                 usb_enabled = 1;
                 break;
@@ -9408,6 +9423,9 @@ int main(int argc, char **argv)
         exit(1);
     }
 
+    /* Basic handler for the noaccel case */
+    register_qemu_accel(&noaccel);
+
     if (nographic) {
        if (serial_device_index == 0)
            serial_devices[0] = "stdio";
-- 
1.5.5.1





reply via email to

[Prev in Thread] Current Thread [Next in Thread]