acrn-config: change names for vcpu_affinity[] related items

hypervisor is replacing vm_configs[].vcpu_affinity[] array with
cpu_affinity_bitmap, the meaning of which has some changes as well.

This patch changes the names in generated vm_configuration.c:
-.vcpu_affinity = VMx_CONFIG_VCPU_AFFINITY,
+.cpu_affinity_bitmap = VMx_CONFIG_CPU_AFFINITY,

Changes in vm_configuration.h:
-#define  VMx_CONFIG_VCPU_AFFINITY {AFFINITY_CPU(xU), AFFINITY_CPU(xU)}
+#define  VMx_CONFIG_CPU_AFFINITY  (AFFINITY_CPU(xU) | AFFINITY_CPU(xU))

Also don't generate default assignment of vcpu_num in vm_configuration.c,
because now hypervisor can easily calculate it from cpu_affinity_bitmap.

Accordingly, in the scenario xml files, tag "vcpu_affinity" is changed
to "cpu_affinity".

Tracked-On: #4641
Signed-off-by: Zide Chen <zide.chen@intel.com>
Acked-by: Victor Sun <victor.sun@intel.com>
This commit is contained in:
Zide Chen
2020-04-13 08:49:12 -07:00
committed by wenlingz
parent 71bdc27a0f
commit fafce7aa5f
9 changed files with 23 additions and 24 deletions

View File

@@ -44,7 +44,7 @@ def get_scenario_item_values(board_info, scenario_info):
guest_flags = copy.deepcopy(common.GUEST_FLAG)
guest_flags.remove('0UL')
scenario_item_values['vm,vm_type'] = scenario_cfg_lib.LOAD_VM_TYPE
scenario_item_values["vm,vcpu_affinity"] = hw_info.get_processor_val()
scenario_item_values["vm,cpu_affinity"] = hw_info.get_processor_val()
scenario_item_values["vm,guest_flags"] = guest_flags
scenario_item_values["vm,clos"] = hw_info.get_clos_val()
scenario_item_values["vm,pci_devs"] = scenario_cfg_lib.avl_pci_devs()

View File

@@ -279,7 +279,7 @@ class VmInfo:
self.guest_flags = common.get_leaf_tag_map(
self.scenario_info, "guest_flags", "guest_flag")
self.cpus_per_vm = common.get_leaf_tag_map(
self.scenario_info, "vcpu_affinity", "pcpu_id")
self.scenario_info, "cpu_affinity", "pcpu_id")
self.clos_per_vm = common.get_leaf_tag_map(
self.scenario_info, "clos", "vcpu_clos")

View File

@@ -160,9 +160,9 @@ def is_need_epc(epc_section, i, config):
print("\t\t},", file=config)
def vcpu_affinity_output(vm_info, i, config):
def cpu_affinity_output(vm_info, i, config):
"""
Output the vcpu affinity
Output the pcpu affinity bitmap
:param vminfo: the data structure have all the xml items values
:param i: the index of vm id
:param config: file pointor to store the information
@@ -171,8 +171,7 @@ def vcpu_affinity_output(vm_info, i, config):
return
cpu_bits = vm_info.get_cpu_bitmap(i)
print("\t\t.vcpu_num = {}U,".format(cpu_bits['cpu_num']), file=config)
print("\t\t.vcpu_affinity = VM{}_CONFIG_VCPU_AFFINITY,".format(i), file=config)
print("\t\t.cpu_affinity_bitmap = VM{}_CONFIG_CPU_AFFINITY,".format(i), file=config)
def clos_output(vm_info, i, config):
@@ -246,7 +245,7 @@ def gen_sos_vm(vm_type, vm_i, vm_info, config):
"there is supposed to be the highest severity guest */", file=config)
if sos_guest_flags:
print("\t\t.guest_flags = {0},".format(sos_guest_flags), file=config)
vcpu_affinity_output(vm_info, vm_i, config)
cpu_affinity_output(vm_info, vm_i, config)
print("\t\t.memory = {", file=config)
print("\t\t\t.start_hpa = {}UL,".format(vm_info.mem_info.mem_start_hpa[vm_i]), file=config)
print("\t\t\t.size = {0},".format("CONFIG_SOS_RAM_SIZE"), file=config)
@@ -280,7 +279,7 @@ def gen_pre_launch_vm(vm_type, vm_i, vm_info, config):
print("\t{{\t/* VM{} */".format(vm_i), file=config)
print("\t\t{},".format(pre_vm_type), file=config)
print('\t\t.name = "{0}",'.format(vm_info.name[vm_i]), file=config)
vcpu_affinity_output(vm_info, vm_i, config)
cpu_affinity_output(vm_info, vm_i, config)
if guest_flags:
print("\t\t.guest_flags = {0},".format(guest_flags), file=config)
clos_output(vm_info, vm_i, config)
@@ -329,7 +328,7 @@ def gen_post_launch_vm(vm_type, vm_i, vm_info, config):
post_vm_type = get_post_vm_type(vm_type, vm_i)
print("\t{{\t/* VM{} */".format(vm_i), file=config)
print("\t\t{},".format(post_vm_type), file=config)
vcpu_affinity_output(vm_info, vm_i, config)
cpu_affinity_output(vm_info, vm_i, config)
is_need_epc(vm_info.epc_section, vm_i, config)
# VUART
err_dic = vuart_output(vm_type, vm_i, vm_info, config)

View File

@@ -25,7 +25,7 @@ def gen_common_header(config):
def cpu_affinity_output(vm_info, i, config):
"""
Output the macro vcpu affinity
Output the macro pcpu affinity bitmap
:param vm_info: the data structure have all the xml items values
:param i: the index of vm id
:param config: file pointor to store the information
@@ -34,7 +34,7 @@ def cpu_affinity_output(vm_info, i, config):
return
cpu_bits = vm_info.get_cpu_bitmap(i)
print("#define VM{0}_CONFIG_VCPU_AFFINITY\t\t{1}".format(
print("#define VM{0}_CONFIG_CPU_AFFINITY\t\t{1}".format(
i, cpu_bits['cpu_map']), file=config)
def clos_config_output(vm_info, i, config):