tests: Allow multi-KvmCPU regressions

Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Change-Id: I3207074e794385528b680e54eaa9a536aef9eb43
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/44325
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Maintainer: Jason Lowe-Power <power.jg@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
Giacomo Travaglini
2021-04-07 14:14:59 +01:00
parent 1f41f50c9a
commit 0b8564f5b2

View File

@@ -125,6 +125,26 @@ class BaseSystem(object, metaclass=ABCMeta):
cpu.connectAllPorts(sha_bus if sha_bus != None else system.membus,
system.membus)
def init_kvm_cpus(self, cpus):
"""
Assign KVM CPUs to their own event queues / threads. This
has to be done after creating caches and other child objects
since these mustn't inherit the CPU event queue.
Arguments:
cpus -- List of cpus
"""
if len(cpus) > 1:
device_eq = 0
first_cpu_eq = 1
for idx, cpu in enumerate(cpus):
# Child objects usually inherit the parent's event
# queue. Override that and use the same event queue for
# all devices.
for obj in cpu.descendants():
obj.eventq_index = device_eq
cpu.eventq_index = first_cpu_eq + idx
def init_kvm(self, system):
"""Do KVM-specific system initialization.
@@ -142,10 +162,6 @@ class BaseSystem(object, metaclass=ABCMeta):
self.create_clk_src(system)
system.cpu = self.create_cpus(system.cpu_clk_domain)
if _have_kvm_support and \
any([isinstance(c, BaseKvmCPU) for c in system.cpu]):
self.init_kvm(system)
if self.use_ruby:
# Add the ruby specific and protocol specific options
parser = optparse.OptionParser()
@@ -181,6 +197,10 @@ class BaseSystem(object, metaclass=ABCMeta):
for cpu in system.cpu:
self.init_cpu(system, cpu, sha_bus)
if _have_kvm_support and \
any([isinstance(c, BaseKvmCPU) for c in system.cpu]):
self.init_kvm(system)
self.init_kvm_cpus(system.cpu)
def create_clk_src(self,system):
# Create system clock domain. This provides clock value to every