mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-06-24 14:33:38 +00:00
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:
parent
45cc2c5e1e
commit
cce7389d6f
@ -228,7 +228,7 @@ the launch scripts will be generated into misc/acrn-config/xmls/config-xmls/[boa
|
||||
{{sub_elem.tag}}</label>
|
||||
|
||||
{% if ','.join(['uos', elem.tag, sub_elem.tag]) not in launch_item_values
|
||||
and elem.tag != 'vcpu_affinity'%}
|
||||
and elem.tag != 'cpu_affinity'%}
|
||||
<div class="col-sm-5">
|
||||
{% if 'readonly' in sub_elem.attrib and sub_elem.attrib['readonly'] == 'true' %}
|
||||
<input type="text" class="form-control" readonly
|
||||
@ -254,7 +254,7 @@ the launch scripts will be generated into misc/acrn-config/xmls/config-xmls/[boa
|
||||
{% endif%}
|
||||
|
||||
{% else %}
|
||||
{% set item_key = ','.join(['uos', elem.tag, sub_elem.tag]) if elem.tag != 'vcpu_affinity'
|
||||
{% set item_key = ','.join(['uos', elem.tag, sub_elem.tag]) if elem.tag != 'cpu_affinity'
|
||||
else ','.join(['uos', elem.tag]) %}
|
||||
<div class="dropdown col-sm-6">
|
||||
{% if 'readonly' in sub_elem.attrib and sub_elem.attrib['readonly'] == 'true' %}
|
||||
@ -273,7 +273,7 @@ the launch scripts will be generated into misc/acrn-config/xmls/config-xmls/[boa
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</select>
|
||||
{% if elem.tag == 'vcpu_affinity' %}
|
||||
{% if elem.tag == 'cpu_affinity' %}
|
||||
<button type="button" class="btn" id="add_vcpu_{{first_child|length}}">+</button>
|
||||
{% if not first_child %}
|
||||
<button type="button" disabled class="btn" id="remove_vcpu_{{first_child|length}}">-</button>
|
||||
|
@ -227,7 +227,7 @@ the source files will be generated into default path and overwirte the previous
|
||||
{{sub_elem.tag}}</label>
|
||||
|
||||
{% if ','.join([vm.tag, elem.tag, sub_elem.tag]) not in scenario_item_values
|
||||
and elem.tag != 'vcpu_affinity' and elem.tag != 'pci_devs' %}
|
||||
and elem.tag != 'cpu_affinity' and elem.tag != 'pci_devs' %}
|
||||
{% if sub_elem.tag in ['bootargs', 'kern_args'] %}
|
||||
<div class="col-sm-6">
|
||||
{% if 'readonly' in sub_elem.attrib and sub_elem.attrib['readonly'] == 'true' %}
|
||||
@ -253,7 +253,7 @@ the source files will be generated into default path and overwirte the previous
|
||||
</div>
|
||||
{% endif %}
|
||||
{% else %}
|
||||
{% set item_key = ','.join([vm.tag, elem.tag, sub_elem.tag]) if elem.tag != 'vcpu_affinity'
|
||||
{% set item_key = ','.join([vm.tag, elem.tag, sub_elem.tag]) if elem.tag != 'cpu_affinity'
|
||||
and elem.tag != 'pci_devs' else ','.join([vm.tag, elem.tag]) %}
|
||||
<div class="dropdown col-sm-6">
|
||||
{% if 'readonly' in sub_elem.attrib and sub_elem.attrib['readonly'] == 'true' %}
|
||||
@ -273,7 +273,7 @@ the source files will be generated into default path and overwirte the previous
|
||||
{% endfor %}
|
||||
</select>
|
||||
|
||||
{% if elem.tag == 'vcpu_affinity' %}
|
||||
{% if elem.tag == 'cpu_affinity' %}
|
||||
<button type="button" class="btn" id="add_vcpu_{{first_child|length}}">+</button>
|
||||
{% if not first_child %}
|
||||
<button type="button" disabled class="btn" id="remove_vcpu_{{first_child|length}}">-</button>
|
||||
|
@ -24,7 +24,7 @@ class AcrnDmArgs:
|
||||
self.args["vuart0"] = common.get_leaf_tag_map(self.launch_info, "vuart0")
|
||||
self.args["cpu_sharing"] = common.get_leaf_tag_map(self.launch_info, "cpu_sharing")
|
||||
self.args["pm_channel"] = common.get_leaf_tag_map(self.launch_info, "poweroff_channel")
|
||||
self.args["off_pcpus"] = common.get_leaf_tag_map(self.scenario_info, "vcpu_affinity", "pcpu_id")
|
||||
self.args["off_pcpus"] = common.get_leaf_tag_map(self.scenario_info, "cpu_affinity", "pcpu_id")
|
||||
self.args["xhci"] = common.get_leaf_tag_map(self.launch_info, "usb_xhci")
|
||||
|
||||
def check_item(self):
|
||||
|
@ -499,7 +499,7 @@ def cpu_sharing_check(cpu_sharing, item):
|
||||
vm_cpu_share = []
|
||||
vm_cpu_share_consistent = True
|
||||
|
||||
cpu_affinity = common.get_leaf_tag_map(common.SCENARIO_INFO_FILE, "vcpu_affinity", "pcpu_id")
|
||||
cpu_affinity = common.get_leaf_tag_map(common.SCENARIO_INFO_FILE, "cpu_affinity", "pcpu_id")
|
||||
for vm_i in cpu_affinity.keys():
|
||||
for cpu in cpu_affinity[vm_i]:
|
||||
if cpu in use_cpus:
|
||||
|
@ -451,14 +451,14 @@ def cpus_assignment(cpus_per_vm, index):
|
||||
for i in range(len(cpus_per_vm[index])):
|
||||
if i == 0:
|
||||
if len(cpus_per_vm[index]) == 1:
|
||||
cpu_str = "{{AFFINITY_CPU({0}U)}}".format(cpus_per_vm[index][0])
|
||||
cpu_str = "(AFFINITY_CPU({0}U))".format(cpus_per_vm[index][0])
|
||||
else:
|
||||
cpu_str = "{{AFFINITY_CPU({0}U)".format(cpus_per_vm[index][0])
|
||||
cpu_str = "(AFFINITY_CPU({0}U)".format(cpus_per_vm[index][0])
|
||||
else:
|
||||
if i == len(cpus_per_vm[index]) - 1:
|
||||
cpu_str = cpu_str + ", AFFINITY_CPU({0}U)}}".format(cpus_per_vm[index][i])
|
||||
cpu_str = cpu_str + " | AFFINITY_CPU({0}U))".format(cpus_per_vm[index][i])
|
||||
else:
|
||||
cpu_str = cpu_str + ", AFFINITY_CPU({0}U)".format(cpus_per_vm[index][i])
|
||||
cpu_str = cpu_str + " | AFFINITY_CPU({0}U)".format(cpus_per_vm[index][i])
|
||||
|
||||
vm_cpu_bmp['cpu_map'] = cpu_str
|
||||
vm_cpu_bmp['cpu_num'] = len(cpus_per_vm[index])
|
||||
|
@ -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()
|
||||
|
@ -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")
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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):
|
||||
|
Loading…
Reference in New Issue
Block a user