aboutsummaryrefslogtreecommitdiffstats
path: root/kvm-android.c
diff options
context:
space:
mode:
authorDavid 'Digit' Turner <digit@android.com>2011-05-30 21:40:26 +0200
committerDavid 'Digit' Turner <digit@android.com>2011-05-30 21:41:25 +0200
commit80ab327edf7caf8d6bd016c80e17a729f03076d7 (patch)
tree7de52420b5395c70706e583c77dad2844170b43c /kvm-android.c
parent8f78ba9c9f79fc7d5e1c386c6eb7ae9656e97d48 (diff)
downloadexternal_qemu-80ab327edf7caf8d6bd016c80e17a729f03076d7.zip
external_qemu-80ab327edf7caf8d6bd016c80e17a729f03076d7.tar.gz
external_qemu-80ab327edf7caf8d6bd016c80e17a729f03076d7.tar.bz2
kvm: Fix KVM auto-detection
Now that we have a work-around for the bug that caused KVM to crash when the 32-bit emulator was running under a 64-bit kernel, we can simplify the auto-detection logic. Change-Id: Ia06908aa947cc3865451a04c38a7782cf4c7b831
Diffstat (limited to 'kvm-android.c')
-rw-r--r--kvm-android.c30
1 files changed, 2 insertions, 28 deletions
diff --git a/kvm-android.c b/kvm-android.c
index 55293fa..76d5a55 100644
--- a/kvm-android.c
+++ b/kvm-android.c
@@ -6,10 +6,8 @@
#define D(...) VERBOSE_PRINT(init,__VA_ARGS__)
/* A simple routine used to check that we can run the program under KVM.
- * We simply want to ensure that the emulator binary and the kernel have the
- * same endianess.
- *
- * A 32-bit executable cannot use the 64-bit KVM interface, even to run a 32-bit guest.
+ * We simply want to ensure that the kvm driver is loaded and that the
+ * corresponding device file is accessible by the user.
*/
#ifndef __linux__
@@ -19,11 +17,6 @@
int
kvm_check_allowed(void)
{
- /* sizeof(void*) is enough to give us the program's bitness */
- const int isProgram64bits = (sizeof(void*) == 8);
- int isKernel64bits = 0;
- struct utsname utn;
-
/* Is there a /dev/kvm device file here? */
if (access("/dev/kvm",F_OK)) {
/* no need to print a warning here */
@@ -37,25 +30,6 @@ kvm_check_allowed(void)
return 0;
}
- /* Determine kernel endianess */
- memset(&utn,0,sizeof(utn));
- uname(&utn);
- D("Kernel machine type: %s", utn.machine);
- if (strcmp(utn.machine,"x86_64") == 0)
- isKernel64bits = 1;
- else if (strcmp(utn.machine,"amd64") == 0)
- isKernel64bits = 1;
-
-
- if (isProgram64bits != isKernel64bits) {
- if (isProgram64bits) {
- D("kvm disabled (64-bit emulator and 32-bit kernel)");
- } else {
- D("kvm disabled (32-bit emulator and 64-bit kernel)");
- }
- return 0;
- }
-
D("KVM mode auto-enabled!");
return 1;
}