summaryrefslogtreecommitdiff
path: root/src/cpu/kvm
diff options
context:
space:
mode:
authorCurtis Dunham <Curtis.Dunham@arm.com>2017-01-27 20:21:59 +0000
committerAndreas Sandberg <andreas.sandberg@arm.com>2017-04-03 16:51:46 +0000
commit567a9b0a085d79c6bc9128204946cd6155960a9f (patch)
tree98f7c28fe491614659d2ac627bd64d935d99b5ca /src/cpu/kvm
parent60075068ea6340e89a4b0cd4bd79c6ee3de44893 (diff)
downloadgem5-567a9b0a085d79c6bc9128204946cd6155960a9f.tar.xz
arm, kvm: implement GIC state transfer
This also allows checkpointing of a Kvm GIC via the Pl390 model. Change-Id: Ic85d81cfefad630617491b732398f5e6a5f34c0b Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com> Reviewed-on: https://gem5-review.googlesource.com/2444 Maintainer: Andreas Sandberg <andreas.sandberg@arm.com> Reviewed-by: Weiping Liao <weipingliao@google.com>
Diffstat (limited to 'src/cpu/kvm')
-rw-r--r--src/cpu/kvm/base.hh1
-rw-r--r--src/cpu/kvm/vm.cc12
-rw-r--r--src/cpu/kvm/vm.hh6
3 files changed, 18 insertions, 1 deletions
diff --git a/src/cpu/kvm/base.hh b/src/cpu/kvm/base.hh
index ef500974f..6f30c55e4 100644
--- a/src/cpu/kvm/base.hh
+++ b/src/cpu/kvm/base.hh
@@ -106,6 +106,7 @@ class BaseKvmCPU : public BaseCPU
void deallocateContext(ThreadID thread_num);
void haltContext(ThreadID thread_num) override;
+ long getVCpuID() const { return vcpuID; }
ThreadContext *getContext(int tn) override;
Counter totalInsts() const override;
diff --git a/src/cpu/kvm/vm.cc b/src/cpu/kvm/vm.cc
index 604d182ab..47e749247 100644
--- a/src/cpu/kvm/vm.cc
+++ b/src/cpu/kvm/vm.cc
@@ -50,6 +50,7 @@
#include <cerrno>
#include <memory>
+#include "cpu/kvm/base.hh"
#include "debug/Kvm.hh"
#include "params/KvmVM.hh"
#include "sim/system.hh"
@@ -528,12 +529,21 @@ KvmVM::createDevice(uint32_t type, uint32_t flags)
}
void
-KvmVM::setSystem(System *s) {
+KvmVM::setSystem(System *s)
+{
panic_if(system != nullptr, "setSystem() can only be called once");
panic_if(s == nullptr, "setSystem() called with null System*");
system = s;
}
+long
+KvmVM::contextIdToVCpuId(ContextID ctx) const
+{
+ assert(system != nullptr);
+ return dynamic_cast<BaseKvmCPU*>
+ (system->getThreadContext(ctx)->getCpuPtr())->getVCpuID();
+}
+
int
KvmVM::createVCPU(long vcpuID)
{
diff --git a/src/cpu/kvm/vm.hh b/src/cpu/kvm/vm.hh
index dbd46aa3c..df2e4119a 100644
--- a/src/cpu/kvm/vm.hh
+++ b/src/cpu/kvm/vm.hh
@@ -48,6 +48,7 @@
// forward declarations
struct KvmVMParams;
+class BaseKvmCPU;
class System;
/**
@@ -405,6 +406,11 @@ class KvmVM : public SimObject
*/
void setSystem(System *s);
+ /**
+ * Get the VCPUID for a given context
+ */
+ long contextIdToVCpuId(ContextID ctx) const;
+
#if defined(__aarch64__)
public: // ARM-specific
/**