scons: Update the Kconfig build options

The CL updates the Kconfig:
1. Replace the USE_NULL_ISA with BUILD_ISA
2. The USE_XXX_ISAs are depends on BUILD_ISA
3. If the BUILD_ISA is set, at least one of USE_XXX_ISAs must be set
4. Refactor the USE_KVM option

Change-Id: I2a600dea9fb671263b0191c46c5790ebbe91a7b8
This commit is contained in:
Roger Chang
2023-09-14 11:41:40 +08:00
parent d37673be9f
commit d758df4b5c
31 changed files with 47 additions and 55 deletions

View File

@@ -1,5 +1,6 @@
RUBY=y RUBY=y
RUBY_PROTOCOL_MESI_TWO_LEVEL=y RUBY_PROTOCOL_MESI_TWO_LEVEL=y
BUILD_ISA=y
USE_ARM_ISA=y USE_ARM_ISA=y
USE_MIPS_ISA=y USE_MIPS_ISA=y
USE_POWER_ISA=y USE_POWER_ISA=y

View File

@@ -1,3 +1,4 @@
BUILD_ISA=y
USE_ARM_ISA=y USE_ARM_ISA=y
RUBY=y RUBY=y
RUBY_PROTOCOL_CHI=y RUBY_PROTOCOL_CHI=y

View File

@@ -1,3 +1,4 @@
BUILD_ISA=y
USE_ARM_ISA=y USE_ARM_ISA=y
RUBY=y RUBY=y
RUBY_PROTOCOL_MESI_THREE_LEVEL=y RUBY_PROTOCOL_MESI_THREE_LEVEL=y

View File

@@ -1,3 +1,4 @@
BUILD_ISA=y
USE_ARM_ISA=y USE_ARM_ISA=y
RUBY=y RUBY=y
RUBY_PROTOCOL_MESI_THREE_LEVEL_HTM=y RUBY_PROTOCOL_MESI_THREE_LEVEL_HTM=y

View File

@@ -1,3 +1,4 @@
BUILD_ISA=y
USE_ARM_ISA=y USE_ARM_ISA=y
RUBY=y RUBY=y
RUBY_PROTOCOL_MOESI_HAMMER=y RUBY_PROTOCOL_MOESI_HAMMER=y

View File

@@ -1,5 +1,6 @@
RUBY=y RUBY=y
RUBY_PROTOCOL_GPU_VIPER=y RUBY_PROTOCOL_GPU_VIPER=y
BUILD_ISA=y
USE_X86_ISA=y USE_X86_ISA=y
GCN3_GPU_ISA=y GCN3_GPU_ISA=y
BUILD_GPU=y BUILD_GPU=y

View File

@@ -1,3 +1,2 @@
RUBY=y RUBY=y
RUBY_PROTOCOL_GARNET_STANDALONE=y RUBY_PROTOCOL_GARNET_STANDALONE=y
USE_NULL_ISA=y

View File

@@ -1,3 +1,4 @@
RUBY=y RUBY=y
RUBY_PROTOCOL_MI_EXAMPLE=y RUBY_PROTOCOL_MI_EXAMPLE=y
BUILD_ISA=y
USE_MIPS_ISA=y USE_MIPS_ISA=y

View File

@@ -1,3 +1,2 @@
RUBY=y RUBY=y
RUBY_PROTOCOL_MI_EXAMPLE=y RUBY_PROTOCOL_MI_EXAMPLE=y
USE_NULL_ISA=y

View File

@@ -1,3 +1,2 @@
RUBY=y RUBY=y
RUBY_PROTOCOL_MESI_TWO_LEVEL=y RUBY_PROTOCOL_MESI_TWO_LEVEL=y
USE_NULL_ISA=y

View File

@@ -1,3 +1,2 @@
RUBY=y RUBY=y
RUBY_PROTOCOL_MOESI_CMP_DIRECTORY=y RUBY_PROTOCOL_MOESI_CMP_DIRECTORY=y
USE_NULL_ISA=y

View File

@@ -1,3 +1,2 @@
RUBY=y RUBY=y
RUBY_PROTOCOL_MOESI_CMP_TOKEN=y RUBY_PROTOCOL_MOESI_CMP_TOKEN=y
USE_NULL_ISA=y

View File

