Giacomo Travaglini has submitted this change. ( https://gem5-review.googlesource.com/c/public/gem5/+/44325 )

Change subject: tests: Allow multi-KvmCPU regressions
......................................................................

tests: Allow multi-KvmCPU regressions

Signed-off-by: Giacomo Travaglini <giacomo.travagl...@arm.com>
Change-Id: I3207074e794385528b680e54eaa9a536aef9eb43
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/44325
Reviewed-by: Jason Lowe-Power <power...@gmail.com>
Maintainer: Jason Lowe-Power <power...@gmail.com>
Tested-by: kokoro <noreply+kok...@google.com>
---
M tests/gem5/configs/base_config.py
1 file changed, 24 insertions(+), 4 deletions(-)

Approvals:
  Jason Lowe-Power: Looks good to me, approved; Looks good to me, approved
  kokoro: Regressions pass



diff --git a/tests/gem5/configs/base_config.py b/tests/gem5/configs/base_config.py
index b18cecf..80bfa2d 100644
--- a/tests/gem5/configs/base_config.py
+++ b/tests/gem5/configs/base_config.py
@@ -125,6 +125,26 @@
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 @@
         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 @@
             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

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/44325
To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings

Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: I3207074e794385528b680e54eaa9a536aef9eb43
Gerrit-Change-Number: 44325
Gerrit-PatchSet: 2
Gerrit-Owner: Giacomo Travaglini <giacomo.travagl...@arm.com>
Gerrit-Reviewer: Bobby R. Bruce <bbr...@ucdavis.edu>
Gerrit-Reviewer: Giacomo Travaglini <giacomo.travagl...@arm.com>
Gerrit-Reviewer: Jason Lowe-Power <power...@gmail.com>
Gerrit-Reviewer: kokoro <noreply+kok...@google.com>
Gerrit-MessageType: merged
_______________________________________________
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

Reply via email to