1# -*- mode:python -*- 2 |
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. |
1025have_kvm = conf.CheckHeader('linux/kvm.h', '<>') |
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 |
1036# Check if the requested target ISA is compatible with the host 1037def is_isa_kvm_compatible(isa): |
1038 try: 1039 import platform 1040 host_isa = platform.machine() 1041 except: 1042 print "Warning: Failed to determine host ISA." 1043 return False 1044 |
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 |
1049 |
1050 if isa == "arm": 1051 return host_isa == "armv7l" 1052 elif isa == "x86": 1053 if host_isa != "x86_64": 1054 return False |
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 |
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 |
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 --- |