mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-06-19 20:22:46 +00:00
acrn-config: grab Processor CPU number from board information
The value of CONFIG_MAX_PCPU_NUM is stands for Processor CPU number and it is grabed from board information. Tracked-On: #3798 Signed-off-by: Wei Liu <weix.w.liu@intel.com> Acked-by: Victor Sun <victor.sun@intel.com>
This commit is contained in:
parent
fcbf9d7b2c
commit
ee66a94ccf
@ -18,9 +18,6 @@ import new_board_kconfig
|
|||||||
ACRN_PATH = board_cfg_lib.SOURCE_ROOT_DIR
|
ACRN_PATH = board_cfg_lib.SOURCE_ROOT_DIR
|
||||||
ACRN_CONFIG = ACRN_PATH + "hypervisor/arch/x86/configs/"
|
ACRN_CONFIG = ACRN_PATH + "hypervisor/arch/x86/configs/"
|
||||||
|
|
||||||
BOARD_NAMES = ['apl-mrb', 'apl-nuc', 'apl-up2', 'dnv-cb2', 'nuc6cayh',
|
|
||||||
'nuc7i7dnb', 'kbl-nuc-i7', 'icl-rvp']
|
|
||||||
|
|
||||||
ACRN_DEFAULT_PLATFORM = ACRN_PATH + "hypervisor/include/arch/x86/default_acpi_info.h"
|
ACRN_DEFAULT_PLATFORM = ACRN_PATH + "hypervisor/include/arch/x86/default_acpi_info.h"
|
||||||
GEN_FILE = ["pci_devices.h", "board.c", "_acpi_info.h", "misc_cfg.h", "ve820.c", ".config"]
|
GEN_FILE = ["pci_devices.h", "board.c", "_acpi_info.h", "misc_cfg.h", "ve820.c", ".config"]
|
||||||
|
|
||||||
@ -55,7 +52,7 @@ def main(args):
|
|||||||
return err_dic
|
return err_dic
|
||||||
|
|
||||||
config_dirs.append(ACRN_CONFIG + board)
|
config_dirs.append(ACRN_CONFIG + board)
|
||||||
if board not in BOARD_NAMES:
|
if board not in board_cfg_lib.BOARD_NAMES:
|
||||||
for config_dir in config_dirs:
|
for config_dir in config_dirs:
|
||||||
if not os.path.exists(config_dir):
|
if not os.path.exists(config_dir):
|
||||||
os.makedirs(config_dir)
|
os.makedirs(config_dir)
|
||||||
@ -101,7 +98,7 @@ def main(args):
|
|||||||
return err_dic
|
return err_dic
|
||||||
|
|
||||||
# generate new board_name.config
|
# generate new board_name.config
|
||||||
if board not in BOARD_NAMES:
|
if board not in board_cfg_lib.BOARD_NAMES:
|
||||||
with open(config_board_kconfig, 'w+') as config:
|
with open(config_board_kconfig, 'w+') as config:
|
||||||
err_dic = new_board_kconfig.generate_file(config)
|
err_dic = new_board_kconfig.generate_file(config)
|
||||||
if err_dic:
|
if err_dic:
|
||||||
@ -110,7 +107,7 @@ def main(args):
|
|||||||
# move changes to patch, and apply to the source code
|
# move changes to patch, and apply to the source code
|
||||||
err_dic = board_cfg_lib.gen_patch(config_srcs, board)
|
err_dic = board_cfg_lib.gen_patch(config_srcs, board)
|
||||||
|
|
||||||
if board not in BOARD_NAMES and not err_dic:
|
if board not in board_cfg_lib.BOARD_NAMES and not err_dic:
|
||||||
print("Config patch for NEW board {} is committed successfully!".format(board))
|
print("Config patch for NEW board {} is committed successfully!".format(board))
|
||||||
elif not err_dic:
|
elif not err_dic:
|
||||||
print("Config patch for {} is committed successfully!".format(board))
|
print("Config patch for {} is committed successfully!".format(board))
|
||||||
|
@ -85,6 +85,10 @@ def generate_file(config):
|
|||||||
"""
|
"""
|
||||||
board_cfg_lib.get_valid_irq(board_cfg_lib.BOARD_INFO_FILE)
|
board_cfg_lib.get_valid_irq(board_cfg_lib.BOARD_INFO_FILE)
|
||||||
|
|
||||||
|
# get cpu processor list
|
||||||
|
cpu_list = board_cfg_lib.get_processor_info()
|
||||||
|
max_cpu_num = len(cpu_list)
|
||||||
|
|
||||||
# get the vuart0/vuart1 which user chosed from scenario.xml of board_private section
|
# get the vuart0/vuart1 which user chosed from scenario.xml of board_private section
|
||||||
(err_dic, ttys_n) = board_cfg_lib.parser_vuart_console()
|
(err_dic, ttys_n) = board_cfg_lib.parser_vuart_console()
|
||||||
if err_dic:
|
if err_dic:
|
||||||
@ -117,6 +121,9 @@ def generate_file(config):
|
|||||||
print("{0}".format(board_cfg_lib.HEADER_LICENSE), file=config)
|
print("{0}".format(board_cfg_lib.HEADER_LICENSE), file=config)
|
||||||
print("{}".format(MISC_CFG_HEADER), file=config)
|
print("{}".format(MISC_CFG_HEADER), file=config)
|
||||||
|
|
||||||
|
# define CONFIG_MAX_PCPCU_NUM
|
||||||
|
print("#define CONFIG_MAX_PCPU_NUM\t{}U".format(max_cpu_num), file=config)
|
||||||
|
|
||||||
# define rootfs with macro
|
# define rootfs with macro
|
||||||
for i in range(root_dev_num):
|
for i in range(root_dev_num):
|
||||||
print('#define ROOTFS_{}\t\t"root={} "'.format(i, root_devs[i]), file=config)
|
print('#define ROOTFS_{}\t\t"root={} "'.format(i, root_devs[i]), file=config)
|
||||||
|
@ -15,6 +15,9 @@ BIOS_INFO = ['BIOS Information', 'Vendor:', 'Version:', 'Release Date:', 'BIOS R
|
|||||||
|
|
||||||
BASE_BOARD = ['Base Board Information', 'Manufacturer:', 'Product Name:', 'Version:']
|
BASE_BOARD = ['Base Board Information', 'Manufacturer:', 'Product Name:', 'Version:']
|
||||||
|
|
||||||
|
BOARD_NAMES = ['apl-mrb', 'apl-nuc', 'apl-up2', 'dnv-cb2', 'nuc6cayh',
|
||||||
|
'nuc7i7dnb', 'kbl-nuc-i7', 'icl-rvp']
|
||||||
|
|
||||||
TTY_CONSOLE = {
|
TTY_CONSOLE = {
|
||||||
'ttyS0':'0x3F8',
|
'ttyS0':'0x3F8',
|
||||||
'ttyS1':'0x2F8',
|
'ttyS1':'0x2F8',
|
||||||
@ -430,3 +433,30 @@ def get_vuart_info_id(config_file, idx):
|
|||||||
vm_id += 1
|
vm_id += 1
|
||||||
|
|
||||||
return tmp_tag
|
return tmp_tag
|
||||||
|
|
||||||
|
|
||||||
|
def get_processor_info():
|
||||||
|
"""
|
||||||
|
Get cpu processor list
|
||||||
|
:param board_info: it is a file what contains board information
|
||||||
|
:return: cpu processor list
|
||||||
|
"""
|
||||||
|
processor_list = []
|
||||||
|
tmp_list = []
|
||||||
|
processor_info = get_info(BOARD_INFO_FILE, "<CPU_PROCESSOR_INFO>", "</CPU_PROCESSOR_INFO>")
|
||||||
|
|
||||||
|
if not processor_info:
|
||||||
|
key = "CPU PROCESSOR_INFO error:"
|
||||||
|
ERR_LIST[key] = "CPU core is not exists"
|
||||||
|
return processor_list
|
||||||
|
|
||||||
|
for processor_line in processor_info:
|
||||||
|
if not processor_line:
|
||||||
|
break
|
||||||
|
|
||||||
|
processor_list = processor_line.strip().split(',')
|
||||||
|
for processor in processor_list:
|
||||||
|
tmp_list.append(processor.strip())
|
||||||
|
break
|
||||||
|
|
||||||
|
return tmp_list
|
||||||
|
Loading…
Reference in New Issue
Block a user