]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
kvm: Ignore MMIO accesses
authorPekka Enberg <penberg@cs.helsinki.fi>
Sun, 11 Apr 2010 12:15:02 +0000 (15:15 +0300)
committerPekka Enberg <penberg@cs.helsinki.fi>
Sun, 11 Apr 2010 12:15:02 +0000 (15:15 +0300)
Lets cheat some more and ignore MMIO accesses altogether.

Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
tools/kvm/Makefile
tools/kvm/include/kvm/kvm.h
tools/kvm/main.c
tools/kvm/mmio.c [new file with mode: 0644]

index bc1290d1336c54df252ccf83ce41c16a48db49b8..1846f3c4f7e7d8f5daa58d4278cae5c0dd1675d7 100644 (file)
@@ -14,9 +14,10 @@ OBJS += interrupt.o
 OBJS   += ioport.o
 OBJS   += kvm.o
 OBJS   += main.o
+OBJS   += mmio.o
 OBJS   += util.o
-OBJS   += bios/c-intfake.o
 OBJS   += bios/c-int10.o
+OBJS   += bios/c-intfake.o
 
 CFLAGS += $(CPPFLAGS) -Iinclude -g
 
index 61100151de377b069c9eff3e690f156402ef9750..2d39b6211c0b1904fd0f581238ce5144e09ee0df 100644 (file)
@@ -39,6 +39,7 @@ bool kvm__load_kernel(struct kvm *kvm, const char *kernel_filename, const char *
 void kvm__reset_vcpu(struct kvm *self);
 void kvm__run(struct kvm *self);
 bool kvm__emulate_io(struct kvm *self, uint16_t port, void *data, int direction, int size, uint32_t count);
+bool kvm__emulate_mmio(struct kvm *self, uint64_t phys_addr, uint8_t *data, uint32_t len, uint8_t is_write);
 
 /*
  * Debugging
index 5e72cf5f781673f549cd1956d1596a4ff561f0f2..b6414e77f474ddf0409902624664206ce7252f46 100644 (file)
@@ -80,6 +80,20 @@ int main(int argc, char *argv[])
                                goto exit_kvm;
                        break;
                }
+               case KVM_EXIT_MMIO: {
+                       bool ret;
+
+                       ret = kvm__emulate_mmio(kvm,
+                                       kvm->kvm_run->mmio.phys_addr,
+                                       kvm->kvm_run->mmio.data,
+                                       kvm->kvm_run->mmio.len,
+                                       kvm->kvm_run->mmio.is_write);
+
+                       if (!ret)
+                               goto exit_kvm;
+                       break;
+
+               }
                default:
                        goto exit_kvm;
                }
diff --git a/tools/kvm/mmio.c b/tools/kvm/mmio.c
new file mode 100644 (file)
index 0000000..095d2c9
--- /dev/null
@@ -0,0 +1,19 @@
+#include "kvm/kvm.h"
+
+#include <stdio.h>
+
+static const char *to_direction(uint8_t is_write)
+{
+       if (is_write)
+               return "write";
+
+       return "read";
+}
+
+bool kvm__emulate_mmio(struct kvm *self, uint64_t phys_addr, uint8_t *data, uint32_t len, uint8_t is_write)
+{
+       fprintf(stderr, "Warning: Ignoring MMIO %s at %016" PRIx64 " (length %" PRIu32 ")\n",
+               to_direction(is_write), phys_addr, len);
+
+       return true;
+}