summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorJames Hogan <james.hogan@imgtec.com>2014-06-26 10:44:25 +0100
committerPaolo Bonzini <pbonzini@redhat.com>2014-07-09 18:17:08 +0200
commitf7f152458e953690f1c8025f507a26d554f6ee4d (patch)
tree93ab4d656479d044ce739ea93e3e68c574e810f4
parentfbdb1d955511c38e61e3aa3ba4fb3944b126eb28 (diff)
downloadfocaccia-qemu-f7f152458e953690f1c8025f507a26d554f6ee4d.tar.gz
focaccia-qemu-f7f152458e953690f1c8025f507a26d554f6ee4d.zip
mips_malta: Catch kernels linked at wrong address
Add error reporting if the wrong type of kernel is provided for the
current mode of acceleration.

Currently a KVM kernel linked at 0x40000000 can't be used with TCG, and
a normal kernel linked at 0x80000000 can't be used with KVM.

Cc: Aurelien Jarno <aurelien@aurel32.net>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: James Hogan <james.hogan@imgtec.com>
Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-rw-r--r--hw/mips/mips_malta.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/hw/mips/mips_malta.c b/hw/mips/mips_malta.c
index 3305a25fc1..cfb60aff9f 100644
--- a/hw/mips/mips_malta.c
+++ b/hw/mips/mips_malta.c
@@ -792,9 +792,23 @@ static int64_t load_kernel (void)
                 loaderparams.kernel_filename);
         exit(1);
     }
+
+    /* Sanity check where the kernel has been linked */
     if (kvm_enabled()) {
+        if (kernel_entry & 0x80000000ll) {
+            error_report("KVM guest kernels must be linked in useg. "
+                         "Did you forget to enable CONFIG_KVM_GUEST?");
+            exit(1);
+        }
+
         xlate_to_kseg0 = cpu_mips_kvm_um_phys_to_kseg0;
     } else {
+        if (!(kernel_entry & 0x80000000ll)) {
+            error_report("KVM guest kernels aren't supported with TCG. "
+                         "Did you unintentionally enable CONFIG_KVM_GUEST?");
+            exit(1);
+        }
+
         xlate_to_kseg0 = cpu_mips_phys_to_kseg0;
     }