summaryrefslogtreecommitdiff
path: root/configs/common/CpuConfig.py
diff options
context:
space:
mode:
authorAndreas Sandberg <andreas.sandberg@arm.com>2018-08-28 11:56:55 +0100
committerAndreas Sandberg <andreas.sandberg@arm.com>2018-09-03 16:05:46 +0000
commit215d5e4096cb4b06aa7fd5e9936440b28d8fe034 (patch)
tree280a6ea01b449ac3592157baadd61382025b7edc /configs/common/CpuConfig.py
parent2b4b94d0556c2d03172ebff63f7fc502c3c26ff8 (diff)
downloadgem5-215d5e4096cb4b06aa7fd5e9936440b28d8fe034.tar.xz
config: Move KVM CPU checking to CpuConfig helper module
Both se.py and fs.py need to check if a CPU is a KVM CPU. This is somewhat involved since CPUs can be disabled at compile time. Enable better code reuse by moving it to the CpuConfig module. Change-Id: I47b1512ecb62e757399a407a0e41be83b9f83be3 Signed-off-by: Andreas Sandberg <andreas.sandberg@arm.com> Reviewed-on: https://gem5-review.googlesource.com/12418 Reviewed-by: Jason Lowe-Power <jason@lowepower.com> Maintainer: Jason Lowe-Power <jason@lowepower.com>
Diffstat (limited to 'configs/common/CpuConfig.py')
-rw-r--r--configs/common/CpuConfig.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/configs/common/CpuConfig.py b/configs/common/CpuConfig.py
index 3f193ae60..d70e6cfa7 100644
--- a/configs/common/CpuConfig.py
+++ b/configs/common/CpuConfig.py
@@ -1,4 +1,4 @@
-# Copyright (c) 2012, 2017 ARM Limited
+# Copyright (c) 2012, 2017-2018 ARM Limited
# All rights reserved.
#
# The license below extends only to copyright in the software and shall
@@ -59,6 +59,17 @@ def is_cpu_class(cls):
except (TypeError, AttributeError):
return False
+def _cpu_subclass_tester(name):
+ cpu_class = getattr(m5.objects, name, None)
+
+ def tester(cls):
+ return cpu_class is not None and cls is not None and \
+ issubclass(cls, cpu_class)
+
+ return tester
+
+is_kvm_cpu = _cpu_subclass_tester("BaseKvmCPU")
+
def get(name):
"""Get a CPU class from a user provided class name or alias."""