From 41beacce088e8f682a0e8ac48f22a3fa4805a43b Mon Sep 17 00:00:00 2001 From: Curtis Dunham Date: Tue, 14 Feb 2017 15:09:18 -0600 Subject: sim, kvm: make KvmVM a System parameter A KVM VM is typically a child of the System object already, but for solving future issues with configuration graph resolution, the most logical way to keep track of this object is for it to be an actual parameter of the System object. Change-Id: I965ded22203ff8667db9ca02de0042ff1c772220 Reviewed-by: Andreas Sandberg --- src/sim/System.py | 4 ++++ src/sim/system.cc | 15 +++++++++++++++ src/sim/system.hh | 11 +++++++++++ 3 files changed, 30 insertions(+) (limited to 'src/sim') diff --git a/src/sim/System.py b/src/sim/System.py index 34b1fd127..e3e42d862 100644 --- a/src/sim/System.py +++ b/src/sim/System.py @@ -29,6 +29,7 @@ # Rick Strong from m5.SimObject import SimObject +from m5.defines import buildEnv from m5.params import * from m5.proxy import * @@ -106,3 +107,6 @@ class System(MemObject): # Dynamic voltage and frequency handler for the system, disabled by default # Provide list of domains that need to be controlled by the handler dvfs_handler = DVFSHandler() + + if buildEnv['USE_KVM']: + kvm_vm = Param.KvmVM(NULL, 'KVM VM (i.e., shared memory domain)') diff --git a/src/sim/system.cc b/src/sim/system.cc index 09be232a7..9315882b7 100644 --- a/src/sim/system.cc +++ b/src/sim/system.cc @@ -53,6 +53,10 @@ #include "base/loader/symtab.hh" #include "base/str.hh" #include "base/trace.hh" +#include "config/use_kvm.hh" +#if USE_KVM +#include "cpu/kvm/vm.hh" +#endif #include "cpu/thread_context.hh" #include "debug/Loader.hh" #include "debug/WorkItems.hh" @@ -90,6 +94,11 @@ System::System(Params *p) kernel(nullptr), loadAddrMask(p->load_addr_mask), loadAddrOffset(p->load_offset), +#if USE_KVM + kvmVM(p->kvm_vm), +#else + kvmVM(nullptr), +#endif physmem(name() + ".physmem", p->memories, p->mmap_using_noreserve), memoryMode(p->mem_mode), _cacheLineSize(p->cache_line_size), @@ -104,6 +113,12 @@ System::System(Params *p) // add self to global system list systemList.push_back(this); +#if USE_KVM + if (kvmVM) { + kvmVM->setSystem(this); + } +#endif + if (FullSystem) { kernelSymtab = new SymbolTable; if (!debugSymbolTable) diff --git a/src/sim/system.hh b/src/sim/system.hh index 1bbd37d9d..c3667fe09 100644 --- a/src/sim/system.hh +++ b/src/sim/system.hh @@ -72,6 +72,7 @@ class BaseRemoteGDB; class GDBListener; +class KvmVM; class ObjectFile; class ThreadContext; @@ -249,6 +250,14 @@ class System : public MemObject Addr loadAddrOffset; public: + /** + * Get a pointer to the Kernel Virtual Machine (KVM) SimObject, + * if present. + */ + KvmVM* getKvmVM() { + return kvmVM; + } + /** Get a pointer to access the physical memory of the system */ PhysicalMemory& getPhysMem() { return physmem; } @@ -289,6 +298,8 @@ class System : public MemObject protected: + KvmVM *const kvmVM; + PhysicalMemory physmem; Enums::MemoryMode memoryMode; -- cgit v1.2.3