Keshav Tirumurti has uploaded this change for review. (
https://gem5-review.googlesource.com/10895
Change subject: cpu-kvm: Add details to failed entry panic.
......................................................................
cpu-kvm: Add details to failed entry panic.
Used a map for hardware failure strings from
asm/vmx.h.
Change-Id: Ic870b70dffaa22133e1c4b6da03fdb262a1d63db
---
M src/cpu/kvm/base.cc
M src/cpu/kvm/vm.cc
M src/cpu/kvm/vm.hh
3 files changed, 22 insertions(+), 2 deletions(-)
diff --git a/src/cpu/kvm/base.cc b/src/cpu/kvm/base.cc
index 3df0fdd..03a70b6 100644
--- a/src/cpu/kvm/base.cc
+++ b/src/cpu/kvm/base.cc
@@ -1109,8 +1109,9 @@
BaseKvmCPU::handleKvmExitFailEntry()
{
dump();
- panic("KVM: Failed to enter virtualized mode (hw reason: 0x%llx)\n",
- _kvmRun->fail_entry.hardware_entry_failure_reason);
+ unsigned int reason =
_kvmRun->fail_entry.hardware_entry_failure_reason;
+ panic("KVM: Failed to enter virtualized mode (hw reason: %s)\n",
+ vm.getHWFailReason(reason));
}
Tick
diff --git a/src/cpu/kvm/vm.cc b/src/cpu/kvm/vm.cc
index 47e7492..d949932 100644
--- a/src/cpu/kvm/vm.cc
+++ b/src/cpu/kvm/vm.cc
@@ -40,6 +40,7 @@
#include "cpu/kvm/vm.hh"
+#include <asm/vmx.h>
#include <fcntl.h>
#include <linux/kvm.h>
#include <sys/ioctl.h>
@@ -49,6 +50,7 @@
#include <cerrno>
#include <memory>
+#include <string>
#include "cpu/kvm/base.hh"
#include "debug/Kvm.hh"
@@ -63,6 +65,10 @@
Kvm *Kvm::instance = NULL;
+//List of hardware errors
+//
+std::map<int, std::string> errStr = {VMX_EXIT_REASONS};
+
Kvm::Kvm()
: kvmFD(-1), apiVersion(-1), vcpuMMapSize(0)
{
@@ -316,6 +322,12 @@
delete kvm;
}
+std::string
+KvmVM::getHWFailReason(unsigned int error)
+{
+ return errStr[error & ~(VMX_EXIT_REASONS_FAILED_VMENTRY)];
+}
+
void
KvmVM::notifyFork()
{
diff --git a/src/cpu/kvm/vm.hh b/src/cpu/kvm/vm.hh
index e122bbf..dd96886 100644
--- a/src/cpu/kvm/vm.hh
+++ b/src/cpu/kvm/vm.hh
@@ -41,6 +41,7 @@
#ifndef __CPU_KVM_KVMVM_HH__
#define __CPU_KVM_KVMVM_HH__
+#include <string>
#include <vector>
#include "base/addr_range.hh"
@@ -298,6 +299,12 @@
void notifyFork();
+ /*
+ * Return a string corresponding to the error associated to
+ * hardware failure.
+ */
+ std::string getHWFailReason(unsigned int error);
+
/**
* Setup a shared three-page memory region used by the internals
* of KVM. This is currently only needed by x86 implementations.
--
To view, visit https://gem5-review.googlesource.com/10895
To unsubscribe, or for help writing mail filters, visit
https://gem5-review.googlesource.com/settings
Gerrit-Project: public/gem5
Gerrit-Branch: master
Gerrit-Change-Id: Ic870b70dffaa22133e1c4b6da03fdb262a1d63db
Gerrit-Change-Number: 10895
Gerrit-PatchSet: 1
Gerrit-Owner: Keshav Tirumurti <kctirumu...@ucdavis.edu>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list
gem5-dev@gem5.org
http://m5sim.org/mailman/listinfo/gem5-dev