@@ -1,3 +1,2 @@
RUBY=y RUBY=y
RUBY_PROTOCOL_MOESI_HAMMER=y RUBY_PROTOCOL_MOESI_HAMMER=y
USE_NULL_ISA=y

View File

@@ -1,3 +1,4 @@
RUBY=y RUBY=y
RUBY_PROTOCOL_MI_EXAMPLE=y RUBY_PROTOCOL_MI_EXAMPLE=y
BUILD_ISA=y
USE_POWER_ISA=y USE_POWER_ISA=y

View File

@@ -1,3 +1,4 @@
RUBY=y RUBY=y
RUBY_PROTOCOL_MI_EXAMPLE=y RUBY_PROTOCOL_MI_EXAMPLE=y
BUILD_ISA=y
USE_RISCV_ISA=y USE_RISCV_ISA=y

View File

@@ -1,3 +1,4 @@
RUBY=y RUBY=y
RUBY_PROTOCOL_MI_EXAMPLE=y RUBY_PROTOCOL_MI_EXAMPLE=y
BUILD_ISA=y
USE_SPARC_ISA=y USE_SPARC_ISA=y

View File

@@ -1,5 +1,6 @@
RUBY=y RUBY=y
RUBY_PROTOCOL_GPU_VIPER=y RUBY_PROTOCOL_GPU_VIPER=y
BUILD_ISA=y
USE_X86_ISA=y USE_X86_ISA=y
VEGA_GPU_ISA=y VEGA_GPU_ISA=y
BUILD_GPU=y BUILD_GPU=y

View File

@@ -1,4 +1,5 @@
RUBY=y RUBY=y
NUMBER_BITS_PER_SET=128 NUMBER_BITS_PER_SET=128
RUBY_PROTOCOL_MESI_TWO_LEVEL=y RUBY_PROTOCOL_MESI_TWO_LEVEL=y
BUILD_ISA=y
USE_X86_ISA=y USE_X86_ISA=y

View File

@@ -1,4 +1,5 @@
RUBY=y RUBY=y
NUMBER_BITS_PER_SET=128 NUMBER_BITS_PER_SET=128
RUBY_PROTOCOL_MESI_TWO_LEVEL=y RUBY_PROTOCOL_MESI_TWO_LEVEL=y
BUILD_ISA=y
USE_X86_ISA=y USE_X86_ISA=y

View File

@@ -1,3 +1,4 @@
RUBY=y RUBY=y
RUBY_PROTOCOL_MI_EXAMPLE=y RUBY_PROTOCOL_MI_EXAMPLE=y
BUILD_ISA=y
USE_X86_ISA=y USE_X86_ISA=y

View File

@@ -1,3 +1,4 @@
RUBY=y RUBY=y
RUBY_PROTOCOL_MOESI_AMD_BASE=y RUBY_PROTOCOL_MOESI_AMD_BASE=y
BUILD_ISA=y
USE_X86_ISA=y USE_X86_ISA=y

View File

@@ -28,10 +28,21 @@ config TARGET_GPU_ISA
rsource "amdgpu/Kconfig" rsource "amdgpu/Kconfig"
config BUILD_ISA
bool "Build the arch ISA"
default n
menu "ISA"
if BUILD_ISA
rsource "arm/Kconfig" rsource "arm/Kconfig"
rsource "mips/Kconfig" rsource "mips/Kconfig"
rsource "null/Kconfig"
rsource "power/Kconfig" rsource "power/Kconfig"
rsource "riscv/Kconfig" rsource "riscv/Kconfig"
rsource "sparc/Kconfig" rsource "sparc/Kconfig"
rsource "x86/Kconfig" rsource "x86/Kconfig"
endif
endmenu

View File

