mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-08-03 09:23:35 +00:00
acrn-config: detect and parse MSI-X table number
Detect and get MSI-X table number in board xmls. Parse and generate the number for board config while 'MAX_MSIX_TABLE_NUM' item is blank. Tracked-On: #4994 Signed-off-by: Wei Liu <weix.w.liu@intel.com> Acked-by: Victor Sun <victor.sun@intel.com>
This commit is contained in:
parent
80c7da8f1c
commit
1cb68b2cda
@ -194,7 +194,13 @@ def get_capacities(hv_info, config):
|
||||
print("CONFIG_MAX_PCI_DEV_NUM={}".format(hv_info.cap.max_pci_dev_num), file=config)
|
||||
print("CONFIG_MAX_IOAPIC_LINES={}".format(hv_info.cap.max_ioapic_lines), file=config)
|
||||
print("CONFIG_MAX_PT_IRQ_ENTRIES={}".format(hv_info.cap.max_pt_irq_entries), file=config)
|
||||
print("CONFIG_MAX_MSIX_TABLE_NUM={}".format(hv_info.cap.max_msix_table_num), file=config)
|
||||
max_msix_table_num = 0
|
||||
if not hv_info.cap.max_msix_table_num:
|
||||
native_max_msix_line = board_cfg_lib.get_info(common.BOARD_INFO_FILE, "<MAX_MSIX_TABLE_NUM>", "</MAX_MSIX_TABLE_NUM>")
|
||||
max_msix_table_num = native_max_msix_line[0].strip()
|
||||
else:
|
||||
max_msix_table_num = hv_info.cap.max_msix_table_num
|
||||
print("CONFIG_MAX_MSIX_TABLE_NUM={}".format(max_msix_table_num), file=config)
|
||||
print("CONFIG_MAX_EMULATED_MMIO_REGIONS={}".format(hv_info.cap.max_emu_mmio_regions), file=config)
|
||||
|
||||
|
||||
|
@ -78,7 +78,7 @@ class CapHv:
|
||||
hv_cfg_lib.ir_entries_check(self.max_ir_entries, "CAPACITIES", "MAX_IR_ENTRIES")
|
||||
hv_cfg_lib.hv_size_check(self.iommu_bus_num, "CAPACITIES", "IOMMU_BUS_NUM")
|
||||
hv_cfg_lib.hv_range_check(self.max_pci_dev_num, "CAPACITIES", "MAX_PCI_DEV_NUM", hv_cfg_lib.RANGE_DB['PCI_DEV_NUM'])
|
||||
hv_cfg_lib.hv_range_check(self.max_msix_table_num, "CAPACITIES", "MAX_MSIX_TABLE_NUM", hv_cfg_lib.RANGE_DB['MSIX_TABLE_NUM'])
|
||||
hv_cfg_lib.max_msix_table_num_check(self.max_msix_table_num, "CAPACITIES", "MAX_MSIX_TABLE_NUM")
|
||||
|
||||
|
||||
class MisCfg:
|
||||
|
@ -71,10 +71,11 @@ def release_check(sel_str, dbg_opt, rel_str):
|
||||
ERR_LIST[key] = "{} should be in {}".format(rel_str, N_Y)
|
||||
|
||||
|
||||
def hv_range_check(str_val, branch_tag, item, range_db):
|
||||
def hv_range_check(str_val, branch_tag, item, range_db, empty_check_enable=True):
|
||||
|
||||
if empty_check(str_val, branch_tag, item):
|
||||
return
|
||||
if empty_check_enable:
|
||||
if empty_check(str_val, branch_tag, item):
|
||||
return
|
||||
if not is_numeric_check(str_val, branch_tag, item):
|
||||
return
|
||||
range_check(str_val, branch_tag, item, range_db)
|
||||
@ -225,3 +226,16 @@ def mba_delay_check(mba_delay_list, feature, mba_str, max_mask_str):
|
||||
key = 'hv,{},{},{}'.format(feature, mba_str, max_mask_str)
|
||||
ERR_LIST[key] = "{} should be in range[0,{}]".format(max_mask_str, mba_delay_str)
|
||||
return
|
||||
|
||||
|
||||
def max_msix_table_num_check(max_msix_table_num, cap_str, max_msi_num_str):
|
||||
native_max_msix_line = board_cfg_lib.get_info(common.BOARD_INFO_FILE, "<MAX_MSIX_TABLE_NUM>", "</MAX_MSIX_TABLE_NUM>")
|
||||
if not native_max_msix_line and not max_msix_table_num:
|
||||
empty_check(max_msix_table_num, cap_str, max_msi_num_str)
|
||||
return
|
||||
|
||||
if max_msix_table_num:
|
||||
hv_range_check(max_msix_table_num, cap_str, max_msi_num_str, RANGE_DB['MSIX_TABLE_NUM'], False)
|
||||
if native_max_msix_line:
|
||||
native_max_msix_num = native_max_msix_line[0].strip()
|
||||
range_check(native_max_msix_num, "In board xml", max_msi_num_str, RANGE_DB['MSIX_TABLE_NUM'])
|
||||
|
@ -217,6 +217,27 @@ def dump_cpu_core_info(config):
|
||||
print("\t</CPU_PROCESSOR_INFO>", file=config)
|
||||
print("", file=config)
|
||||
|
||||
def dump_max_msix_table_num(config):
|
||||
|
||||
msix_table_num_list = []
|
||||
max_msix_table_num = 1
|
||||
cmd = 'lspci -vv | grep "MSI-X" | grep "Count="'
|
||||
res_lines = parser_lib.get_output_lines(cmd)
|
||||
for line in res_lines:
|
||||
tmp_num = line.split('=')[1].split()[0]
|
||||
msix_table_num_list.append(tmp_num)
|
||||
|
||||
if msix_table_num_list:
|
||||
max_msix_table_num = max(msix_table_num_list)
|
||||
print("\t<MAX_MSIX_TABLE_NUM>", file=config)
|
||||
print("\t{}".format(max_msix_table_num), file=config)
|
||||
print("\t</MAX_MSIX_TABLE_NUM>", file=config)
|
||||
|
||||
|
||||
def dump_dev_config_info(config):
|
||||
|
||||
dump_max_msix_table_num(config)
|
||||
print("", file=config)
|
||||
|
||||
def generate_info(board_info):
|
||||
"""Get System Ram information
|
||||
@ -235,3 +256,5 @@ def generate_info(board_info):
|
||||
dump_total_mem(config)
|
||||
|
||||
dump_cpu_core_info(config)
|
||||
|
||||
dump_dev_config_info(config)
|
||||
|
@ -154,3 +154,15 @@ def dump_execute(cmd, desc, config):
|
||||
print("\t{}".format(line.strip()), file=config)
|
||||
|
||||
print("\t</{0}>".format(desc), file=config)
|
||||
|
||||
|
||||
def get_output_lines(cmd):
|
||||
res_lines = []
|
||||
res = cmd_execute(cmd)
|
||||
while True:
|
||||
line = res.stdout.readline().decode('ascii')
|
||||
if not line:
|
||||
break
|
||||
res_lines.append(line.strip())
|
||||
|
||||
return res_lines
|
||||
|
Loading…
Reference in New Issue
Block a user