From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KeDk0-0000Hq-JS for qemu-devel@nongnu.org; Fri, 12 Sep 2008 14:51:36 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KeDjy-0000HU-UV for qemu-devel@nongnu.org; Fri, 12 Sep 2008 14:51:35 -0400 Received: from [199.232.76.173] (port=43489 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KeDjy-0000HR-Qd for qemu-devel@nongnu.org; Fri, 12 Sep 2008 14:51:34 -0400 Received: from mx2.redhat.com ([66.187.237.31]:33946) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KeDjz-0000ba-4I for qemu-devel@nongnu.org; Fri, 12 Sep 2008 14:51:35 -0400 From: Glauber Costa Date: Fri, 12 Sep 2008 15:47:13 -0300 Message-Id: <1221245233-26152-1-git-send-email-glommer@redhat.com> Subject: [Qemu-devel] [PATCH/RFC] provide --accel option Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: jan.kiszka@siemens.com, aliguori@us.ibm.com, jes@sgi.com, dmitry.baryshkov@siemens.com 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 --- 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