Austin Harris has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/50127 )

Change subject: python: Update switchable processor to support KVM
......................................................................

python: Update switchable processor to support KVM

Change-Id: Ie843e2b4ab6e506bb195bfcef33cead9a6273901
---
M components_library/processors/simple_switchable_processor.py
M components_library/processors/switchable_processor.py
2 files changed, 20 insertions(+), 7 deletions(-)



diff --git a/components_library/processors/simple_switchable_processor.py b/components_library/processors/simple_switchable_processor.py
index 8dee013..a875817 100644
--- a/components_library/processors/simple_switchable_processor.py
+++ b/components_library/processors/simple_switchable_processor.py
@@ -56,10 +56,6 @@
         self._start_key = "start"
         self._switch_key = "switch"
         self._current_is_start = True
-        self._prepare_kvm = CPUTypes.KVM in (
-            starting_core_type,
-            switch_core_type,
-        )

         if starting_core_type in (CPUTypes.TIMING, CPUTypes.O3):
             self._mem_mode = MemMode.TIMING
@@ -90,9 +86,6 @@
     def incorporate_processor(self, board: AbstractBoard) -> None:
         super().incorporate_processor(board=board)

-        if self._prepare_kvm:
-            board.kvm_vm = KvmVM()
-
         board.set_mem_mode(self._mem_mode)

     def switch(self):
diff --git a/components_library/processors/switchable_processor.py b/components_library/processors/switchable_processor.py
index cb15803..aff3a80 100644
--- a/components_library/processors/switchable_processor.py
+++ b/components_library/processors/switchable_processor.py
@@ -26,6 +26,7 @@

 from components_library.processors.simple_core import SimpleCore
 from components_library.processors.abstract_core import AbstractCore
+from .cpu_types import CPUTypes
 import m5

 from typing import Dict, Any, List
@@ -65,6 +66,15 @@
                 core.set_switched_out(core not in self._current_cores)
                 all_cores.append(core)

+        self._prepare_kvm = CPUTypes.KVM in [
+            core.get_type() for core in all_cores
+        ]
+
+        if self._prepare_kvm:
+            from m5.objects import KvmVM
+
+            self.kvm_vm = KvmVM()
+
         super(SwitchableProcessor, self).__init__(cores=all_cores)

     @overrides(AbstractProcessor)
@@ -76,6 +86,16 @@
         # procsesor
         self._board = board

+        if self._prepare_kvm:
+            board.kvm_vm = self.kvm_vm
+
+            # 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
+
     @overrides(AbstractProcessor)
     def get_num_cores(self) -> int:
# Note: This is a special case where the total number of cores in the

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/50127
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: Ie843e2b4ab6e506bb195bfcef33cead9a6273901
Gerrit-Change-Number: 50127
Gerrit-PatchSet: 1
Gerrit-Owner: Austin Harris <austin.dane.har...@gmail.com>
Gerrit-MessageType: newchange
_______________________________________________
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