Bobby R. Bruce has submitted this change. ( https://gem5-review.googlesource.com/c/public/gem5/+/49613 )

Change subject: configs,python: Update components library to support KVM
......................................................................

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 <[email protected]>
Reviewed-by: Jason Lowe-Power <[email protected]>
Maintainer: Jason Lowe-Power <[email protected]>
---
M components_library/processors/simple_core.py
M components_library/processors/simple_processor.py
M configs/example/components-library/boot_exit_disk_run.py
M configs/example/components-library/parsec_disk_run.py
M configs/example/components-library/simple_binary_run.py
5 files changed, 26 insertions(+), 6 deletions(-)

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




diff --git a/components_library/processors/simple_core.py b/components_library/processors/simple_core.py
index 8f510e9..0875fad 100644
--- a/components_library/processors/simple_core.py
+++ b/components_library/processors/simple_core.py
@@ -54,6 +54,7 @@
         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
diff --git a/components_library/processors/simple_processor.py b/components_library/processors/simple_processor.py
index e449173..1eac24a 100644
--- a/components_library/processors/simple_processor.py
+++ b/components_library/processors/simple_processor.py
@@ -53,13 +53,9 @@

         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 @@
                 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
diff --git a/configs/example/components-library/boot_exit_disk_run.py b/configs/example/components-library/boot_exit_disk_run.py
index 2284ff3..91fa7c1 100644
--- a/configs/example/components-library/boot_exit_disk_run.py
+++ b/configs/example/components-library/boot_exit_disk_run.py
@@ -238,6 +238,11 @@

 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!")
diff --git a/configs/example/components-library/parsec_disk_run.py b/configs/example/components-library/parsec_disk_run.py
index 535a78f..f52bd66 100644
--- a/configs/example/components-library/parsec_disk_run.py
+++ b/configs/example/components-library/parsec_disk_run.py
@@ -132,6 +132,11 @@

 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()
diff --git a/configs/example/components-library/simple_binary_run.py b/configs/example/components-library/simple_binary_run.py
index 9a5faa9..2906429 100644
--- a/configs/example/components-library/simple_binary_run.py
+++ b/configs/example/components-library/simple_binary_run.py
@@ -99,6 +99,11 @@

 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()

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/49613
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: Ic3340e77ab0f9a72752924b9dee89bb5e220615f
Gerrit-Change-Number: 49613
Gerrit-PatchSet: 16
Gerrit-Owner: Bobby R. Bruce <[email protected]>
Gerrit-Reviewer: Andreas Sandberg <[email protected]>
Gerrit-Reviewer: Bobby R. Bruce <[email protected]>
Gerrit-Reviewer: Jason Lowe-Power <[email protected]>
Gerrit-Reviewer: Jason Lowe-Power <[email protected]>
Gerrit-Reviewer: kokoro <[email protected]>
Gerrit-CC: Austin Harris <[email protected]>
Gerrit-MessageType: merged
_______________________________________________
gem5-dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

Reply via email to