SConstruct (10710:9b71309d29f9) | SConstruct (10841:38af38f1f307) |
---|---|
1# -*- mode:python -*- 2 | 1# -*- mode:python -*- 2 |
3# Copyright (c) 2013 ARM Limited | 3# Copyright (c) 2013, 2015 ARM Limited |
4# All rights reserved. 5# 6# The license below extends only to copyright in the software and shall 7# not be construed as granting a license to any other intellectual 8# property including but not limited to intellectual property relating 9# to a hardware implementation of the functionality of the software 10# licensed hereunder. You may use the software subject to the license 11# terms below provided that you ensure that this notice is replicated --- 1005 unchanged lines hidden (view full) --- 1017if not have_fenv: 1018 print "Warning: Header file <fenv.h> not found." 1019 print " This host has no IEEE FP rounding mode control." 1020 1021# Check if we should enable KVM-based hardware virtualization. The API 1022# we rely on exists since version 2.6.36 of the kernel, but somehow 1023# the KVM_API_VERSION does not reflect the change. We test for one of 1024# the types as a fall back. | 4# All rights reserved. 5# 6# The license below extends only to copyright in the software and shall 7# not be construed as granting a license to any other intellectual 8# property including but not limited to intellectual property relating 9# to a hardware implementation of the functionality of the software 10# licensed hereunder. You may use the software subject to the license 11# terms below provided that you ensure that this notice is replicated --- 1005 unchanged lines hidden (view full) --- 1017if not have_fenv: 1018 print "Warning: Header file <fenv.h> not found." 1019 print " This host has no IEEE FP rounding mode control." 1020 1021# Check if we should enable KVM-based hardware virtualization. The API 1022# we rely on exists since version 2.6.36 of the kernel, but somehow 1023# the KVM_API_VERSION does not reflect the change. We test for one of 1024# the types as a fall back. |
1025have_kvm = conf.CheckHeader('linux/kvm.h', '<>') and \ 1026 conf.CheckTypeSize('struct kvm_xsave', '#include <linux/kvm.h>') != 0 | 1025have_kvm = conf.CheckHeader('linux/kvm.h', '<>') |
1027if not have_kvm: 1028 print "Info: Compatible header file <linux/kvm.h> not found, " \ 1029 "disabling KVM support." 1030 | 1026if not have_kvm: 1027 print "Info: Compatible header file <linux/kvm.h> not found, " \ 1028 "disabling KVM support." 1029 |
1030# x86 needs support for xsave. We test for the structure here since we 1031# won't be able to run new tests by the time we know which ISA we're 1032# targeting. 1033have_kvm_xsave = conf.CheckTypeSize('struct kvm_xsave', 1034 '#include <linux/kvm.h>') != 0 1035 |
|
1031# Check if the requested target ISA is compatible with the host 1032def is_isa_kvm_compatible(isa): | 1036# Check if the requested target ISA is compatible with the host 1037def is_isa_kvm_compatible(isa): |
1033 isa_comp_table = { 1034 "arm" : ( "armv7l" ), 1035 "x86" : ( "x86_64" ), 1036 } | |
1037 try: 1038 import platform 1039 host_isa = platform.machine() 1040 except: 1041 print "Warning: Failed to determine host ISA." 1042 return False 1043 | 1038 try: 1039 import platform 1040 host_isa = platform.machine() 1041 except: 1042 print "Warning: Failed to determine host ISA." 1043 return False 1044 |
1044 return host_isa in isa_comp_table.get(isa, []) | 1045 if not have_posix_timers: 1046 print "Warning: Can not enable KVM, host seems to lack support " \ 1047 "for POSIX timers" 1048 return False |
1045 | 1049 |
1050 if isa == "arm": 1051 return host_isa == "armv7l" 1052 elif isa == "x86": 1053 if host_isa != "x86_64": 1054 return False |
|
1046 | 1055 |
1056 if not have_kvm_xsave: 1057 print "KVM on x86 requires xsave support in kernel headers." 1058 return False 1059 1060 return True 1061 else: 1062 return False 1063 1064 |
|
1047# Check if the exclude_host attribute is available. We want this to 1048# get accurate instruction counts in KVM. 1049main['HAVE_PERF_ATTR_EXCLUDE_HOST'] = conf.CheckMember( 1050 'linux/perf_event.h', 'struct perf_event_attr', 'exclude_host') 1051 1052 1053###################################################################### 1054# --- 297 unchanged lines hidden (view full) --- 1352 1353 if env['EFENCE']: 1354 env.Append(LIBS=['efence']) 1355 1356 if env['USE_KVM']: 1357 if not have_kvm: 1358 print "Warning: Can not enable KVM, host seems to lack KVM support" 1359 env['USE_KVM'] = False | 1065# Check if the exclude_host attribute is available. We want this to 1066# get accurate instruction counts in KVM. 1067main['HAVE_PERF_ATTR_EXCLUDE_HOST'] = conf.CheckMember( 1068 'linux/perf_event.h', 'struct perf_event_attr', 'exclude_host') 1069 1070 1071###################################################################### 1072# --- 297 unchanged lines hidden (view full) --- 1370 1371 if env['EFENCE']: 1372 env.Append(LIBS=['efence']) 1373 1374 if env['USE_KVM']: 1375 if not have_kvm: 1376 print "Warning: Can not enable KVM, host seems to lack KVM support" 1377 env['USE_KVM'] = False |
1360 elif not have_posix_timers: 1361 print "Warning: Can not enable KVM, host seems to lack support " \ 1362 "for POSIX timers" 1363 env['USE_KVM'] = False | |
1364 elif not is_isa_kvm_compatible(env['TARGET_ISA']): 1365 print "Info: KVM support disabled due to unsupported host and " \ 1366 "target ISA combination" 1367 env['USE_KVM'] = False 1368 1369 # Warn about missing optional functionality 1370 if env['USE_KVM']: 1371 if not main['HAVE_PERF_ATTR_EXCLUDE_HOST']: --- 45 unchanged lines hidden --- | 1378 elif not is_isa_kvm_compatible(env['TARGET_ISA']): 1379 print "Info: KVM support disabled due to unsupported host and " \ 1380 "target ISA combination" 1381 env['USE_KVM'] = False 1382 1383 # Warn about missing optional functionality 1384 if env['USE_KVM']: 1385 if not main['HAVE_PERF_ATTR_EXCLUDE_HOST']: --- 45 unchanged lines hidden --- |