configs,python: Update components library to support KVM

Issue-on: https://gem5.atlassian.net/browse/GEM5-1024
Change-Id: Ic3340e77ab0f9a72752924b9dee89bb5e220615f
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/49613
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Maintainer: Jason Lowe-Power <power.jg@gmail.com>
This commit is contained in:
Bobby R. Bruce
2021-08-25 16:24:18 -07:00
parent 091ba116ee
commit b12381bbe4
5 changed files with 26 additions and 6 deletions

View File

@@ -54,6 +54,7 @@ class SimpleCore(AbstractCore):
elif cpu_type == CPUTypes.TIMING:
self.core = TimingSimpleCPU(cpu_id=core_id)
elif cpu_type == CPUTypes.KVM:
from m5.objects import X86KvmCPU
self.core = X86KvmCPU(cpu_id=core_id)
else:
raise NotImplementedError

View File

@@ -53,13 +53,9 @@ class SimpleProcessor(AbstractProcessor):
self._cpu_type = cpu_type
if self._cpu_type == CPUTypes.KVM:
from m5.objects import KvmVM
self.kvm_vm = KvmVM()
# To get the KVM CPUs to run on different host CPUs
# Specify a different event queue for each CPU
for i, core in enumerate(self.cores):
for obj in core.get_simobject().descendants():
obj.eventq_index = 0
core.get_simobject().eventq_index = i + 1
def _create_cores(self, cpu_type: CPUTypes, num_cores: int):
return [
@@ -87,3 +83,11 @@ class SimpleProcessor(AbstractProcessor):
board.set_mem_mode(MemMode.ATOMIC)
else:
raise NotImplementedError
if self._cpu_type == CPUTypes.KVM:
# To get the KVM CPUs to run on different host CPUs
# Specify a different event queue for each CPU
for i, core in enumerate(self.cores):
for obj in core.get_simobject().descendants():
obj.eventq_index = 0
core.get_simobject().eventq_index = i + 1

View File

@@ -238,6 +238,11 @@ print()
root = Root(full_system=True, system=motherboard)
if args.cpu == "kvm":
# TODO: This of annoying. Is there a way to fix this to happen
# automatically when running KVM?
root.sim_quantum = int(1e9)
m5.instantiate()
print("Beginning simulation!")

View File

@@ -132,6 +132,11 @@ print()
root = Root(full_system=True, system=motherboard)
if args.cpu == "kvm" or args.boot_cpu == "kvm":
# TODO: This of annoying. Is there a way to fix this to happen
# automatically when running KVM?
root.sim_quantum = int(1e9)
m5.instantiate()
globalStart = time.time()

View File

@@ -99,6 +99,11 @@ print()
root = Root(full_system=False, system=motherboard)
if args.cpu == "kvm":
# TODO: This of annoying. Is there a way to fix this to happen
# automatically when running KVM?
root.sim_quantum = int(1e9)
m5.instantiate()
exit_event = m5.simulate()