@@ -56,20 +56,17 @@ Import('*')
# #
################################################################# #################################################################
if env['CONF']['USE_ARM_ISA']: if env['CONF']['BUILD_ISA']:
isa = 'arm' if (
elif env['CONF']['USE_MIPS_ISA']: not env['CONF']['USE_ARM_ISA'] and
isa = 'mips' not env['CONF']['USE_MIPS_ISA'] and
elif env['CONF']['USE_POWER_ISA']: not env['CONF']['USE_POWER_ISA'] and
isa = 'power' not env['CONF']['USE_RISCV_ISA'] and
elif env['CONF']['USE_RISCV_ISA']: not env['CONF']['USE_SPARC_ISA'] and
isa = 'riscv' not env['CONF']['USE_X86_ISA']
elif env['CONF']['USE_SPARC_ISA']: ):
isa = 'sparc' error("At least one ISA need to be set")
elif env['CONF']['USE_X86_ISA']:
isa = 'x86'
elif env['CONF']['USE_NULL_ISA']:
isa = 'null'
amdgpu_isa = ['gcn3', 'vega'] amdgpu_isa = ['gcn3', 'vega']

View File

@@ -1,27 +0,0 @@
# Copyright 2022 Google LLC
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met: redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer;
# redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution;
# neither the name of the copyright holders nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
config USE_NULL_ISA
bool "Null ISA support"

View File

@@ -30,5 +30,4 @@ config KVM_ISA
config USE_KVM config USE_KVM
depends on KVM_ISA != "" depends on KVM_ISA != ""
bool "Enable hardware virtualized (KVM) CPU models" bool "Enable hardware virtualized (KVM) CPU models"
default y if KVM_ISA != "" default y
default n

View File

@@ -40,7 +40,7 @@
Import('*') Import('*')
if not env['CONF']['USE_NULL_ISA']: if env['CONF']['BUILD_ISA']:
SimObject('BaseMinorCPU.py', sim_objects=[ SimObject('BaseMinorCPU.py', sim_objects=[
'MinorOpClass', 'MinorOpClassSet', 'MinorFUTiming', 'MinorFU', 'MinorOpClass', 'MinorOpClassSet', 'MinorFUTiming', 'MinorFU',
'MinorFUPool', 'BaseMinorCPU'], 'MinorFUPool', 'BaseMinorCPU'],

View File

@@ -30,7 +30,7 @@ import sys
Import('*') Import('*')
if not env['CONF']['USE_NULL_ISA']: if env['CONF']['BUILD_ISA']:
SimObject('FUPool.py', sim_objects=['FUPool']) SimObject('FUPool.py', sim_objects=['FUPool'])
SimObject('FuncUnitConfig.py', sim_objects=[]) SimObject('FuncUnitConfig.py', sim_objects=[])
SimObject('BaseO3CPU.py', sim_objects=['BaseO3CPU'], enums=[ SimObject('BaseO3CPU.py', sim_objects=['BaseO3CPU'], enums=[

View File

@@ -37,7 +37,7 @@
Import('*') Import('*')
if not env['CONF']['USE_NULL_ISA']: if env['CONF']['BUILD_ISA']:
SimObject('SimpleTrace.py', sim_objects=['SimpleTrace']) SimObject('SimpleTrace.py', sim_objects=['SimpleTrace'])
Source('simple_trace.cc') Source('simple_trace.cc')
DebugFlag('SimpleTrace') DebugFlag('SimpleTrace')

View File

@@ -28,7 +28,7 @@
Import('*') Import('*')
if not env['CONF']['USE_NULL_ISA']: if env['CONF']['BUILD_ISA']:
SimObject('BaseAtomicSimpleCPU.py', sim_objects=['BaseAtomicSimpleCPU']) SimObject('BaseAtomicSimpleCPU.py', sim_objects=['BaseAtomicSimpleCPU'])
Source('atomic.cc') Source('atomic.cc')

View File

@@ -28,6 +28,6 @@
Import('*') Import('*')
if not env['CONF']['USE_NULL_ISA']: if env['CONF']['BUILD_ISA']:
SimObject('SimPoint.py', sim_objects=['SimPoint']) SimObject('SimPoint.py', sim_objects=['SimPoint'])
Source('simpoint.cc') Source('simpoint.cc')

View File

@@ -42,6 +42,9 @@ def get_supported_isas() -> Set[ISA]:
""" """
supported_isas = set() supported_isas = set()
if not buildEnv["BUILD_ISA"]:
return {ISA.NULL}
if "TARGET_ISA" in buildEnv.keys(): if "TARGET_ISA" in buildEnv.keys():
supported_isas.add(get_isa_from_str(buildEnv["TARGET_ISA"])) supported_isas.add(get_isa_from_str(buildEnv["TARGET_ISA"]))