summaryrefslogtreecommitdiff
path: root/src/sim
diff options
context:
space:
mode:
authorCurtis Dunham <Curtis.Dunham@arm.com>2017-05-17 21:34:04 +0000
committerAndreas Sandberg <andreas.sandberg@arm.com>2017-07-05 14:24:03 +0000
commitb829b4a8e4ef82345cf81d442dbc6c67016fde98 (patch)
treeeb080d8bca85dd76314f8721e2b8b5c28d1e89fb /src/sim
parent97187fa814167906ed168a02aad09ff6fd0ed17c (diff)
downloadgem5-b829b4a8e4ef82345cf81d442dbc6c67016fde98.tar.xz
kvm: move Kvm check from ARM Kvm GIC to System
The check was nearly completely generic anyway, with the exception of the Kvm CPU type. This will make it easier for other parts of the codebase to do similar checks. Change-Id: Ibfdd3d65e9e6cc3041b53b73adfabee1999283da Reviewed-on: https://gem5-review.googlesource.com/3540 Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com> Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>
Diffstat (limited to 'src/sim')
-rw-r--r--src/sim/system.cc19
-rw-r--r--src/sim/system.hh3
2 files changed, 22 insertions, 0 deletions
diff --git a/src/sim/system.cc b/src/sim/system.cc
index 9315882b7..e46c35611 100644
--- a/src/sim/system.cc
+++ b/src/sim/system.cc
@@ -55,6 +55,7 @@
#include "base/trace.hh"
#include "config/use_kvm.hh"
#if USE_KVM
+#include "cpu/kvm/base.hh"
#include "cpu/kvm/vm.hh"
#endif
#include "cpu/thread_context.hh"
@@ -335,6 +336,24 @@ System::replaceThreadContext(ThreadContext *tc, ContextID context_id)
remoteGDB[context_id]->replaceThreadContext(tc);
}
+bool
+System::validKvmEnvironment() const
+{
+#if USE_KVM
+ if (threadContexts.empty())
+ return false;
+
+ for (auto tc : threadContexts) {
+ if (dynamic_cast<BaseKvmCPU*>(tc->getCpuPtr()) == nullptr) {
+ return false;
+ }
+ }
+ return true;
+#else
+ return false;
+#endif
+}
+
Addr
System::allocPhysPages(int npages)
{
diff --git a/src/sim/system.hh b/src/sim/system.hh
index c3c178dbd..a656ab382 100644
--- a/src/sim/system.hh
+++ b/src/sim/system.hh
@@ -262,6 +262,9 @@ class System : public MemObject
return kvmVM;
}
+ /** Verify gem5 configuration will support KVM emulation */
+ bool validKvmEnvironment() const;
+
/** Get a pointer to access the physical memory of the system */
PhysicalMemory& getPhysMem() { return physmem; }