acrn-config: keep align with vcpu_affinity for vm config

The pcpu sharing for vm already enabled in master branch, acrn-config
tool for generating scenario config souce file should keep align with master branch.

1. Add 'vcpu_affinity' tag and its vaule in config xml.
2. Parse the 'vcpu_affinity' tag of value from config xml for generating vcpu_affinity.

v1-v2:
    1). apl-up2-n3350 has two PCPUs, set appropriate value for vcpu_affinity.

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:
Wei Liu
2019-10-11 13:58:17 +08:00
committed by ACRN System Integration
parent db909edda5
commit c442f3f4d1
31 changed files with 261 additions and 57 deletions

View File

@@ -114,7 +114,7 @@ def get_processor_info(board_info):
processor_info = get_info(board_info, "<CPU_PROCESSOR_INFO>", "</CPU_PROCESSOR_INFO>")
if not processor_info:
key = "vm:id=0,pcpu_ids"
key = "vm:id=0,vcpu_affinity"
ERR_LIST[key] = "CPU core is not exists"
return processor_list
@@ -637,14 +637,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 = "(PLUG_CPU({0}))".format(cpus_per_vm[index][0])
cpu_str = "{{AFFINITY_CPU({0}U)}}".format(cpus_per_vm[index][0])
else:
cpu_str = "(PLUG_CPU({0})".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 + " | PLUG_CPU({0}))".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 + " | PLUG_CPU({0})".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])