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/cpu/kvm/vm.cc | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/cpu/kvm/vm.cc') diff --git a/src/cpu/kvm/vm.cc b/src/cpu/kvm/vm.cc index d3ab8c45a..604d182ab 100644 --- a/src/cpu/kvm/vm.cc +++ b/src/cpu/kvm/vm.cc @@ -292,7 +292,7 @@ Kvm::createVM() KvmVM::KvmVM(KvmVMParams *params) : SimObject(params), - kvm(new Kvm()), system(params->system), + kvm(new Kvm()), system(nullptr), vmFD(kvm->createVM()), started(false), nextVCPUID(0) @@ -342,6 +342,7 @@ KvmVM::cpuStartup() void KvmVM::delayedStartup() { + assert(system); // set by the system during its construction const std::vector &memories( system->getPhysMem().getBackingStore()); @@ -526,6 +527,13 @@ KvmVM::createDevice(uint32_t type, uint32_t flags) #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) { -- cgit v1.2.3