summaryrefslogtreecommitdiff
path: root/SConstruct
diff options
context:
space:
mode:
authorAndreas Sandberg <andreas.sandberg@arm.com>2015-05-23 13:37:18 +0100
committerAndreas Sandberg <andreas.sandberg@arm.com>2015-05-23 13:37:18 +0100
commit12e91f701b4d4ecfd1a7d9ed92ed1e11c06bb69c (patch)
treee5472d56a3086d2de0d18d14a843d052788fa974 /SConstruct
parentcba3a125e1b7af015a736d44ab84a36129ee6890 (diff)
downloadgem5-12e91f701b4d4ecfd1a7d9ed92ed1e11c06bb69c.tar.xz
build: Don't test for KVM xsave support on ARM
The current build tests for KVM unconditionally check for xsave support. This obviously never works on ARM since xsave is x86-specific. This changeset refactors the build tests probing for KVM support and moves the xsave test to an x86-specific section of is_isa_kvm_compatible().
Diffstat (limited to 'SConstruct')
-rwxr-xr-xSConstruct38
1 files changed, 26 insertions, 12 deletions
diff --git a/SConstruct b/SConstruct
index c51c7b28c..2d61aa0f2 100755
--- a/SConstruct
+++ b/SConstruct
@@ -1,6 +1,6 @@
# -*- mode:python -*-
-# Copyright (c) 2013 ARM Limited
+# Copyright (c) 2013, 2015 ARM Limited
# All rights reserved.
#
# The license below extends only to copyright in the software and shall
@@ -1022,18 +1022,19 @@ if not have_fenv:
# we rely on exists since version 2.6.36 of the kernel, but somehow
# the KVM_API_VERSION does not reflect the change. We test for one of
# the types as a fall back.
-have_kvm = conf.CheckHeader('linux/kvm.h', '<>') and \
- conf.CheckTypeSize('struct kvm_xsave', '#include <linux/kvm.h>') != 0
+have_kvm = conf.CheckHeader('linux/kvm.h', '<>')
if not have_kvm:
print "Info: Compatible header file <linux/kvm.h> not found, " \
"disabling KVM support."
+# x86 needs support for xsave. We test for the structure here since we
+# won't be able to run new tests by the time we know which ISA we're
+# targeting.
+have_kvm_xsave = conf.CheckTypeSize('struct kvm_xsave',
+ '#include <linux/kvm.h>') != 0
+
# Check if the requested target ISA is compatible with the host
def is_isa_kvm_compatible(isa):
- isa_comp_table = {
- "arm" : ( "armv7l" ),
- "x86" : ( "x86_64" ),
- }
try:
import platform
host_isa = platform.machine()
@@ -1041,7 +1042,24 @@ def is_isa_kvm_compatible(isa):
print "Warning: Failed to determine host ISA."
return False
- return host_isa in isa_comp_table.get(isa, [])
+ if not have_posix_timers:
+ print "Warning: Can not enable KVM, host seems to lack support " \
+ "for POSIX timers"
+ return False
+
+ if isa == "arm":
+ return host_isa == "armv7l"
+ elif isa == "x86":
+ if host_isa != "x86_64":
+ return False
+
+ if not have_kvm_xsave:
+ print "KVM on x86 requires xsave support in kernel headers."
+ return False
+
+ return True
+ else:
+ return False
# Check if the exclude_host attribute is available. We want this to
@@ -1357,10 +1375,6 @@ for variant_path in variant_paths:
if not have_kvm:
print "Warning: Can not enable KVM, host seems to lack KVM support"
env['USE_KVM'] = False
- elif not have_posix_timers:
- print "Warning: Can not enable KVM, host seems to lack support " \
- "for POSIX timers"
- env['USE_KVM'] = False
elif not is_isa_kvm_compatible(env['TARGET_ISA']):
print "Info: KVM support disabled due to unsupported host and " \
"target ISA combination"