summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/arch/arm/kvm/gic.cc18
-rw-r--r--src/arch/arm/kvm/gic.hh3
-rw-r--r--src/sim/system.cc19
-rw-r--r--src/sim/system.hh3
4 files changed, 24 insertions, 19 deletions
diff --git a/src/arch/arm/kvm/gic.cc b/src/arch/arm/kvm/gic.cc
index 7cf4d07c6..498b79faa 100644
--- a/src/arch/arm/kvm/gic.cc
+++ b/src/arch/arm/kvm/gic.cc
@@ -189,7 +189,7 @@ void
MuxingKvmGic::startup()
{
Pl390::startup();
- usingKvm = (kernelGic != nullptr) && validKvmEnvironment();
+ usingKvm = (kernelGic != nullptr) && system.validKvmEnvironment();
if (usingKvm)
fromPl390ToKvm();
}
@@ -206,7 +206,7 @@ void
MuxingKvmGic::drainResume()
{
Pl390::drainResume();
- bool use_kvm = (kernelGic != nullptr) && validKvmEnvironment();
+ bool use_kvm = (kernelGic != nullptr) && system.validKvmEnvironment();
if (use_kvm != usingKvm) {
// Should only occur due to CPU switches
if (use_kvm) // from simulation to KVM emulation
@@ -287,20 +287,6 @@ MuxingKvmGic::clearPPInt(uint32_t num, uint32_t cpu)
kernelGic->clearPPI(cpu, num);
}
-bool
-MuxingKvmGic::validKvmEnvironment() const
-{
- if (system.threadContexts.empty())
- return false;
-
- for (auto tc : system.threadContexts) {
- if (dynamic_cast<BaseArmKvmCPU*>(tc->getCpuPtr()) == nullptr) {
- return false;
- }
- }
- return true;
-}
-
void
MuxingKvmGic::copyDistRegister(BaseGicRegisters* from, BaseGicRegisters* to,
ContextID ctx, Addr daddr)
diff --git a/src/arch/arm/kvm/gic.hh b/src/arch/arm/kvm/gic.hh
index b5544486c..ee04088d3 100644
--- a/src/arch/arm/kvm/gic.hh
+++ b/src/arch/arm/kvm/gic.hh
@@ -195,9 +195,6 @@ class MuxingKvmGic : public Pl390
void clearPPInt(uint32_t num, uint32_t cpu) override;
protected:
- /** Verify gem5 configuration will support KVM emulation */
- bool validKvmEnvironment() const;
-
/** System this interrupt controller belongs to */
System &system;
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; }