@@ -106,6 +106,20 @@ static int handle_unhandled(uint64_t reason)
return -EINVAL;
}
+static int handle_failed_vmentry(uint64_t reason)
+{
+ fprintf(stderr, "kvm: vm entry failed with error 0x%" PRIx64 "\n\n", reason);
+ fprintf(stderr, "If you're runnning a guest on an Intel machine, it can be\n");
+ fprintf(stderr, "most-likely due to the guest going into an invalid state\n");
+ fprintf(stderr, "for Intel VT. For example, the guest maybe running in big\n");
+ fprintf(stderr, "real mode which is not supported by Intel VT.\n\n");
+ fprintf(stderr, "You may want to try enabling real mode emulation in KVM.\n");
+ fprintf(stderr, "To Enable it, you may run the following commands as root:\n");
+ fprintf(stderr, "# rmmod kvm_intel\n");
+ fprintf(stderr, "# rmmod kvm\n");
+ fprintf(stderr, "# modprobe kvm_intel emulate_invalid_guest_state=1\n");
+ return -EINVAL;
+}
static inline void set_gsi(kvm_context_t kvm, unsigned int gsi)
{
@@ -586,7 +600,7 @@ int kvm_run(CPUState *env)
r = handle_unhandled(run->hw.hardware_exit_reason);
break;
case KVM_EXIT_FAIL_ENTRY:
- r = handle_unhandled(run->fail_entry.hardware_entry_failure_reason);
+ r = handle_failed_vmentry(run->fail_entry.hardware_entry_failure_reason);
break;
case KVM_EXIT_EXCEPTION:
fprintf(stderr, "exception %d (%x)\n", run->ex.exception,