From 567a9b0a085d79c6bc9128204946cd6155960a9f Mon Sep 17 00:00:00 2001 From: Curtis Dunham Date: Fri, 27 Jan 2017 20:21:59 +0000 Subject: 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 Reviewed-on: https://gem5-review.googlesource.com/2444 Maintainer: Andreas Sandberg Reviewed-by: Weiping Liao --- src/cpu/kvm/base.hh | 1 + src/cpu/kvm/vm.cc | 12 +++++++++++- src/cpu/kvm/vm.hh | 6 ++++++ 3 files changed, 18 insertions(+), 1 deletion(-) (limited to 'src/cpu/kvm') 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 #include +#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 + (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 /** -- cgit v1.2.3