From 5eff9b5e9b93a29cd33c73f74e096eb74b125698 Mon Sep 17 00:00:00 2001 From: Austin Harris Date: Fri, 10 Sep 2021 15:07:40 -0500 Subject: [PATCH] python: Fix switchable processor event queues This fixes the event queues added to the switchable processor in ade8c08 to only be added to the KVM cores. Jira Issue: https://gem5.atlassian.net/browse/GEM5-1086 Change-Id: I74ebc4aa52a44662602b9512c23c8fb8a40101d0 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/50229 Reviewed-by: Jason Lowe-Power Reviewed-by: Bobby R. Bruce Maintainer: Bobby R. Bruce Tested-by: kokoro --- components_library/processors/switchable_processor.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/components_library/processors/switchable_processor.py b/components_library/processors/switchable_processor.py index e764717041..3495a27454 100644 --- a/components_library/processors/switchable_processor.py +++ b/components_library/processors/switchable_processor.py @@ -73,6 +73,11 @@ class SwitchableProcessor(AbstractProcessor): ] if self._prepare_kvm: + if all_cores[0].get_type() != CPUTypes.KVM: + raise Exception( + "When using KVM, the switchable processor must start " + "with the KVM cores." + ) from m5.objects import KvmVM self.kvm_vm = KvmVM() @@ -93,7 +98,10 @@ class SwitchableProcessor(AbstractProcessor): # 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): + kvm_cores = [ + core for core in self.cores if core.get_type() == CPUTypes.KVM + ] + for i, core in enumerate(kvm_cores): for obj in core.get_simobject().descendants(): obj.eventq_index = 0 core.get_simobject().eventq_index = i + 1