Add '-accel <mode>' and 'no-accel' options.
This patch adds two new options to better control CPU emulation
acceleration (i.e. KVM and HAX). More specifically:
'-no-accel' can be used to disable acceleration if available.
'-accel off' does the same.
'-accel on' forces to run with acceleration, or refuses to start
the emulator.
'-accel auto' probes the system for a working accelerator and uses
it when possible (i.e. when emulating x86 or x86_64 images only).
Also print some information with -verbose or -debug-init.
Note: This adds QEMU-independent probing code for KVM and HAX
under android/emulation/ (C++), as well as some glue to
use it from C under android/cpu_accelerator.[hc].
Note: HAX is no longer enabled by default when reaching the QEMU
main function.
Change-Id: Ic91db7a3b213d69296c50fec35cd29a32a8e5779
diff --git a/android/help.c b/android/help.c
index e5d3e49..b703ec5 100644
--- a/android/help.c
+++ b/android/help.c
@@ -734,6 +734,39 @@
}
static void
+help_accel(stralloc_t *out)
+{
+ PRINTF(
+ " Use '-accel <mode>' to control how CPU emulation can be accelerated\n"
+ " when launching the Android emulator. Accelerated emulation only works\n"
+ " for x86 and x86_64 system images. On Linux, it relies on KVM being\n"
+ " installed. On Windows and OS X, it relies on an Intel CPU and the\n"
+ " Intel HAXM driver being installed on your development machine.\n"
+ " Valid values for <mode> are:\n\n"
+
+ " auto The default, determines automatically if acceleration\n"
+ " is supported, and uses it when possible.\n\n"
+
+ " off Disables acceleration entirely. Mostly useful for debugging.\n\n"
+
+ " on Force acceleration. If KVM/HAXM is not installed or usable,\n"
+ " the emulator will refuse to start and print an error message.\n\n"
+
+ " Note that this flag is ignored if you're not emulating an x86 or x86_64\n"
+ );
+}
+
+static void
+help_no_accel(stralloc_t* out)
+{
+ PRINTF(
+ " Use '-no-accel' as a shortcut to '-accel off', i.e. to disable accelerated\n"
+ " CPU emulation, when emulating an x86 or x86_64 system image. Only useful\n"
+ " for debugging.\n"
+ );
+}
+
+static void
help_skindir(stralloc_t* out)
{
PRINTF(