]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
kvm: Don't stop on ioport errors by default
authorPekka Enberg <penberg@cs.helsinki.fi>
Sun, 4 Jul 2010 11:02:05 +0000 (14:02 +0300)
committerPekka Enberg <penberg@cs.helsinki.fi>
Sun, 4 Jul 2010 11:03:25 +0000 (14:03 +0300)
This patch introduces a '--ioport-debug' option that preserves the old
stop-on-error behavior and changes the default to keep on running despite of
ioport errors. This allows Linux kernel to boot to VFS mount phase.

Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
tools/kvm/ioport.c
tools/kvm/main.c

index 4bcc2b7dbf9619a6c9b9405dcba14042ce05c59a..a06bcb4edea3fb6dbaca06b3aa1999fa73d680ab 100644 (file)
@@ -2,11 +2,14 @@
 
 #include "kvm/kvm.h"
 
+#include <stdbool.h>
 #include <assert.h>
 #include <limits.h>
 #include <stdlib.h>
 #include <stdio.h>
 
+bool ioport_debug;
+
 static uint8_t ioport_to_uint8(void *data)
 {
        uint8_t *p = data;
@@ -150,6 +153,8 @@ bool kvm__emulate_io(struct kvm *self, uint16_t port, void *data, int direction,
        }
        return true;
 error:
-       ioport_error(port, data, direction, size, count);
-       return false;
+       if (ioport_debug)
+               ioport_error(port, data, direction, size, count);
+
+       return !ioport_debug;
 }
index 962c2c2624e96d79b820c0911fc21cc2c0c19252..e4dda8c64092395c5508f89eba2f290961b2a923 100644 (file)
 #include <string.h>
 #include <stdio.h>
 
+extern bool ioport_debug;
+
 static void usage(char *argv[])
 {
-       fprintf(stderr, "  usage: %s [--single-step] [--params=<kernel-params>] [--kernel=]<kernel-image>\n",
+       fprintf(stderr, "  usage: %s [--single-step] [--ioport-debug] [--params=<kernel-params>] [--kernel=]<kernel-image>\n",
                argv[0]);
        exit(1);
 }
@@ -48,13 +50,16 @@ int main(int argc, char *argv[])
 
        for (i = 1; i < argc; i++) {
                if (option_matches(argv[i], "--kernel=")) {
-                       kernel_filename = &argv[i][9];
+                       kernel_filename = &argv[i][9];
                        continue;
                } else if (option_matches(argv[i], "--params=")) {
-                       kernel_cmdline = &argv[i][9];
+                       kernel_cmdline  = &argv[i][9];
                        continue;
                } else if (option_matches(argv[i], "--single-step")) {
-                       single_step = true;
+                       single_step     = true;
+                       continue;
+               } else if (option_matches(argv[i], "--ioport-debug")) {
+                       ioport_debug    = true;
                        continue;
                } else {
                        /* any unspecified arg is kernel image */