for i in xrange(np)]
if is_kvm_cpu(TestCPUClass) or is_kvm_cpu(FutureClass):
- test_sys.vm = KvmVM()
+ test_sys.kvm_vm = KvmVM()
if options.ruby:
# Check for timing mode because ruby does not support atomic accesses
drive_sys.kernel = binary(options.kernel)
if is_kvm_cpu(DriveCPUClass):
- drive_sys.vm = KvmVM()
+ drive_sys.kvm_vm = KvmVM()
drive_sys.iobridge = Bridge(delay='50ns',
ranges = drive_sys.mem_ranges)
if is_kvm_cpu(CPUClass) or is_kvm_cpu(FutureClass):
if buildEnv['TARGET_ISA'] == 'x86':
- system.vm = KvmVM()
+ system.kvm_vm = KvmVM()
for process in multiprocesses:
process.useArchPT = True
process.kvmInSE = True
system = Param.System(Parent.any,
'System this interrupt controller belongs to')
- kvmVM = Param.KvmVM(Parent.any, 'KVM VM (i.e., shared memory domain)')
KvmGic::KvmGic(const KvmGicParams *p)
: BaseGic(p),
system(*p->system),
- kernelGic(*p->kvmVM, p->cpu_addr, p->dist_addr, p->it_lines),
+ kernelGic(*system.getKvmVM(),
+ p->cpu_addr, p->dist_addr, p->it_lines),
addrRanges{kernelGic.distRange, kernelGic.cpuRange}
{
}
def support_take_over(cls):
return True
- kvmVM = Param.KvmVM(Parent.any, 'KVM VM (i.e., shared memory domain)')
useCoalescedMMIO = Param.Bool(False, "Use coalesced MMIO (EXPERIMENTAL)")
usePerfOverflow = Param.Bool(False, "Use perf event overflow counters (EXPERIMENTAL)")
alwaysSyncTC = Param.Bool(False,
type = 'KvmVM'
cxx_header = "cpu/kvm/vm.hh"
- system = Param.System(Parent.any, "system object")
-
- coalescedMMIO = VectorParam.AddrRange([], "memory ranges for coalesced MMIO")
+ coalescedMMIO = \
+ VectorParam.AddrRange([], "memory ranges for coalesced MMIO")
BaseKvmCPU::BaseKvmCPU(BaseKvmCPUParams *params)
: BaseCPU(params),
- vm(*params->kvmVM),
+ vm(*params->system->getKvmVM()),
_status(Idle),
dataPort(name() + ".dcache_port", this),
instPort(name() + ".icache_port", this),
KvmVM::KvmVM(KvmVMParams *params)
: SimObject(params),
- kvm(new Kvm()), system(params->system),
+ kvm(new Kvm()), system(nullptr),
vmFD(kvm->createVM()),
started(false),
nextVCPUID(0)
void
KvmVM::delayedStartup()
{
+ assert(system); // set by the system during its construction
const std::vector<BackingStoreEntry> &memories(
system->getPhysMem().getBackingStore());
#endif
}
+void
+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;
+}
+
int
KvmVM::createVCPU(long vcpuID)
{
/** Global KVM interface */
Kvm *kvm;
+ /**
+ * Initialize system pointer. Invoked by system object.
+ */
+ void setSystem(System *s);
+
#if defined(__aarch64__)
public: // ARM-specific
/**
# Rick Strong
from m5.SimObject import SimObject
+from m5.defines import buildEnv
from m5.params import *
from m5.proxy import *
# 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)')
#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"
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),
// 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)
class BaseRemoteGDB;
class GDBListener;
+class KvmVM;
class ObjectFile;
class ThreadContext;
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; }
protected:
+ KvmVM *const kvmVM;
+
PhysicalMemory physmem;
Enums::MemoryMode memoryMode;