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().
This commit is contained in:
parent
cba3a125e1
commit
12e91f701b
1 changed files with 26 additions and 12 deletions
38
SConstruct
38
SConstruct
|
@ -1,6 +1,6 @@
|
||||||
# -*- mode:python -*-
|
# -*- mode:python -*-
|
||||||
|
|
||||||
# Copyright (c) 2013 ARM Limited
|
# Copyright (c) 2013, 2015 ARM Limited
|
||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
#
|
#
|
||||||
# The license below extends only to copyright in the software and shall
|
# 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
|
# 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 KVM_API_VERSION does not reflect the change. We test for one of
|
||||||
# the types as a fall back.
|
# the types as a fall back.
|
||||||
have_kvm = conf.CheckHeader('linux/kvm.h', '<>') and \
|
have_kvm = conf.CheckHeader('linux/kvm.h', '<>')
|
||||||
conf.CheckTypeSize('struct kvm_xsave', '#include <linux/kvm.h>') != 0
|
|
||||||
if not have_kvm:
|
if not have_kvm:
|
||||||
print "Info: Compatible header file <linux/kvm.h> not found, " \
|
print "Info: Compatible header file <linux/kvm.h> not found, " \
|
||||||
"disabling KVM support."
|
"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
|
# Check if the requested target ISA is compatible with the host
|
||||||
def is_isa_kvm_compatible(isa):
|
def is_isa_kvm_compatible(isa):
|
||||||
isa_comp_table = {
|
|
||||||
"arm" : ( "armv7l" ),
|
|
||||||
"x86" : ( "x86_64" ),
|
|
||||||
}
|
|
||||||
try:
|
try:
|
||||||
import platform
|
import platform
|
||||||
host_isa = platform.machine()
|
host_isa = platform.machine()
|
||||||
|
@ -1041,7 +1042,24 @@ def is_isa_kvm_compatible(isa):
|
||||||
print "Warning: Failed to determine host ISA."
|
print "Warning: Failed to determine host ISA."
|
||||||
return False
|
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
|
# 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:
|
if not have_kvm:
|
||||||
print "Warning: Can not enable KVM, host seems to lack KVM support"
|
print "Warning: Can not enable KVM, host seems to lack KVM support"
|
||||||
env['USE_KVM'] = False
|
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']):
|
elif not is_isa_kvm_compatible(env['TARGET_ISA']):
|
||||||
print "Info: KVM support disabled due to unsupported host and " \
|
print "Info: KVM support disabled due to unsupported host and " \
|
||||||
"target ISA combination"
|
"target ISA combination"
|
||||||
|
|
Loading…
Reference in a new issue