qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH/RFC] provide --accel option
@ 2008-09-12 18:47 Glauber Costa
  2008-09-12 19:07 ` Blue Swirl
  0 siblings, 1 reply; 3+ messages in thread
From: Glauber Costa @ 2008-09-12 18:47 UTC (permalink / raw)
  To: qemu-devel; +Cc: jan.kiszka, aliguori, jes, dmitry.baryshkov

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 <glommer@redhat.com>
---
 vl.c |   25 +++++++++++++++++++++----
 1 files changed, 21 insertions(+), 4 deletions(-)

diff --git a/vl.c b/vl.c
index a93b76f..a75635d 100644
--- a/vl.c
+++ b/vl.c
@@ -296,6 +296,13 @@ QEMUAccel noaccel = {
     .break_loop = accel_nop,
 };
 
+QEMUAccel *available_accels[] = {
+/* list of available accelerators */
+#ifdef USE_KQEMU
+    &kqemu_accel,
+#endif
+};
+
 #define TFR(expr) do { if ((expr) != -1) break; } while (errno == EINTR)
 
 /***********************************************************/
@@ -7900,6 +7907,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,
@@ -7985,6 +7993,7 @@ 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
@@ -8307,10 +8316,6 @@ int main(int argc, char **argv)
     }
 #endif
 
-    /* Basic handler for the noaccel case */
-    register_qemu_accel(&noaccel);
-    register_qemu_accel(&kqemu_accel);
-
     register_machines();
     machine = first_machine;
     cpu_model = NULL;
@@ -8767,6 +8772,15 @@ int main(int argc, char **argv)
                 kqemu_allowed = 2;
                 break;
 #endif
+            case QEMU_OPTION_accel:
+                {
+                    int i;
+                    for (i = 0; i < sizeof(available_accels)/sizeof(void *); i++) {
+                        if (!strcasecmp(optarg, available_accels[i]->name))
+                            register_qemu_accel(available_accels[i]);
+                    } 
+                }
+                break;
             case QEMU_OPTION_usb:
                 usb_enabled = 1;
                 break;
@@ -8891,6 +8905,9 @@ int main(int argc, char **argv)
         }
     }
 
+    /* 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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH/RFC] provide --accel option
  2008-09-12 18:47 [Qemu-devel] [PATCH/RFC] provide --accel option Glauber Costa
@ 2008-09-12 19:07 ` Blue Swirl
  2008-09-12 19:14   ` Glauber Costa
  0 siblings, 1 reply; 3+ messages in thread
From: Blue Swirl @ 2008-09-12 19:07 UTC (permalink / raw)
  To: qemu-devel

On 9/12/08, Glauber Costa <glommer@redhat.com> wrote:
> 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.

>  +            case QEMU_OPTION_accel:
>  +                {
>  +                    int i;
>  +                    for (i = 0; i < sizeof(available_accels)/sizeof(void *); i++) {

ARRAY_SIZE(available_accels)?

>  +                        if (!strcasecmp(optarg, available_accels[i]->name))
>  +                            register_qemu_accel(available_accels[i]);
>  +                    }
>  +                }
>  +                break;

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH/RFC] provide --accel option
  2008-09-12 19:07 ` Blue Swirl
@ 2008-09-12 19:14   ` Glauber Costa
  0 siblings, 0 replies; 3+ messages in thread
From: Glauber Costa @ 2008-09-12 19:14 UTC (permalink / raw)
  To: qemu-devel

On Fri, Sep 12, 2008 at 4:07 PM, Blue Swirl <blauwirbel@gmail.com> wrote:
> On 9/12/08, Glauber Costa <glommer@redhat.com> wrote:
>> 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.
>
>>  +            case QEMU_OPTION_accel:
>>  +                {
>>  +                    int i;
>>  +                    for (i = 0; i < sizeof(available_accels)/sizeof(void *); i++) {
>
> ARRAY_SIZE(available_accels)?
agreed.

>>  +                        if (!strcasecmp(optarg, available_accels[i]->name))
>>  +                            register_qemu_accel(available_accels[i]);
>>  +                    }
>>  +                }
>>  +                break;
>
>
>



-- 
Glauber Costa.
"Free as in Freedom"
http://glommer.net

"The less confident you are, the more serious you have to act."

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-09-12 19:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-09-12 18:47 [Qemu-devel] [PATCH/RFC] provide --accel option Glauber Costa
2008-09-12 19:07 ` Blue Swirl
2008-09-12 19:14   ` Glauber Costa

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).