mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-06-23 05:57:33 +00:00
acrn-config: move the MACRO of IVSHMEM shared region name to ivshmem_cfg.h
The MACRO of IVSHMEM shared region name is relevant to scenario, move the MACRO from pci_devices.h which should be consistent for different scenarios to ivshmem_cfg.h which is the configuration for IVSHMEM and could vary in sceanrios. Tracked-On: #4853 Signed-off-by: Shuang Zheng <shuang.zheng@intel.com> Acked-by: Victor Sun <victor.sun@intel.com>
This commit is contained in:
parent
bed82b3736
commit
67426ed69c
@ -62,16 +62,5 @@ def generate_file(config):
|
|||||||
|
|
||||||
i_cnt += 1
|
i_cnt += 1
|
||||||
|
|
||||||
ivshmem_enabled = common.get_hv_item_tag(common.SCENARIO_INFO_FILE, "FEATURES", "IVSHMEM", "IVSHMEM_ENABLED")
|
|
||||||
raw_shmem_regions = common.get_hv_item_tag(common.SCENARIO_INFO_FILE, "FEATURES", "IVSHMEM", "IVSHMEM_REGION")
|
|
||||||
if ivshmem_enabled == 'y':
|
|
||||||
shmem_cnt = 0
|
|
||||||
for raw_shmem_region in raw_shmem_regions:
|
|
||||||
if raw_shmem_region and raw_shmem_region.strip != '':
|
|
||||||
name = raw_shmem_region.split(',')[0].strip()
|
|
||||||
print("", file=config)
|
|
||||||
print("#define IVSHMEM_SHM_REGION_%-21d"%shmem_cnt, end="", file=config)
|
|
||||||
print('"{}"'.format(name), file=config)
|
|
||||||
shmem_cnt += 1
|
|
||||||
# write the end to the pci devices
|
# write the end to the pci devices
|
||||||
print("{0}".format(PCI_END_HEADER), file=config)
|
print("{0}".format(PCI_END_HEADER), file=config)
|
||||||
|
@ -36,6 +36,13 @@ def write_shmem_regions(config):
|
|||||||
shmem_regions.append((raw_shm_splited[0].strip(), raw_shm_splited[1].strip(), raw_shm_splited[2].strip().split(':')))
|
shmem_regions.append((raw_shm_splited[0].strip(), raw_shm_splited[1].strip(), raw_shm_splited[2].strip().split(':')))
|
||||||
shmem_dev_num += len(raw_shm_splited[2].strip().split(':'))
|
shmem_dev_num += len(raw_shm_splited[2].strip().split(':'))
|
||||||
|
|
||||||
|
if len(shmem_regions) > 0:
|
||||||
|
shmem_cnt = 0
|
||||||
|
print("", file=config)
|
||||||
|
for shmem_region in shmem_regions:
|
||||||
|
print("#define IVSHMEM_SHM_REGION_%d\t"%shmem_cnt, end="", file=config)
|
||||||
|
print('"{}"'.format(shmem_region[0]), file=config)
|
||||||
|
shmem_cnt += 1
|
||||||
print("", file=config)
|
print("", file=config)
|
||||||
print("/*", file=config)
|
print("/*", file=config)
|
||||||
print(" * The IVSHMEM_SHM_SIZE is the sum of all memory regions.", file=config)
|
print(" * The IVSHMEM_SHM_SIZE is the sum of all memory regions.", file=config)
|
||||||
@ -59,22 +66,27 @@ def write_shmem_regions(config):
|
|||||||
print("#define IVSHMEM_DEV_NUM\t\t{}UL".format(shmem_dev_num), file=config)
|
print("#define IVSHMEM_DEV_NUM\t\t{}UL".format(shmem_dev_num), file=config)
|
||||||
print("", file=config)
|
print("", file=config)
|
||||||
print("/* All user defined memory regions */", file=config)
|
print("/* All user defined memory regions */", file=config)
|
||||||
print("\nstruct ivshmem_shm_region mem_regions[] = {", file=config)
|
if len(shmem_regions) == 0:
|
||||||
shmem_cnt = 0
|
print("#define IVSHMEM_SHM_REGIONS", file=config)
|
||||||
for shmem in shmem_regions:
|
else:
|
||||||
print("\t{", file=config)
|
print("#define IVSHMEM_SHM_REGIONS \\", file=config)
|
||||||
print('\t\t.name = IVSHMEM_SHM_REGION_{},'.format(shmem_cnt), file=config)
|
shmem_cnt = 0
|
||||||
try:
|
for shmem in shmem_regions:
|
||||||
if shmem[1].isdecimal():
|
print("\t{ \\", file=config)
|
||||||
int_m_size = int(int(shmem[1])/0x100000)
|
print('\t\t.name = IVSHMEM_SHM_REGION_{}, \\'.format(shmem_cnt), file=config)
|
||||||
|
try:
|
||||||
|
if shmem[1].isdecimal():
|
||||||
|
int_m_size = int(int(shmem[1])/0x100000)
|
||||||
|
else:
|
||||||
|
int_m_size = int(int(shmem[1], 16)/0x100000)
|
||||||
|
except:
|
||||||
|
int_m_size = 0
|
||||||
|
print('\t\t.size = {}UL,\t\t/* {}M */ \\'.format(shmem[1], int_m_size), file=config)
|
||||||
|
if shmem_cnt < len(shmem_regions) - 1:
|
||||||
|
print("\t}, \\", file=config)
|
||||||
else:
|
else:
|
||||||
int_m_size = int(int(shmem[1], 16)/0x100000)
|
print("\t},", file=config)
|
||||||
except:
|
shmem_cnt += 1
|
||||||
int_m_size = 0
|
|
||||||
print('\t\t.size = {}UL,\t\t/* {}M */'.format(shmem[1], int_m_size), file=config)
|
|
||||||
print("\t},", file=config)
|
|
||||||
shmem_cnt += 1
|
|
||||||
print("};", file=config)
|
|
||||||
print("", file=config)
|
print("", file=config)
|
||||||
|
|
||||||
|
|
||||||
@ -90,7 +102,6 @@ def generate_file(scenario_items, config):
|
|||||||
if vm_info.shmem.shmem_enabled == 'y':
|
if vm_info.shmem.shmem_enabled == 'y':
|
||||||
print("#include <ivshmem.h>", file=config)
|
print("#include <ivshmem.h>", file=config)
|
||||||
print("#include <pgtable.h>", file=config)
|
print("#include <pgtable.h>", file=config)
|
||||||
print("#include <pci_devices.h>", file=config)
|
|
||||||
write_shmem_regions(config)
|
write_shmem_regions(config)
|
||||||
|
|
||||||
print("{0}".format(IVSHMEM_END_DEFINE), file=config)
|
print("{0}".format(IVSHMEM_END_DEFINE), file=config)
|
||||||
|
@ -53,7 +53,7 @@ def generate_file(vm_info, config):
|
|||||||
print("#include <mmu.h>", file=config)
|
print("#include <mmu.h>", file=config)
|
||||||
print("#include <page.h>", file=config)
|
print("#include <page.h>", file=config)
|
||||||
if vm_info.shmem.shmem_enabled == 'y':
|
if vm_info.shmem.shmem_enabled == 'y':
|
||||||
print("#include <ivshmem.h>", file=config)
|
print("#include <ivshmem_cfg.h>", file=config)
|
||||||
for vm_i, pci_bdf_devs_list in vm_info.cfg_pci.pci_devs.items():
|
for vm_i, pci_bdf_devs_list in vm_info.cfg_pci.pci_devs.items():
|
||||||
if not pci_bdf_devs_list:
|
if not pci_bdf_devs_list:
|
||||||
continue
|
continue
|
||||||
|
Loading…
Reference in New Issue
Block a user