scons: Put all config variables in an env['CONF'] sub-dict.

This makes what are configuration and what are internal SCons variables
explicit and separate, and makes it unnecessary to call out what
variables to export to C++.

These variables will also be plumbed into and out of kconfiglib in later
changes.

Change-Id: Iaf5e098d7404af06285c421dbdf8ef4171b3f001
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/56892
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
Maintainer: Gabe Black <gabe.black@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
Gabe Black
2022-02-15 22:23:43 -08:00
parent caa5f12e21
commit e6c0ba97db
87 changed files with 211 additions and 233 deletions

View File

@@ -37,7 +37,8 @@
Import('*')
if not env['USE_KVM'] or env['TARGET_ISA'] != env['KVM_ISA']:
if not env['CONF']['USE_KVM'] or \
env['CONF']['TARGET_ISA'] != env['CONF']['KVM_ISA']:
Return()
SimObject('KvmVM.py', sim_objects=['KvmVM'])

View File

@@ -42,7 +42,7 @@ with gem5_scons.Configure(main) as conf:
# the types as a fall back.
# The default value of KVM_ISA should serialize to a string in the
# C++ header and test False in Scons/Python.
conf.env['KVM_ISA'] = ''
conf.env['CONF']['KVM_ISA'] = ''
if not conf.CheckHeader('linux/kvm.h', '<>'):
print("Info: Compatible header file <linux/kvm.h> not found, "
"disabling KVM support.")
@@ -52,33 +52,28 @@ with gem5_scons.Configure(main) as conf:
elif host_isa == 'x86_64':
if conf.CheckTypeSize('struct kvm_xsave',
'#include <linux/kvm.h>') != 0:
conf.env['KVM_ISA'] = 'x86'
conf.env['CONF']['KVM_ISA'] = 'x86'
else:
warning("KVM on x86 requires xsave support in kernel headers.")
elif host_isa in ('armv7l', 'aarch64'):
conf.env['KVM_ISA'] = 'arm'
conf.env['CONF']['KVM_ISA'] = 'arm'
else:
warning("Failed to determine host ISA.")
if conf.env['KVM_ISA']:
if conf.env['CONF']['KVM_ISA']:
# Check if the exclude_host attribute is available. We want this to
# get accurate instruction counts in KVM.
conf.env['HAVE_PERF_ATTR_EXCLUDE_HOST'] = conf.CheckMember(
conf.env['CONF']['HAVE_PERF_ATTR_EXCLUDE_HOST'] = conf.CheckMember(
'linux/perf_event.h', 'struct perf_event_attr', 'exclude_host')
# Warn about missing optional functionality
if not conf.env['HAVE_PERF_ATTR_EXCLUDE_HOST']:
if not conf.env['CONF']['HAVE_PERF_ATTR_EXCLUDE_HOST']:
warning("perf_event headers lack support for the exclude_host "
"attribute. KVM instruction counts will be inaccurate.")
export_vars.append('HAVE_PERF_ATTR_EXCLUDE_HOST')
if main['KVM_ISA']:
if main['CONF']['KVM_ISA']:
sticky_vars.Add(BoolVariable('USE_KVM',
'Enable hardware virtualized (KVM) CPU models', True))
else:
main['USE_KVM'] = False
export_vars.append('USE_KVM')
main['CONF']['USE_KVM'] = False
warning("Can not enable KVM, host seems to lack KVM support")
export_vars.append('KVM_ISA')