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:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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!")
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user